1
2/*
3 [auto_generated]
4 boost/numeric/odeint/iterator/adaptive_time_iterator.hpp
5
6 [begin_description]
7 Iterator for iterating throught the solution of an ODE with adaptive step size. The dereferenced types containes also the time.
8 [end_description]
9
10 Copyright 2012-2013 Karsten Ahnert
11 Copyright 2012-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_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED
20#define BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED
21
22
23
24#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
25#include <boost/numeric/odeint/util/stepper_traits.hpp>
26#include <boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp>
27
28namespace boost {
29namespace numeric {
30namespace odeint {
31
32 /* use the adaptive_iterator_impl with the right tags */
33 template< class Stepper , class System , class State
34#ifndef DOXYGEN_SKIP
35 , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type
36#endif
37 >
38 class adaptive_time_iterator : public adaptive_iterator_impl<
39 adaptive_time_iterator< Stepper , System , State , StepperTag > ,
40 Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag
41 >
42 {
43 typedef typename traits::time_type< Stepper >::type time_type;
44 typedef adaptive_time_iterator< Stepper , System , State , StepperTag > iterator_type;
45
46 public:
47 adaptive_time_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt )
48 : adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt )
49 {}
50
51 adaptive_time_iterator( Stepper stepper , System sys , State &s )
52 : adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s )
53 {}
54 };
55
56
57
58
59 template< class Stepper , class System , class State >
60 adaptive_time_iterator< Stepper , System , State > make_adaptive_time_iterator_begin(
61 Stepper stepper ,
62 System system ,
63 State &x ,
64 typename traits::time_type< Stepper >::type t_start ,
65 typename traits::time_type< Stepper >::type t_end ,
66 typename traits::time_type< Stepper >::type dt )
67 {
68 return adaptive_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt );
69 }
70
71 template< class Stepper , class System , class State >
72 adaptive_time_iterator< Stepper , System , State > make_adaptive_time_iterator_end(
73 Stepper stepper ,
74 System system ,
75 State &x )
76 {
77 return adaptive_time_iterator< Stepper , System , State >( stepper , system , x );
78 }
79
80
81 template< class Stepper , class System , class State >
82 std::pair< adaptive_time_iterator< Stepper , System , State > , adaptive_time_iterator< Stepper , System , State > >
83 make_adaptive_time_range(
84 Stepper stepper ,
85 System system ,
86 State &x ,
87 typename traits::time_type< Stepper >::type t_start ,
88 typename traits::time_type< Stepper >::type t_end ,
89 typename traits::time_type< Stepper >::type dt )
90 {
91 return std::make_pair(
92 adaptive_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) ,
93 adaptive_time_iterator< Stepper , System , State >( stepper , system , x ) );
94 }
95
96
97
98 /**
99 * \class adaptive_time_iterator
100 *
101 * \brief ODE Iterator with adaptive step size. The value type of this iterator is a std::pair containing state and time.
102 *
103 * Implements an iterator representing the solution of an ODE from t_start
104 * to t_end evaluated at steps with an adaptive step size dt.
105 * After each iteration the iterator dereferences to a pair containing state
106 * and time at the next time point t+dt where dt is controlled by the stepper.
107 * This iterator can be used with ControlledSteppers and
108 * DenseOutputSteppers and it always makes use of the all the given steppers
109 * capabilities. A for_each over such an iterator range behaves similar to
110 * the integrate_adaptive routine.
111 *
112 * adaptive_iterator is a model of single-pass iterator.
113 *
114 * The value type of this iterator is a std::pair of state and time of the stepper.
115 *
116 * \tparam Stepper The stepper type which should be used during the iteration.
117 * \tparam System The type of the system function (ODE) which should be solved.
118 * \tparam State The state type of the ODE.
119 */
120
121
122
123 /**
124 * \fn make_adaptive_time_iterator_begin( Stepper stepper , System system , State &x ,
125 typename traits::time_type< Stepper >::type t_start ,
126 typename traits::time_type< Stepper >::type t_end ,
127 typename traits::time_type< Stepper >::type dt )
128 *
129 * \brief Factory function for adaptive_time_iterator. Constructs a begin iterator.
130 *
131 * \param stepper The stepper to use during the iteration.
132 * \param system The system function (ODE) to solve.
133 * \param x The initial state. adaptive_time_iterator stores a reference of s and changes its value during the iteration.
134 * \param t_start The initial time.
135 * \param t_end The end time, at which the iteration should stop.
136 * \param dt The initial time step.
137 * \returns The adaptive time iterator.
138 */
139
140
141 /**
142 * \fn make_adaptive_time_iterator_end( Stepper stepper , System system , State &x )
143 * \brief Factory function for adaptive_time_iterator. Constructs a end iterator.
144 *
145 * \param stepper The stepper to use during the iteration.
146 * \param system The system function (ODE) to solve.
147 * \param x The initial state. adaptive_time_iterator stores a reference of s and changes its value during the iteration.
148 * \returns The adaptive time iterator.
149 */
150
151
152 /**
153 * \fn make_adaptive_time_range( Stepper stepper , System system , State &x ,
154 typename traits::time_type< Stepper >::type t_start ,
155 typename traits::time_type< Stepper >::type t_end ,
156 typename traits::time_type< Stepper >::type dt )
157 *
158 * \brief Factory function to construct a single pass range of adaptive time iterators. A range is here a pair of adaptive_time_iterators.
159 *
160 * \param stepper The stepper to use during the iteration.
161 * \param system The system function (ODE) to solve.
162 * \param x The initial state. adaptive_time_iterator stores a reference of s and changes its value during the iteration.
163 * \param t_start The initial time.
164 * \param t_end The end time, at which the iteration should stop.
165 * \param dt The initial time step.
166 * \returns The adaptive time range.
167 */
168
169
170} // namespace odeint
171} // namespace numeric
172} // namespace boost
173
174
175#endif // BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED
176

source code of boost/boost/numeric/odeint/iterator/adaptive_time_iterator.hpp