Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 91fd5f3e2e.
Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template controlled_runge_kutta<ErrorStepper, ErrorChecker, StepAdjuster, Resizer, explicit_error_stepper_fsal_tag>

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

Synopsis

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

template<typename ErrorStepper, typename ErrorChecker, typename StepAdjuster, 
         typename Resizer> 
class controlled_runge_kutta<ErrorStepper, ErrorChecker, StepAdjuster, Resizer, explicit_error_stepper_fsal_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 StepAdjuster                         step_adjuster_type;
  typedef explicit_controlled_stepper_fsal_tag stepper_category;  

  // construct/copy/destruct
  controlled_runge_kutta(const error_checker_type & = error_checker_type(), 
                         const step_adjuster_type & = step_adjuster_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 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 StateInOut, typename DerivInOut> 
    controlled_step_result 
    try_step(System, StateInOut &, DerivInOut &, time_type &, time_type &);
  template<typename System, typename StateIn, typename DerivIn, 
           typename StateOut, typename DerivOut> 
    controlled_step_result 
    try_step(System, const StateIn &, const DerivIn &, time_type &, 
             StateOut &, DerivOut &, time_type &);
  void reset(void);
  template<typename DerivIn> void initialize(const DerivIn &);
  template<typename System, typename StateIn> 
    void initialize(System, const StateIn &, time_type);
  bool is_initialized(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 StateIn> bool resize_m_xerr_impl(const StateIn &);
  template<typename StateIn> bool resize_m_dxdt_impl(const StateIn &);
  template<typename StateIn> bool resize_m_dxdt_new_impl(const StateIn &);
  template<typename StateIn> bool resize_m_xnew_impl(const StateIn &);
  template<typename System, typename StateInOut> 
    controlled_step_result 
    try_step_v1(System, StateInOut &, time_type &, time_type &);
};

Description

This class implements the step size control for FSAL 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 StepAdjuster
  4. 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 step_adjuster_type & step_adjuster = step_adjuster_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 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.

  4. template<typename System, typename StateInOut, typename DerivInOut> 
      controlled_step_result 
      try_step(System system, StateInOut & x, DerivInOut & 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.

  5. template<typename System, typename StateIn, typename DerivIn, 
             typename StateOut, typename DerivOut> 
      controlled_step_result 
      try_step(System system, const StateIn & in, const DerivIn & dxdt_in, 
               time_type & t, StateOut & out, DerivOut & dxdt_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.

    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. void reset(void);
    Resets the internal state of the underlying FSAL stepper.
  7. template<typename DerivIn> void initialize(const DerivIn & deriv);
    Initializes the internal state storing an internal copy of the derivative.

    Parameters:

    deriv

    The initial derivative of the ODE.

  8. template<typename System, typename StateIn> 
      void initialize(System system, const StateIn & x, time_type t);
    Initializes the internal state storing an internal copy of the derivative.

    Parameters:

    system

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

    t

    The initial time.

    x

    The initial state of the ODE which should be solved.

  9. bool is_initialized(void) const;
    Returns true if the stepper has been initialized, false otherwise.

    Returns:

    true, if the stepper has been initialized, false otherwise.

  10. 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.

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

    Returns:

    The instance of the underlying stepper.

  12. 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 StateIn> bool resize_m_xerr_impl(const StateIn & x);
  2. template<typename StateIn> bool resize_m_dxdt_impl(const StateIn & x);
  3. template<typename StateIn> bool resize_m_dxdt_new_impl(const StateIn & x);
  4. template<typename StateIn> bool resize_m_xnew_impl(const StateIn & x);
  5. template<typename System, typename StateInOut> 
      controlled_step_result 
      try_step_v1(System system, StateInOut & x, time_type & t, time_type & dt);

PrevUpHomeNext