Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:54

0001 
0002 /*
0003  [auto_generated]
0004  boost/numeric/odeint/iterator/n_step_time_iterator.hpp
0005 
0006  [begin_description]
0007  Iterator for iterating through the solution of an ODE with constant step size performing exactly n steps.
0008  The dereferenced type contains also the time.
0009  [end_description]
0010 
0011  Copyright 2009-2013 Karsten Ahnert
0012  Copyright 2009-2013 Mario Mulansky
0013 
0014  Distributed under the Boost Software License, Version 1.0.
0015  (See accompanying file LICENSE_1_0.txt or
0016  copy at http://www.boost.org/LICENSE_1_0.txt)
0017  */
0018 
0019 
0020 #ifndef BOOST_NUMERIC_ODEINT_ITERATOR_N_STEP_TIME_ITERATOR_HPP_INCLUDED
0021 #define BOOST_NUMERIC_ODEINT_ITERATOR_N_STEP_TIME_ITERATOR_HPP_INCLUDED
0022 
0023 
0024 #include <boost/numeric/odeint/util/stepper_traits.hpp>
0025 #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
0026 #include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp>
0027 #include <boost/numeric/odeint/iterator/impl/n_step_iterator_impl.hpp>
0028 
0029 
0030 namespace boost {
0031 namespace numeric {
0032 namespace odeint {
0033 
0034 
0035     /* use the n_step_iterator_impl with the right tags */
0036     template< class Stepper , class System , class State
0037 #ifndef DOXYGEN_SKIP
0038         , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type
0039 #endif
0040     >
0041     class n_step_time_iterator : public n_step_iterator_impl<
0042             n_step_time_iterator< Stepper , System , State , StepperTag > ,
0043             Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag
0044         >
0045     {
0046         typedef typename traits::time_type< Stepper >::type time_type;
0047         typedef n_step_time_iterator< Stepper , System , State , StepperTag > iterator_type;
0048 
0049     public:
0050         n_step_time_iterator( Stepper stepper , System sys , State &s , time_type t , time_type dt , size_t num_of_steps )
0051             : n_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s , t , dt , num_of_steps )
0052         {}
0053 
0054         n_step_time_iterator( Stepper stepper , System sys , State &s )
0055             : n_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s )
0056         {}
0057     };
0058 
0059     /* make functions */
0060 
0061     template< class Stepper , class System , class State >
0062     n_step_time_iterator< Stepper , System, State > make_n_step_time_iterator_begin(
0063         Stepper stepper ,
0064         System system , 
0065         State &x ,
0066         typename traits::time_type< Stepper >::type t ,
0067         typename traits::time_type< Stepper >::type dt ,
0068         size_t num_of_steps )
0069     {
0070         return n_step_time_iterator< Stepper , System , State >( stepper , system , x , t , dt , num_of_steps );
0071     }
0072 
0073     template< class Stepper , class System , class State >
0074     n_step_time_iterator< Stepper , System , State > make_n_step_time_iterator_end(
0075         Stepper stepper ,
0076         System system , 
0077         State &x )
0078     {
0079         return n_step_time_iterator< Stepper , System , State >( stepper , system , x );
0080     }
0081 
0082     template< class Stepper , class System , class State >
0083     std::pair< n_step_time_iterator< Stepper , System , State > , n_step_time_iterator< Stepper , System , State > >
0084     make_n_step_time_range(
0085         Stepper stepper ,
0086         System system , 
0087         State &x ,
0088         typename traits::time_type< Stepper >::type t ,
0089         typename traits::time_type< Stepper >::type dt ,
0090         size_t num_of_steps )
0091     {
0092         return std::make_pair(
0093             n_step_time_iterator< Stepper , System , State >( stepper , system , x , t , dt , num_of_steps ) ,
0094             n_step_time_iterator< Stepper , System , State >( stepper , system , x )
0095             );
0096     }
0097 
0098 
0099     /**
0100      * \class n_step_time_iterator
0101      *
0102      * \brief ODE Iterator with constant step size. The value type of this iterator is a std::pair containing state and time.
0103      *
0104      * Implements an iterator representing the solution of an ODE starting from t
0105      * with n steps and a constant step size dt.
0106      * After each iteration the iterator dereferences to a pair of state and time at the next
0107      * time t+dt.
0108      * This iterator can be used with Steppers and
0109      * DenseOutputSteppers and it always makes use of the all the given steppers
0110      * capabilities. A for_each over such an iterator range behaves similar to
0111      * the integrate_n_steps routine.
0112      *
0113      * n_step_time_iterator is a model of single-pass iterator.
0114      *
0115      * The value type of this iterator is pair of state and time.
0116      *
0117      * \tparam Stepper The stepper type which should be used during the iteration.
0118      * \tparam System The type of the system function (ODE) which should be solved.
0119      * \tparam State The state type of the ODE.
0120      */
0121 
0122 
0123     /**
0124      * \fn make_n_step_time_iterator_begin( Stepper stepper , System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , size_t num_of_steps )
0125      *
0126      * \brief Factory function for n_step_time_iterator. Constructs a begin iterator.
0127      *
0128      * \param stepper The stepper to use during the iteration.
0129      * \param system The system function (ODE) to solve.
0130      * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
0131      * \param t The initial time.
0132      * \param dt The initial time step.
0133      * \param num_of_steps The number of steps to be executed.
0134      * \returns The n-step iterator.
0135      */
0136 
0137 
0138     /**
0139      * \fn make_n_step_time_iterator_end( Stepper stepper , System system , State &x )
0140      * \brief Factory function for n_step_time_iterator. Constructs an end iterator.
0141      *
0142      * \param stepper The stepper to use during the iteration.
0143      * \param system The system function (ODE) to solve.
0144      * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
0145      * \returns The const_step_iterator.
0146      */
0147 
0148 
0149     /**
0150      * \fn make_n_step_time_range( Stepper stepper , System system , State &x , typename traits::time_type< Stepper >::type t , typename traits::time_type< Stepper >::type dt , size_t num_of_steps )
0151      *
0152      * \brief Factory function to construct a single pass range of n-step iterators. A range is here a pair
0153      * of n_step_time_iterator.
0154      *
0155      * \param stepper The stepper to use during the iteration.
0156      * \param system The system function (ODE) to solve.
0157      * \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration.
0158      * \param t The initial time.
0159      * \param dt The initial time step.
0160      * \param num_of_steps The number of steps to be executed.
0161      * \returns The n-step range.
0162      */
0163 
0164 
0165 } // namespace odeint
0166 } // namespace numeric
0167 } // namespace boost
0168 
0169 #endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_N_STEP_TIME_ITERATOR_HPP_INCLUDED