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