Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:19:50

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