Chris@102
|
1 /*
|
Chris@102
|
2 [auto_generated]
|
Chris@102
|
3 boost/numeric/odeint/integrate/integrate.hpp
|
Chris@102
|
4
|
Chris@102
|
5 [begin_description]
|
Chris@102
|
6 Convenience methods which choose the stepper for the current ODE.
|
Chris@102
|
7 [end_description]
|
Chris@102
|
8
|
Chris@102
|
9 Copyright 2009-2011 Karsten Ahnert
|
Chris@102
|
10 Copyright 2009-2011 Mario Mulansky
|
Chris@102
|
11
|
Chris@102
|
12 Distributed under the Boost Software License, Version 1.0.
|
Chris@102
|
13 (See accompanying file LICENSE_1_0.txt or
|
Chris@102
|
14 copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
15 */
|
Chris@102
|
16
|
Chris@102
|
17
|
Chris@102
|
18 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED
|
Chris@102
|
19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED
|
Chris@102
|
20
|
Chris@102
|
21 #include <boost/utility/enable_if.hpp>
|
Chris@102
|
22
|
Chris@102
|
23 #include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp>
|
Chris@102
|
24 #include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
|
Chris@102
|
25 #include <boost/numeric/odeint/iterator/integrate/null_observer.hpp>
|
Chris@102
|
26 #include <boost/numeric/odeint/iterator/integrate/integrate_adaptive.hpp>
|
Chris@102
|
27
|
Chris@102
|
28 // for has_value_type trait
|
Chris@102
|
29 #include <boost/numeric/odeint/algebra/detail/extract_value_type.hpp>
|
Chris@102
|
30
|
Chris@102
|
31
|
Chris@102
|
32 namespace boost {
|
Chris@102
|
33 namespace numeric {
|
Chris@102
|
34 namespace odeint {
|
Chris@102
|
35
|
Chris@102
|
36
|
Chris@102
|
37 /*
|
Chris@102
|
38 * ToDo :
|
Chris@102
|
39 *
|
Chris@102
|
40 * determine type of dxdt for units
|
Chris@102
|
41 *
|
Chris@102
|
42 */
|
Chris@102
|
43 template< class System , class State , class Time , class Observer >
|
Chris@102
|
44 typename boost::enable_if< typename has_value_type<State>::type , size_t >::type
|
Chris@102
|
45 integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
|
Chris@102
|
46 {
|
Chris@102
|
47 typedef controlled_runge_kutta< runge_kutta_dopri5< State , typename State::value_type , State , Time > > stepper_type;
|
Chris@102
|
48 return integrate_adaptive( stepper_type() , system , start_state , start_time , end_time , dt , observer );
|
Chris@102
|
49 }
|
Chris@102
|
50
|
Chris@102
|
51
|
Chris@102
|
52
|
Chris@102
|
53 /*
|
Chris@102
|
54 * the two overloads are needed in order to solve the forwarding problem
|
Chris@102
|
55 */
|
Chris@102
|
56 template< class System , class State , class Time >
|
Chris@102
|
57 size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
|
Chris@102
|
58 {
|
Chris@102
|
59 return integrate( system , start_state , start_time , end_time , dt , null_observer() );
|
Chris@102
|
60 }
|
Chris@102
|
61
|
Chris@102
|
62
|
Chris@102
|
63 /**
|
Chris@102
|
64 * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
|
Chris@102
|
65 * \brief Integrates the ODE.
|
Chris@102
|
66 *
|
Chris@102
|
67 * Integrates the ODE given by system from start_time to end_time starting
|
Chris@102
|
68 * with start_state as initial condition and dt as initial time step.
|
Chris@102
|
69 * This function uses a dense output dopri5 stepper and performs an adaptive
|
Chris@102
|
70 * integration with step size control, thus dt changes during the integration.
|
Chris@102
|
71 * This method uses standard error bounds of 1E-6.
|
Chris@102
|
72 * After each step, the observer is called.
|
Chris@102
|
73 *
|
Chris@102
|
74 * \param system The system function to solve, hence the r.h.s. of the
|
Chris@102
|
75 * ordinary differential equation.
|
Chris@102
|
76 * \param start_state The initial state.
|
Chris@102
|
77 * \param start_time Start time of the integration.
|
Chris@102
|
78 * \param end_time End time of the integration.
|
Chris@102
|
79 * \param dt Initial step size, will be adjusted during the integration.
|
Chris@102
|
80 * \param observer Observer that will be called after each time step.
|
Chris@102
|
81 * \return The number of steps performed.
|
Chris@102
|
82 */
|
Chris@102
|
83
|
Chris@102
|
84
|
Chris@102
|
85 /**
|
Chris@102
|
86 * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
|
Chris@102
|
87 * \brief Integrates the ODE without observer calls.
|
Chris@102
|
88 *
|
Chris@102
|
89 * Integrates the ODE given by system from start_time to end_time starting
|
Chris@102
|
90 * with start_state as initial condition and dt as initial time step.
|
Chris@102
|
91 * This function uses a dense output dopri5 stepper and performs an adaptive
|
Chris@102
|
92 * integration with step size control, thus dt changes during the integration.
|
Chris@102
|
93 * This method uses standard error bounds of 1E-6.
|
Chris@102
|
94 * No observer is called.
|
Chris@102
|
95 *
|
Chris@102
|
96 * \param system The system function to solve, hence the r.h.s. of the
|
Chris@102
|
97 * ordinary differential equation.
|
Chris@102
|
98 * \param start_state The initial state.
|
Chris@102
|
99 * \param start_time Start time of the integration.
|
Chris@102
|
100 * \param end_time End time of the integration.
|
Chris@102
|
101 * \param dt Initial step size, will be adjusted during the integration.
|
Chris@102
|
102 * \return The number of steps performed.
|
Chris@102
|
103 */
|
Chris@102
|
104
|
Chris@102
|
105 } // namespace odeint
|
Chris@102
|
106 } // namespace numeric
|
Chris@102
|
107 } // namespace boost
|
Chris@102
|
108
|
Chris@102
|
109
|
Chris@102
|
110
|
Chris@102
|
111 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED
|