1 /*
2  [auto_generated]
3  boost/numeric/odeint/integrate/detail/integrate_times.hpp
4 
5  [begin_description]
6  Default integrate times implementation.
7  [end_description]
8 
9  Copyright 2009-2012 Karsten Ahnert
10  Copyright 2009-2012 Mario Mulansky
11 
12  Distributed under the Boost Software License, Version 1.0.
13  (See accompanying file LICENSE_1_0.txt or
14  copy at http://www.boost.org/LICENSE_1_0.txt)
15  */
16 
17 
18 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_TIMES_HPP_INCLUDED
20 
21 #include <stdexcept>
22 
23 #include <boost/config.hpp>
24 #include <boost/range/algorithm/for_each.hpp>
25 
26 #include <boost/numeric/odeint/util/unwrap_reference.hpp>
27 #include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
28 #include <boost/numeric/odeint/util/detail/less_with_sign.hpp>
29 #include <boost/numeric/odeint/iterator/times_time_iterator.hpp>
30 #include <boost/numeric/odeint/iterator/integrate/detail/functors.hpp>
31 
32 namespace boost {
33 namespace numeric {
34 namespace odeint {
35 namespace detail {
36 
37 
38 
39 /*
40  * integrate_times for all steppers
41  */
42 template< class Stepper , class System , class State , class TimeIterator , class Time , class Observer , class StepperTag >
integrate_times(Stepper stepper,System system,State & start_state,TimeIterator start_time,TimeIterator end_time,Time dt,Observer observer,StepperTag)43 size_t integrate_times(
44         Stepper stepper , System system , State &start_state ,
45         TimeIterator start_time , TimeIterator end_time , Time dt ,
46         Observer observer , StepperTag
47 )
48 {
49     size_t obs_calls = 0;
50 
51     boost::for_each( make_times_time_range( stepper , system , start_state ,
52                                             start_time , end_time , dt ) ,
53                          // should we use traits<Stepper>::state_type here instead of State? NO!
54                      obs_caller< Observer >( obs_calls , observer ) );
55 
56         // step integration steps gives step+1 observer calls
57     return obs_calls-1;
58 }
59 
60 
61 } // namespace detail
62 } // namespace odeint
63 } // namespace numeric
64 } // namespace boost
65 
66 
67 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED
68