Chris@16: /* Chris@16: [auto_generated] Chris@16: boost/numeric/odeint/integrate/integrate.hpp Chris@16: Chris@16: [begin_description] Chris@16: Convenience methods which choose the stepper for the current ODE. Chris@16: [end_description] Chris@16: Chris@101: Copyright 2011-2013 Karsten Ahnert Chris@101: Copyright 2011-2012 Mario Mulansky Chris@16: Chris@16: Distributed under the Boost Software License, Version 1.0. Chris@16: (See accompanying file LICENSE_1_0.txt or Chris@16: copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: Chris@16: Chris@16: #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED Chris@16: #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED Chris@16: Chris@101: #include Chris@101: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@101: // for has_value_type trait Chris@101: #include Chris@16: Chris@16: Chris@16: namespace boost { Chris@16: namespace numeric { Chris@16: namespace odeint { Chris@16: Chris@16: Chris@16: /* Chris@16: * ToDo : Chris@16: * Chris@16: * determine type of dxdt for units Chris@16: * Chris@16: */ Chris@16: template< class System , class State , class Time , class Observer > Chris@101: typename boost::enable_if< typename has_value_type::type , size_t >::type Chris@101: integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) Chris@16: { Chris@101: typedef controlled_runge_kutta< runge_kutta_dopri5< State , typename State::value_type , State , Time > > stepper_type; Chris@101: return integrate_adaptive( stepper_type() , system , start_state , start_time , end_time , dt , observer ); Chris@16: } Chris@16: Chris@101: template< class Value , class System , class State , class Time , class Observer > Chris@101: size_t Chris@101: integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) Chris@101: { Chris@101: typedef controlled_runge_kutta< runge_kutta_dopri5< State , Value , State , Time > > stepper_type; Chris@101: return integrate_adaptive( stepper_type() , system , start_state , start_time , end_time , dt , observer ); Chris@101: } Chris@101: Chris@101: Chris@16: Chris@16: Chris@16: /* Chris@16: * the two overloads are needed in order to solve the forwarding problem Chris@16: */ Chris@16: template< class System , class State , class Time > Chris@16: size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt ) Chris@16: { Chris@16: return integrate( system , start_state , start_time , end_time , dt , null_observer() ); Chris@16: } Chris@16: Chris@101: template< class Value , class System , class State , class Time > Chris@101: size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt ) Chris@101: { Chris@101: return integrate< Value >( system , start_state , start_time , end_time , dt , null_observer() ); Chris@101: } Chris@101: Chris@101: Chris@16: Chris@16: /** Chris@16: * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) Chris@16: * \brief Integrates the ODE. Chris@16: * Chris@16: * Integrates the ODE given by system from start_time to end_time starting Chris@16: * with start_state as initial condition and dt as initial time step. Chris@16: * This function uses a dense output dopri5 stepper and performs an adaptive Chris@16: * integration with step size control, thus dt changes during the integration. Chris@16: * This method uses standard error bounds of 1E-6. Chris@16: * After each step, the observer is called. Chris@101: * Chris@101: * \attention A second version of this function template exists which explicitly Chris@101: * expects the value type as template parameter, i.e. integrate< double >( sys , x , t0 , t1 , dt , obs ); Chris@16: * Chris@16: * \param system The system function to solve, hence the r.h.s. of the Chris@16: * ordinary differential equation. Chris@16: * \param start_state The initial state. Chris@16: * \param start_time Start time of the integration. Chris@16: * \param end_time End time of the integration. Chris@16: * \param dt Initial step size, will be adjusted during the integration. Chris@16: * \param observer Observer that will be called after each time step. Chris@16: * \return The number of steps performed. Chris@16: */ Chris@16: Chris@16: Chris@16: /** Chris@16: * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt ) Chris@16: * \brief Integrates the ODE without observer calls. Chris@16: * Chris@16: * Integrates the ODE given by system from start_time to end_time starting Chris@16: * with start_state as initial condition and dt as initial time step. Chris@16: * This function uses a dense output dopri5 stepper and performs an adaptive Chris@16: * integration with step size control, thus dt changes during the integration. Chris@16: * This method uses standard error bounds of 1E-6. Chris@16: * No observer is called. Chris@101: * Chris@101: * \attention A second version of this function template exists which explicitly Chris@101: * expects the value type as template parameter, i.e. integrate< double >( sys , x , t0 , t1 , dt ); Chris@16: * Chris@16: * \param system The system function to solve, hence the r.h.s. of the Chris@16: * ordinary differential equation. Chris@16: * \param start_state The initial state. Chris@16: * \param start_time Start time of the integration. Chris@16: * \param end_time End time of the integration. Chris@16: * \param dt Initial step size, will be adjusted during the integration. Chris@16: * \return The number of steps performed. Chris@16: */ Chris@16: Chris@16: } // namespace odeint Chris@16: } // namespace numeric Chris@16: } // namespace boost Chris@16: Chris@16: Chris@16: Chris@16: #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED