integrate_times.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. [auto_generated]
  3. boost/numeric/odeint/integrate/detail/integrate_times.hpp
  4. [begin_description]
  5. Default integrate times implementation.
  6. [end_description]
  7. Copyright 2009-2012 Karsten Ahnert
  8. Copyright 2009-2012 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_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED
  14. #define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED
  15. #include <stdexcept>
  16. #include <boost/config.hpp>
  17. #include <boost/range/algorithm/for_each.hpp>
  18. #include <boost/numeric/odeint/util/unwrap_reference.hpp>
  19. #include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
  20. #include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
  21. #include <boost/numeric/odeint/iterator/times_time_iterator.hpp>
  22. #include <boost/numeric/odeint/iterator/integrate/detail/functors.hpp>
  23. namespace boost {
  24. namespace numeric {
  25. namespace odeint {
  26. namespace detail {
  27. /*
  28. * integrate_times for all steppers
  29. */
  30. template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer , class StepperTag >
  31. size_t integrate_times(
  32. Stepper stepper , System system , State &start_state ,
  33. TimeIterator start_time , TimeIterator end_time , Time dt ,
  34. Observer observer , StepperTag
  35. )
  36. {
  37. size_t obs_calls = 0;
  38. boost::for_each( make_times_time_range( stepper , system , start_state ,
  39. start_time , end_time , dt ) ,
  40. // should we use traits<Stepper>::state_type here instead of State? NO!
  41. obs_caller< Observer >( obs_calls , observer ) );
  42. // step integration steps gives step+1 observer calls
  43. return obs_calls-1;
  44. }
  45. } // namespace detail
  46. } // namespace odeint
  47. } // namespace numeric
  48. } // namespace boost
  49. #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED