...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::controlled_runge_kutta<ErrorStepper, ErrorChecker, StepAdjuster, Resizer, explicit_error_stepper_fsal_tag> — Implements step size control for Runge-Kutta FSAL steppers with error estimation.
// 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 &); };
This class implements the step size control for FSAL Runge-Kutta steppers with error estimation.
typename ErrorStepper
The stepper type with error estimation, has to fulfill the ErrorStepper concept.
typename ErrorChecker
The error checker
typename StepAdjuster
typename Resizer
The resizer policy type.
controlled_runge_kutta
public
construct/copy/destructcontrolled_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: |
|
controlled_runge_kutta
public member functionstemplate<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: |
|
||||||||
Returns: |
success if the step was accepted, fail otherwise. |
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: |
|
||||||||
Returns: |
success if the step was accepted, fail otherwise. |
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 | |
---|---|
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: |
|
||||||||||
Returns: |
success if the step was accepted, fail otherwise. |
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: |
|
||||||||||
Returns: |
success if the step was accepted, fail otherwise. |
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: |
|
||||||||||
Returns: |
success if the step was accepted, fail otherwise. |
void reset(void);Resets the internal state of the underlying FSAL stepper.
template<typename DerivIn> void initialize(const DerivIn & deriv);Initializes the internal state storing an internal copy of the derivative.
Parameters: |
|
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: |
|
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. |
template<typename StateType> void adjust_size(const StateType & x);Adjust the size of all temporaries in the stepper manually.
Parameters: |
|
stepper_type & stepper(void);Returns the instance of the underlying stepper.
Returns: |
The instance of the underlying stepper. |
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 functionstemplate<typename StateIn> bool resize_m_xerr_impl(const StateIn & x);
template<typename StateIn> bool resize_m_dxdt_impl(const StateIn & x);
template<typename StateIn> bool resize_m_dxdt_new_impl(const StateIn & x);
template<typename StateIn> bool resize_m_xnew_impl(const StateIn & x);
template<typename System, typename StateInOut> controlled_step_result try_step_v1(System system, StateInOut & x, time_type & t, time_type & dt);