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 an old version of Boost. Click here to view this page for the latest version.
Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template modified_midpoint

boost::numeric::odeint::modified_midpoint

Synopsis

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

template<typename State, typename Value = double, typename Deriv = State, 
         typename Time = Value, typename Algebra = range_algebra, 
         typename Operations = default_operations, 
         typename Resizer = initially_resizer> 
class modified_midpoint : public boost::numeric::odeint::explicit_stepper_base< Stepper, Order, State, Value, Deriv, Time, Algebra, Operations, Resizer >
{
public:
  // types
  typedef explicit_stepper_base< modified_midpoint< State, Value, Deriv, Time, Algebra, Operations, Resizer >, 2, State, Value, Deriv, Time, Algebra, Operations, Resizer > stepper_base_type; 
  typedef stepper_base_type::state_type                                                                                                                                     state_type;        
  typedef stepper_base_type::wrapped_state_type                                                                                                                             wrapped_state_type;
  typedef stepper_base_type::value_type                                                                                                                                     value_type;        
  typedef stepper_base_type::deriv_type                                                                                                                                     deriv_type;        
  typedef stepper_base_type::wrapped_deriv_type                                                                                                                             wrapped_deriv_type;
  typedef stepper_base_type::time_type                                                                                                                                      time_type;         
  typedef stepper_base_type::algebra_type                                                                                                                                   algebra_type;      
  typedef stepper_base_type::operations_type                                                                                                                                operations_type;   
  typedef stepper_base_type::resizer_type                                                                                                                                   resizer_type;      
  typedef stepper_base_type::stepper_type                                                                                                                                   stepper_type;      

  // construct/copy/destruct
  modified_midpoint(unsigned short = 2, const algebra_type & = algebra_type());

  // public member functions
  template<typename System, typename StateIn, typename DerivIn, 
           typename StateOut> 
    void do_step_impl(System, const StateIn &, const DerivIn &, time_type, 
                      StateOut &, time_type);
  void set_steps(unsigned short);
  unsigned short steps(void) const;
  template<typename StateIn> void adjust_size(const StateIn &);
  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 StateInOut, typename DerivIn> 
    boost::disable_if< boost::is_same< DerivIn, time_type >, void >::type 
    do_step(System, StateInOut &, const DerivIn &, time_type, time_type);
  template<typename System, typename StateIn, typename StateOut> 
    void do_step(System, const StateIn &, time_type, StateOut &, time_type);
  template<typename System, typename StateIn, typename DerivIn, 
           typename StateOut> 
    void do_step(System, const StateIn &, const DerivIn &, time_type, 
                 StateOut &, time_type);
  algebra_type & algebra();
  const algebra_type & algebra() const;

  // private member functions
  template<typename StateIn> bool resize_impl(const StateIn &);
};

Description

Implementation of the modified midpoint method with a configurable number of intermediate steps. This class is used by the Bulirsch-Stoer algorithm and is not meant for direct usage.

modified_midpoint public construct/copy/destruct

  1. modified_midpoint(unsigned short steps = 2, 
                      const algebra_type & algebra = algebra_type());

modified_midpoint public member functions

  1. template<typename System, typename StateIn, typename DerivIn, 
             typename StateOut> 
      void do_step_impl(System system, const StateIn & in, const DerivIn & dxdt, 
                        time_type t, StateOut & out, time_type dt);
  2. void set_steps(unsigned short steps);
  3. unsigned short steps(void) const;
  4. template<typename StateIn> void adjust_size(const StateIn & x);
  5. order_type order(void) const;

    Returns:

    Returns the order of the stepper.

  6. template<typename System, typename StateInOut> 
      void do_step(System system, StateInOut & x, time_type t, time_type dt);
    This method performs one step. It transforms the result in-place.

    Parameters:

    dt

    The step size.

    system

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

    t

    The value of the time, at which the step should be performed.

    x

    The state of the ODE which should be solved. After calling do_step the result is updated in x.

  7. 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.
  8. template<typename System, typename StateInOut, typename DerivIn> 
      boost::disable_if< boost::is_same< DerivIn, time_type >, void >::type 
      do_step(System system, StateInOut & x, const DerivIn & dxdt, time_type t, 
              time_type dt);
    The method performs one step. Additionally to the other method the derivative of x is also passed to this method. It is supposed to be used in the following way:
    sys( x , dxdt , t );
    stepper.do_step( sys , x , dxdt , t , dt );
    

    The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this case the method could not be distinguished from other do_step versions.

    [Note] Note

    This method does not solve the forwarding problem.

    Parameters:

    dt

    The step size.

    dxdt

    The derivative of x at t.

    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, at which the step should be performed.

    x

    The state of the ODE which should be solved. After calling do_step the result is updated in x.

  9. template<typename System, typename StateIn, typename StateOut> 
      void do_step(System system, const StateIn & in, time_type t, StateOut & out, 
                   time_type dt);
    The method performs one step. The state of the ODE is updated out-of-place.
    [Note] Note

    This method does not solve the forwarding problem.

    Parameters:

    dt

    The step size.

    in

    The state of the ODE which should be solved. in is not modified in this method

    out

    The result of the step is written in out.

    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, at which the step should be performed.

  10. template<typename System, typename StateIn, typename DerivIn, 
             typename StateOut> 
      void do_step(System system, const StateIn & in, const DerivIn & dxdt, 
                   time_type t, StateOut & out, time_type dt);
    The method performs one step. The state of the ODE is updated out-of-place. Furthermore, the derivative of x at t is passed to the stepper. It is supposed to be used in the following way:
    sys( in , dxdt , t );
    stepper.do_step( sys , in , dxdt , t , out , dt );
    
    [Note] Note

    This method does not solve the forwarding problem.

    Parameters:

    dt

    The step size.

    dxdt

    The derivative of x at t.

    in

    The state of the ODE which should be solved. in is not modified in this method

    out

    The result of the step is written in out.

    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, at which the step should be performed.

  11. algebra_type & algebra();

    Returns:

    A reference to the algebra which is held by this class.

  12. const algebra_type & algebra() const;

    Returns:

    A const reference to the algebra which is held by this class.

modified_midpoint private member functions

  1. template<typename StateIn> bool resize_impl(const StateIn & x);

PrevUpHomeNext