00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef PHYSICAL_FIXEDEXPONENTS
00015 #define PHYSICAL_FIXEDEXPONENTS
00016
00017 #include "physical/config.hpp"
00018 #include "physical/detail/dimension_vector.hpp"
00019
00020 #include <boost/mpl/size.hpp>
00021 #include <boost/mpl/transform.hpp>
00022 #include <boost/static_assert.hpp>
00023
00024 namespace physical {
00025
00026 namespace detail {
00027
00028
00029
00030
00031
00032
00033
00034
00035 template<class UnitSystem, class ExpVector>
00036 struct FixedExponents {
00037 typedef ExpVector dimensions;
00038
00039 BOOST_STATIC_ASSERT(( boost::mpl::size<dimensions>::value==UnitSystem::number_baseunits ));
00040 };
00041
00042
00043 template<class fixedexponents1, class fixedexponents2>
00044 struct plus;
00045
00046 template<class UnitSystem, class ExpVector1, class ExpVector2>
00047 struct plus< FixedExponents<UnitSystem, ExpVector1>, FixedExponents<UnitSystem, ExpVector2> > {
00048 typedef struct FixedExponents<
00049 UnitSystem,
00050 typename boost::mpl::transform<
00051 ExpVector1, ExpVector2,
00052 boost::mpl::plus<boost::mpl::placeholders::_1, boost::mpl::placeholders::_2>
00053 >::type
00054 > type;
00055 };
00056
00057 template<class fixedexponents1, class fixedexponents2>
00058 struct minus;
00059
00060
00061 template<class UnitSystem, class ExpVector1, class ExpVector2>
00062 struct minus< FixedExponents<UnitSystem, ExpVector1>, FixedExponents<UnitSystem, ExpVector2> > {
00063 typedef struct FixedExponents<
00064 UnitSystem,
00065 typename boost::mpl::transform<
00066 ExpVector1, ExpVector2,
00067 boost::mpl::minus<boost::mpl::placeholders::_1, boost::mpl::placeholders::_2>
00068 >::type
00069 > type;
00070 };
00071
00072 template<class UnitSystem, int Pos>
00073 struct FixExponents{
00074 typedef FixedExponents<UnitSystem, typename dimension_vector<Pos, UnitSystem::number_baseunits>::type> type;
00075 };
00076
00077 };
00078
00079 };
00080
00081 #endif