]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | [auto_generated] | |
3 | boost/numeric/odeint/integrate/integrate_adaptive.hpp | |
4 | ||
5 | [begin_description] | |
6 | Adaptive integration of ODEs. | |
7 | [end_description] | |
8 | ||
9 | Copyright 2011-2013 Karsten Ahnert | |
10 | Copyright 2011-2015 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_ADAPTIVE_HPP_INCLUDED | |
19 | #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED | |
20 | ||
21 | #include <boost/type_traits/is_same.hpp> | |
22 | ||
23 | #include <boost/numeric/odeint/stepper/stepper_categories.hpp> | |
24 | #include <boost/numeric/odeint/integrate/null_observer.hpp> | |
25 | #include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp> | |
26 | ||
27 | namespace boost { | |
28 | namespace numeric { | |
29 | namespace odeint { | |
30 | ||
31 | ||
32 | /* | |
33 | * the two overloads are needed in order to solve the forwarding problem | |
34 | */ | |
35 | template< class Stepper , class System , class State , class Time , class Observer > | |
36 | size_t integrate_adaptive( | |
37 | Stepper stepper , System system , State &start_state , | |
38 | Time start_time , Time end_time , Time dt , | |
39 | Observer observer ) | |
40 | { | |
41 | typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; | |
42 | return detail::integrate_adaptive( | |
43 | stepper , system , start_state , | |
44 | start_time , end_time , dt , | |
45 | observer , stepper_category() ); | |
46 | ||
47 | /* | |
48 | * Suggestion for a new extendable version: | |
49 | * | |
50 | * integrator_adaptive< Stepper , System, State , Time , Observer , typename Stepper::stepper_category > integrator; | |
51 | * return integrator.run( stepper , system , start_state , start_time , end_time , dt , observer ); | |
52 | */ | |
53 | } | |
54 | ||
55 | /** | |
56 | * \brief Second version to solve the forwarding problem, | |
57 | * can be called with Boost.Range as start_state. | |
58 | */ | |
59 | template< class Stepper , class System , class State , class Time , class Observer > | |
60 | size_t integrate_adaptive( | |
61 | Stepper stepper , System system , const State &start_state , | |
62 | Time start_time , Time end_time , Time dt , | |
63 | Observer observer ) | |
64 | { | |
65 | typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; | |
66 | return detail::integrate_adaptive( | |
67 | stepper , system , start_state , | |
68 | start_time , end_time , dt , | |
69 | observer , stepper_category() ); | |
70 | } | |
71 | ||
72 | ||
73 | ||
74 | ||
75 | /** | |
76 | * \brief integrate_adaptive without an observer. | |
77 | */ | |
78 | template< class Stepper , class System , class State , class Time > | |
79 | size_t integrate_adaptive( | |
80 | Stepper stepper , System system , State &start_state , | |
81 | Time start_time , Time end_time , Time dt ) | |
82 | { | |
83 | return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , null_observer() ); | |
84 | } | |
85 | ||
86 | /** | |
87 | * \brief Second version to solve the forwarding problem, | |
88 | * can be called with Boost.Range as start_state. | |
89 | */ | |
90 | template< class Stepper , class System , class State , class Time > | |
91 | size_t integrate_adaptive( | |
92 | Stepper stepper , System system , const State &start_state , | |
93 | Time start_time , Time end_time , Time dt ) | |
94 | { | |
95 | return integrate_adaptive( stepper , system , start_state , start_time , end_time , dt , null_observer() ); | |
96 | } | |
97 | ||
98 | ||
99 | /************* DOXYGEN ************/ | |
100 | ||
101 | /** | |
102 | * \fn integrate_adaptive( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) | |
103 | * \brief Integrates the ODE with adaptive step size. | |
104 | * | |
105 | * This function integrates the ODE given by system with the given stepper. | |
106 | * The observer is called after each step. If the stepper has no error | |
107 | * control, the step size remains constant and the observer is called at | |
108 | * equidistant time points t0+n*dt. If the stepper is a ControlledStepper, | |
109 | * the step size is adjusted and the observer is called in non-equidistant | |
110 | * intervals. | |
111 | * | |
112 | * \param stepper The stepper to be used for numerical integration. | |
113 | * \param system Function/Functor defining the rhs of the ODE. | |
114 | * \param start_state The initial condition x0. | |
115 | * \param start_time The initial time t0. | |
116 | * \param end_time The final integration time tend. | |
117 | * \param dt The time step between observer calls, _not_ necessarily the | |
118 | * time step of the integration. | |
119 | * \param observer Function/Functor called at equidistant time intervals. | |
120 | * \return The number of steps performed. | |
121 | */ | |
122 | ||
123 | } // namespace odeint | |
124 | } // namespace numeric | |
125 | } // namespace boost | |
126 | ||
127 | ||
128 | ||
129 | #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED |