Chris@16
|
1 /*
|
Chris@16
|
2 [auto_generated]
|
Chris@16
|
3 boost/numeric/odeint/integrate/integrate.hpp
|
Chris@16
|
4
|
Chris@16
|
5 [begin_description]
|
Chris@16
|
6 Convenience methods which choose the stepper for the current ODE.
|
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_HPP_INCLUDED
|
Chris@16
|
19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED
|
Chris@16
|
20
|
Chris@101
|
21 #include <boost/utility/enable_if.hpp>
|
Chris@101
|
22
|
Chris@16
|
23 #include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp>
|
Chris@16
|
24 #include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
|
Chris@16
|
25 #include <boost/numeric/odeint/integrate/null_observer.hpp>
|
Chris@16
|
26 #include <boost/numeric/odeint/integrate/integrate_adaptive.hpp>
|
Chris@16
|
27
|
Chris@101
|
28 // for has_value_type trait
|
Chris@101
|
29 #include <boost/numeric/odeint/algebra/detail/extract_value_type.hpp>
|
Chris@16
|
30
|
Chris@16
|
31
|
Chris@16
|
32 namespace boost {
|
Chris@16
|
33 namespace numeric {
|
Chris@16
|
34 namespace odeint {
|
Chris@16
|
35
|
Chris@16
|
36
|
Chris@16
|
37 /*
|
Chris@16
|
38 * ToDo :
|
Chris@16
|
39 *
|
Chris@16
|
40 * determine type of dxdt for units
|
Chris@16
|
41 *
|
Chris@16
|
42 */
|
Chris@16
|
43 template< class System , class State , class Time , class Observer >
|
Chris@101
|
44 typename boost::enable_if< typename has_value_type<State>::type , size_t >::type
|
Chris@101
|
45 integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
|
Chris@16
|
46 {
|
Chris@101
|
47 typedef controlled_runge_kutta< runge_kutta_dopri5< State , typename State::value_type , State , Time > > stepper_type;
|
Chris@101
|
48 return integrate_adaptive( stepper_type() , system , start_state , start_time , end_time , dt , observer );
|
Chris@16
|
49 }
|
Chris@16
|
50
|
Chris@101
|
51 template< class Value , class System , class State , class Time , class Observer >
|
Chris@101
|
52 size_t
|
Chris@101
|
53 integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
|
Chris@101
|
54 {
|
Chris@101
|
55 typedef controlled_runge_kutta< runge_kutta_dopri5< State , Value , State , Time > > stepper_type;
|
Chris@101
|
56 return integrate_adaptive( stepper_type() , system , start_state , start_time , end_time , dt , observer );
|
Chris@101
|
57 }
|
Chris@101
|
58
|
Chris@101
|
59
|
Chris@16
|
60
|
Chris@16
|
61
|
Chris@16
|
62 /*
|
Chris@16
|
63 * the two overloads are needed in order to solve the forwarding problem
|
Chris@16
|
64 */
|
Chris@16
|
65 template< class System , class State , class Time >
|
Chris@16
|
66 size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
|
Chris@16
|
67 {
|
Chris@16
|
68 return integrate( system , start_state , start_time , end_time , dt , null_observer() );
|
Chris@16
|
69 }
|
Chris@16
|
70
|
Chris@101
|
71 template< class Value , class System , class State , class Time >
|
Chris@101
|
72 size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
|
Chris@101
|
73 {
|
Chris@101
|
74 return integrate< Value >( system , start_state , start_time , end_time , dt , null_observer() );
|
Chris@101
|
75 }
|
Chris@101
|
76
|
Chris@101
|
77
|
Chris@16
|
78
|
Chris@16
|
79 /**
|
Chris@16
|
80 * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
|
Chris@16
|
81 * \brief Integrates the ODE.
|
Chris@16
|
82 *
|
Chris@16
|
83 * Integrates the ODE given by system from start_time to end_time starting
|
Chris@16
|
84 * with start_state as initial condition and dt as initial time step.
|
Chris@16
|
85 * This function uses a dense output dopri5 stepper and performs an adaptive
|
Chris@16
|
86 * integration with step size control, thus dt changes during the integration.
|
Chris@16
|
87 * This method uses standard error bounds of 1E-6.
|
Chris@16
|
88 * After each step, the observer is called.
|
Chris@101
|
89 *
|
Chris@101
|
90 * \attention A second version of this function template exists which explicitly
|
Chris@101
|
91 * expects the value type as template parameter, i.e. integrate< double >( sys , x , t0 , t1 , dt , obs );
|
Chris@16
|
92 *
|
Chris@16
|
93 * \param system The system function to solve, hence the r.h.s. of the
|
Chris@16
|
94 * ordinary differential equation.
|
Chris@16
|
95 * \param start_state The initial state.
|
Chris@16
|
96 * \param start_time Start time of the integration.
|
Chris@16
|
97 * \param end_time End time of the integration.
|
Chris@16
|
98 * \param dt Initial step size, will be adjusted during the integration.
|
Chris@16
|
99 * \param observer Observer that will be called after each time step.
|
Chris@16
|
100 * \return The number of steps performed.
|
Chris@16
|
101 */
|
Chris@16
|
102
|
Chris@16
|
103
|
Chris@16
|
104 /**
|
Chris@16
|
105 * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
|
Chris@16
|
106 * \brief Integrates the ODE without observer calls.
|
Chris@16
|
107 *
|
Chris@16
|
108 * Integrates the ODE given by system from start_time to end_time starting
|
Chris@16
|
109 * with start_state as initial condition and dt as initial time step.
|
Chris@16
|
110 * This function uses a dense output dopri5 stepper and performs an adaptive
|
Chris@16
|
111 * integration with step size control, thus dt changes during the integration.
|
Chris@16
|
112 * This method uses standard error bounds of 1E-6.
|
Chris@16
|
113 * No observer is called.
|
Chris@101
|
114 *
|
Chris@101
|
115 * \attention A second version of this function template exists which explicitly
|
Chris@101
|
116 * expects the value type as template parameter, i.e. integrate< double >( sys , x , t0 , t1 , dt );
|
Chris@16
|
117 *
|
Chris@16
|
118 * \param system The system function to solve, hence the r.h.s. of the
|
Chris@16
|
119 * ordinary differential equation.
|
Chris@16
|
120 * \param start_state The initial state.
|
Chris@16
|
121 * \param start_time Start time of the integration.
|
Chris@16
|
122 * \param end_time End time of the integration.
|
Chris@16
|
123 * \param dt Initial step size, will be adjusted during the integration.
|
Chris@16
|
124 * \return The number of steps performed.
|
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_HPP_INCLUDED
|