• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  [auto_generated]
3  boost/numeric/odeint/integrate/integrate_n_steps.hpp
4 
5  [begin_description]
6  Integration of n steps with constant time size. Adaptive and dense-output methods are fully supported.
7  [end_description]
8 
9  Copyright 2009-2011 Karsten Ahnert
10  Copyright 2009-2011 Mario Mulansky
11 
12  Distributed under the Boost Software License, Version 1.0.
13  (See accompanying file LICENSE_1_0.txt or
14  copy at http://www.boost.org/LICENSE_1_0.txt)
15  */
16 
17 
18 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
20 
21 #include <boost/type_traits/is_same.hpp>
22 
23 #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
24 #include <boost/numeric/odeint/iterator/integrate/null_observer.hpp>
25 #include <boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp>
26 
27 namespace boost {
28 namespace numeric {
29 namespace odeint {
30 
31 
32 /*
33  * Integrates n steps
34  *
35  * the two overloads are needed in order to solve the forwarding problem
36  */
37 template< class Stepper , class System , class State , class Time , class Observer>
integrate_n_steps(Stepper stepper,System system,State & start_state,Time start_time,Time dt,size_t num_of_steps,Observer observer)38 Time integrate_n_steps(
39         Stepper stepper , System system , State &start_state ,
40         Time start_time , Time dt , size_t num_of_steps ,
41         Observer observer )
42 {
43     typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
44     return detail::integrate_n_steps(
45                 stepper , system , start_state ,
46                 start_time , dt , num_of_steps ,
47                 observer , stepper_category() );
48 }
49 
50 /**
51  * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
52  */
53 template< class Stepper , class System , class State , class Time , class Observer >
integrate_n_steps(Stepper stepper,System system,const State & start_state,Time start_time,Time dt,size_t num_of_steps,Observer observer)54 Time integrate_n_steps(
55         Stepper stepper , System system , const State &start_state ,
56         Time start_time , Time dt , size_t num_of_steps ,
57         Observer observer )
58 {
59     typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
60     return detail::integrate_n_steps(
61                  stepper , system , start_state ,
62                  start_time , dt , num_of_steps ,
63                  observer , stepper_category() );
64 }
65 
66 
67 /**
68  * \brief The same function as above, but without observer calls.
69  */
70 template< class Stepper , class System , class State , class Time >
integrate_n_steps(Stepper stepper,System system,State & start_state,Time start_time,Time dt,size_t num_of_steps)71 Time integrate_n_steps(
72         Stepper stepper , System system , State &start_state ,
73         Time start_time , Time dt , size_t num_of_steps )
74 {
75     return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , null_observer() );
76 }
77 
78 /**
79  * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
80  */
81 template< class Stepper , class System , class State , class Time >
integrate_n_steps(Stepper stepper,System system,const State & start_state,Time start_time,Time dt,size_t num_of_steps)82 Time integrate_n_steps(
83         Stepper stepper , System system , const State &start_state ,
84         Time start_time , Time dt , size_t num_of_steps )
85 {
86     return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , null_observer() );
87 }
88 
89 
90 
91 /************* DOXYGEN *************/
92     /**
93      * \fn Time integrate_n_steps( Stepper stepper , System system , State &start_state , Time start_time , Time dt , size_t num_of_steps , Observer observer )
94      * \brief Integrates the ODE with constant step size.
95      *
96      * This function is similar to integrate_const. The observer is called at
97      * equidistant time intervals t0 + n*dt.
98      * If the Stepper is a normal stepper without step size control, dt is also
99      * used for the numerical scheme. If a ControlledStepper is provided, the
100      * algorithm might reduce the step size to meet the error bounds, but it is
101      * ensured that the observer is always called at equidistant time points
102      * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary
103      * and the dense output is used to call the observer at equidistant time
104      * points. The final integration time is always t0 + num_of_steps*dt.
105      *
106      * \param stepper The stepper to be used for numerical integration.
107      * \param system Function/Functor defining the rhs of the ODE.
108      * \param start_state The initial condition x0.
109      * \param start_time The initial time t0.
110      * \param dt The time step between observer calls, _not_ necessarily the
111      * time step of the integration.
112      * \param num_of_steps Number of steps to be performed
113      * \param observer Function/Functor called at equidistant time intervals.
114      * \return The number of steps performed.
115      */
116 
117 
118 
119 } // namespace odeint
120 } // namespace numeric
121 } // namespace boost
122 
123 
124 
125 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
126