3 boost/numeric/odeint/integrate/integrate_times.hpp
6 Integration of ODEs with observation at user defined points
9 Copyright 2009-2011 Karsten Ahnert
10 Copyright 2009-2011 Mario Mulansky
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)
18 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
21 #include <boost/type_traits/is_same.hpp>
23 #include <boost/range.hpp>
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>
35 * the two overloads are needed in order to solve the forwarding problem
37 template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer >
38 size_t integrate_times(
39 Stepper stepper , System system , State &start_state ,
40 TimeIterator times_start , TimeIterator times_end , Time dt ,
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() );
51 * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
53 template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer >
54 size_t integrate_times(
55 Stepper stepper , System system , const State &start_state ,
56 TimeIterator times_start , TimeIterator times_end , Time dt ,
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() );
67 * \brief The same function as above, but without observer calls.
69 template< class Stepper , class System , class State , class TimeRange , class Time , class Observer >
70 size_t integrate_times(
71 Stepper stepper , System system , State &start_state ,
72 const TimeRange × , Time dt ,
75 return integrate_times(
76 stepper , system , start_state ,
77 boost::begin( times ) , boost::end( times ) , dt , observer );
81 * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
83 template< class Stepper , class System , class State , class TimeRange , class Time , class Observer >
84 size_t integrate_times(
85 Stepper stepper , System system , const State &start_state ,
86 const TimeRange × , Time dt ,
89 return integrate_times(
90 stepper , system , start_state ,
91 boost::begin( times ) , boost::end( times ) , dt , observer );
97 /********* DOXYGEN ***********/
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.
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).
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.
127 } // namespace odeint
128 } // namespace numeric
133 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED