PrevUpHomeNext

Class template explicit_generic_rk

boost::numeric::odeint::explicit_generic_rk — A generic implementation of explicit Runge-Kutta algorithms. This class is as a base class for all explicit Runge-Kutta steppers.

Synopsis

// 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 explicit_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_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 &);

  // private member functions
  template<typename StateIn> bool resize_impl(const StateIn &);
};

Description

This class implements the explicit Runge-Kutta 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 template-metaprogramming algorithm. ToDo : Add example!

This class derives explicit_stepper_base which provides the stepper interface.

Template Parameters

  1. size_t StageCount

    The number of stages of the Runge-Kutta algorithm.

  2. size_t Order

    The order of the stepper.

  3. typename State

    The type representing the state of the ODE.

  4. typename Value

    The floating point type which is used in the computations.

  5. typename Deriv
  6. typename Time

    The type representing the independent variable - the time - of the ODE.

  7. typename Algebra

    The algebra type.

  8. typename Operations

    The operations type.

  9. typename Resizer

    The resizer policy type.

explicit_generic_rk public construct/copy/destruct

  1. explicit_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:

    a

    Triangular matrix of parameters b in the Butcher tableau.

    algebra

    A copy of algebra is made and stored inside explicit_stepper_base.

    b

    Last row of the butcher tableau.

    c

    Parameters to calculate the time points in the Butcher tableau.

explicit_generic_rk public member functions

  1. 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:

    dt

    The step size.

    dxdt

    The derivative of x at t.

    in

    The state of the ODE which should be solved. in is not modified in this method

    out

    The result of the step is written in out.

    system

    The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept.

    t

    The value of the time, at which the step should be performed.

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

    Parameters:

    x

    A state from which the size of the temporaries to be resized is deduced.

explicit_generic_rk private member functions

  1. template<typename StateIn> bool resize_impl(const StateIn & x);

PrevUpHomeNext