]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/odeint/include/boost/numeric/odeint/iterator/integrate/integrate_const.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / numeric / odeint / include / boost / numeric / odeint / iterator / integrate / integrate_const.hpp
1 /*
2 [auto_generated]
3 boost/numeric/odeint/integrate/integrate_const.hpp
4
5 [begin_description]
6 Constant integration of ODEs, meaning that the state of the ODE is observed on constant time intervals.
7 The routines makes full use of adaptive and dense-output methods.
8 [end_description]
9
10 Copyright 2009-2011 Karsten Ahnert
11 Copyright 2009-2011 Mario Mulansky
12
13 Distributed under the Boost Software License, Version 1.0.
14 (See accompanying file LICENSE_1_0.txt or
15 copy at http://www.boost.org/LICENSE_1_0.txt)
16 */
17
18
19 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
20 #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
21
22 #include <boost/type_traits/is_same.hpp>
23
24 #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
25 #include <boost/numeric/odeint/iterator/integrate/null_observer.hpp>
26 #include <boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp>
27 #include <boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp>
28
29 namespace boost {
30 namespace numeric {
31 namespace odeint {
32
33
34
35
36
37 /*
38 * Integrates with constant time step dt.
39 */
40 template< class Stepper , class System , class State , class Time , class Observer >
41 size_t integrate_const(
42 Stepper stepper , System system , State &start_state ,
43 Time start_time , Time end_time , Time dt ,
44 Observer observer
45 )
46 {
47 typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
48 // we want to get as fast as possible to the end
49 if( boost::is_same< null_observer , Observer >::value )
50 {
51 return detail::integrate_adaptive(
52 stepper , system , start_state ,
53 start_time , end_time , dt ,
54 observer , stepper_category() );
55 }
56 else
57 {
58 return detail::integrate_const( stepper , system , start_state ,
59 start_time , end_time , dt ,
60 observer , stepper_category() );
61 }
62 }
63
64 /**
65 * \brief Second version to solve the forwarding problem,
66 * can be called with Boost.Range as start_state.
67 */
68 template< class Stepper , class System , class State , class Time , class Observer >
69 size_t integrate_const(
70 Stepper stepper , System system , const State &start_state ,
71 Time start_time , Time end_time , Time dt ,
72 Observer observer
73 )
74 {
75 typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
76 // we want to get as fast as possible to the end
77 if( boost::is_same< null_observer , Observer >::value )
78 {
79 return detail::integrate_adaptive(
80 stepper , system , start_state ,
81 start_time , end_time , dt ,
82 observer , stepper_category() );
83 }
84 else
85 {
86 return detail::integrate_const( stepper , system , start_state ,
87 start_time , end_time , dt ,
88 observer , stepper_category() );
89 }
90 }
91
92
93
94
95
96 /**
97 * \brief integrate_const without observer calls
98 */
99 template< class Stepper , class System , class State , class Time >
100 size_t integrate_const(
101 Stepper stepper , System system , State &start_state ,
102 Time start_time , Time end_time , Time dt
103 )
104 {
105 return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() );
106 }
107
108 /**
109 * \brief Second version to solve the forwarding problem,
110 * can be called with Boost.Range as start_state.
111 */
112 template< class Stepper , class System , class State , class Time >
113 size_t integrate_const(
114 Stepper stepper , System system , const State &start_state ,
115 Time start_time , Time end_time , Time dt
116 )
117 {
118 return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() );
119 }
120
121
122
123
124
125
126 /********* DOXYGEN *********/
127 /**
128 * \fn integrate_const( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
129 * \brief Integrates the ODE with constant step size.
130 *
131 * Integrates the ODE defined by system using the given stepper.
132 * This method ensures that the observer is called at constant intervals dt.
133 * If the Stepper is a normal stepper without step size control, dt is also
134 * used for the numerical scheme. If a ControlledStepper is provided, the
135 * algorithm might reduce the step size to meet the error bounds, but it is
136 * ensured that the observer is always called at equidistant time points
137 * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary
138 * and the dense output is used to call the observer at equidistant time
139 * points.
140 *
141 * \param stepper The stepper to be used for numerical integration.
142 * \param system Function/Functor defining the rhs of the ODE.
143 * \param start_state The initial condition x0.
144 * \param start_time The initial time t0.
145 * \param end_time The final integration time tend.
146 * \param dt The time step between observer calls, _not_ necessarily the
147 * time step of the integration.
148 * \param observer Function/Functor called at equidistant time intervals.
149 * \return The number of steps performed.
150 */
151
152 } // namespace odeint
153 } // namespace numeric
154 } // namespace boost
155
156
157
158 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED