Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/numeric/odeint/integrate/integrate_n_steps.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  [auto_generated]
0003  boost/numeric/odeint/integrate/integrate_n_steps.hpp
0004 
0005  [begin_description]
0006  Integration of n steps with constant time size. Adaptive and dense-output methods are fully supported.
0007  [end_description]
0008 
0009  Copyright 2011-2013 Karsten Ahnert
0010  Copyright 2011-2015 Mario Mulansky
0011 
0012  Distributed under the Boost Software License, Version 1.0.
0013  (See accompanying file LICENSE_1_0.txt or
0014  copy at http://www.boost.org/LICENSE_1_0.txt)
0015  */
0016 
0017 
0018 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
0019 #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
0020 
0021 #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
0022 #include <boost/numeric/odeint/integrate/null_observer.hpp>
0023 #include <boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp>
0024 #include <boost/numeric/odeint/integrate/check_adapter.hpp>
0025 
0026 namespace boost {
0027 namespace numeric {
0028 namespace odeint {
0029 
0030 
0031 /*
0032  * Integrates n steps
0033  *
0034  * the two overloads are needed in order to solve the forwarding problem
0035  */
0036 template< class Stepper , class System , class State , class Time , class Observer , class StepOverflowChecker >
0037 Time integrate_n_steps(
0038         Stepper stepper , System system , State &start_state ,
0039         Time start_time , Time dt , size_t num_of_steps ,
0040         Observer observer , StepOverflowChecker checker )
0041 {
0042     // unwrap references
0043     typedef typename odeint::unwrap_reference< Stepper >::type stepper_type;
0044     typedef typename odeint::unwrap_reference< Observer >::type observer_type;
0045     typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type;
0046     typedef typename stepper_type::stepper_category stepper_category;
0047 
0048     return detail::integrate_n_steps(
0049                 checked_stepper<stepper_type, checker_type>(stepper, checker),
0050                 system , start_state ,
0051                 start_time , dt , num_of_steps ,
0052                 checked_observer<observer_type, checker_type>(observer, checker),
0053                 stepper_category() );
0054 }
0055 
0056 /**
0057  * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
0058  */
0059 template< class Stepper , class System , class State , class Time , class Observer , class StepOverflowChecker >
0060 Time integrate_n_steps(
0061         Stepper stepper , System system , const State &start_state ,
0062         Time start_time , Time dt , size_t num_of_steps ,
0063         Observer observer , StepOverflowChecker checker )
0064 {
0065     typedef typename odeint::unwrap_reference< Stepper >::type stepper_type;
0066     typedef typename odeint::unwrap_reference< Observer >::type observer_type;
0067     typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type;
0068     typedef typename stepper_type::stepper_category stepper_category;
0069 
0070     return detail::integrate_n_steps(
0071             checked_stepper<stepper_type, checker_type>(stepper, checker),
0072             system , start_state ,
0073             start_time , dt , num_of_steps ,
0074             checked_observer<observer_type, checker_type>(observer, checker),
0075             stepper_category() );
0076 }
0077 
0078 
0079 /**
0080 * \brief The same function as above, but without checker.
0081 */
0082 template< class Stepper , class System , class State , class Time , class Observer >
0083 Time integrate_n_steps(
0084         Stepper stepper , System system , State &start_state ,
0085         Time start_time , Time dt , size_t num_of_steps , Observer observer )
0086 {
0087     typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category;
0088 
0089     return detail::integrate_n_steps(
0090             stepper , system , start_state ,
0091             start_time , dt , num_of_steps ,
0092             observer , stepper_category() );
0093 }
0094 
0095 /**
0096 * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
0097 */
0098 template< class Stepper , class System , class State , class Time , class Observer >
0099 Time integrate_n_steps(
0100         Stepper stepper , System system , const State &start_state ,
0101         Time start_time , Time dt , size_t num_of_steps , Observer observer )
0102 {
0103     typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category;
0104 
0105     return detail::integrate_n_steps(
0106             stepper , system , start_state ,
0107             start_time , dt , num_of_steps ,
0108             observer , stepper_category() );
0109 }
0110 
0111 /**
0112  * \brief The same function as above, but without observer calls.
0113  */
0114 template< class Stepper , class System , class State , class Time >
0115 Time integrate_n_steps(
0116         Stepper stepper , System system , State &start_state ,
0117         Time start_time , Time dt , size_t num_of_steps )
0118 {
0119     return integrate_n_steps(stepper, system, start_state, start_time,
0120                              dt, num_of_steps, null_observer());
0121 }
0122 
0123 /**
0124  * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
0125  */
0126 template< class Stepper , class System , class State , class Time >
0127 Time integrate_n_steps(
0128         Stepper stepper , System system , const State &start_state ,
0129         Time start_time , Time dt , size_t num_of_steps )
0130 {
0131     return integrate_n_steps(stepper, system, start_state, start_time,
0132                              dt, num_of_steps, null_observer());
0133 }
0134 
0135 
0136 
0137 /************* DOXYGEN *************/
0138     /**
0139      * \fn Time integrate_n_steps( Stepper stepper , System system , State &start_state , Time start_time , Time dt , size_t num_of_steps , Observer observer )
0140      * \brief Integrates the ODE with constant step size.
0141      *
0142      * This function is similar to integrate_const. The observer is called at
0143      * equidistant time intervals t0 + n*dt.
0144      * If the Stepper is a normal stepper without step size control, dt is also
0145      * used for the numerical scheme. If a ControlledStepper is provided, the 
0146      * algorithm might reduce the step size to meet the error bounds, but it is 
0147      * ensured that the observer is always called at equidistant time points
0148      * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary
0149      * and the dense output is used to call the observer at equidistant time
0150      * points. The final integration time is always t0 + num_of_steps*dt.
0151      * If a max_step_checker is provided as StepOverflowChecker, a
0152      * no_progress_errror is thrown if too many steps (default: 500) are
0153      * performed without progress, i.e. in between observer calls. If no
0154      * checker is provided, no such overflow check is performed.
0155 
0156      *
0157      * \param stepper The stepper to be used for numerical integration.
0158      * \param system Function/Functor defining the rhs of the ODE.
0159      * \param start_state The initial condition x0.
0160      * \param start_time The initial time t0.
0161      * \param dt The time step between observer calls, _not_ necessarily the 
0162      * time step of the integration.
0163      * \param num_of_steps Number of steps to be performed
0164      * \param observer Function/Functor called at equidistant time intervals.
0165      * \param checker [optional] Functor to check for step count overflows, if no
0166      * checker is provided, no exception is thrown.
0167      * \return The number of steps performed.
0168      */
0169 
0170 
0171 
0172 } // namespace odeint
0173 } // namespace numeric
0174 } // namespace boost
0175 
0176 
0177 
0178 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED