/* [auto_generated] boost/numeric/odeint/util/unit_helper.hpp [begin_description] Get and set the value of a unit. [end_description] Copyright 2012-2013 Karsten Ahnert Copyright 2012-2013 Mario Mulansky Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED #define BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED #ifndef __CUDACC__ #include #include #include #endif namespace boost { namespace numeric { namespace odeint { namespace detail { template struct get_unit_value_impl { static T value(const T &t) { return t; } typedef T result_type; }; #ifndef __CUDACC__ template struct get_unit_value_impl< boost::units::quantity< Unit , T> > { static T value( const boost::units::quantity< Unit , T> &t ) { return t.value(); } typedef T result_type; }; #endif template struct set_unit_value_impl { static void set_value(T &t , const V &v) { t = v; } }; #ifndef __CUDACC__ template struct set_unit_value_impl , V> { static void set_value(boost::units::quantity &t , const V &v) { t = boost::units::quantity::from_value(v); } }; #endif } // namespace detail template typename detail::get_unit_value_impl::result_type get_unit_value(const T &t) { return detail::get_unit_value_impl::value(t); } template void set_unit_value(T &t , const V &v) { return detail::set_unit_value_impl::set_value(t , v); } template< class T > struct unit_value_type { typedef T type; }; #ifndef __CUDACC__ template< class Unit , class Y > struct unit_value_type< boost::units::quantity< Unit , Y > > { typedef Y type; }; #endif template< typename Time > struct inverse_time { typedef Time type; }; #ifndef __CUDACC__ template< typename Unit , typename Value > struct inverse_time< boost::units::quantity< Unit , Value > > { typedef boost::units::quantity< Unit , Value > time_type; typedef typename boost::units::get_dimension< time_type >::type dimension; typedef typename boost::units::get_system< time_type >::type system; typedef typename boost::mpl::divides< boost::units::dimensionless_type , dimension >::type inv_dimension; typedef boost::units::unit< inv_dimension , system > inv_unit; typedef boost::units::quantity< inv_unit , Value > type; }; #endif } // namespace odeint } // namespace numeric } // namespace boost #endif // BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED