const_step_time_iterator.hpp 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/iterator/const_step_time_iterator.hpp
  4. [begin_description]
  5. Iterator for iterating throught the solution of an ODE with constant step size. The dereferences types containes also the time.
  6. [end_description]
  7. Copyright 2012-2013 Karsten Ahnert
  8. Copyright 2013 Mario Mulansky
  9. Distributed under the Boost Software License, Version 1.0.
  10. (See accompanying file LICENSE_1_0.txt or
  11. copy at http://www.boost.org/LICENSE_1_0.txt)
  12. */
  13. #ifndef BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_TIME_ITERATOR_HPP_INCLUDED
  14. #define BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_TIME_ITERATOR_HPP_INCLUDED
  15. #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
  16. #include <boost/numeric/odeint/util/stepper_traits.hpp>
  17. #include <boost/numeric/odeint/iterator/detail/ode_iterator_base.hpp>
  18. #include <boost/numeric/odeint/iterator/impl/const_step_iterator_impl.hpp>
  19. namespace boost {
  20. namespace numeric {
  21. namespace odeint {
  22. /* use the const_step_iterator_impl with the right tags */
  23. template< class Stepper , class System , class State
  24. #ifndef DOXYGEN_SKIP
  25. , class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type
  26. #endif
  27. >
  28. class const_step_time_iterator : public const_step_iterator_impl<
  29. const_step_time_iterator< Stepper , System , State , StepperTag > ,
  30. Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag
  31. >
  32. {
  33. typedef typename traits::time_type< Stepper >::type time_type;
  34. typedef const_step_time_iterator< Stepper , System , State , StepperTag > iterator_type;
  35. public:
  36. const_step_time_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt )
  37. : const_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt )
  38. {}
  39. const_step_time_iterator( Stepper stepper , System sys , State &s )
  40. : const_step_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_time_iterator_tag , StepperTag >( stepper , sys , s )
  41. {}
  42. };
  43. template< class Stepper , class System , class State >
  44. const_step_time_iterator< Stepper , System , State > make_const_step_time_iterator_begin(
  45. Stepper stepper ,
  46. System system ,
  47. State &x ,
  48. typename traits::time_type< Stepper >::type t_start ,
  49. typename traits::time_type< Stepper >::type t_end ,
  50. typename traits::time_type< Stepper >::type dt )
  51. {
  52. return const_step_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt );
  53. }
  54. template< class Stepper , class System , class State >
  55. const_step_time_iterator< Stepper , System , State > make_const_step_time_iterator_end(
  56. Stepper stepper ,
  57. System system ,
  58. State &x )
  59. {
  60. return const_step_time_iterator< Stepper , System , State >( stepper , system , x );
  61. }
  62. template< class Stepper , class System , class State >
  63. std::pair< const_step_time_iterator< Stepper , System , State > , const_step_time_iterator< Stepper , System , State > >
  64. make_const_step_time_range(
  65. Stepper stepper ,
  66. System system ,
  67. State &x ,
  68. typename traits::time_type< Stepper >::type t_start ,
  69. typename traits::time_type< Stepper >::type t_end ,
  70. typename traits::time_type< Stepper >::type dt )
  71. {
  72. return std::make_pair(
  73. const_step_time_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) ,
  74. const_step_time_iterator< Stepper , System , State >( stepper , system , x ) );
  75. }
  76. /**
  77. * \class const_step_time_iterator
  78. *
  79. * \brief ODE Iterator with constant step size. The value type of this iterator is a std::pair containing state and time.
  80. *
  81. * Implements an iterator representing the solution of an ODE from t_start
  82. * to t_end evaluated at steps with constant step size dt.
  83. * After each iteration the iterator dereferences to a pair containing
  84. * state and time at the next time point t+dt..
  85. * This iterator can be used with Steppers and
  86. * DenseOutputSteppers and it always makes use of the all the given steppers
  87. * capabilities. A for_each over such an iterator range behaves similar to
  88. * the integrate_const routine.
  89. *
  90. * const_step_time_iterator is a model of single-pass iterator.
  91. *
  92. * The value type of this iterator is a pair with the state type and time type of the stepper.
  93. *
  94. * \tparam Stepper The stepper type which should be used during the iteration.
  95. * \tparam System The type of the system function (ODE) which should be solved.
  96. * \tparam State The state type of the ODE.
  97. */
  98. /**
  99. * \fn make_const_step_time_iterator_begin( Stepper stepper , System system , State &x ,
  100. typename traits::time_type< Stepper >::type t_start ,
  101. typename traits::time_type< Stepper >::type t_end ,
  102. typename traits::time_type< Stepper >::type dt )
  103. *
  104. * \brief Factory function for const_step_time_iterator. Constructs a begin iterator.
  105. *
  106. * \param stepper The stepper to use during the iteration.
  107. * \param system The system function (ODE) to solve.
  108. * \param x The initial state. const_step_time_iterator stores a reference of s and changes its value during the iteration.
  109. * \param t_start The initial time.
  110. * \param t_end The end time, at which the iteration should stop.
  111. * \param dt The initial time step.
  112. * \returns The const step time iterator.
  113. */
  114. /**
  115. * \fn make_const_step_time_iterator_end( Stepper stepper , System system , State &x )
  116. * \brief Factory function for const_step_time_iterator. Constructs a end iterator.
  117. *
  118. * \param stepper The stepper to use during the iteration.
  119. * \param system The system function (ODE) to solve.
  120. * \param x The initial state. const_step_time_iterator store a reference of s and changes its value during the iteration.
  121. * \returns The const step time iterator.
  122. */
  123. /**
  124. * \fn make_const_step_time_range( Stepper stepper , System system , State &x ,
  125. typename traits::time_type< Stepper >::type t_start ,
  126. typename traits::time_type< Stepper >::type t_end ,
  127. typename traits::time_type< Stepper >::type dt)
  128. *
  129. * \brief Factory function to construct a single pass range of const_step_time_iterator. A range is here a pair of const_step_time_iterator.
  130. *
  131. * \param stepper The stepper to use during the iteration.
  132. * \param system The system function (ODE) to solve.
  133. * \param x The initial state. const_step_time_iterator stores a reference of s and changes its value during the iteration.
  134. * \param t The initial time.
  135. * \param t_end The end time, at which the iteration should stop.
  136. * \param dt The initial time step.
  137. * \returns The const step time range.
  138. */
  139. } // namespace odeint
  140. } // namespace numeric
  141. } // namespace boost
  142. #endif // BOOST_NUMERIC_ODEINT_ITERATOR_CONST_STEP_TIME_ITERATOR_HPP_INCLUDED