boost::numeric::odeint::bulirsch_stoer_dense_out — The Bulirsch-Stoer algorithm.
// In header: <boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp> template<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 bulirsch_stoer_dense_out { public: // types typedef State state_type; typedef Value value_type; typedef Deriv deriv_type; typedef Time time_type; typedef Algebra algebra_type; typedef Operations operations_type; typedef Resizer resizer_type; typedef dense_output_stepper_tag stepper_category; // construct/copy/destruct bulirsch_stoer_dense_out(value_type = 1E-6, value_type = 1E-6, value_type = 1.0, value_type = 1.0, bool = false); // public member functions 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 &); template<typename StateType> void initialize(const StateType &, const time_type &, const time_type &); template<typename System> std::pair< time_type, time_type > do_step(System); template<typename StateOut> void calc_state(time_type, StateOut &) const; const state_type & current_state(void) const; time_type current_time(void) const; const state_type & previous_state(void) const; time_type previous_time(void) const; time_type current_time_step(void) const; void reset(); template<typename StateIn> void adjust_size(const StateIn &); // private member functions template<typename StateInOut, typename StateVector> void extrapolate(size_t, StateVector &, const value_matrix &, StateInOut &, size_t = 0); template<typename StateVector> void extrapolate_dense_out(size_t, StateVector &, const value_matrix &, size_t = 0); time_type calc_h_opt(time_type, value_type, size_t) const; bool in_convergence_window(size_t) const; bool should_reject(value_type, size_t) const; template<typename StateIn1, typename DerivIn1, typename StateIn2, typename DerivIn2> value_type prepare_dense_output(int, const StateIn1 &, const DerivIn1 &, const StateIn2 &, const DerivIn2 &, time_type); template<typename DerivIn> void calculate_finite_difference(size_t, size_t, value_type, const DerivIn &); template<typename StateOut> void do_interpolation(time_type, StateOut &) const; template<typename StateIn> bool resize_impl(const StateIn &); state_type & get_current_state(void); const state_type & get_current_state(void) const; state_type & get_old_state(void); const state_type & get_old_state(void) const; deriv_type & get_current_deriv(void); const deriv_type & get_current_deriv(void) const; deriv_type & get_old_deriv(void); const deriv_type & get_old_deriv(void) const; void toggle_current_state(void); // public data members static const size_t m_k_max; };
The Bulirsch-Stoer is a controlled stepper that adjusts both step size and order of the method. The algorithm uses the modified midpoint and a polynomial extrapolation compute the solution. This class also provides dense output facility.
typename State
The state type.
typename Value = double
The value type.
typename Deriv = State
The type representing the time derivative of the state.
typename Time = Value
The time representing the independent variable - the time.
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.
bulirsch_stoer_dense_out
public
construct/copy/destructbulirsch_stoer_dense_out(value_type eps_abs = 1E-6, value_type eps_rel = 1E-6, value_type factor_x = 1.0, value_type factor_dxdt = 1.0, bool control_interpolation = false);Constructs the
bulirsch_stoer
class, including initialization of the error bounds.
Parameters: |
|
bulirsch_stoer_dense_out
public member functionstemplate<typename System, typename StateIn, typename DerivIn, typename StateOut, typename DerivOut> controlled_step_result try_step(System system, const StateIn & in, const DerivIn & dxdt, time_type & t, StateOut & out, DerivOut & dxdt_new, 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. Also, the internal order of the stepper is adjusted if required.
Parameters: |
|
||||||||||||
Returns: |
success if the step was accepted, fail otherwise. |
template<typename StateType> void initialize(const StateType & x0, const time_type & t0, const time_type & dt0);Initializes the dense output stepper.
Parameters: |
|
template<typename System> std::pair< time_type, time_type > do_step(System system);Does one time step. This is the main method that should be used to integrate an ODE with this stepper.
Note | |
---|---|
initialize has to be called before using this method to set the initial conditions x,t and the stepsize. |
Parameters: |
|
||
Returns: |
Pair with start and end time of the integration step. |
template<typename StateOut> void calc_state(time_type t, StateOut & x) const;Calculates the solution at an intermediate point within the last step.
Parameters: |
|
const state_type & current_state(void) const;Returns the current state of the solution.
Returns: |
The current state of the solution x(t). |
time_type current_time(void) const;Returns the current time of the solution.
Returns: |
The current time of the solution t. |
const state_type & previous_state(void) const;Returns the last state of the solution.
Returns: |
The last state of the solution x(t-dt). |
time_type previous_time(void) const;Returns the last time of the solution.
Returns: |
The last time of the solution t-dt. |
time_type current_time_step(void) const;Returns the current step size.
Returns: |
The current step size. |
void reset();Resets the internal state of the stepper.
template<typename StateIn> void adjust_size(const StateIn & x);Adjust the size of all temporaries in the stepper manually.
Parameters: |
|
bulirsch_stoer_dense_out
private member functionstemplate<typename StateInOut, typename StateVector> void extrapolate(size_t k, StateVector & table, const value_matrix & coeff, StateInOut & xest, size_t order_start_index = 0);
template<typename StateVector> void extrapolate_dense_out(size_t k, StateVector & table, const value_matrix & coeff, size_t order_start_index = 0);
time_type calc_h_opt(time_type h, value_type error, size_t k) const;
bool in_convergence_window(size_t k) const;
bool should_reject(value_type error, size_t k) const;
template<typename StateIn1, typename DerivIn1, typename StateIn2, typename DerivIn2> value_type prepare_dense_output(int k, const StateIn1 & x_start, const DerivIn1 & dxdt_start, const StateIn2 &, const DerivIn2 &, time_type dt);
template<typename DerivIn> void calculate_finite_difference(size_t j, size_t kappa, value_type fac, const DerivIn & dxdt);
template<typename StateOut> void do_interpolation(time_type t, StateOut & out) const;
template<typename StateIn> bool resize_impl(const StateIn & x);
state_type & get_current_state(void);
const state_type & get_current_state(void) const;
state_type & get_old_state(void);
const state_type & get_old_state(void) const;
deriv_type & get_current_deriv(void);
const deriv_type & get_current_deriv(void) const;
deriv_type & get_old_deriv(void);
const deriv_type & get_old_deriv(void) const;
void toggle_current_state(void);