Chris@102: /* Chris@102: [auto_generated] Chris@102: boost/numeric/odeint/integrate/detail/functors.hpp Chris@102: Chris@102: [begin_description] Chris@102: some functors for the iterator based integrate routines Chris@102: [end_description] Chris@102: Chris@102: Copyright 2009-2013 Karsten Ahnert Chris@102: Copyright 2009-2013 Mario Mulansky Chris@102: Chris@102: Distributed under the Boost Software License, Version 1.0. Chris@102: (See accompanying file LICENSE_1_0.txt or Chris@102: copy at http://www.boost.org/LICENSE_1_0.txt) Chris@102: */ Chris@102: Chris@102: Chris@102: #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED Chris@102: #define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED Chris@102: Chris@102: #include Chris@102: Chris@102: namespace boost { Chris@102: namespace numeric { Chris@102: namespace odeint { Chris@102: namespace detail { Chris@102: Chris@102: Chris@102: template< class Observer > Chris@102: struct obs_caller { Chris@102: Chris@102: size_t &m_n; Chris@102: Observer m_obs; Chris@102: Chris@102: obs_caller( size_t &m , Observer &obs ) : m_n(m) , m_obs( obs ) {} Chris@102: Chris@102: template< class State , class Time > Chris@102: void operator()( std::pair< const State & , const Time & > x ) Chris@102: { Chris@102: typedef typename odeint::unwrap_reference< Observer >::type observer_type; Chris@102: observer_type &obs = m_obs; Chris@102: obs( x.first , x.second ); Chris@102: m_n++; Chris@102: } Chris@102: }; Chris@102: Chris@102: template< class Observer , class Time > Chris@102: struct obs_caller_time { Chris@102: Chris@102: Time &m_t; Chris@102: Observer m_obs; Chris@102: Chris@102: obs_caller_time( Time &t , Observer &obs ) : m_t(t) , m_obs( obs ) {} Chris@102: Chris@102: template< class State > Chris@102: void operator()( std::pair< const State & , const Time & > x ) Chris@102: { Chris@102: typedef typename odeint::unwrap_reference< Observer >::type observer_type; Chris@102: observer_type &obs = m_obs; Chris@102: obs( x.first , x.second ); Chris@102: m_t = x.second; Chris@102: } Chris@102: }; Chris@102: Chris@102: } // namespace detail Chris@102: } // namespace odeint Chris@102: } // namespace numeric Chris@102: } // namespace boost Chris@102: Chris@102: #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED