PrevUpHomeNext

Class template controlled_runge_kutta<ErrorStepper, ErrorChecker, Resizer, explicit_error_stepper_tag>

boost::numeric::odeint::controlled_runge_kutta<ErrorStepper, ErrorChecker, Resizer, explicit_error_stepper_tag> — Implements step size control for Runge-Kutta steppers with error estimation.

Synopsis

// In header: <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>

template<typename ErrorStepper, typename ErrorChecker, typename Resizer> 
class controlled_runge_kutta<ErrorStepper, ErrorChecker, Resizer, explicit_error_stepper_tag> {
public:
  // types
  typedef ErrorStepper                    stepper_type;      
  typedef stepper_type::state_type        state_type;        
  typedef stepper_type::value_type        value_type;        
  typedef stepper_type::deriv_type        deriv_type;        
  typedef stepper_type::time_type         time_type;         
  typedef stepper_type::algebra_type      algebra_type;      
  typedef stepper_type::operations_type   operations_type;   
  typedef Resizer                         resizer_type;      
  typedef ErrorChecker                    error_checker_type;
  typedef explicit_controlled_stepper_tag stepper_category;  

  // construct/copy/destruct
  controlled_runge_kutta(const error_checker_type & = error_checker_type(), 
                         const stepper_type & = stepper_type());

  // public member functions
  template<typename System, typename StateInOut> 
    controlled_step_result 
    try_step(System, StateInOut &, time_type &, time_type &);
  template<typename System, typename StateInOut> 
    controlled_step_result 
    try_step(System, const StateInOut &, time_type &, time_type &);
  template<typename System, typename StateInOut, typename DerivIn> 
    controlled_step_result 
    try_step(System, StateInOut &, const DerivIn &, time_type &, time_type &);
  template<typename System, typename StateIn, typename StateOut> 
    boost::disable_if< boost::is_same< StateIn, time_type >, controlled_step_result >::type 
    try_step(System, const StateIn &, time_type &, StateOut &, time_type &);
  template<typename System, typename StateIn, typename DerivIn, 
           typename StateOut> 
    controlled_step_result 
    try_step(System, const StateIn &, const DerivIn &, time_type &, 
             StateOut &, time_type &);
  value_type last_error(void) const;
  template<typename StateType> void adjust_size(const StateType &);
  stepper_type & stepper(void);
  const stepper_type & stepper(void) const;

  // private member functions
  template<typename System, typename StateInOut> 
    controlled_step_result 
    try_step_v1(System, StateInOut &, time_type &, time_type &);
  template<typename StateIn> bool resize_m_xerr_impl(const StateIn &);
  template<typename StateIn> bool resize_m_dxdt_impl(const StateIn &);
  template<typename StateIn> bool resize_m_xnew_impl(const StateIn &);
};

Description

This class implements the step size control for standard Runge-Kutta steppers with error estimation.

Template Parameters

  1. typename ErrorStepper

    The stepper type with error estimation, has to fulfill the ErrorStepper concept.

  2. typename ErrorChecker

    The error checker

  3. typename Resizer

    The resizer policy type.

controlled_runge_kutta public construct/copy/destruct

  1. controlled_runge_kutta(const error_checker_type & error_checker = error_checker_type(), 
                           const stepper_type & stepper = stepper_type());
    Constructs the controlled Runge-Kutta stepper.

    Parameters:

    error_checker

    An instance of the error checker.

    stepper

    An instance of the underlying stepper.

controlled_runge_kutta public member functions

  1. template<typename System, typename StateInOut> 
      controlled_step_result 
      try_step(System system, StateInOut & x, time_type & t, time_type & dt);
    Tries to perform one step.

    This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed.

    Parameters:

    dt

    The step size. Updated.

    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. Updated if the step is successful.

    x

    The state of the ODE which should be solved. Overwritten if the step is successful.

    Returns:

    success if the step was accepted, fail otherwise.

  2. template<typename System, typename StateInOut> 
      controlled_step_result 
      try_step(System system, const StateInOut & x, time_type & t, time_type & dt);
    Tries to perform one step. Solves the forwarding problem and allows for using boost range as state_type.

    This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed.

    Parameters:

    dt

    The step size. Updated.

    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. Updated if the step is successful.

    x

    The state of the ODE which should be solved. Overwritten if the step is successful. Can be a boost range.

    Returns:

    success if the step was accepted, fail otherwise.

  3. template<typename System, typename StateInOut, typename DerivIn> 
      controlled_step_result 
      try_step(System system, StateInOut & x, const DerivIn & dxdt, time_type & t, 
               time_type & dt);
    Tries to perform one step.

    This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed.

    Parameters:

    dt

    The step size. Updated.

    dxdt

    The derivative of state.

    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. Updated if the step is successful.

    x

    The state of the ODE which should be solved. Overwritten if the step is successful.

    Returns:

    success if the step was accepted, fail otherwise.

  4. template<typename System, typename StateIn, typename StateOut> 
      boost::disable_if< boost::is_same< StateIn, time_type >, controlled_step_result >::type 
      try_step(System system, const StateIn & in, time_type & t, StateOut & out, 
               time_type & dt);
    Tries to perform one step.
    [Note] Note

    This method is disabled if state_type=time_type to avoid ambiguity.

    This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed.

    Parameters:

    dt

    The step size. Updated.

    in

    The state of the ODE which should be solved.

    out

    Used to store the result of the step.

    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. Updated if the step is successful.

    Returns:

    success if the step was accepted, fail otherwise.

  5. template<typename System, typename StateIn, typename DerivIn, 
             typename StateOut> 
      controlled_step_result 
      try_step(System system, const StateIn & in, const DerivIn & dxdt, 
               time_type & t, StateOut & out, time_type & dt);
    Tries to perform one step.

    This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed.

    Parameters:

    dt

    The step size. Updated.

    dxdt

    The derivative of state.

    in

    The state of the ODE which should be solved.

    out

    Used to store the result of the step.

    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. Updated if the step is successful.

    Returns:

    success if the step was accepted, fail otherwise.

  6. value_type last_error(void) const;
    Returns the error of the last step.

    returns The last error of the step.

  7. template<typename StateType> void adjust_size(const StateType & 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.

  8. stepper_type & stepper(void);
    Returns the instance of the underlying stepper.

    Returns:

    The instance of the underlying stepper.

  9. const stepper_type & stepper(void) const;
    Returns the instance of the underlying stepper.

    Returns:

    The instance of the underlying stepper.

controlled_runge_kutta private member functions

  1. template<typename System, typename StateInOut> 
      controlled_step_result 
      try_step_v1(System system, StateInOut & x, time_type & t, time_type & dt);
  2. template<typename StateIn> bool resize_m_xerr_impl(const StateIn & x);
  3. template<typename StateIn> bool resize_m_dxdt_impl(const StateIn & x);
  4. template<typename StateIn> bool resize_m_xnew_impl(const StateIn & x);

PrevUpHomeNext