...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::adams_bashforth_moulton — The Adams-Bashforth-Moulton multistep algorithm.
// In header: <boost/numeric/odeint/stepper/adams_bashforth_moulton.hpp> template<size_t Steps, 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, typename InitializingStepper = runge_kutta4< State , Value , Deriv , Time , Algebra , Operations, Resizer > > class adams_bashforth_moulton { public: // types typedef State state_type; typedef state_wrapper< state_type > wrapped_state_type; typedef Value value_type; typedef Deriv deriv_type; typedef state_wrapper< deriv_type > wrapped_deriv_type; typedef Time time_type; typedef Algebra algebra_type; typedef Operations operations_type; typedef Resizer resizer_type; typedef stepper_tag stepper_category; typedef InitializingStepper initializing_stepper_type; typedef unsigned short order_type; // construct/copy/destruct adams_bashforth_moulton(void); adams_bashforth_moulton(const algebra_type &); // public member functions order_type order(void) const; template<typename System, typename StateInOut> void do_step(System, StateInOut &, time_type, time_type); template<typename System, typename StateInOut> void do_step(System, const StateInOut &, time_type, time_type); template<typename System, typename StateIn, typename StateOut> void do_step(System, const StateIn &, time_type, const StateOut &, time_type); template<typename System, typename StateIn, typename StateOut> void do_step(System, const StateIn &, time_type, StateOut &, time_type); template<typename StateType> void adjust_size(const StateType &); template<typename ExplicitStepper, typename System, typename StateIn> void initialize(ExplicitStepper, System, StateIn &, time_type &, time_type); template<typename System, typename StateIn> void initialize(System, StateIn &, time_type &, time_type); void reset(void); // private member functions template<typename System, typename StateInOut> void do_step_impl1(System, StateInOut &, time_type, time_type); template<typename System, typename StateIn, typename StateInOut> void do_step_impl2(System, StateIn const &, time_type, StateInOut &, time_type); template<typename StateIn> bool resize_impl(const StateIn &); // public data members static const size_t steps; static const order_type order_value; };
The Adams-Bashforth method is a multi-step predictor-corrector algorithm with configurable step number. The step number is specified as template parameter Steps and it then uses the result from the previous Steps steps. See also en.wikipedia.org/wiki/Linear_multistep_method. Currently, a maximum of Steps=8 is supported. The method is explicit and fulfills the Stepper concept. Step size control or continuous output are not provided.
This class derives from algebra_base and inherits its interface via CRTP (current recurring template pattern). For more details see algebra_stepper_base.
size_t Steps
The number of steps (maximal 8).
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.
typename InitializingStepper = runge_kutta4< State , Value , Deriv , Time , Algebra , Operations, Resizer >
The stepper for the first two steps.
adams_bashforth_moulton
public
construct/copy/destructadams_bashforth_moulton(void);Constructs the
adams_bashforth
class. adams_bashforth_moulton(const algebra_type & algebra);Constructs the
adams_bashforth
class. This constructor can be used as a default constructor if the algebra has a default constructor.
Parameters: |
|
adams_bashforth_moulton
public member functionsorder_type order(void) const;Returns the order of the algorithm, which is equal to the number of steps+1.
Returns: |
order of the method. |
template<typename System, typename StateInOut> void do_step(System system, StateInOut & x, time_type t, time_type dt);
template<typename System, typename StateInOut> void do_step(System system, const StateInOut & x, time_type t, time_type dt);Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut.
template<typename System, typename StateIn, typename StateOut> void do_step(System system, const StateIn & in, time_type t, const StateOut & out, time_type dt);
template<typename System, typename StateIn, typename StateOut> void do_step(System system, const StateIn & in, time_type t, StateOut & out, time_type dt);Second version to solve the forwarding problem, can be called with Boost.Range as StateOut.
template<typename StateType> void adjust_size(const StateType & x);Adjust the size of all temporaries in the stepper manually.
Parameters: |
|
template<typename ExplicitStepper, typename System, typename StateIn> void initialize(ExplicitStepper explicit_stepper, System system, StateIn & x, time_type & t, time_type dt);
template<typename System, typename StateIn> void initialize(System system, StateIn & x, time_type & t, time_type dt);
void reset(void);Resets the internal buffers of the stepper.
adams_bashforth_moulton
private member functionstemplate<typename System, typename StateInOut> void do_step_impl1(System system, StateInOut & x, time_type t, time_type dt);
template<typename System, typename StateIn, typename StateInOut> void do_step_impl2(System system, StateIn const & in, time_type t, StateInOut & out, time_type dt);
template<typename StateIn> bool resize_impl(const StateIn & x);