2 * Copyright 2011 Mario Mulansky
3 * Copyright 2012 Karsten Ahnert
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE_1_0.txt or
7 * copy at http://www.boost.org/LICENSE_1_0.txt)
11 #include <boost/array.hpp>
13 //#include <boost/numeric/odeint/stepper/explicit_generic_rk.hpp>
14 #include <boost/numeric/odeint/stepper/runge_kutta4.hpp>
15 #include <boost/numeric/odeint/algebra/array_algebra.hpp>
17 #include "rk_performance_test_case.hpp"
21 using namespace boost::numeric::odeint;
23 typedef boost::array< double , 3 > state_type;
26 typedef explicit_generic_rk< 4 , 4 , state_type , double , state_type , double , array_algebra > rk4_type;
28 typedef rk4_type::coef_a_type coef_a_type;
29 typedef rk4_type::coef_b_type coef_b_type;
30 typedef rk4_type::coef_c_type coef_c_type;
32 const boost::array< double , 1 > a1 = {{ 0.5 }};
33 const boost::array< double , 2 > a2 = {{ 0.0 , 0.5 }};
34 const boost::array< double , 3 > a3 = {{ 0.0 , 0.0 , 1.0 }};
36 const coef_a_type a = fusion::make_vector( a1 , a2 , a3 );
37 const coef_b_type b = {{ 1.0/6 , 1.0/3 , 1.0/3 , 1.0/6 }};
38 const coef_c_type c = {{ 0.0 , 0.5 , 0.5 , 1.0 }};
41 typedef runge_kutta4< state_type , double , state_type , double , array_algebra > rk4_type;
50 // : m_stepper( a , b , c )
53 void reset_init_cond()
55 m_x[0] = 10.0 * rand() / RAND_MAX;
56 m_x[1] = 10.0 * rand() / RAND_MAX;
57 m_x[2] = 10.0 * rand() / RAND_MAX;
61 inline void do_step( const double dt )
63 m_stepper.do_step( lorenz(), m_x , m_t , dt );
66 double state( const size_t i ) const