Chris@16: /* Chris@16: [auto_generated] Chris@16: boost/numeric/odeint/integrate/integrate_const.hpp Chris@16: Chris@16: [begin_description] Chris@16: Constant integration of ODEs, meaning that the state of the ODE is observed on constant time intervals. Chris@16: The routines makes full use of adaptive and dense-output methods. 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_CONST_HPP_INCLUDED Chris@16: #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace numeric { Chris@16: namespace odeint { Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: /* Chris@16: * Integrates with constant time step dt. Chris@16: */ Chris@16: template< class Stepper , class System , class State , class Time , class Observer > Chris@16: size_t integrate_const( Chris@16: Stepper stepper , System system , State &start_state , Chris@16: Time start_time , Time end_time , Time dt , Chris@16: Observer observer Chris@16: ) Chris@16: { Chris@101: typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; Chris@16: // we want to get as fast as possible to the end Chris@16: if( boost::is_same< null_observer , Observer >::value ) Chris@16: { Chris@16: return detail::integrate_adaptive( Chris@16: stepper , system , start_state , Chris@16: start_time , end_time , dt , Chris@101: observer , stepper_category() ); Chris@16: } Chris@16: else Chris@16: { Chris@16: return detail::integrate_const( stepper , system , start_state , Chris@16: start_time , end_time , dt , Chris@101: observer , stepper_category() ); Chris@16: } Chris@16: } Chris@16: Chris@16: /** Chris@16: * \brief Second version to solve the forwarding problem, Chris@16: * can be called with Boost.Range as start_state. Chris@16: */ Chris@16: template< class Stepper , class System , class State , class Time , class Observer > Chris@16: size_t integrate_const( Chris@16: Stepper stepper , System system , const State &start_state , Chris@16: Time start_time , Time end_time , Time dt , Chris@16: Observer observer Chris@16: ) Chris@16: { Chris@101: typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category; Chris@16: // we want to get as fast as possible to the end Chris@16: if( boost::is_same< null_observer , Observer >::value ) Chris@16: { Chris@16: return detail::integrate_adaptive( Chris@16: stepper , system , start_state , Chris@16: start_time , end_time , dt , Chris@101: observer , stepper_category() ); Chris@16: } Chris@16: else Chris@16: { Chris@16: return detail::integrate_const( stepper , system , start_state , Chris@16: start_time , end_time , dt , Chris@101: observer , stepper_category() ); Chris@16: } Chris@16: } Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: /** Chris@16: * \brief integrate_const without observer calls Chris@16: */ Chris@16: template< class Stepper , class System , class State , class Time > Chris@16: size_t integrate_const( Chris@16: Stepper stepper , System system , State &start_state , Chris@16: Time start_time , Time end_time , Time dt Chris@16: ) Chris@16: { Chris@16: return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() ); Chris@16: } Chris@16: Chris@16: /** Chris@16: * \brief Second version to solve the forwarding problem, Chris@16: * can be called with Boost.Range as start_state. Chris@16: */ Chris@16: template< class Stepper , class System , class State , class Time > Chris@16: size_t integrate_const( Chris@16: Stepper stepper , System system , const State &start_state , Chris@16: Time start_time , Time end_time , Time dt Chris@16: ) Chris@16: { Chris@16: return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() ); Chris@16: } Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: /********* DOXYGEN *********/ Chris@16: /** Chris@16: * \fn integrate_const( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer ) Chris@16: * \brief Integrates the ODE with constant step size. Chris@16: * Chris@16: * Integrates the ODE defined by system using the given stepper. Chris@16: * This method ensures that the observer is called at constant intervals dt. Chris@16: * If the Stepper is a normal stepper without step size control, dt is also Chris@16: * used for the numerical scheme. If a ControlledStepper is provided, the Chris@16: * algorithm might reduce the step size to meet the error bounds, but it is Chris@16: * ensured that the observer is always called at equidistant time points Chris@16: * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary Chris@16: * and the dense output is used to call the observer at equidistant time Chris@16: * points. Chris@16: * Chris@16: * \param stepper The stepper to be used for numerical integration. Chris@16: * \param system Function/Functor defining the rhs of the ODE. Chris@16: * \param start_state The initial condition x0. Chris@16: * \param start_time The initial time t0. Chris@16: * \param end_time The final integration time tend. Chris@16: * \param dt The time step between observer calls, _not_ necessarily the Chris@16: * time step of the integration. Chris@16: * \param observer Function/Functor called at equidistant time intervals. 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_CONST_HPP_INCLUDED