prepare_stepper_testing.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. [auto_generated]
  3. libs/numeric/odeint/test/prepare_stepper_testing.hpp
  4. [begin_description]
  5. This file defines some helper functions for the stepper tests.
  6. [end_description]
  7. Copyright 2011-2012 Karsten Ahnert
  8. Copyright 2012-2013 Mario Mulansky
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef PREPARE_STEPPER_TESTING_HPP_
  14. #define PREPARE_STEPPER_TESTING_HPP_
  15. #include <boost/array.hpp>
  16. #include <vector>
  17. #include <complex>
  18. #include <boost/fusion/sequence.hpp>
  19. #include <boost/mpl/vector.hpp>
  20. #include <boost/multiprecision/cpp_dec_float.hpp>
  21. #include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
  22. #include <boost/numeric/odeint/algebra/array_algebra.hpp>
  23. #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
  24. namespace mpl = boost::mpl;
  25. namespace fusion = boost::fusion;
  26. using namespace boost::numeric::odeint;
  27. /* the state types that will be tested */
  28. typedef std::vector< double > vector_type;
  29. typedef std::vector< std::complex<double> > complex_vector_type;
  30. typedef double vector_space_type;
  31. typedef boost::array< double , 1 > array_type;
  32. typedef boost::array< std::complex<double> , 1 > complex_array_type;
  33. typedef boost::multiprecision::cpp_dec_float_50 mp_type;
  34. typedef boost::array< mp_type , 1 > mp_array_type;
  35. typedef mpl::vector< vector_type , complex_vector_type , vector_space_type ,
  36. array_type , complex_array_type , mp_type , mp_array_type
  37. >::type container_types;
  38. namespace boost { namespace numeric { namespace odeint {
  39. // mp_type forms a vector space
  40. template<>
  41. struct algebra_dispatcher< mp_type >
  42. {
  43. typedef vector_space_algebra algebra_type;
  44. };
  45. // add norm computation
  46. template<>
  47. struct vector_space_norm_inf< mp_type >
  48. {
  49. typedef mp_type result_type;
  50. mp_type operator()( mp_type x ) const
  51. {
  52. using std::abs;
  53. return abs(x);
  54. }
  55. };
  56. } } }
  57. #endif /* PREPARE_STEPPER_TESTING_HPP_ */