|
||||
File indexing completed on 2025-01-18 09:42:53
0001 0002 /* 0003 [auto_generated] 0004 boost/numeric/odeint/iterator/const_step_iterator.hpp 0005 0006 [begin_description] 0007 Iterator for iterating through the solution of an ODE with constant step size. 0008 [end_description] 0009 0010 Copyright 2012-2013 Karsten Ahnert 0011 Copyright 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_CONST_STEP_ODE_ITERATOR_HPP_INCLUDED 0020 #define BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_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/const_step_iterator_impl.hpp> 0027 0028 0029 namespace boost { 0030 namespace numeric { 0031 namespace odeint { 0032 0033 0034 /* use the const_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 const_step_iterator : public const_step_iterator_impl< 0041 const_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 const_step_iterator< Stepper , System , State , StepperTag > iterator_type; 0047 0048 public: 0049 const_step_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt ) 0050 : const_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt ) 0051 {} 0052 0053 const_step_iterator( Stepper stepper , System sys , State &s ) 0054 : const_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 const_step_iterator< Stepper , System, State > make_const_step_iterator_begin( 0062 Stepper stepper , 0063 System system , 0064 State &x , 0065 typename traits::time_type< Stepper >::type t_start , 0066 typename traits::time_type< Stepper >::type t_end , 0067 typename traits::time_type< Stepper >::type dt ) 0068 { 0069 return const_step_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ); 0070 } 0071 0072 template< class Stepper , class System , class State > 0073 const_step_iterator< Stepper , System , State > make_const_step_iterator_end( 0074 Stepper stepper , 0075 System system , 0076 State &x ) 0077 { 0078 return const_step_iterator< Stepper , System , State >( stepper , system , x ); 0079 } 0080 0081 template< class Stepper , class System , class State > 0082 std::pair< const_step_iterator< Stepper , System , State > , const_step_iterator< Stepper , System , State > > 0083 make_const_step_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 const_step_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) , 0093 const_step_iterator< Stepper , System , State >( stepper , system , x ) 0094 ); 0095 } 0096 0097 0098 0099 /** 0100 * \class const_step_iterator 0101 * 0102 * \brief ODE Iterator with constant step size. The value type of this iterator is the state type of the stepper. 0103 * 0104 * Implements an iterator representing the solution of an ODE from t_start 0105 * to t_end evaluated at steps with constant step size dt. 0106 * After each iteration the iterator dereferences to the state x 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_const routine. 0112 * 0113 * const_step_iterator is a model of single-pass iterator. 0114 * 0115 * 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. 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_const_step_iterator_begin( 0125 Stepper stepper , 0126 System system , 0127 State &x , 0128 typename traits::time_type< Stepper >::type t_start , 0129 typename traits::time_type< Stepper >::type t_end , 0130 typename traits::time_type< Stepper >::type dt ) 0131 * 0132 * \brief Factory function for const_step_iterator. Constructs a begin iterator. 0133 * 0134 * \param stepper The stepper to use during the iteration. 0135 * \param system The system function (ODE) to solve. 0136 * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. 0137 * \param t_start The initial time. 0138 * \param t_end The end time, at which the iteration should stop. 0139 * \param dt The initial time step. 0140 * \returns The const step iterator. 0141 */ 0142 0143 0144 /** 0145 * \fn make_const_step_iterator_end( Stepper stepper , System system , State &x ) 0146 * \brief Factory function for const_step_iterator. Constructs a end iterator. 0147 * 0148 * \param stepper The stepper to use during the iteration. 0149 * \param system The system function (ODE) to solve. 0150 * \param x The initial state. const_step_iterator stores a reference of s and changes its value during the iteration. 0151 * \returns The const_step_iterator. 0152 */ 0153 0154 0155 /** 0156 * \fn make_const_step_range( Stepper stepper , System system , State &x , 0157 typename traits::time_type< Stepper >::type t_start , 0158 typename traits::time_type< Stepper >::type t_end , 0159 typename traits::time_type< Stepper >::type dt ) 0160 * 0161 * \brief Factory function to construct a single pass range of const step iterators. A range is here a pair 0162 * of const_step_iterator. 0163 * 0164 * \param stepper The stepper to use during the iteration. 0165 * \param system The system function (ODE) to solve. 0166 * \param x The initial state. const_step_iterator store a reference of s and changes its value during the iteration. 0167 * \param t_start The initial time. 0168 * \param t_end The end time, at which the iteration should stop. 0169 * \param dt The initial time step. 0170 * \returns The const step range. 0171 */ 0172 0173 0174 } // namespace odeint 0175 } // namespace numeric 0176 } // namespace boost 0177 0178 //#include <boost/numeric/odeint/iterator/impl/const_step_iterator_dense_output_impl.hpp> 0179 0180 #endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_ODE_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 |