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