integrate.hpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/integrate/integrate.hpp
  4. [begin_description]
  5. Convenience methods which choose the stepper for the current ODE.
  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_HPP_INCLUDED
  14. #define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED
  15. #include <boost/numeric/odeint/stepper/runge_kutta_dopri5.hpp>
  16. #include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
  17. #include <boost/numeric/odeint/integrate/null_observer.hpp>
  18. #include <boost/numeric/odeint/integrate/integrate_adaptive.hpp>
  19. namespace boost {
  20. namespace numeric {
  21. namespace odeint {
  22. /*
  23. * ToDo :
  24. *
  25. * determine type of dxdt for units
  26. *
  27. */
  28. template< class System , class State , class Time , class Observer >
  29. size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
  30. {
  31. return integrate_adaptive( controlled_runge_kutta< runge_kutta_dopri5< State > >() , system , start_state , start_time , end_time , dt , observer );
  32. }
  33. /*
  34. * the two overloads are needed in order to solve the forwarding problem
  35. */
  36. template< class System , class State , class Time >
  37. size_t integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
  38. {
  39. return integrate( system , start_state , start_time , end_time , dt , null_observer() );
  40. }
  41. /**
  42. * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer )
  43. * \brief Integrates the ODE.
  44. *
  45. * Integrates the ODE given by system from start_time to end_time starting
  46. * with start_state as initial condition and dt as initial time step.
  47. * This function uses a dense output dopri5 stepper and performs an adaptive
  48. * integration with step size control, thus dt changes during the integration.
  49. * This method uses standard error bounds of 1E-6.
  50. * After each step, the observer is called.
  51. *
  52. * \param system The system function to solve, hence the r.h.s. of the
  53. * ordinary differential equation.
  54. * \param start_state The initial state.
  55. * \param start_time Start time of the integration.
  56. * \param end_time End time of the integration.
  57. * \param dt Initial step size, will be adjusted during the integration.
  58. * \param observer Observer that will be called after each time step.
  59. * \return The number of steps performed.
  60. */
  61. /**
  62. * \fn integrate( System system , State &start_state , Time start_time , Time end_time , Time dt )
  63. * \brief Integrates the ODE without observer calls.
  64. *
  65. * Integrates the ODE given by system from start_time to end_time starting
  66. * with start_state as initial condition and dt as initial time step.
  67. * This function uses a dense output dopri5 stepper and performs an adaptive
  68. * integration with step size control, thus dt changes during the integration.
  69. * This method uses standard error bounds of 1E-6.
  70. * No observer is called.
  71. *
  72. * \param system The system function to solve, hence the r.h.s. of the
  73. * ordinary differential equation.
  74. * \param start_state The initial state.
  75. * \param start_time Start time of the integration.
  76. * \param end_time End time of the integration.
  77. * \param dt Initial step size, will be adjusted during the integration.
  78. * \return The number of steps performed.
  79. */
  80. } // namespace odeint
  81. } // namespace numeric
  82. } // namespace boost
  83. #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_HPP_INCLUDED