Chris@102
|
1 /*
|
Chris@102
|
2 [auto_generated]
|
Chris@102
|
3 boost/numeric/odeint/integrate/detail/functors.hpp
|
Chris@102
|
4
|
Chris@102
|
5 [begin_description]
|
Chris@102
|
6 some functors for the iterator based integrate routines
|
Chris@102
|
7 [end_description]
|
Chris@102
|
8
|
Chris@102
|
9 Copyright 2009-2013 Karsten Ahnert
|
Chris@102
|
10 Copyright 2009-2013 Mario Mulansky
|
Chris@102
|
11
|
Chris@102
|
12 Distributed under the Boost Software License, Version 1.0.
|
Chris@102
|
13 (See accompanying file LICENSE_1_0.txt or
|
Chris@102
|
14 copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
15 */
|
Chris@102
|
16
|
Chris@102
|
17
|
Chris@102
|
18 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED
|
Chris@102
|
19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED
|
Chris@102
|
20
|
Chris@102
|
21 #include <utility>
|
Chris@102
|
22
|
Chris@102
|
23 namespace boost {
|
Chris@102
|
24 namespace numeric {
|
Chris@102
|
25 namespace odeint {
|
Chris@102
|
26 namespace detail {
|
Chris@102
|
27
|
Chris@102
|
28
|
Chris@102
|
29 template< class Observer >
|
Chris@102
|
30 struct obs_caller {
|
Chris@102
|
31
|
Chris@102
|
32 size_t &m_n;
|
Chris@102
|
33 Observer m_obs;
|
Chris@102
|
34
|
Chris@102
|
35 obs_caller( size_t &m , Observer &obs ) : m_n(m) , m_obs( obs ) {}
|
Chris@102
|
36
|
Chris@102
|
37 template< class State , class Time >
|
Chris@102
|
38 void operator()( std::pair< const State & , const Time & > x )
|
Chris@102
|
39 {
|
Chris@102
|
40 typedef typename odeint::unwrap_reference< Observer >::type observer_type;
|
Chris@102
|
41 observer_type &obs = m_obs;
|
Chris@102
|
42 obs( x.first , x.second );
|
Chris@102
|
43 m_n++;
|
Chris@102
|
44 }
|
Chris@102
|
45 };
|
Chris@102
|
46
|
Chris@102
|
47 template< class Observer , class Time >
|
Chris@102
|
48 struct obs_caller_time {
|
Chris@102
|
49
|
Chris@102
|
50 Time &m_t;
|
Chris@102
|
51 Observer m_obs;
|
Chris@102
|
52
|
Chris@102
|
53 obs_caller_time( Time &t , Observer &obs ) : m_t(t) , m_obs( obs ) {}
|
Chris@102
|
54
|
Chris@102
|
55 template< class State >
|
Chris@102
|
56 void operator()( std::pair< const State & , const Time & > x )
|
Chris@102
|
57 {
|
Chris@102
|
58 typedef typename odeint::unwrap_reference< Observer >::type observer_type;
|
Chris@102
|
59 observer_type &obs = m_obs;
|
Chris@102
|
60 obs( x.first , x.second );
|
Chris@102
|
61 m_t = x.second;
|
Chris@102
|
62 }
|
Chris@102
|
63 };
|
Chris@102
|
64
|
Chris@102
|
65 } // namespace detail
|
Chris@102
|
66 } // namespace odeint
|
Chris@102
|
67 } // namespace numeric
|
Chris@102
|
68 } // namespace boost
|
Chris@102
|
69
|
Chris@102
|
70 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED
|