1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
/*
[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 <boost/units/quantity.hpp>
#include <boost/units/get_dimension.hpp>
#include <boost/units/get_system.hpp>
#endif
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template<class T , class Enabler = void >
struct get_unit_value_impl
{
static T value(const T &t)
{
return t;
}
typedef T result_type;
};
#ifndef __CUDACC__
template<class Unit , class T>
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<class T , class V , class Enabler = void >
struct set_unit_value_impl
{
static void set_value(T &t , const V &v)
{
t = v;
}
};
#ifndef __CUDACC__
template<class Unit , class T , class V>
struct set_unit_value_impl<boost::units::quantity<Unit , T> , V>
{
static void set_value(boost::units::quantity<Unit , T> &t , const V &v)
{
t = boost::units::quantity<Unit , T>::from_value(v);
}
};
#endif
} // namespace detail
template<class T>
typename detail::get_unit_value_impl<T>::result_type get_unit_value(const T &t)
{
return detail::get_unit_value_impl<T>::value(t);
}
template<class T , class V>
void set_unit_value(T &t , const V &v)
{
return detail::set_unit_value_impl<T , V>::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
|