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