Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:58:50

0001 /*
0002   [auto_generated]
0003   boost/numeric/odeint/util/unit_helper.hpp
0004 
0005   [begin_description]
0006   Get and set the value of a unit.
0007   [end_description]
0008 
0009   Copyright 2012-2013 Karsten Ahnert
0010   Copyright 2012-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_UTIL_UNIT_HELPER_HPP_INCLUDED
0019 #define BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED
0020 
0021 
0022 #ifndef __CUDACC__
0023 #include <boost/units/quantity.hpp>
0024 #include <boost/units/get_dimension.hpp>
0025 #include <boost/units/get_system.hpp>
0026 #endif
0027 
0028 
0029 
0030 namespace boost {
0031 namespace numeric {
0032 namespace odeint {
0033 
0034 
0035 namespace detail {
0036 
0037     template<class T , class Enabler = void >
0038     struct get_unit_value_impl
0039     {
0040         static T value(const T &t)
0041         {
0042             return t;
0043         }
0044         typedef T result_type;
0045     };
0046     
0047 #ifndef __CUDACC__
0048     template<class Unit , class T>
0049     struct get_unit_value_impl< boost::units::quantity< Unit , T> >
0050     {
0051         static T value( const boost::units::quantity< Unit , T> &t )
0052         {
0053             return t.value();
0054         }
0055         typedef T result_type;
0056     };
0057 #endif
0058 
0059 
0060 
0061 
0062 
0063     template<class T , class V , class Enabler = void >
0064     struct set_unit_value_impl
0065     {
0066         static void set_value(T &t , const V &v)
0067         {
0068             t = v;
0069         }
0070     };
0071 
0072 #ifndef __CUDACC__
0073     template<class Unit , class T , class V>
0074     struct set_unit_value_impl<boost::units::quantity<Unit , T> , V>
0075     {
0076         static void set_value(boost::units::quantity<Unit , T> &t , const V &v)
0077         {
0078             t = boost::units::quantity<Unit , T>::from_value(v);
0079         }
0080     };
0081 #endif
0082 
0083 
0084 
0085 } // namespace detail
0086 
0087 
0088     template<class T>
0089     typename detail::get_unit_value_impl<T>::result_type get_unit_value(const T &t)
0090     {
0091         return detail::get_unit_value_impl<T>::value(t);
0092     }
0093 
0094 
0095     template<class T , class V>
0096     void set_unit_value(T &t , const V &v)
0097     {
0098         return detail::set_unit_value_impl<T , V>::set_value(t , v);
0099     }
0100 
0101 
0102 
0103     template< class T >
0104     struct unit_value_type
0105     {
0106         typedef T type;
0107     };
0108 
0109 #ifndef __CUDACC__
0110     template< class Unit , class Y >
0111     struct unit_value_type< boost::units::quantity< Unit , Y > >
0112     {
0113         typedef Y type;
0114     };
0115 #endif
0116 
0117 
0118 
0119 
0120 
0121 
0122 
0123 
0124 
0125 
0126     template< typename Time >
0127     struct inverse_time
0128     {
0129         typedef Time type;
0130     };
0131 
0132 #ifndef __CUDACC__
0133     template< typename Unit , typename Value >
0134     struct inverse_time< boost::units::quantity< Unit , Value > >
0135     {
0136         typedef boost::units::quantity< Unit , Value > time_type;
0137         typedef typename boost::units::get_dimension< time_type >::type dimension;
0138         typedef typename boost::units::get_system< time_type >::type system;
0139         typedef typename boost::mpl::divides< boost::units::dimensionless_type , dimension >::type inv_dimension;
0140         typedef boost::units::unit< inv_dimension , system > inv_unit;
0141         typedef boost::units::quantity< inv_unit , Value > type;
0142     };
0143 #endif
0144 
0145 
0146 } // namespace odeint
0147 } // namespace numeric
0148 } // namespace boost
0149 
0150 
0151 #endif // BOOST_NUMERIC_ODEINT_UTIL_UNIT_HELPER_HPP_INCLUDED