3 boost/numeric/odeint/integrate/integrate.hpp
6 Convenience methods which choose the stepper for the current ODE.
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_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED
21 #include <boost/utility/enable_if.hpp>
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>
28 // for has_value_type trait
29 #include <boost/numeric/odeint/algebra/detail/extract_value_type.hpp>
40 * determine type of dxdt for units
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 )
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 );
54 * the two overloads are needed in order to solve the forwarding problem
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 )
59 return integrate( system , start_state , start_time , end_time , dt , null_observer() );
64 * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
65 * \brief Integrates the ODE.
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.
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.
86 * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
87 * \brief Integrates the ODE without observer calls.
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.
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.
105 } // namespace odeint
106 } // namespace numeric
111 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED