Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:53:59

0001 /*
0002  [auto_generated]
0003  boost/numeric/odeint/integrate/integrate_const.hpp
0004 
0005  [begin_description]
0006  Constant integration of ODEs, meaning that the state of the ODE is observed on constant time intervals.
0007  The routines makes full use of adaptive and dense-output methods.
0008  [end_description]
0009 
0010  Copyright 2009-2011 Karsten Ahnert
0011  Copyright 2009-2011 Mario Mulansky
0012 
0013  Distributed under the Boost Software License, Version 1.0.
0014  (See accompanying file LICENSE_1_0.txt or
0015  copy at http://www.boost.org/LICENSE_1_0.txt)
0016  */
0017 
0018 
0019 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
0020 #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
0021 
0022 #include <type_traits>
0023 
0024 #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
0025 #include <boost/numeric/odeint/iterator/integrate/null_observer.hpp>
0026 #include <boost/numeric/odeint/iterator/integrate/detail/integrate_const.hpp>
0027 #include <boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp>
0028 
0029 namespace boost {
0030 namespace numeric {
0031 namespace odeint {
0032 
0033 
0034 
0035 
0036 
0037 /*
0038  * Integrates with constant time step dt.
0039  */
0040 template< class Stepper , class System , class State , class Time , class Observer >
0041 size_t integrate_const(
0042         Stepper stepper , System system , State &start_state ,
0043         Time start_time , Time end_time , Time dt ,
0044         Observer observer
0045 )
0046 {
0047     typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
0048     // we want to get as fast as possible to the end
0049     BOOST_IF_CONSTEXPR ( std::is_same< null_observer , Observer >::value )
0050     {
0051         return detail::integrate_adaptive(
0052                 stepper , system , start_state ,
0053                 start_time , end_time  , dt ,
0054                 observer , stepper_category() );
0055     }
0056     else
0057     {
0058         return detail::integrate_const( stepper , system , start_state , 
0059                                         start_time , end_time , dt ,
0060                                         observer , stepper_category() );
0061       }
0062 }
0063 
0064 /**
0065  * \brief Second version to solve the forwarding problem, 
0066  * can be called with Boost.Range as start_state.
0067  */
0068 template< class Stepper , class System , class State , class Time , class Observer >
0069 size_t integrate_const(
0070         Stepper stepper , System system , const State &start_state ,
0071         Time start_time , Time end_time , Time dt ,
0072         Observer observer
0073 )
0074 {
0075     typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
0076     // we want to get as fast as possible to the end
0077     BOOST_IF_CONSTEXPR ( std::is_same< null_observer , Observer >::value )
0078     {
0079         return detail::integrate_adaptive(
0080                 stepper , system , start_state ,
0081                 start_time , end_time  , dt ,
0082                 observer , stepper_category() );
0083     }
0084     else
0085     {
0086         return detail::integrate_const( stepper , system , start_state , 
0087                                         start_time , end_time , dt ,
0088                                         observer , stepper_category() );
0089     }
0090 }
0091 
0092 
0093 
0094 
0095 
0096 /**
0097  * \brief integrate_const without observer calls
0098  */
0099 template< class Stepper , class System , class State , class Time >
0100 size_t integrate_const(
0101         Stepper stepper , System system , State &start_state ,
0102         Time start_time , Time end_time , Time dt
0103 )
0104 {
0105     return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() );
0106 }
0107 
0108 /**
0109  * \brief Second version to solve the forwarding problem,
0110  * can be called with Boost.Range as start_state.
0111  */
0112 template< class Stepper , class System , class State , class Time >
0113 size_t integrate_const(
0114         Stepper stepper , System system , const State &start_state ,
0115         Time start_time , Time end_time , Time dt
0116 )
0117 {
0118     return integrate_const( stepper , system , start_state , start_time , end_time , dt , null_observer() );
0119 }
0120 
0121 
0122 
0123 
0124 
0125 
0126 /********* DOXYGEN *********/
0127     /**
0128      * \fn integrate_const( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
0129      * \brief Integrates the ODE with constant step size.
0130      *
0131      * Integrates the ODE defined by system using the given stepper.
0132      * This method ensures that the observer is called at constant intervals dt.
0133      * If the Stepper is a normal stepper without step size control, dt is also
0134      * used for the numerical scheme. If a ControlledStepper is provided, the 
0135      * algorithm might reduce the step size to meet the error bounds, but it is 
0136      * ensured that the observer is always called at equidistant time points
0137      * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary
0138      * and the dense output is used to call the observer at equidistant time
0139      * points.
0140      *
0141      * \param stepper The stepper to be used for numerical integration.
0142      * \param system Function/Functor defining the rhs of the ODE.
0143      * \param start_state The initial condition x0.
0144      * \param start_time The initial time t0.
0145      * \param end_time The final integration time tend.
0146      * \param dt The time step between observer calls, _not_ necessarily the 
0147      * time step of the integration.
0148      * \param observer Function/Functor called at equidistant time intervals.
0149      * \return The number of steps performed.
0150      */
0151 
0152 } // namespace odeint
0153 } // namespace numeric
0154 } // namespace boost
0155 
0156 
0157 
0158 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED