1 /* 2 [auto_generated] 3 boost/numeric/odeint/integrate/detail/functors.hpp 4 5 [begin_description] 6 some functors for the iterator based integrate routines 7 [end_description] 8 9 Copyright 2009-2013 Karsten Ahnert 10 Copyright 2009-2013 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_FUNCTORS_HPP_INCLUDED 19 #define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED 20 21 #include <utility> 22 23 namespace boost { 24 namespace numeric { 25 namespace odeint { 26 namespace detail { 27 28 29 template< class Observer > 30 struct obs_caller { 31 32 size_t &m_n; 33 Observer m_obs; 34 obs_callerboost::numeric::odeint::detail::obs_caller35 obs_caller( size_t &m , Observer &obs ) : m_n(m) , m_obs( obs ) {} 36 37 template< class State , class Time > operator ()boost::numeric::odeint::detail::obs_caller38 void operator()( std::pair< const State & , const Time & > x ) 39 { 40 typedef typename odeint::unwrap_reference< Observer >::type observer_type; 41 observer_type &obs = m_obs; 42 obs( x.first , x.second ); 43 m_n++; 44 } 45 }; 46 47 template< class Observer , class Time > 48 struct obs_caller_time { 49 50 Time &m_t; 51 Observer m_obs; 52 obs_caller_timeboost::numeric::odeint::detail::obs_caller_time53 obs_caller_time( Time &t , Observer &obs ) : m_t(t) , m_obs( obs ) {} 54 55 template< class State > operator ()boost::numeric::odeint::detail::obs_caller_time56 void operator()( std::pair< const State & , const Time & > x ) 57 { 58 typedef typename odeint::unwrap_reference< Observer >::type observer_type; 59 observer_type &obs = m_obs; 60 obs( x.first , x.second ); 61 m_t = x.second; 62 } 63 }; 64 65 } // namespace detail 66 } // namespace odeint 67 } // namespace numeric 68 } // namespace boost 69 70 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED 71