1 /*
2 [auto_generated]
3 libs/numeric/odeint/test/generation.cpp
4
5 [begin_description]
6 This file tests the generation functions.
7 [end_description]
8
9 Copyright 2011-2012 Karsten Ahnert
10 Copyright 2011-2012 Mario Mulansky
11
12 Distributed under the Boost Software License, Version 1.0.
13 (See accompanying file LICENSE_1_0.txt or
14 copy at http://www.boost.org/LICENSE_1_0.txt)
15 */
16
17
18 #define BOOST_TEST_MODULE odeint_generation
19
20 #include <vector>
21
22 #include <boost/test/unit_test.hpp>
23 #include <boost/static_assert.hpp>
24 #include <boost/type_traits/is_same.hpp>
25
26 #include <boost/numeric/odeint/config.hpp>
27 #include <boost/numeric/odeint/stepper/generation.hpp>
28
29 using namespace boost::numeric::odeint;
30
31 template< class Stepper1 , class Stepper2 >
check_stepper_type(const Stepper1 & s1,const Stepper2 & s2)32 void check_stepper_type( const Stepper1 &s1 , const Stepper2 &s2 )
33 {
34 BOOST_STATIC_ASSERT(( boost::is_same< Stepper1 , Stepper2 >::value ));
35 }
36
37 BOOST_AUTO_TEST_SUITE( generation_test )
38
39 typedef std::vector< double > state_type;
40
41 typedef runge_kutta_cash_karp54< state_type > rk54_type;
42 typedef runge_kutta_cash_karp54_classic< state_type > rk54_classic_type;
43 typedef runge_kutta_dopri5< state_type > dopri5_type;
44 typedef runge_kutta_fehlberg78< state_type > fehlberg78_type;
45 typedef rosenbrock4< double > rosenbrock4_type;
46
47
BOOST_AUTO_TEST_CASE(test_generation_dopri5)48 BOOST_AUTO_TEST_CASE( test_generation_dopri5 )
49 {
50 check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , dopri5_type() ) , controlled_runge_kutta< dopri5_type >() );
51 check_stepper_type( make_controlled< dopri5_type >( 1.0e-6 , 1.0e-10 ) , controlled_runge_kutta< dopri5_type >() );
52
53 check_stepper_type( make_dense_output( 1.0e-6 , 1.0e-10 , dopri5_type() ) , dense_output_runge_kutta< controlled_runge_kutta< dopri5_type > >() );
54 check_stepper_type( make_dense_output< dopri5_type >( 1.0e-6 , 1.0e-10 ) , dense_output_runge_kutta< controlled_runge_kutta< dopri5_type > >() );
55 }
56
BOOST_AUTO_TEST_CASE(test_generation_cash_karp54)57 BOOST_AUTO_TEST_CASE( test_generation_cash_karp54 )
58 {
59 check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , rk54_type() ) , controlled_runge_kutta< rk54_type >() );
60 check_stepper_type( make_controlled< rk54_type >( 1.0e-6 , 1.0e-10 ) , controlled_runge_kutta< rk54_type >() );
61 }
62
BOOST_AUTO_TEST_CASE(test_generation_cash_karp54_classic)63 BOOST_AUTO_TEST_CASE( test_generation_cash_karp54_classic )
64 {
65 check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , rk54_classic_type() ) , controlled_runge_kutta< rk54_classic_type >() );
66 check_stepper_type( make_controlled< rk54_classic_type >( 1.0e-6 , 1.0e-10 ) , controlled_runge_kutta< rk54_classic_type >() );
67 }
68
69
BOOST_AUTO_TEST_CASE(test_generation_fehlberg78)70 BOOST_AUTO_TEST_CASE( test_generation_fehlberg78 )
71 {
72 check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , fehlberg78_type() ) , controlled_runge_kutta< fehlberg78_type >() );
73 check_stepper_type( make_controlled< fehlberg78_type >( 1.0e-6 , 1.0e-10 ) , controlled_runge_kutta< fehlberg78_type >() );
74 }
75
76
BOOST_AUTO_TEST_CASE(test_generation_rosenbrock4)77 BOOST_AUTO_TEST_CASE( test_generation_rosenbrock4 )
78 {
79 check_stepper_type( make_controlled( 1.0e-6 , 1.0e-10 , rosenbrock4_type() ) , rosenbrock4_controller< rosenbrock4_type >() );
80 check_stepper_type( make_controlled< rosenbrock4_type >( 1.0e-6 , 1.0e-10 ) , rosenbrock4_controller< rosenbrock4_type >() );
81
82 check_stepper_type( make_dense_output( 1.0e-6 , 1.0e-10 , rosenbrock4_type() ) , rosenbrock4_dense_output< rosenbrock4_controller< rosenbrock4_type > >() );
83 check_stepper_type( make_dense_output< rosenbrock4_type >( 1.0e-6 , 1.0e-10 ) , rosenbrock4_dense_output< rosenbrock4_controller< rosenbrock4_type > >() );
84 }
85
86
87 BOOST_AUTO_TEST_SUITE_END()
88