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