|
||||
File indexing completed on 2025-01-18 09:42:53
0001 0002 /* 0003 [auto_generated] 0004 boost/numeric/odeint/iterator/adaptive_time_iterator.hpp 0005 0006 [begin_description] 0007 Iterator for iterating throught the solution of an ODE with adaptive step size. The dereferenced types containes also the time. 0008 [end_description] 0009 0010 Copyright 2012-2013 Karsten Ahnert 0011 Copyright 2012-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_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED 0020 #define BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_TIME_ITERATOR_HPP_INCLUDED 0021 0022 0023 0024 #include <boost/numeric/odeint/stepper/stepper_categories.hpp> 0025 #include <boost/numeric/odeint/util/stepper_traits.hpp> 0026 #include <boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp> 0027 0028 namespace boost { 0029 namespace numeric { 0030 namespace odeint { 0031 0032 /* use the adaptive_iterator_impl with the right tags */ 0033 template< class Stepper , class System , class State 0034 #ifndef DOXYGEN_SKIP 0035 , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type 0036 #endif 0037 > 0038 class adaptive_time_iterator : public adaptive_iterator_impl< 0039 adaptive_time_iterator< Stepper , System , State , StepperTag > , 0040 Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag 0041 > 0042 { 0043 typedef typename traits::time_type< Stepper >::type time_type; 0044 typedef adaptive_time_iterator< Stepper , System , State , StepperTag > iterator_type; 0045 0046 public: 0047 adaptive_time_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt ) 0048 : adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt ) 0049 {} 0050 0051 adaptive_time_iterator( Stepper stepper , System sys , State &s ) 0052 : adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s ) 0053 {} 0054 }; 0055 0056 0057 0058 0059 template< class Stepper , class System , class State > 0060 adaptive_time_iterator< Stepper , System , State > make_adaptive_time_iterator_begin( 0061 Stepper stepper , 0062 System system , 0063 State &x , 0064 typename traits::time_type< Stepper >::type t_start , 0065 typename traits::time_type< Stepper >::type t_end , 0066 typename traits::time_type< Stepper >::type dt ) 0067 { 0068 return adaptive_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ); 0069 } 0070 0071 template< class Stepper , class System , class State > 0072 adaptive_time_iterator< Stepper , System , State > make_adaptive_time_iterator_end( 0073 Stepper stepper , 0074 System system , 0075 State &x ) 0076 { 0077 return adaptive_time_iterator< Stepper , System , State >( stepper , system , x ); 0078 } 0079 0080 0081 template< class Stepper , class System , class State > 0082 std::pair< adaptive_time_iterator< Stepper , System , State > , adaptive_time_iterator< Stepper , System , State > > 0083 make_adaptive_time_range( 0084 Stepper stepper , 0085 System system , 0086 State &x , 0087 typename traits::time_type< Stepper >::type t_start , 0088 typename traits::time_type< Stepper >::type t_end , 0089 typename traits::time_type< Stepper >::type dt ) 0090 { 0091 return std::make_pair( 0092 adaptive_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) , 0093 adaptive_time_iterator< Stepper , System , State >( stepper , system , x ) ); 0094 } 0095 0096 0097 0098 /** 0099 * \class adaptive_time_iterator 0100 * 0101 * \brief ODE Iterator with adaptive step size. The value type of this iterator is a std::pair containing state and time. 0102 * 0103 * Implements an iterator representing the solution of an ODE from t_start 0104 * to t_end evaluated at steps with an adaptive step size dt. 0105 * After each iteration the iterator dereferences to a pair containing state 0106 * and time at the next time point t+dt where dt is controlled by the stepper. 0107 * This iterator can be used with ControlledSteppers 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_adaptive routine. 0111 * 0112 * adaptive_iterator is a model of single-pass iterator. 0113 * 0114 * The value type of this iterator is a std::pair of state and time of the stepper. 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 /** 0124 * \fn make_adaptive_time_iterator_begin( Stepper stepper , System system , State &x , 0125 typename traits::time_type< Stepper >::type t_start , 0126 typename traits::time_type< Stepper >::type t_end , 0127 typename traits::time_type< Stepper >::type dt ) 0128 * 0129 * \brief Factory function for adaptive_time_iterator. Constructs a begin iterator. 0130 * 0131 * \param stepper The stepper to use during the iteration. 0132 * \param system The system function (ODE) to solve. 0133 * \param x The initial state. adaptive_time_iterator stores a reference of s and changes its value during the iteration. 0134 * \param t_start The initial time. 0135 * \param t_end The end time, at which the iteration should stop. 0136 * \param dt The initial time step. 0137 * \returns The adaptive time iterator. 0138 */ 0139 0140 0141 /** 0142 * \fn make_adaptive_time_iterator_end( Stepper stepper , System system , State &x ) 0143 * \brief Factory function for adaptive_time_iterator. Constructs a end iterator. 0144 * 0145 * \param stepper The stepper to use during the iteration. 0146 * \param system The system function (ODE) to solve. 0147 * \param x The initial state. adaptive_time_iterator stores a reference of s and changes its value during the iteration. 0148 * \returns The adaptive time iterator. 0149 */ 0150 0151 0152 /** 0153 * \fn make_adaptive_time_range( Stepper stepper , System system , State &x , 0154 typename traits::time_type< Stepper >::type t_start , 0155 typename traits::time_type< Stepper >::type t_end , 0156 typename traits::time_type< Stepper >::type dt ) 0157 * 0158 * \brief Factory function to construct a single pass range of adaptive time iterators. A range is here a pair of adaptive_time_iterators. 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. adaptive_time_iterator stores a reference of s and changes its value during the iteration. 0163 * \param t_start The initial time. 0164 * \param t_end The end time, at which the iteration should stop. 0165 * \param dt The initial time step. 0166 * \returns The adaptive time range. 0167 */ 0168 0169 0170 } // namespace odeint 0171 } // namespace numeric 0172 } // namespace boost 0173 0174 0175 #endif // BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_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 |