]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/odeint/include/boost/numeric/odeint/iterator/times_iterator.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / numeric / odeint / include / boost / numeric / odeint / iterator / times_iterator.hpp
1
2 /*
3 [auto_generated]
4 boost/numeric/odeint/iterator/times_iterator.hpp
5
6 [begin_description]
7 Iterator for iterating through the solution of an ODE with oscillator calls at times from a given sequence.
8 [end_description]
9
10 Copyright 2009-2013 Karsten Ahnert
11 Copyright 2009-2013 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_ITERATOR_TIMES_ITERATOR_HPP_INCLUDED
20 #define BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_ITERATOR_HPP_INCLUDED
21
22
23 #include <boost/numeric/odeint/util/stepper_traits.hpp>
24 #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
25 #include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp>
26 #include <boost/numeric/odeint/iterator/impl/times_iterator_impl.hpp>
27
28
29 namespace boost {
30 namespace numeric {
31 namespace odeint {
32
33
34 /* use the times_iterator_impl with the right tags */
35 template< class Stepper , class System , class State , class TimeIterator
36 #ifndef DOXYGEN_SKIP
37 , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type
38 #endif
39 >
40 class times_iterator : public times_iterator_impl<
41 times_iterator< Stepper , System , State , TimeIterator , StepperTag > ,
42 Stepper , System , State , TimeIterator , detail::ode_state_iterator_tag , StepperTag
43 >
44 {
45 typedef typename traits::time_type< Stepper >::type time_type;
46 typedef times_iterator< Stepper , System , State , TimeIterator , StepperTag > iterator_type;
47
48 public:
49 times_iterator( Stepper stepper , System sys , State &s ,
50 TimeIterator t_start , TimeIterator t_end , time_type dt )
51 : times_iterator_impl< iterator_type , Stepper , System , State , TimeIterator, detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt )
52 {}
53
54 times_iterator( Stepper stepper , System sys , State &s )
55 : times_iterator_impl< iterator_type , Stepper , System , State , TimeIterator , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s )
56 {}
57 };
58
59 /* make functions */
60
61 template< class Stepper , class System , class State , class TimeIterator >
62 times_iterator< Stepper , System, State , TimeIterator > make_times_iterator_begin(
63 Stepper stepper ,
64 System system ,
65 State &x ,
66 TimeIterator t_start ,
67 TimeIterator t_end ,
68 typename traits::time_type< Stepper >::type dt )
69 {
70 return times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x , t_start , t_end , dt );
71 }
72
73 // ToDo: requires to specifically provide the TimeIterator template parameter, can this be improved?
74 template< class TimeIterator , class Stepper , class System , class State >
75 times_iterator< Stepper , System , State , TimeIterator > make_times_iterator_end(
76 Stepper stepper ,
77 System system ,
78 State &x )
79 //TimeIterator t_end )
80 {
81 return times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x );
82 }
83
84 template< class Stepper , class System , class State , class TimeIterator >
85 std::pair< times_iterator< Stepper , System , State , TimeIterator > ,
86 times_iterator< Stepper , System , State , TimeIterator > >
87 make_times_range(
88 Stepper stepper ,
89 System system ,
90 State &x ,
91 TimeIterator t_start ,
92 TimeIterator t_end ,
93 typename traits::time_type< Stepper >::type dt )
94 {
95 return std::make_pair(
96 times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x , t_start , t_end , dt ) ,
97 times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x )
98 );
99 }
100
101
102 /**
103 * \class times_iterator
104 *
105 * \brief ODE Iterator with given evaluation points. The value type of this iterator is the state type of the stepper.
106 *
107 * Implements an iterator representing the solution of an ODE from *t_start
108 * to *t_end evaluated at time points given by the sequence t_start to t_end.
109 * t_start and t_end are iterators representing a sequence of time points
110 * where the solution of the ODE should be evaluated.
111 * After each iteration the iterator dereferences to the state x at the next
112 * time *t_start++ until t_end is reached.
113 * This iterator can be used with Steppers, ControlledSteppers and
114 * DenseOutputSteppers and it always makes use of the all the given steppers
115 * capabilities. A for_each over such an iterator range behaves similar to
116 * the integrate_times routine.
117 *
118 * times_iterator is a model of single-pass iterator.
119 *
120 * The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time.
121 *
122 * \tparam Stepper The stepper type which should be used during the iteration.
123 * \tparam System The type of the system function (ODE) which should be solved.
124 * \tparam State The state type of the ODE.
125 * \tparam TimeIterator The iterator type for the sequence of time points.
126 */
127
128
129
130 /**
131 * \fn make_times_iterator_begin( Stepper stepper ,
132 System system ,
133 State &x ,
134 TimeIterator t_start ,
135 TimeIterator t_end ,
136 typename traits::time_type< Stepper >::type dt )
137 *
138 * \brief Factory function for times_iterator. Constructs a begin iterator.
139 *
140 * \param stepper The stepper to use during the iteration.
141 * \param system The system function (ODE) to solve.
142 * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
143 * \param t_start Begin iterator of the sequence of evaluation time points.
144 * \param t_end End iterator of the sequence of evaluation time points.
145 * \param dt The initial time step.
146 * \returns The times iterator.
147 */
148
149
150 /**
151 * \fn make_times_iterator_end( Stepper stepper , System system , State &x )
152 * \brief Factory function for times_iterator. Constructs an end iterator.
153 *
154 * \tparam TimesIterator The iterator type of the time sequence, must be specifically provided.
155 *
156 * \param stepper The stepper to use during the iteration.
157 * \param system The system function (ODE) to solve.
158 * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
159 * \returns The times iterator.
160 *
161 * This function needs the TimeIterator type specifically defined as a
162 * template parameter.
163 */
164
165
166 /**
167 * \fn make_times_range( Stepper stepper , System system , State &x ,
168 TimeIterator t_start ,
169 TimeIterator t_end ,
170 typename traits::time_type< Stepper >::type dt )
171 *
172 * \brief Factory function to construct a single pass range of times iterators. A range is here a pair
173 * of times_iterator.
174 *
175 * \param stepper The stepper to use during the iteration.
176 * \param system The system function (ODE) to solve.
177 * \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration.
178 * \param t_start Begin iterator of the sequence of evaluation time points.
179 * \param t_end End iterator of the sequence of evaluation time points.
180 * \param dt The initial time step.
181 * \returns The times iterator range.
182 */
183
184
185 } // namespace odeint
186 } // namespace numeric
187 } // namespace boost
188
189 #endif // BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_ITERATOR_HPP_INCLUDED