...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_error_generic_rk — A generic implementation of explicit Runge-Kutta algorithms with error estimation. This class is as a base class for all explicit Runge-Kutta steppers with error estimation.
// In header: <boost/numeric/odeint/stepper/explicit_error_generic_rk.hpp> template<size_t StageCount, size_t Order, size_t StepperOrder, size_t ErrorOrder, typename State, typename Value = double, typename Deriv = State, typename Time = Value, typename Algebra = typename algebra_dispatcher< State >::algebra_type, typename Operations = typename operations_dispatcher< State >::operations_type, typename Resizer = initially_resizer> class explicit_error_generic_rk : public explicit_error_stepper_base { 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_error_generic_rk(const coef_a_type &, const coef_b_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, typename Err> void do_step_impl(System, const StateIn &, const DerivIn &, time_type, StateOut &, time_type, Err &); 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 &); // private member functions template<typename StateIn> bool resize_impl(const StateIn &); // public data members static const size_t stage_count; };
This class implements the explicit Runge-Kutta algorithms with error estimation in a generic way. The Butcher tableau is passed to the stepper which constructs the stepper scheme with the help of a template-metaprogramming algorithm. ToDo : Add example!
This class derives explicit_error_stepper_base which provides the stepper interface.
size_t StageCount
The number of stages of the Runge-Kutta algorithm.
size_t Order
The order of a stepper if the stepper is used without error estimation.
size_t StepperOrder
The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have the same value.
size_t ErrorOrder
The order of the error step if the stepper is used with error estimation.
typename State
The type representing the state of the ODE.
typename Value = double
The floating point type which is used in the computations.
typename Deriv = State
typename Time = Value
The type representing the independent variable - the time - of the ODE.
typename Algebra = typename algebra_dispatcher< State >::algebra_type
The algebra type.
typename Operations = typename operations_dispatcher< State >::operations_type
The operations type.
typename Resizer = initially_resizer
The resizer policy type.
explicit_error_generic_rk
public
construct/copy/destructexplicit_error_generic_rk(const coef_a_type & a, const coef_b_type & b, const coef_b_type & b2, const coef_c_type & c, const algebra_type & algebra = algebra_type());Constructs the explicit_error_generik_rk class with the given parameters a, b, b2 and c. See examples section for details on the coefficients.
Parameters: |
|
explicit_error_generic_rk
public member functionstemplate<typename System, typename StateIn, typename DerivIn, typename StateOut, typename Err> void do_step_impl(System system, const StateIn & in, const DerivIn & dxdt, time_type t, StateOut & out, time_type dt, Err & xerr);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
. Futhermore, an estimation of the error is stored in xerr
. do_step_impl
is used by explicit_error_stepper_base.
Parameters: |
|
template<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: |
|