integrate_n_steps.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/integrate/integrate_n_steps.hpp
  4. [begin_description]
  5. Integration of n steps with constant time size. Adaptive and dense-output methods are fully supported.
  6. [end_description]
  7. Copyright 2009-2011 Karsten Ahnert
  8. Copyright 2009-2011 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_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
  14. #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
  15. #include <boost/type_traits/is_same.hpp>
  16. #include <boost/numeric/odeint/stepper/stepper_categories.hpp>
  17. #include <boost/numeric/odeint/integrate/null_observer.hpp>
  18. #include <boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp>
  19. namespace boost {
  20. namespace numeric {
  21. namespace odeint {
  22. /*
  23. * Integrates n steps
  24. *
  25. * the two overloads are needed in order to solve the forwarding problem
  26. */
  27. template< class Stepper , class System , class State , class Time , class Observer>
  28. Time integrate_n_steps(
  29. Stepper stepper , System system , State &start_state ,
  30. Time start_time , Time dt , size_t num_of_steps ,
  31. Observer observer )
  32. {
  33. return detail::integrate_n_steps(
  34. stepper , system , start_state ,
  35. start_time , dt , num_of_steps ,
  36. observer , typename Stepper::stepper_category() );
  37. }
  38. /**
  39. * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
  40. */
  41. template< class Stepper , class System , class State , class Time , class Observer >
  42. Time integrate_n_steps(
  43. Stepper stepper , System system , const State &start_state ,
  44. Time start_time , Time dt , size_t num_of_steps ,
  45. Observer observer )
  46. {
  47. return detail::integrate_n_steps(
  48. stepper , system , start_state ,
  49. start_time , dt , num_of_steps ,
  50. observer , typename Stepper::stepper_category() );
  51. }
  52. /**
  53. * \brief The same function as above, but without observer calls.
  54. */
  55. template< class Stepper , class System , class State , class Time >
  56. Time integrate_n_steps(
  57. Stepper stepper , System system , State &start_state ,
  58. Time start_time , Time dt , size_t num_of_steps )
  59. {
  60. return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , null_observer() );
  61. }
  62. /**
  63. * \brief Solves the forwarding problem, can be called with Boost.Range as start_state.
  64. */
  65. template< class Stepper , class System , class State , class Time >
  66. Time integrate_n_steps(
  67. Stepper stepper , System system , const State &start_state ,
  68. Time start_time , Time dt , size_t num_of_steps )
  69. {
  70. return integrate_n_steps( stepper , system , start_state , start_time , dt , num_of_steps , null_observer() );
  71. }
  72. /************* DOXYGEN *************/
  73. /**
  74. * \fn Time integrate_n_steps( Stepper stepper , System system , State &start_state , Time start_time , Time dt , size_t num_of_steps , Observer observer )
  75. * \brief Integrates the ODE with constant step size.
  76. *
  77. * This function is similar to integrate_const. The observer is called at
  78. * equidistant time intervals t0 + n*dt.
  79. * If the Stepper is a normal stepper without step size control, dt is also
  80. * used for the numerical scheme. If a ControlledStepper is provided, the
  81. * algorithm might reduce the step size to meet the error bounds, but it is
  82. * ensured that the observer is always called at equidistant time points
  83. * t0 + n*dt. If a DenseOutputStepper is used, the step size also may vary
  84. * and the dense output is used to call the observer at equidistant time
  85. * points. The final integration time is always t0 + num_of_steps*dt.
  86. *
  87. * \param stepper The stepper to be used for numerical integration.
  88. * \param system Function/Functor defining the rhs of the ODE.
  89. * \param start_state The initial condition x0.
  90. * \param start_time The initial time t0.
  91. * \param dt The time step between observer calls, _not_ necessarily the
  92. * time step of the integration.
  93. * \param num_of_steps Number of steps to be performed
  94. * \param observer Function/Functor called at equidistant time intervals.
  95. * \return The number of steps performed.
  96. */
  97. } // namespace odeint
  98. } // namespace numeric
  99. } // namespace boost
  100. #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED