...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Home  Libraries  People  FAQ  More 
boost::numeric::odeint::explicit_generic_rk — A generic implementation of explicit RungeKutta algorithms. This class is as a base class for all explicit RungeKutta steppers.
// In header: <boost/numeric/odeint/stepper/explicit_generic_rk.hpp> template<size_t StageCount, size_t Order, typename State, typename Value, typename Deriv, typename Time, typename Algebra, typename Operations, typename Resizer> class explicit_generic_rk : public boost::numeric::odeint::explicit_stepper_base< Stepper, Order, State, Value, Deriv, Time, Algebra, Operations, Resizer > { public: // types typedef explicit_stepper_base< ... > stepper_base_type; typedef stepper_base_type::state_type state_type; typedef stepper_base_type::wrapped_state_type wrapped_state_type; typedef stepper_base_type::value_type value_type; typedef stepper_base_type::deriv_type deriv_type; typedef stepper_base_type::wrapped_deriv_type wrapped_deriv_type; typedef stepper_base_type::time_type time_type; typedef stepper_base_type::algebra_type algebra_type; typedef stepper_base_type::operations_type operations_type; typedef stepper_base_type::resizer_type resizer_type; typedef unspecified rk_algorithm_type; typedef rk_algorithm_type::coef_a_type coef_a_type; typedef rk_algorithm_type::coef_b_type coef_b_type; typedef rk_algorithm_type::coef_c_type coef_c_type; // construct/copy/destruct explicit_generic_rk(const coef_a_type &, const coef_b_type &, const coef_c_type &, const algebra_type & = algebra_type()); // public member functions template<typename System, typename StateIn, typename DerivIn, typename StateOut> void do_step_impl(System, const StateIn &, const DerivIn &, time_type, StateOut &, time_type); template<typename StateIn> void adjust_size(const StateIn &); order_type order(void) const; template<typename System, typename StateInOut> void do_step(System, StateInOut &, time_type, time_type); template<typename System, typename StateInOut> void do_step(System, const StateInOut &, time_type, time_type); template<typename System, typename StateInOut, typename DerivIn> boost::disable_if< boost::is_same< DerivIn, time_type >, void >::type do_step(System, StateInOut &, const DerivIn &, time_type, time_type); template<typename System, typename StateIn, typename StateOut> void do_step(System, const StateIn &, time_type, StateOut &, time_type); template<typename System, typename StateIn, typename DerivIn, typename StateOut> void do_step(System, const StateIn &, const DerivIn &, time_type, StateOut &, time_type); algebra_type & algebra(); const algebra_type & algebra() const; // private member functions template<typename StateIn> bool resize_impl(const StateIn &); };
This class implements the explicit RungeKutta algorithms without error estimation in a generic way. The Butcher tableau is passed to the stepper which constructs the stepper scheme with the help of a templatemetaprogramming algorithm. ToDo : Add example!
This class derives explicit_stepper_base which provides the stepper interface.
size_t StageCount
The number of stages of the RungeKutta algorithm.
size_t Order
The order of the stepper.
typename State
The type representing the state of the ODE.
typename Value
The floating point type which is used in the computations.
typename Deriv
typename Time
The type representing the independent variable  the time  of the ODE.
typename Algebra
The algebra type.
typename Operations
The operations type.
typename Resizer
The resizer policy type.
explicit_generic_rk
public
construct/copy/destructexplicit_generic_rk(const coef_a_type & a, const coef_b_type & b, const coef_c_type & c, const algebra_type & algebra = algebra_type());Constructs the
explicit_generic_rk
class. See examples section for details on the coefficients.
Parameters: 

explicit_generic_rk
public member functionstemplate<typename System, typename StateIn, typename DerivIn, typename StateOut> void do_step_impl(System system, const StateIn & in, const DerivIn & dxdt, time_type t, StateOut & out, time_type dt);This method performs one step. The derivative
dxdt
of in
at the time t
is passed to the method. The result is updated out of place, hence the input is in in
and the output in out
. Access to this step functionality is provided by explicit_stepper_base
and do_step_impl
should not be called directly.
Parameters: 

template<typename StateIn> void adjust_size(const StateIn & x);Adjust the size of all temporaries in the stepper manually.
Parameters: 

order_type order(void) const;
Returns: 
Returns the order of the stepper. 
template<typename System, typename StateInOut> void do_step(System system, StateInOut & x, time_type t, time_type dt);This method performs one step. It transforms the result inplace.
Parameters: 

template<typename System, typename StateInOut> void do_step(System system, const StateInOut & x, time_type t, time_type dt);Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut.
template<typename System, typename StateInOut, typename DerivIn> boost::disable_if< boost::is_same< DerivIn, time_type >, void >::type do_step(System system, StateInOut & x, const DerivIn & dxdt, time_type t, time_type dt);The method performs one step. Additionally to the other method the derivative of x is also passed to this method. It is supposed to be used in the following way:
sys( x , dxdt , t ); stepper.do_step( sys , x , dxdt , t , dt );
The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this case the method could not be distinguished from other do_step
versions.
Note  

This method does not solve the forwarding problem. 
Parameters: 

template<typename System, typename StateIn, typename StateOut> void do_step(System system, const StateIn & in, time_type t, StateOut & out, time_type dt);The method performs one step. The state of the ODE is updated outofplace.
Note  

This method does not solve the forwarding problem. 
Parameters: 

template<typename System, typename StateIn, typename DerivIn, typename StateOut> void do_step(System system, const StateIn & in, const DerivIn & dxdt, time_type t, StateOut & out, time_type dt);The method performs one step. The state of the ODE is updated outofplace. Furthermore, the derivative of x at t is passed to the stepper. It is supposed to be used in the following way:
sys( in , dxdt , t ); stepper.do_step( sys , in , dxdt , t , out , dt );
Note  

This method does not solve the forwarding problem. 
Parameters: 

algebra_type & algebra();
Returns: 
A reference to the algebra which is held by this class. 
const algebra_type & algebra() const;
Returns: 
A const reference to the algebra which is held by this class. 