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/times_iterator.hpp
0005 
0006  [begin_description]
0007  Iterator for iterating through the solution of an ODE with oscillator calls at times from a given sequence.
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_TIMES_ITERATOR_HPP_INCLUDED
0020 #define BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_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/times_iterator_impl.hpp>
0027 
0028 
0029 namespace boost {
0030 namespace numeric {
0031 namespace odeint {
0032 
0033 
0034     /* use the times_iterator_impl with the right tags */
0035     template< class Stepper , class System , class State , class TimeIterator
0036 #ifndef DOXYGEN_SKIP
0037         , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type
0038 #endif
0039     >
0040     class times_iterator : public times_iterator_impl<
0041             times_iterator< Stepper , System , State , TimeIterator , StepperTag > ,
0042             Stepper , System , State , TimeIterator , detail::ode_state_iterator_tag , StepperTag
0043         >
0044     {
0045         typedef typename traits::time_type< Stepper >::type time_type;
0046         typedef times_iterator< Stepper , System , State , TimeIterator , StepperTag > iterator_type;
0047 
0048     public:
0049         times_iterator( Stepper stepper , System sys , State &s ,
0050                         TimeIterator t_start , TimeIterator t_end , time_type dt )
0051             : times_iterator_impl< iterator_type , Stepper , System , State , TimeIterator, detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt )
0052         {}
0053 
0054         times_iterator( Stepper stepper , System sys , State &s )
0055             : times_iterator_impl< iterator_type , Stepper , System , State , TimeIterator , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s )
0056         {}
0057     };
0058 
0059     /* make functions */
0060 
0061     template< class Stepper , class System , class State , class TimeIterator >
0062     times_iterator< Stepper , System, State , TimeIterator > make_times_iterator_begin(
0063         Stepper stepper ,
0064         System system , 
0065         State &x ,
0066         TimeIterator t_start ,
0067         TimeIterator t_end ,
0068         typename traits::time_type< Stepper >::type dt )
0069     {
0070         return times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x , t_start , t_end , dt );
0071     }
0072 
0073     // ToDo: requires to specifically provide the TimeIterator template parameter, can this be improved?
0074     template< class TimeIterator , class Stepper , class System , class State >
0075     times_iterator< Stepper , System , State , TimeIterator > make_times_iterator_end(
0076         Stepper stepper ,
0077         System system , 
0078         State &x )
0079         //TimeIterator t_end )
0080     {
0081         return times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x );
0082     }
0083 
0084     template< class Stepper , class System , class State , class TimeIterator >
0085     std::pair< times_iterator< Stepper , System , State , TimeIterator > ,
0086                times_iterator< Stepper , System , State , TimeIterator > >
0087     make_times_range(
0088         Stepper stepper ,
0089         System system , 
0090         State &x ,
0091         TimeIterator t_start ,
0092         TimeIterator t_end ,
0093         typename traits::time_type< Stepper >::type dt )
0094     {
0095         return std::make_pair(
0096             times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x , t_start , t_end , dt ) ,
0097             times_iterator< Stepper , System , State , TimeIterator >( stepper , system , x )
0098             );
0099     }
0100 
0101 
0102     /**
0103      * \class times_iterator
0104      *
0105      * \brief ODE Iterator with given evaluation points. The value type of this iterator is the state type of the stepper.
0106      *
0107      * Implements an iterator representing the solution of an ODE from *t_start
0108      * to *t_end evaluated at time points given by the sequence t_start to t_end.
0109      * t_start and t_end are iterators representing a sequence of time points
0110      * where the solution of the ODE should be evaluated.
0111      * After each iteration the iterator dereferences to the state x at the next
0112      * time *t_start++ until t_end is reached.
0113      * This iterator can be used with Steppers, ControlledSteppers and
0114      * DenseOutputSteppers and it always makes use of the all the given steppers
0115      * capabilities. A for_each over such an iterator range behaves similar to
0116      * the integrate_times routine.
0117      *
0118      * times_iterator is a model of single-pass iterator.
0119      *
0120      * 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.
0121      *
0122      * \tparam Stepper The stepper type which should be used during the iteration.
0123      * \tparam System The type of the system function (ODE) which should be solved.
0124      * \tparam State The state type of the ODE.
0125      * \tparam TimeIterator The iterator type for the sequence of time points.
0126      */
0127 
0128 
0129 
0130     /**
0131      * \fn make_times_iterator_begin( Stepper stepper ,
0132         System system ,
0133         State &x ,
0134         TimeIterator t_start ,
0135         TimeIterator t_end ,
0136         typename traits::time_type< Stepper >::type dt )
0137      *
0138      * \brief Factory function for times_iterator. Constructs a begin iterator.
0139      *
0140      * \param stepper The stepper to use during the iteration.
0141      * \param system The system function (ODE) to solve.
0142      * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
0143      * \param t_start Begin iterator of the sequence of evaluation time points.
0144      * \param t_end End iterator of the sequence of evaluation time points.
0145      * \param dt The initial time step.
0146      * \returns The times iterator.
0147      */
0148 
0149 
0150     /**
0151      * \fn make_times_iterator_end( Stepper stepper , System system , State &x )
0152      * \brief Factory function for times_iterator. Constructs an end iterator.
0153      *
0154      * \tparam TimesIterator The iterator type of the time sequence, must be specifically provided.
0155      *
0156      * \param stepper The stepper to use during the iteration.
0157      * \param system The system function (ODE) to solve.
0158      * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration.
0159      * \returns The times iterator.
0160      *
0161      * This function needs the TimeIterator type specifically defined as a
0162      * template parameter.
0163      */
0164 
0165 
0166     /**
0167      * \fn make_times_range( Stepper stepper , System system , State &x ,
0168         TimeIterator t_start ,
0169         TimeIterator t_end ,
0170         typename traits::time_type< Stepper >::type dt )
0171      *
0172      * \brief Factory function to construct a single pass range of times iterators. A range is here a pair
0173      * of times_iterator.
0174      *
0175      * \param stepper The stepper to use during the iteration.
0176      * \param system The system function (ODE) to solve.
0177      * \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration.
0178      * \param t_start Begin iterator of the sequence of evaluation time points.
0179      * \param t_end End iterator of the sequence of evaluation time points.
0180      * \param dt The initial time step.
0181      * \returns The times iterator range.
0182      */
0183 
0184 
0185 } // namespace odeint
0186 } // namespace numeric
0187 } // namespace boost
0188 
0189 #endif // BOOST_NUMERIC_ODEINT_ITERATOR_TIMES_ITERATOR_HPP_INCLUDED