Chris@16
|
1 /*
|
Chris@16
|
2 [auto_generated]
|
Chris@16
|
3 boost/numeric/odeint/integrate/integrate_times.hpp
|
Chris@16
|
4
|
Chris@16
|
5 [begin_description]
|
Chris@16
|
6 Integration of ODEs with observation at user defined points
|
Chris@16
|
7 [end_description]
|
Chris@16
|
8
|
Chris@101
|
9 Copyright 2011-2013 Karsten Ahnert
|
Chris@101
|
10 Copyright 2011-2012 Mario Mulansky
|
Chris@16
|
11
|
Chris@16
|
12 Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
13 (See accompanying file LICENSE_1_0.txt or
|
Chris@16
|
14 copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
15 */
|
Chris@16
|
16
|
Chris@16
|
17
|
Chris@16
|
18 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
|
Chris@16
|
19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
|
Chris@16
|
20
|
Chris@16
|
21 #include <boost/type_traits/is_same.hpp>
|
Chris@16
|
22
|
Chris@16
|
23 #include <boost/range.hpp>
|
Chris@16
|
24
|
Chris@16
|
25 #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
|
Chris@16
|
26 #include <boost/numeric/odeint/integrate/null_observer.hpp>
|
Chris@16
|
27 #include <boost/numeric/odeint/integrate/detail/integrate_times.hpp>
|
Chris@16
|
28
|
Chris@16
|
29 namespace boost {
|
Chris@16
|
30 namespace numeric {
|
Chris@16
|
31 namespace odeint {
|
Chris@16
|
32
|
Chris@16
|
33
|
Chris@16
|
34 /*
|
Chris@16
|
35 * the two overloads are needed in order to solve the forwarding problem
|
Chris@16
|
36 */
|
Chris@16
|
37 template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer >
|
Chris@16
|
38 size_t integrate_times(
|
Chris@16
|
39 Stepper stepper , System system , State &start_state ,
|
Chris@16
|
40 TimeIterator times_start , TimeIterator times_end , Time dt ,
|
Chris@16
|
41 Observer observer )
|
Chris@16
|
42 {
|
Chris@101
|
43 typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
|
Chris@16
|
44 return detail::integrate_times(
|
Chris@16
|
45 stepper , system , start_state ,
|
Chris@16
|
46 times_start , times_end , dt ,
|
Chris@101
|
47 observer , stepper_category() );
|
Chris@16
|
48 }
|
Chris@16
|
49
|
Chris@16
|
50 /**
|
Chris@16
|
51 * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
|
Chris@16
|
52 */
|
Chris@16
|
53 template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer >
|
Chris@16
|
54 size_t integrate_times(
|
Chris@16
|
55 Stepper stepper , System system , const State &start_state ,
|
Chris@16
|
56 TimeIterator times_start , TimeIterator times_end , Time dt ,
|
Chris@16
|
57 Observer observer )
|
Chris@16
|
58 {
|
Chris@101
|
59 typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
|
Chris@16
|
60 return detail::integrate_times(
|
Chris@16
|
61 stepper , system , start_state ,
|
Chris@16
|
62 times_start , times_end , dt ,
|
Chris@101
|
63 observer , stepper_category() );
|
Chris@16
|
64 }
|
Chris@16
|
65
|
Chris@16
|
66 /**
|
Chris@16
|
67 * \brief The same function as above, but without observer calls.
|
Chris@16
|
68 */
|
Chris@16
|
69 template< class Stepper , class System , class State , class TimeRange , class Time , class Observer >
|
Chris@16
|
70 size_t integrate_times(
|
Chris@16
|
71 Stepper stepper , System system , State &start_state ,
|
Chris@16
|
72 const TimeRange × , Time dt ,
|
Chris@16
|
73 Observer observer )
|
Chris@16
|
74 {
|
Chris@16
|
75 return integrate_times(
|
Chris@16
|
76 stepper , system , start_state ,
|
Chris@16
|
77 boost::begin( times ) , boost::end( times ) , dt , observer );
|
Chris@16
|
78 }
|
Chris@16
|
79
|
Chris@16
|
80 /**
|
Chris@16
|
81 * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
|
Chris@16
|
82 */
|
Chris@16
|
83 template< class Stepper , class System , class State , class TimeRange , class Time , class Observer >
|
Chris@16
|
84 size_t integrate_times(
|
Chris@16
|
85 Stepper stepper , System system , const State &start_state ,
|
Chris@16
|
86 const TimeRange × , Time dt ,
|
Chris@16
|
87 Observer observer )
|
Chris@16
|
88 {
|
Chris@16
|
89 return integrate_times(
|
Chris@16
|
90 stepper , system , start_state ,
|
Chris@16
|
91 boost::begin( times ) , boost::end( times ) , dt , observer );
|
Chris@16
|
92 }
|
Chris@16
|
93
|
Chris@16
|
94
|
Chris@16
|
95
|
Chris@16
|
96
|
Chris@16
|
97 /********* DOXYGEN ***********/
|
Chris@16
|
98
|
Chris@16
|
99 /**
|
Chris@16
|
100 * \fn size_t integrate_times( Stepper stepper , System system , State &start_state , TimeIterator times_start , TimeIterator times_end , Time dt , Observer observer )
|
Chris@16
|
101 * \brief Integrates the ODE with observer calls at given time points.
|
Chris@16
|
102 *
|
Chris@16
|
103 * Integrates the ODE given by system using the given stepper. This function
|
Chris@16
|
104 * does observer calls at the subsequent time points given by the range
|
Chris@16
|
105 * times_start, times_end. If the stepper has not step size control, the
|
Chris@16
|
106 * step size might be reduced occasionally to ensure observer calls exactly
|
Chris@16
|
107 * at the time points from the given sequence. If the stepper is a
|
Chris@16
|
108 * ControlledStepper, the step size is adjusted to meet the error bounds,
|
Chris@16
|
109 * but also might be reduced occasionally to ensure correct observer calls.
|
Chris@16
|
110 * If a DenseOutputStepper is provided, the dense output functionality is
|
Chris@16
|
111 * used to call the observer at the given times. The end time of the
|
Chris@16
|
112 * integration is always *(end_time-1).
|
Chris@16
|
113 *
|
Chris@16
|
114 * \param stepper The stepper to be used for numerical integration.
|
Chris@16
|
115 * \param system Function/Functor defining the rhs of the ODE.
|
Chris@16
|
116 * \param start_state The initial condition x0.
|
Chris@16
|
117 * \param times_start Iterator to the start time
|
Chris@16
|
118 * \param times_end Iterator to the end time
|
Chris@16
|
119 * \param dt The time step between observer calls, _not_ necessarily the
|
Chris@16
|
120 * time step of the integration.
|
Chris@16
|
121 * \param observer Function/Functor called at equidistant time intervals.
|
Chris@16
|
122 * \return The number of steps performed.
|
Chris@16
|
123 */
|
Chris@16
|
124
|
Chris@16
|
125
|
Chris@16
|
126
|
Chris@16
|
127 } // namespace odeint
|
Chris@16
|
128 } // namespace numeric
|
Chris@16
|
129 } // namespace boost
|
Chris@16
|
130
|
Chris@16
|
131
|
Chris@16
|
132
|
Chris@16
|
133 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
|