generation.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. [auto_generated]
  3. libs/numeric/odeint/test/generation.cpp
  4. [begin_description]
  5. This file tests the generation functions.
  6. [end_description]
  7. Copyright 2011-2012 Karsten Ahnert
  8. Copyright 2011-2012 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. #define BOOST_TEST_MODULE odeint_generation
  14. #include <vector>
  15. #include <boost/test/unit_test.hpp>
  16. #include <boost/static_assert.hpp>
  17. #include <boost/type_traits/is_same.hpp>
  18. #include <boost/numeric/odeint/config.hpp>
  19. #include <boost/numeric/odeint/stepper/generation.hpp>
  20. using namespace boost::numeric::odeint;
  21. template< class Stepper1 , class Stepper2 >
  22. void check_stepper_type( const Stepper1 &s1 , const Stepper2 &s2 )
  23. {
  24. BOOST_STATIC_ASSERT(( boost::is_same< Stepper1 , Stepper2 >::value ));
  25. }
  26. BOOST_AUTO_TEST_SUITE( generation_test )
  27. typedef std::vector< double > state_type;
  28. typedef runge_kutta_cash_karp54< state_type > rk54_type;
  29. typedef runge_kutta_cash_karp54_classic< state_type > rk54_classic_type;
  30. typedef runge_kutta_dopri5< state_type > dopri5_type;
  31. typedef runge_kutta_fehlberg78< state_type > fehlberg78_type;
  32. typedef rosenbrock4< double > rosenbrock4_type;
  33. BOOST_AUTO_TEST_CASE( test_generation_dopri5 )
  34. {
  35. check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , dopri5_type() ) , controlled_runge_kutta< dopri5_type >() );
  36. check_stepper_type( make_controlled< dopri5_type >( 1.0e-6 , 1.0e-10 ) , controlled_runge_kutta< dopri5_type >() );
  37. check_stepper_type( make_dense_output( 1.0e-6 , 1.0e-10 , dopri5_type() ) , dense_output_runge_kutta< controlled_runge_kutta< dopri5_type > >() );
  38. check_stepper_type( make_dense_output< dopri5_type >( 1.0e-6 , 1.0e-10 ) , dense_output_runge_kutta< controlled_runge_kutta< dopri5_type > >() );
  39. }
  40. BOOST_AUTO_TEST_CASE( test_generation_cash_karp54 )
  41. {
  42. check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , rk54_type() ) , controlled_runge_kutta< rk54_type >() );
  43. check_stepper_type( make_controlled< rk54_type >( 1.0e-6 , 1.0e-10 ) , controlled_runge_kutta< rk54_type >() );
  44. }
  45. BOOST_AUTO_TEST_CASE( test_generation_cash_karp54_classic )
  46. {
  47. check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , rk54_classic_type() ) , controlled_runge_kutta< rk54_classic_type >() );
  48. check_stepper_type( make_controlled< rk54_classic_type >( 1.0e-6 , 1.0e-10 ) , controlled_runge_kutta< rk54_classic_type >() );
  49. }
  50. BOOST_AUTO_TEST_CASE( test_generation_fehlberg78 )
  51. {
  52. check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , fehlberg78_type() ) , controlled_runge_kutta< fehlberg78_type >() );
  53. check_stepper_type( make_controlled< fehlberg78_type >( 1.0e-6 , 1.0e-10 ) , controlled_runge_kutta< fehlberg78_type >() );
  54. }
  55. BOOST_AUTO_TEST_CASE( test_generation_rosenbrock4 )
  56. {
  57. check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , rosenbrock4_type() ) , rosenbrock4_controller< rosenbrock4_type >() );
  58. check_stepper_type( make_controlled< rosenbrock4_type >( 1.0e-6 , 1.0e-10 ) , rosenbrock4_controller< rosenbrock4_type >() );
  59. check_stepper_type( make_dense_output( 1.0e-6 , 1.0e-10 , rosenbrock4_type() ) , rosenbrock4_dense_output< rosenbrock4_controller< rosenbrock4_type > >() );
  60. check_stepper_type( make_dense_output< rosenbrock4_type >( 1.0e-6 , 1.0e-10 ) , rosenbrock4_dense_output< rosenbrock4_controller< rosenbrock4_type > >() );
  61. }
  62. BOOST_AUTO_TEST_SUITE_END()