Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:52

0001 /*
0002  [auto_generated]
0003  boost/numeric/odeint/integrate/detail/functors.hpp
0004 
0005  [begin_description]
0006  some functors for the iterator based integrate routines
0007  [end_description]
0008 
0009  Copyright 2009-2013 Karsten Ahnert
0010  Copyright 2009-2013 Mario Mulansky
0011 
0012  Distributed under the Boost Software License, Version 1.0.
0013  (See accompanying file LICENSE_1_0.txt or
0014  copy at http://www.boost.org/LICENSE_1_0.txt)
0015  */
0016 
0017 
0018 #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED
0019 #define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED
0020 
0021 #include <utility>
0022 
0023 namespace boost {
0024 namespace numeric {
0025 namespace odeint {
0026 namespace detail {
0027 
0028 
0029 template< class Observer >
0030 struct obs_caller {
0031 
0032     size_t &m_n;
0033     Observer m_obs;
0034 
0035     obs_caller( size_t &m , Observer &obs ) : m_n(m) , m_obs( obs ) {}
0036 
0037     template< class State , class Time >
0038     void operator()( std::pair< const State & , const Time & > x )
0039     {
0040         typedef typename odeint::unwrap_reference< Observer >::type observer_type;
0041         observer_type &obs = m_obs;
0042         obs( x.first , x.second );
0043         m_n++;
0044     }
0045 };
0046 
0047 template< class Observer , class Time >
0048 struct obs_caller_time {
0049 
0050     Time &m_t;
0051     Observer m_obs;
0052 
0053     obs_caller_time( Time &t , Observer &obs ) : m_t(t) , m_obs( obs ) {}
0054 
0055     template< class State >
0056     void operator()( std::pair< const State & , const Time & > x )
0057     {
0058         typedef typename odeint::unwrap_reference< Observer >::type observer_type;
0059         observer_type &obs = m_obs;
0060         obs( x.first , x.second );
0061         m_t = x.second;
0062     }
0063 };
0064 
0065 } // namespace detail
0066 } // namespace odeint
0067 } // namespace numeric
0068 } // namespace boost
0069 
0070 #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_FUNCTORS_HPP_INCLUDED