]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/numeric/odeint/integrate/integrate_n_steps.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / numeric / odeint / integrate / integrate_n_steps.hpp
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 2011-2013 Karsten Ahnert
10 Copyright 2011-2015 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/integrate/null_observer.hpp>
25 #include <boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp>
26 #include <boost/numeric/odeint/integrate/check_adapter.hpp>
27
28 namespace boost {
29 namespace numeric {
30 namespace odeint {
31
32
33 /*
34 * Integrates n steps
35 *
36 * the two overloads are needed in order to solve the forwarding problem
37 */
38 template< class Stepper , class System , class State , class Time , class Observer , class StepOverflowChecker >
39 Time integrate_n_steps(
40 Stepper stepper , System system , State &start_state ,
41 Time start_time , Time dt , size_t num_of_steps ,
42 Observer observer , StepOverflowChecker checker )
43 {
44 // unwrap references
45 typedef typename odeint::unwrap_reference< Stepper >::type stepper_type;
46 typedef typename odeint::unwrap_reference< Observer >::type observer_type;
47 typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type;
48 typedef typename stepper_type::stepper_category stepper_category;
49
50 return detail::integrate_n_steps(
51 checked_stepper<stepper_type, checker_type>(stepper, checker),
52 system , start_state ,
53 start_time , dt , num_of_steps ,
54 checked_observer<observer_type, checker_type>(observer, checker),
55 stepper_category() );
56 }
57
58 /**
59 * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
60 */
61 template< class Stepper , class System , class State , class Time , class Observer , class StepOverflowChecker >
62 Time integrate_n_steps(
63 Stepper stepper , System system , const State &start_state ,
64 Time start_time , Time dt , size_t num_of_steps ,
65 Observer observer , StepOverflowChecker checker )
66 {
67 typedef typename odeint::unwrap_reference< Stepper >::type stepper_type;
68 typedef typename odeint::unwrap_reference< Observer >::type observer_type;
69 typedef typename odeint::unwrap_reference< StepOverflowChecker >::type checker_type;
70 typedef typename stepper_type::stepper_category stepper_category;
71
72 return detail::integrate_n_steps(
73 checked_stepper<stepper_type, checker_type>(stepper, checker),
74 system , start_state ,
75 start_time , dt , num_of_steps ,
76 checked_observer<observer_type, checker_type>(observer, checker),
77 stepper_category() );
78 }
79
80
81 /**
82 * \brief The same function as above, but without checker.
83 */
84 template< class Stepper , class System , class State , class Time , class Observer >
85 Time integrate_n_steps(
86 Stepper stepper , System system , State &start_state ,
87 Time start_time , Time dt , size_t num_of_steps , Observer observer )
88 {
89 typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category;
90
91 return detail::integrate_n_steps(
92 stepper , system , start_state ,
93 start_time , dt , num_of_steps ,
94 observer , stepper_category() );
95 }
96
97 /**
98 * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
99 */
100 template< class Stepper , class System , class State , class Time , class Observer >
101 Time integrate_n_steps(
102 Stepper stepper , System system , const State &start_state ,
103 Time start_time , Time dt , size_t num_of_steps , Observer observer )
104 {
105 typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category;
106
107 return detail::integrate_n_steps(
108 stepper , system , start_state ,
109 start_time , dt , num_of_steps ,
110 observer , stepper_category() );
111 }
112
113 /**
114 * \brief The same function as above, but without observer calls.
115 */
116 template< class Stepper , class System , class State , class Time >
117 Time integrate_n_steps(
118 Stepper stepper , System system , State &start_state ,
119 Time start_time , Time dt , size_t num_of_steps )
120 {
121 return integrate_n_steps(stepper, system, start_state, start_time,
122 dt, num_of_steps, null_observer());
123 }
124
125 /**
126 * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
127 */
128 template< class Stepper , class System , class State , class Time >
129 Time integrate_n_steps(
130 Stepper stepper , System system , const State &start_state ,
131 Time start_time , Time dt , size_t num_of_steps )
132 {
133 return integrate_n_steps(stepper, system, start_state, start_time,
134 dt, num_of_steps, null_observer());
135 }
136
137
138
139 /************* DOXYGEN *************/
140 /**
141 * \fn Time integrate_n_steps( Stepper stepper , System system , State &start_state , Time start_time , Time dt , size_t num_of_steps , Observer observer )
142 * \brief Integrates the ODE with constant step size.
143 *
144 * This function is similar to integrate_const. The observer is called at
145 * equidistant time intervals t0 + n*dt.
146 * If the Stepper is a normal stepper without step size control, dt is also
147 * used for the numerical scheme. If a ControlledStepper is provided, the
148 * algorithm might reduce the step size to meet the error bounds, but it is
149 * ensured that the observer is always called at equidistant time points
150 * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary
151 * and the dense output is used to call the observer at equidistant time
152 * points. The final integration time is always t0 + num_of_steps*dt.
153 * If a max_step_checker is provided as StepOverflowChecker, a
154 * no_progress_errror is thrown if too many steps (default: 500) are
155 * performed without progress, i.e. in between observer calls. If no
156 * checker is provided, no such overflow check is performed.
157
158 *
159 * \param stepper The stepper to be used for numerical integration.
160 * \param system Function/Functor defining the rhs of the ODE.
161 * \param start_state The initial condition x0.
162 * \param start_time The initial time t0.
163 * \param dt The time step between observer calls, _not_ necessarily the
164 * time step of the integration.
165 * \param num_of_steps Number of steps to be performed
166 * \param observer Function/Functor called at equidistant time intervals.
167 * \param checker [optional] Functor to check for step count overflows, if no
168 * checker is provided, no exception is thrown.
169 * \return The number of steps performed.
170 */
171
172
173
174 } // namespace odeint
175 } // namespace numeric
176 } // namespace boost
177
178
179
180 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED