Back to home page

EIC code displayed by LXR

 
 

    


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

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