You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(89) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(208) |
Feb
(76) |
Mar
(55) |
Apr
(74) |
May
(43) |
Jun
(116) |
Jul
(109) |
Aug
(46) |
Sep
(36) |
Oct
(106) |
Nov
(159) |
Dec
(128) |
| 2007 |
Jan
(54) |
Feb
(225) |
Mar
(200) |
Apr
(229) |
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Matthias S. <mat...@us...> - 2007-04-03 20:27:55
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23993/systems Modified Files: physical_units.hpp Log Message: remove deprecated quantity_cast and quantity_reinterpret_cast usages Index: physical_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/physical_units.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- physical_units.hpp 3 Apr 2007 18:24:37 -0000 1.6 +++ physical_units.hpp 3 Apr 2007 20:27:51 -0000 1.7 @@ -115,6 +115,9 @@ /// composite dimension for activity : T^-1 typedef composite_dimension<time_tag,-1>::type activity_type; +/// composite dimension for angular velocity : T^-1 QP +typedef composite_dimension<time_tag,-1,plane_angle_tag,1>::type angular_velocity_type; + /// composite dimension for area : L^2 typedef composite_dimension<length_tag,2>::type area_type; |
|
From: Matthias S. <mat...@us...> - 2007-04-03 20:27:55
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23993 Modified Files: quantity.hpp Log Message: remove deprecated quantity_cast and quantity_reinterpret_cast usages Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- quantity.hpp 3 Apr 2007 19:25:08 -0000 1.12 +++ quantity.hpp 3 Apr 2007 20:27:51 -0000 1.13 @@ -239,99 +239,28 @@ namespace units { -/// extract a reference to the value type -template<class X, class Unit,class Y> -X quantity_reinterpret_cast(const quantity<Unit,Y>& q) -{ - return q.value(); -} - -template<class X, class Unit,class Y> -X quantity_reinterpret_cast(quantity<Unit,Y>& q) -{ - return const_cast<Y&>(q.value()); -} - /// helper class for quantity_cast template<class X,class Y> struct quantity_cast_helper; -/// specialization for construction of quantity from raw value_type -template<class Unit,class X,class Y> -struct quantity_cast_helper< quantity<Unit,X>,Y > -{ - typedef quantity<Unit,X> type; - - type operator()(Y& source) { return type::from_value(source); } -}; - -/// specialization for casting from one value_type to another -template<class Unit,class X,class Y> -struct quantity_cast_helper< quantity<Unit,X>,quantity<Unit,Y> > -{ - typedef quantity<Unit,X> type; - - type operator()(quantity<Unit,Y>& source) { return type::from_value(source.value()); } -}; - -/// specialization for casting from one value_type to another -template<class Unit,class X,class Y> -struct quantity_cast_helper< quantity<Unit,X>,const quantity<Unit,Y> > -{ - typedef quantity<Unit,X> type; - - type operator()(const quantity<Unit,Y>& source) { return type::from_value(source.value()); } -}; - -/// specialization for casting from one unit system to another -template<class Y,class X,class Unit1,class Unit2> -struct quantity_cast_helper< quantity<Unit1,Y>,quantity<Unit2,X> > -{ - typedef quantity<Unit1,Y> type; - - type operator()(quantity<Unit2,X>& source) - { - return conversion_helper<quantity<Unit2,X>,quantity<Unit1,Y> >::convert(source); - } -}; - -/// specialization for casting from one unit system to another -template<class Y,class X,class Unit1,class Unit2> -struct quantity_cast_helper< quantity<Unit1,Y>,const quantity<Unit2,X> > -{ - typedef quantity<Unit1,Y> type; - - type operator()(const quantity<Unit2,X>& source) - { - return conversion_helper<quantity<Unit2,X>,quantity<Unit1,Y> >::convert(source); - } -}; - /// specialization for casting to the value type -template<class Y,class X,class Unit2> -struct quantity_cast_helper<Y,quantity<Unit2,X> > +template<class Y,class X,class Unit> +struct quantity_cast_helper<Y,quantity<Unit,X> > { typedef Y type; - type operator()(quantity<Unit2,X>& source) { return const_cast<X&>(source.value()); } + type operator()(quantity<Unit,X>& source) { return const_cast<X&>(source.value()); } }; /// specialization for casting to the value type -template<class Y,class X,class Unit2> -struct quantity_cast_helper<Y,const quantity<Unit2,X> > +template<class Y,class X,class Unit> +struct quantity_cast_helper<Y,const quantity<Unit,X> > { typedef Y type; - type operator()(const quantity<Unit2,X>& source) { return source.value(); } + type operator()(const quantity<Unit,X>& source) { return source.value(); } }; -/// quantity_cast supporting three types of casting: -/// -/// 1) Casting from a @c value_type to a @c quantity : -/// @verbatim quantity<Unit,X> q = quantity_cast< quantity<Unit,X> >(const X&); @endverbatim -/// 2) Casting from one @c value_type to another @c value_type : -/// @verbatim quantity<Unit,X> q = quantity_cast<quantity<Unit,X> >(const quantity<Unit,Y>&); @endverbatim -/// 3) Casting from one unit system to another : -/// @verbatim quantity<unit,X> q = quantity_cast< quantity<unit<Dim,System1>,X> >(const quantity<unit<Dim,System2> >,Y>&); @endverbatim +/// quantity_cast provides mutating access to underlying quantity value_type template<class X,class Y> inline typename quantity_cast_helper<X,Y>::type @@ -357,7 +286,7 @@ inline void swap(quantity<Unit,Y>& lhs, quantity<Unit,Y>& rhs) { using std::swap; - swap(quantity_reinterpret_cast<Y&>(lhs),quantity_reinterpret_cast<Y&>(rhs)); + swap(quantity_cast<Y&>(lhs),quantity_cast<Y&>(rhs)); } /// utility class to simplify construction of dimensionless quantities |
|
From: Matthias S. <mat...@us...> - 2007-04-03 19:48:49
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8231 Modified Files: io.hpp Log Message: spelling mistake corrected Index: io.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/io.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- io.hpp 2 Apr 2007 22:22:02 -0000 1.6 +++ io.hpp 3 Apr 2007 19:48:48 -0000 1.7 @@ -75,7 +75,7 @@ } /// Write @c unit to @c std::basic_ostream. Prints the symbol of -/// each fundamental unit followed by it's exponent e.g. +/// each fundamental unit followed by its exponent e.g. /// joules = m^2 kg s^(-2). If this is not what you want feel free /// to overload it for your own units. template<class Char, class Traits, class System,class Dim> |
|
From: Matthias S. <mat...@us...> - 2007-04-03 19:45:24
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7055 Added Files: angular_velocity.hpp Log Message: angular velocity unit --- NEW FILE: angular_velocity.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_ANGULAR_VELOCITY_HPP #define BOOST_UNITS_SI_ANGULAR_VELOCITY_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<angular_velocity_type,SI::system> angular_velocity; BOOST_UNITS_STATIC_CONSTANT(radian_per_second,angular_velocity); BOOST_UNITS_STATIC_CONSTANT(radians_per_second,angular_velocity); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_ANGULAR_VELOCITY_HPP |
|
From: Matthias S. <mat...@us...> - 2007-04-03 19:25:11
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31109 Modified Files: operators.hpp quantity.hpp Log Message: minor changes to simplify testing w/wo typeof support Index: operators.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/operators.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- operators.hpp 16 Mar 2007 18:12:42 -0000 1.1.1.1 +++ operators.hpp 3 Apr 2007 19:25:08 -0000 1.2 @@ -18,15 +18,20 @@ #include <boost/version.hpp> #include <boost/type_traits/is_same.hpp> +#if (BOOST_VERSION >= 103400) + #define BOOST_UNITS_HAS_BOOST_TYPEOF 1 +#else + #define BOOST_UNITS_HAS_BOOST_TYPEOF 0 +#endif + // uncomment this to test without Boost Typeof -//#undef BOOST_VERSION -//#define BOOST_VERSION 103300 +//#undef BOOST_UNITS_HAS_BOOST_TYPEOF +//#define BOOST_UNITS_HAS_BOOST_TYPEOF 0 -#if (BOOST_VERSION >= 103400) +#if (BOOST_UNITS_HAS_BOOST_TYPEOF) #include <boost/typeof/typeof.hpp> #include <boost/typeof/std/complex.hpp> #define BOOST_UNITS_HAS_TYPEOF 1 - #define BOOST_UNITS_HAS_BOOST_TYPEOF 1 #else #if (__GNUC__ && __cplusplus && __GNUC__ >= 3) #define BOOST_UNITS_HAS_TYPEOF 1 @@ -86,7 +91,7 @@ } // namespace typeof_ -#if BOOST_UNITS_HAS_BOOST_TYPEOF +#if (BOOST_UNITS_HAS_TYPEOF && BOOST_UNITS_HAS_BOOST_TYPEOF) template<typename X> struct unary_plus_typeof_helper { @@ -124,7 +129,7 @@ typedef typename nested::type type; }; -#elif BOOST_UNITS_HAS_MWERKS_TYPEOF +#elif (BOOST_UNITS_HAS_TYPEOF && BOOST_UNITS_HAS_MWERKS_TYPEOF) template<typename X> struct unary_plus_typeof_helper { typedef __typeof__((+typeof_::make<X>())) type; }; template<typename X> struct unary_minus_typeof_helper { typedef __typeof__((-typeof_::make<X>())) type; }; @@ -134,7 +139,7 @@ template<typename X,typename Y> struct multiply_typeof_helper { typedef __typeof__((typeof_::make<X>()*typeof_::make<Y>())) type; }; template<typename X,typename Y> struct divide_typeof_helper { typedef __typeof__((typeof_::make<X>()/typeof_::make<Y>())) type; }; -#elif BOOST_UNITS_HAS_GNU_TYPEOF +#elif (BOOST_UNITS_HAS_TYPEOF && BOOST_UNITS_HAS_GNU_TYPEOF) template<typename X> struct unary_plus_typeof_helper { typedef typeof((+typeof_::make<X>())) type; }; template<typename X> struct unary_minus_typeof_helper { typedef typeof((-typeof_::make<X>())) type; }; Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- quantity.hpp 3 Apr 2007 18:24:37 -0000 1.11 +++ quantity.hpp 3 Apr 2007 19:25:08 -0000 1.12 @@ -76,7 +76,6 @@ template<class System2,class Dim2,class YY> explicit quantity(const quantity<unit<Dim2,System2>,YY>& source, -// typename boost::disable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit<Dim,System> >::type>::type* = 0) typename boost::disable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit_type>::type>::type* = 0) : val_(conversion_helper<quantity<unit<Dim2,System2>,YY>,this_type>::convert(source).value()) { @@ -86,7 +85,6 @@ /// implicit conversion between different unit systems is allowed if each fundamental dimension is implicitly convertible template<class System2,class Dim2,class YY> quantity(const quantity<unit<Dim2,System2>,YY>& source, -// typename boost::enable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit<Dim,System> >::type>::type* = 0) typename boost::enable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit_type>::type>::type* = 0) : val_(conversion_helper<quantity<unit<Dim2,System2>,YY>,this_type>::convert(source).value()) { @@ -174,14 +172,14 @@ quantity(const quantity<unit<dimension_type,system_type>,YY>& source) : val_(source.value()) { - BOOST_STATIC_ASSERT((boost::is_convertible<YY, Y>::value == true)); + BOOST_STATIC_ASSERT((boost::is_convertible<YY,Y>::value == true)); } /// implicit assignment between value types is allowed if allowed for value types themselves template<class YY> this_type& operator=(const quantity<unit<dimension_type,system_type>,YY>& source) { - BOOST_STATIC_ASSERT((boost::is_convertible<YY, Y>::value == true)); + BOOST_STATIC_ASSERT((boost::is_convertible<YY,Y>::value == true)); *this = this_type(source); @@ -225,9 +223,9 @@ value_type val_; }; -} +} // namespace units -} +} // namespace boost #if BOOST_UNITS_HAS_BOOST_TYPEOF |
|
From: Matthias S. <mat...@us...> - 2007-04-03 18:24:44
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7118 Modified Files: quantity.hpp Log Message: cleanup Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- quantity.hpp 3 Apr 2007 14:54:27 -0000 1.10 +++ quantity.hpp 3 Apr 2007 18:24:37 -0000 1.11 @@ -25,28 +25,20 @@ namespace units { template<class Q1,class Q2> class conversion_helper; -template<class Unit,class Y = double> class quantity; /// class declaration -//template<class System,class Dim,class Y> -//class quantity<unit<Dim,System>,Y> -//{ -// public: -// typedef quantity<unit<Dim,System>,Y> this_type; -template<class Unit,class Y> +template<class Unit,class Y = double> class quantity { public: typedef quantity<Unit,Y> this_type; - typedef typename get_dimension<Unit>::type Dim; - typedef typename get_system<Unit>::type System; - - BOOST_STATIC_ASSERT((detail::check_system<System, Dim>::value == true)); typedef Y value_type; - typedef System system_type; - typedef Dim dimension_type; + typedef typename get_system<Unit>::type system_type; + typedef typename get_dimension<Unit>::type dimension_type; typedef unit<dimension_type,system_type> unit_type; + + BOOST_STATIC_ASSERT((detail::check_system<system_type,dimension_type>::value == true)); quantity() : val_() { } quantity(const this_type& source) : val_(source.val_) { } @@ -54,7 +46,6 @@ this_type& operator=(const this_type& source) { - val_ = source.val_; return *this; @@ -85,19 +76,21 @@ template<class System2,class Dim2,class YY> explicit quantity(const quantity<unit<Dim2,System2>,YY>& source, - typename boost::disable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit<Dim,System> >::type>::type* = 0) +// typename boost::disable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit<Dim,System> >::type>::type* = 0) + typename boost::disable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit_type>::type>::type* = 0) : val_(conversion_helper<quantity<unit<Dim2,System2>,YY>,this_type>::convert(source).value()) { - BOOST_STATIC_ASSERT((boost::is_convertible<YY, Y>::value == true)); + BOOST_STATIC_ASSERT((boost::is_convertible<YY,Y>::value == true)); } /// implicit conversion between different unit systems is allowed if each fundamental dimension is implicitly convertible template<class System2,class Dim2,class YY> quantity(const quantity<unit<Dim2,System2>,YY>& source, - typename boost::enable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit<Dim,System> >::type>::type* = 0) +// typename boost::enable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit<Dim,System> >::type>::type* = 0) + typename boost::enable_if<typename is_implicitly_convertible<unit<Dim2,System2>,unit_type>::type>::type* = 0) : val_(conversion_helper<quantity<unit<Dim2,System2>,YY>,this_type>::convert(source).value()) { - BOOST_STATIC_ASSERT((boost::is_convertible<YY, Y>::value == true)); + BOOST_STATIC_ASSERT((boost::is_convertible<YY,Y>::value == true)); } #else @@ -108,7 +101,7 @@ explicit quantity(const quantity<unit<Dim2,System2>,YY>& source) : val_(conversion_helper<quantity<unit<Dim2,System2>,YY>,this_type>::convert(source).value()) { - BOOST_STATIC_ASSERT((boost::is_convertible<YY, Y>::value == true)); + BOOST_STATIC_ASSERT((boost::is_convertible<YY,Y>::value == true)); } #endif @@ -117,7 +110,7 @@ template<class System2,class Dim2,class YY> this_type& operator=(const quantity<unit<Dim2,System2>,YY>& source) { - typedef unit<Dim,System> unit1_type; + typedef unit_type unit1_type; typedef unit<Dim2,System2> unit2_type; BOOST_STATIC_ASSERT((is_implicitly_convertible<unit2_type,unit1_type>::value == true)); @@ -157,12 +150,12 @@ class quantity<unit<dimensionless_type,System>,Y> { public: - typedef quantity<unit<dimensionless_type,System>,Y> this_type; + typedef quantity<unit<dimensionless_type,System>,Y> this_type; - typedef Y value_type; - typedef System system_type; - typedef dimensionless_type dimension_type; - typedef unit<dimension_type,system_type> unit_type; + typedef Y value_type; + typedef System system_type; + typedef dimensionless_type dimension_type; + typedef unit<dimension_type,system_type> unit_type; quantity() : val_() { } quantity(value_type val) : val_(val) { } ///< construction from raw @c value_type is allowed |
|
From: Matthias S. <mat...@us...> - 2007-04-03 18:24:44
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7118/systems Modified Files: physical_units.hpp Log Message: cleanup Index: physical_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/physical_units.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- physical_units.hpp 3 Apr 2007 17:12:25 -0000 1.5 +++ physical_units.hpp 3 Apr 2007 18:24:37 -0000 1.6 @@ -154,6 +154,9 @@ /// composite dimension for pressure : L^-1 M T^-2 typedef composite_dimension<length_tag,-1,mass_tag,1,time_tag,-2>::type pressure_type; +/// composite dimension for specific volume : L^3 M^-1 +typedef composite_dimension<length_tag,3,mass_tag,-1>::type specific_volume_type; + /// composite dimension for stress : L^-1 M T^-2 typedef composite_dimension<length_tag,-1,mass_tag,1,time_tag,-2>::type stress_type; |
|
From: Matthias S. <mat...@us...> - 2007-04-03 17:12:58
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10335/example Modified Files: unit_example_4.cpp Log Message: improve SI compliance Index: unit_example_4.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_4.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- unit_example_4.cpp 3 Apr 2007 14:50:19 -0000 1.5 +++ unit_example_4.cpp 3 Apr 2007 17:12:57 -0000 1.6 @@ -156,7 +156,7 @@ /// sin takes a quantity and returns a dimensionless quantity template<class System,class Y> quantity<unit<dimensionless_type,System>,Y> -sin(const quantity<unit<angle_type,System>,Y>& theta) +sin(const quantity<unit<plane_angle_type,System>,Y>& theta) { return quantity<unit<dimensionless_type,System>,Y>(std::sin(theta.value())); } @@ -165,10 +165,10 @@ //[unit_example_4_function_snippet_2 /// asin takes a dimensionless quantity and returns a quantity template<class System,class Y> -quantity<unit<angle_type,System>,Y> +quantity<unit<plane_angle_type,System>,Y> asin(const quantity<unit<dimensionless_type,System>,Y>& val) { - typedef quantity<unit<angle_type,System>,Y> quantity_type; + typedef quantity<unit<plane_angle_type,System>,Y> quantity_type; return quantity_type::from_value(std::asin(val.value())); } |
|
From: Matthias S. <mat...@us...> - 2007-04-03 17:12:58
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10335/test Modified Files: test_implicit_conversion.cpp Log Message: improve SI compliance Index: test_implicit_conversion.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/test_implicit_conversion.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- test_implicit_conversion.cpp 16 Mar 2007 18:29:55 -0000 1.1.1.1 +++ test_implicit_conversion.cpp 3 Apr 2007 17:12:57 -0000 1.2 @@ -41,8 +41,8 @@ BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::current_tag,bu::SI::system_tag,bu::SI::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::temperature_tag,bu::SI::system_tag,bu::SI::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::amount_tag,bu::SI::system_tag,bu::SI::system_tag>::value == true)); - BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::intensity_tag,bu::SI::system_tag,bu::SI::system_tag>::value == true)); - BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::angle_tag,bu::SI::system_tag,bu::SI::system_tag>::value == true)); + BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::luminous_intensity_tag,bu::SI::system_tag,bu::SI::system_tag>::value == true)); + BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::plane_angle_tag,bu::SI::system_tag,bu::SI::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::solid_angle_tag,bu::SI::system_tag,bu::SI::system_tag>::value == true)); // CGS->CGS always true @@ -52,8 +52,8 @@ BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::current_tag,bu::CGS::system_tag,bu::CGS::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::temperature_tag,bu::CGS::system_tag,bu::CGS::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::amount_tag,bu::CGS::system_tag,bu::CGS::system_tag>::value == true)); - BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::intensity_tag,bu::CGS::system_tag,bu::CGS::system_tag>::value == true)); - BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::angle_tag,bu::CGS::system_tag,bu::CGS::system_tag>::value == true)); + BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::luminous_intensity_tag,bu::CGS::system_tag,bu::CGS::system_tag>::value == true)); + BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::plane_angle_tag,bu::CGS::system_tag,bu::CGS::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::solid_angle_tag,bu::CGS::system_tag,bu::CGS::system_tag>::value == true)); // SI->CGS @@ -63,8 +63,8 @@ BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::current_tag,bu::SI::system_tag,bu::CGS::system_tag>::value == false)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::temperature_tag,bu::SI::system_tag,bu::CGS::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::amount_tag,bu::SI::system_tag,bu::CGS::system_tag>::value == true)); - BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::intensity_tag,bu::SI::system_tag,bu::CGS::system_tag>::value == true)); - BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::angle_tag,bu::SI::system_tag,bu::CGS::system_tag>::value == true)); + BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::luminous_intensity_tag,bu::SI::system_tag,bu::CGS::system_tag>::value == true)); + BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::plane_angle_tag,bu::SI::system_tag,bu::CGS::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::solid_angle_tag,bu::SI::system_tag,bu::CGS::system_tag>::value == true)); BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::length,bu::CGS::length>::value == false)); @@ -73,7 +73,7 @@ BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::current,bu::CGS::current>::value == false)); BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::temperature,bu::CGS::temperature>::value == true)); BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::amount,bu::CGS::amount>::value == true)); - BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::intensity,bu::CGS::intensity>::value == true)); + BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::luminous_intensity,bu::CGS::intensity>::value == true)); BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::angle,bu::CGS::angle>::value == true)); BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::solid_angle,bu::CGS::solid_angle>::value == true)); @@ -96,8 +96,8 @@ BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::current_tag,bu::CGS::system_tag,bu::SI::system_tag>::value == false)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::temperature_tag,bu::CGS::system_tag,bu::SI::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::amount_tag,bu::CGS::system_tag,bu::SI::system_tag>::value == true)); - BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::intensity_tag,bu::CGS::system_tag,bu::SI::system_tag>::value == true)); - BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::angle_tag,bu::CGS::system_tag,bu::SI::system_tag>::value == true)); + BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::luminous_intensity_tag,bu::CGS::system_tag,bu::SI::system_tag>::value == true)); + BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::plane_angle_tag,bu::CGS::system_tag,bu::SI::system_tag>::value == true)); BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::solid_angle_tag,bu::CGS::system_tag,bu::SI::system_tag>::value == true)); BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::length,bu::SI::length>::value == false)); @@ -106,7 +106,7 @@ BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::current,bu::SI::current>::value == false)); BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::temperature,bu::SI::temperature>::value == true)); BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::amount,bu::SI::amount>::value == true)); - BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::intensity,bu::SI::intensity>::value == true)); + BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::luminous_intensity,bu::SI::intensity>::value == true)); BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::angle,bu::SI::angle>::value == true)); BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::solid_angle,bu::SI::solid_angle>::value == true)); |
|
From: Matthias S. <mat...@us...> - 2007-04-03 17:12:27
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9916/systems Modified Files: abstract.hpp cgs.hpp physical_units.hpp si.hpp trig.hpp Log Message: extended SI unit system to improve compliance with standard Index: cgs.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/cgs.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- cgs.hpp 2 Apr 2007 20:12:51 -0000 1.6 +++ cgs.hpp 3 Apr 2007 17:12:25 -0000 1.7 @@ -35,8 +35,10 @@ #include <boost/units/systems/cgs/power.hpp> #include <boost/units/systems/cgs/pressure.hpp> #include <boost/units/systems/cgs/velocity.hpp> -#include <boost/units/systems/cgs/viscosity.hpp> #include <boost/units/systems/cgs/volume.hpp> #include <boost/units/systems/cgs/wavenumber.hpp> +#include <boost/units/systems/cgs/dynamic_viscosity.hpp> +#include <boost/units/systems/cgs/kinematic_viscosity.hpp> + #endif // BOOST_UNITS_CGS_HPP Index: si.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- si.hpp 2 Apr 2007 20:12:51 -0000 1.6 +++ si.hpp 3 Apr 2007 17:12:25 -0000 1.7 @@ -27,6 +27,7 @@ #include <boost/units/systems/si/current.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/si/amount.hpp> +#include <boost/units/systems/si/luminous_intensity.hpp> #include <boost/units/systems/si/acceleration.hpp> #include <boost/units/systems/si/area.hpp> @@ -38,9 +39,11 @@ #include <boost/units/systems/si/power.hpp> #include <boost/units/systems/si/pressure.hpp> #include <boost/units/systems/si/velocity.hpp> -#include <boost/units/systems/si/viscosity.hpp> #include <boost/units/systems/si/volume.hpp> +#include <boost/units/systems/si/dynamic_viscosity.hpp> +#include <boost/units/systems/si/kinematic_viscosity.hpp> + #include <boost/units/systems/si/capacitance.hpp> #include <boost/units/systems/si/conductance.hpp> #include <boost/units/systems/si/conductivity.hpp> Index: abstract.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/abstract.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- abstract.hpp 29 Mar 2007 19:10:39 -0000 1.3 +++ abstract.hpp 3 Apr 2007 17:12:25 -0000 1.4 @@ -46,17 +46,17 @@ namespace abstract { -typedef homogeneous_system<system_tag> system; +typedef homogeneous_system<system_tag> system; -typedef unit<length_type,system> length; ///< abstract unit of length -typedef unit<mass_type,system> mass; ///< abstract unit of mass -typedef unit<time_type,system> time; ///< abstract unit of time -typedef unit<current_type,system> current; ///< abstract unit of current -typedef unit<temperature_type,system> temperature; ///< abstract unit of temperature -typedef unit<amount_type,system> amount; ///< abstract unit of amount -//typedef unit<intensity_type,system> intensity; ///< abstract unit of intensity -typedef unit<angle_type,system> angle; ///< abstract unit of angle -typedef unit<solid_angle_type,system> solid_angle; ///< abstract unit of solid angle +typedef unit<length_type,system> length; ///< abstract unit of length +typedef unit<mass_type,system> mass; ///< abstract unit of mass +typedef unit<time_type,system> time; ///< abstract unit of time +typedef unit<current_type,system> current; ///< abstract unit of current +typedef unit<temperature_type,system> temperature; ///< abstract unit of temperature +typedef unit<amount_type,system> amount; ///< abstract unit of amount +typedef unit<luminous_intensity_type,system> luminous_intensity; ///< abstract unit of intensity +typedef unit<plane_angle_type,system> angle; ///< abstract unit of angle +typedef unit<solid_angle_type,system> solid_angle; ///< abstract unit of solid angle } // namespace abstract @@ -103,14 +103,14 @@ }; template<> -struct base_unit_info<intensity_tag,abstract::system_tag> +struct base_unit_info<luminous_intensity_tag,abstract::system_tag> { - static std::string name() { return "[Intensity]"; } + static std::string name() { return "[Luminous Intensity]"; } static std::string symbol() { return "[I]"; } }; template<> -struct base_unit_info<angle_tag,abstract::system_tag> +struct base_unit_info<plane_angle_tag,abstract::system_tag> { static std::string name() { return "[Planar Angle]"; } static std::string symbol() { return "[QP]"; } Index: trig.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/trig.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- trig.hpp 2 Apr 2007 03:15:11 -0000 1.5 +++ trig.hpp 3 Apr 2007 17:12:25 -0000 1.6 @@ -78,10 +78,10 @@ /// acos of dimensionless quantity returning angle in same system template<class Y,class System> -quantity<unit<angle_type,System>,Y> +quantity<unit<plane_angle_type,System>,Y> acos(const quantity<unit<dimensionless_type,System>,Y>& val) { - return quantity<unit<angle_type,System>,Y>(std::acos(val)*radians); + return quantity<unit<plane_angle_type,System>,Y>(std::acos(val)*radians); } /// asin of @c value_type returning angle in radians @@ -94,10 +94,10 @@ /// asin of dimensionless quantity returning angle in same system template<class Y,class System> -quantity<unit<angle_type,System>,Y> +quantity<unit<plane_angle_type,System>,Y> asin(const quantity<unit<dimensionless_type,System>,Y>& val) { - return quantity<unit<angle_type,System>,Y>(std::asin(val)*radians); + return quantity<unit<plane_angle_type,System>,Y>(std::asin(val)*radians); } /// atan of @c value_type returning angle in radians @@ -110,10 +110,10 @@ /// atan of dimensionless quantity returning angle in same system template<class Y,class System> -quantity<unit<angle_type,System>,Y> +quantity<unit<plane_angle_type,System>,Y> atan(const quantity<unit<dimensionless_type,System>,Y>& val) { - return quantity<unit<angle_type,System>,Y>(std::atan(val)*radians); + return quantity<unit<plane_angle_type,System>,Y>(std::atan(val)*radians); } /// atan2 of @c value_type returning angle in radians Index: physical_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/physical_units.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- physical_units.hpp 2 Apr 2007 20:12:51 -0000 1.4 +++ physical_units.hpp 3 Apr 2007 17:12:25 -0000 1.5 @@ -28,28 +28,28 @@ namespace units { /// tag representing length -struct length_tag : public ordinal<-8> { }; +struct length_tag : public ordinal<-9> { }; /// tag representing mass -struct mass_tag : public ordinal<-7> { }; +struct mass_tag : public ordinal<-8> { }; /// tag representing time -struct time_tag : public ordinal<-6> { }; +struct time_tag : public ordinal<-7> { }; /// tag representing electrical current -struct current_tag : public ordinal<-5> { }; +struct current_tag : public ordinal<-6> { }; /// tag representing temperature -struct temperature_tag : public ordinal<-4> { }; +struct temperature_tag : public ordinal<-5> { }; /// tag representing amount of substance -struct amount_tag : public ordinal<-3> { }; +struct amount_tag : public ordinal<-4> { }; /// tag representing luminous intensity - demoted from status as a fundamental SI unit in 1979 -struct intensity_tag : public ordinal<-3> { }; +struct luminous_intensity_tag : public ordinal<-3> { }; /// tag representing plane angle -struct angle_tag : public ordinal<-2> { }; +struct plane_angle_tag : public ordinal<-2> { }; /// tag representing solid angle struct solid_angle_tag : public ordinal<-1> { }; @@ -68,8 +68,8 @@ BOOST_TYPEOF_REGISTER_TYPE(boost::units::current_tag) BOOST_TYPEOF_REGISTER_TYPE(boost::units::temperature_tag) BOOST_TYPEOF_REGISTER_TYPE(boost::units::amount_tag) -BOOST_TYPEOF_REGISTER_TYPE(boost::units::intensity_tag) -BOOST_TYPEOF_REGISTER_TYPE(boost::units::angle_tag) +BOOST_TYPEOF_REGISTER_TYPE(boost::units::luminous_intensity_tag) +BOOST_TYPEOF_REGISTER_TYPE(boost::units::plane_angle_tag) BOOST_TYPEOF_REGISTER_TYPE(boost::units::solid_angle_tag) #endif @@ -79,73 +79,95 @@ namespace units { /// fundamental dimension of length (L) -typedef fundamental_dimension<length_tag>::type length_type; +typedef fundamental_dimension<length_tag>::type length_type; /// fundamental dimension of mass (M) -typedef fundamental_dimension<mass_tag>::type mass_type; +typedef fundamental_dimension<mass_tag>::type mass_type; /// fundamental dimension of time (T) -typedef fundamental_dimension<time_tag>::type time_type; +typedef fundamental_dimension<time_tag>::type time_type; /// fundamental dimension of electric current (C) -typedef fundamental_dimension<current_tag>::type current_type; +typedef fundamental_dimension<current_tag>::type current_type; /// fundamental dimension of temperature (K) -typedef fundamental_dimension<temperature_tag>::type temperature_type; +typedef fundamental_dimension<temperature_tag>::type temperature_type; /// fundamental dimension of amount of substance (A) -typedef fundamental_dimension<amount_tag>::type amount_type; +typedef fundamental_dimension<amount_tag>::type amount_type; /// fundamental dimension of luminous intensity (I, deprecated by SI) -typedef fundamental_dimension<intensity_tag>::type intensity_type; +typedef fundamental_dimension<luminous_intensity_tag>::type luminous_intensity_type; /// fundamental dimension of planar angle (QP) -typedef fundamental_dimension<angle_tag>::type angle_type; +typedef fundamental_dimension<plane_angle_tag>::type plane_angle_type; /// fundamental dimension of solid angle (QS) -typedef fundamental_dimension<solid_angle_tag>::type solid_angle_type; +typedef fundamental_dimension<solid_angle_tag>::type solid_angle_type; + +/// composite dimension for absorbed dose : L^2 T^-2 +typedef composite_dimension<length_tag,2,time_tag,-2>::type absorbed_dose_type; + /// composite dimension for acceleration : L T^-2 -typedef composite_dimension<length_tag,1,time_tag,-2>::type acceleration_type; +typedef composite_dimension<length_tag,1,time_tag,-2>::type acceleration_type; + +/// composite dimension for activity : T^-1 +typedef composite_dimension<time_tag,-1>::type activity_type; /// composite dimension for area : L^2 -typedef composite_dimension<length_tag,2>::type area_type; +typedef composite_dimension<length_tag,2>::type area_type; + +/// composite dimension for dose equivalent : L^2 T^-2 +typedef composite_dimension<length_tag,2,time_tag,-2>::type dose_equivalent_type; + +/// composite dimension for dynamic viscosity : M L^-1 T^-1 +typedef composite_dimension<mass_tag,1,length_tag,-1,time_tag,-1>::type dynamic_viscosity_type; /// composite dimension for energy : L^2 M T^-2 -typedef composite_dimension<length_tag,2,mass_tag,1,time_tag,-2>::type energy_type; +typedef composite_dimension<length_tag,2,mass_tag,1,time_tag,-2>::type energy_type; /// composite dimension for force : L M T^-2 -typedef composite_dimension<length_tag,1,mass_tag,1,time_tag,-2>::type force_type; +typedef composite_dimension<length_tag,1,mass_tag,1,time_tag,-2>::type force_type; /// composite dimension for frequency : T^-1 -typedef composite_dimension<time_tag,-1>::type frequency_type; +typedef composite_dimension<time_tag,-1>::type frequency_type; + +/// composite dimension for illuminance : L^-2 I QS +typedef composite_dimension<length_tag,-2,luminous_intensity_tag,1,solid_angle_tag,1>::type illuminance_type; + +/// composite dimension for kinematic viscosity : L^2 T^-1 +typedef composite_dimension<length_tag,2,time_tag,-1>::type kinematic_viscosity_type; + +/// composite dimension for luminous flux : I QS +typedef composite_dimension<luminous_intensity_tag,1,solid_angle_tag,1>::type luminous_flux_type; /// composite dimension for mass density : L^-3 M -typedef composite_dimension<length_tag,-3,mass_tag,1>::type mass_density_type; +typedef composite_dimension<length_tag,-3,mass_tag,1>::type mass_density_type; /// composite dimension for linear momentum : L M T^-1 -typedef composite_dimension<length_tag,1,mass_tag,1,time_tag,-1>::type momentum_type; +typedef composite_dimension<length_tag,1,mass_tag,1,time_tag,-1>::type momentum_type; /// composite dimension for power : L^2 M T^-3 -typedef composite_dimension<length_tag,2,mass_tag,1,time_tag,-3>::type power_type; +typedef composite_dimension<length_tag,2,mass_tag,1,time_tag,-3>::type power_type; /// composite dimension for pressure : L^-1 M T^-2 -typedef composite_dimension<length_tag,-1,mass_tag,1,time_tag,-2>::type pressure_type; +typedef composite_dimension<length_tag,-1,mass_tag,1,time_tag,-2>::type pressure_type; /// composite dimension for stress : L^-1 M T^-2 -typedef composite_dimension<length_tag,-1,mass_tag,1,time_tag,-2>::type stress_type; +typedef composite_dimension<length_tag,-1,mass_tag,1,time_tag,-2>::type stress_type; -/// composite dimension for velocity : L T^-1 -typedef composite_dimension<length_tag,1,time_tag,-1>::type velocity_type; +/// composite dimension for surface density : L^-2 M +typedef composite_dimension<length_tag,-2,mass_tag,1>::type surface_density_type; -/// composite dimension for viscosity : M L^-1 T^-1 -typedef composite_dimension<mass_tag,1,length_tag,-1,time_tag,-1>::type viscosity_type; +/// composite dimension for velocity : L T^-1 +typedef composite_dimension<length_tag,1,time_tag,-1>::type velocity_type; /// composite dimension for volume : l^3 -typedef composite_dimension<length_tag,3>::type volume_type; +typedef composite_dimension<length_tag,3>::type volume_type; /// composite dimension for wavenumber : L^-1 -typedef composite_dimension<length_tag,-1>::type wavenumber_type; +typedef composite_dimension<length_tag,-1>::type wavenumber_type; } // namespace units |
|
From: Matthias S. <mat...@us...> - 2007-04-03 17:12:27
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/angles In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9916/systems/angles Modified Files: degrees.hpp gradians.hpp radians.hpp Log Message: extended SI unit system to improve compliance with standard Index: gradians.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/angles/gradians.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- gradians.hpp 2 Apr 2007 03:15:14 -0000 1.4 +++ gradians.hpp 3 Apr 2007 17:12:25 -0000 1.5 @@ -55,7 +55,7 @@ //namespace angle { // //typedef unit<dimensionless_type,gradian_ns::system> dimensionless_gradian; -//typedef unit<angle_type,gradian_ns::system> gradian; ///< angle gradian unit constant +//typedef unit<plane_angle_type,gradian_ns::system> gradian; ///< angle gradian unit constant // //} // namespace gradian_ns // @@ -63,7 +63,7 @@ //BOOST_UNITS_STATIC_CONSTANT(gradians,angle::gradian); // //template<> -//struct base_unit_info<angle_tag,gradian_ns::system_tag> +//struct base_unit_info<plane_angle_tag,gradian_ns::system_tag> //{ // static std::string name() { return "gradian"; } // static std::string symbol() { return "grad"; } @@ -102,7 +102,7 @@ typedef homogeneous_system<system_tag> system; ///< gradian unit system typedef unit<dimensionless_type,system> dimensionless; -typedef unit<angle_type,system> gradian; ///< angle gradian unit constant +typedef unit<plane_angle_type,system> gradian; ///< angle gradian unit constant } // namespace gradians @@ -112,7 +112,7 @@ BOOST_UNITS_STATIC_CONSTANT(gradians,angles::gradians::gradian); template<> -struct base_unit_info<angle_tag,angles::gradians::system_tag> +struct base_unit_info<plane_angle_tag,angles::gradians::system_tag> { static std::string name() { return "gradian"; } static std::string symbol() { return "grad"; } Index: radians.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/angles/radians.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- radians.hpp 2 Apr 2007 20:12:51 -0000 1.5 +++ radians.hpp 3 Apr 2007 17:12:25 -0000 1.6 @@ -57,7 +57,7 @@ typedef homogeneous_system<system_tag> system; ///< radian unit system typedef unit<dimensionless_type,system> dimensionless; -typedef unit<angle_type,system> radian; ///< angle radian unit constant +typedef unit<plane_angle_type,system> radian; ///< angle radian unit constant } // namespace radians @@ -67,7 +67,7 @@ BOOST_UNITS_STATIC_CONSTANT(radians,angles::radians::radian); template<> -struct base_unit_info<angle_tag,angles::radians::system_tag> +struct base_unit_info<plane_angle_tag,angles::radians::system_tag> { static std::string name() { return "radian"; } static std::string symbol() { return "rad"; } Index: degrees.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/angles/degrees.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- degrees.hpp 2 Apr 2007 03:15:14 -0000 1.4 +++ degrees.hpp 3 Apr 2007 17:12:25 -0000 1.5 @@ -55,7 +55,7 @@ //namespace angle { // //typedef unit<dimensionless_type,degree_ns::system> dimensionless_degree; -//typedef unit<angle_type,degree_ns::system> degree; ///< angle degree unit constant +//typedef unit<plane_angle_type,degree_ns::system> degree; ///< angle degree unit constant // //} // namespace angle // @@ -63,7 +63,7 @@ //BOOST_UNITS_STATIC_CONSTANT(degrees,angle::degree); // //template<> -//struct base_unit_info<angle_tag,degree_ns::system_tag> +//struct base_unit_info<plane_angle_tag,degree_ns::system_tag> //{ // static std::string name() { return "degree"; } // static std::string symbol() { return "deg"; } @@ -102,7 +102,7 @@ typedef homogeneous_system<system_tag> system; ///< degree unit system typedef unit<dimensionless_type,system> dimensionless; -typedef unit<angle_type,system> degree; ///< angle degree unit constant +typedef unit<plane_angle_type,system> degree; ///< angle degree unit constant } // namespace degrees @@ -112,7 +112,7 @@ BOOST_UNITS_STATIC_CONSTANT(degrees,angles::degrees::degree); template<> -struct base_unit_info<angle_tag,angles::degrees::system_tag> +struct base_unit_info<plane_angle_tag,angles::degrees::system_tag> { static std::string name() { return "degree"; } static std::string symbol() { return "deg"; } |
|
From: Matthias S. <mat...@us...> - 2007-04-03 17:12:27
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9916/systems/conversions Modified Files: convert_degrees_to_gradians.hpp convert_radians_to_degrees.hpp convert_radians_to_gradians.hpp Log Message: extended SI unit system to improve compliance with standard Index: convert_radians_to_degrees.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions/convert_radians_to_degrees.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- convert_radians_to_degrees.hpp 2 Apr 2007 03:15:15 -0000 1.3 +++ convert_radians_to_degrees.hpp 3 Apr 2007 17:12:25 -0000 1.4 @@ -22,7 +22,7 @@ // conversions from radians to degrees template<> -struct base_unit_converter<angle_tag,angles::radians::system_tag,angles::degrees::system_tag> : +struct base_unit_converter<plane_angle_tag,angles::radians::system_tag,angles::degrees::system_tag> : #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION public implicitly_convertible, #endif Index: convert_degrees_to_gradians.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions/convert_degrees_to_gradians.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- convert_degrees_to_gradians.hpp 2 Apr 2007 03:15:15 -0000 1.3 +++ convert_degrees_to_gradians.hpp 3 Apr 2007 17:12:25 -0000 1.4 @@ -22,7 +22,7 @@ // conversions from degrees to gradians template<> -struct base_unit_converter<angle_tag,angles::degrees::system_tag,angles::gradians::system_tag> : +struct base_unit_converter<plane_angle_tag,angles::degrees::system_tag,angles::gradians::system_tag> : #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION public implicitly_convertible, #endif Index: convert_radians_to_gradians.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions/convert_radians_to_gradians.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- convert_radians_to_gradians.hpp 2 Apr 2007 03:15:15 -0000 1.3 +++ convert_radians_to_gradians.hpp 3 Apr 2007 17:12:25 -0000 1.4 @@ -22,7 +22,7 @@ // conversions from radians to gradians template<> -struct base_unit_converter<angle_tag,angles::radians::system_tag,angles::gradians::system_tag> : +struct base_unit_converter<plane_angle_tag,angles::radians::system_tag,angles::gradians::system_tag> : #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION public implicitly_convertible, #endif |
|
From: Matthias S. <mat...@us...> - 2007-04-03 17:11:41
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9831 Modified Files: acceleration.hpp base.hpp mass_density.hpp Added Files: absorbed_dose.hpp activity.hpp dose_equivalent.hpp illuminance.hpp luminous_flux.hpp luminous_intensity.hpp plane_angle.hpp solid_angle.hpp surface_density.hpp Log Message: more SI units according to official SI documents --- NEW FILE: solid_angle.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_SOLID_ANGLE_HPP #define BOOST_UNITS_SI_SOLID_ANGLE_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<solid_angle_type,SI::system> solid_angle; BOOST_UNITS_STATIC_CONSTANT(steradian,solid_angle); BOOST_UNITS_STATIC_CONSTANT(steradians,solid_angle); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_SOLID_ANGLE_HPP --- NEW FILE: surface_density.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_SURFACE_DENSITY_HPP #define BOOST_UNITS_SI_SURFACE_DENSITY_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<surface_density_type,SI::system> surface_density; BOOST_UNITS_STATIC_CONSTANT(kilogram_per_square_meter,surface_density); BOOST_UNITS_STATIC_CONSTANT(kilograms_per_square_meter,surface_density); BOOST_UNITS_STATIC_CONSTANT(kilogramme_per_square_metre,surface_density); BOOST_UNITS_STATIC_CONSTANT(kilogrammes_per_square_metre,surface_density); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_SURFACE_DENSITY_HPP Index: mass_density.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/mass_density.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- mass_density.hpp 16 Mar 2007 18:12:46 -0000 1.1.1.1 +++ mass_density.hpp 3 Apr 2007 17:11:40 -0000 1.2 @@ -21,6 +21,11 @@ typedef unit<mass_density_type,SI::system> mass_density; +BOOST_UNITS_STATIC_CONSTANT(kilogram_per_cubic_meter,mass_density); +BOOST_UNITS_STATIC_CONSTANT(kilograms_per_cubic_meter,mass_density); +BOOST_UNITS_STATIC_CONSTANT(kilogramme_per_cubic_metre,mass_density); +BOOST_UNITS_STATIC_CONSTANT(kilogrammes_per_cubic_metre,mass_density); + } // namespace SI } // namespace units --- NEW FILE: dose_equivalent.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_DOSE_EQUIVALENT_HPP #define BOOST_UNITS_SI_DOSE_EQUIVALENT_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<dose_equivalent_type,SI::system> dose_equivalent; BOOST_UNITS_STATIC_CONSTANT(sievert,dose_equivalent); BOOST_UNITS_STATIC_CONSTANT(sieverts,dose_equivalent); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_DOSE_EQUIVALENT_HPP --- NEW FILE: luminous_intensity.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_LUMINOUS_INTENSITY_HPP #define BOOST_UNITS_SI_LUMINOUS_INTENSITY_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<luminous_intensity_type,SI::system> luminous_intensity; BOOST_UNITS_STATIC_CONSTANT(candela,luminous_intensity); BOOST_UNITS_STATIC_CONSTANT(candelas,luminous_intensity); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_LUMINOUS_INTENSITY_HPP --- NEW FILE: illuminance.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_ILLUMINANCE_HPP #define BOOST_UNITS_SI_ILLUMINANCE_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<illuminance_type,SI::system> illuminance; BOOST_UNITS_STATIC_CONSTANT(lux,illuminance); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_ILLUMINANCE_HPP --- NEW FILE: absorbed_dose.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_ABSORBED_DOSE_HPP #define BOOST_UNITS_SI_ABSORBED_DOSE_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<absorbed_dose_type,SI::system> absorbed_dose; BOOST_UNITS_STATIC_CONSTANT(gray,absorbed_dose); BOOST_UNITS_STATIC_CONSTANT(grays,absorbed_dose); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_ABSORBED_DOSE_HPP --- NEW FILE: activity.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_ACTIVITY_HPP #define BOOST_UNITS_SI_ACTIVITY_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<activity_type,SI::system> activity; BOOST_UNITS_STATIC_CONSTANT(becquerel,activity); BOOST_UNITS_STATIC_CONSTANT(becquerels,activity); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_ACTIVITY_HPP Index: acceleration.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/acceleration.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- acceleration.hpp 16 Mar 2007 18:12:45 -0000 1.1.1.1 +++ acceleration.hpp 3 Apr 2007 17:11:39 -0000 1.2 @@ -21,6 +21,11 @@ typedef unit<acceleration_type,SI::system> acceleration; +BOOST_UNITS_STATIC_CONSTANT(meter_per_second_squared,acceleration); +BOOST_UNITS_STATIC_CONSTANT(meters_per_second_squared,acceleration); +BOOST_UNITS_STATIC_CONSTANT(metre_per_second_squared,acceleration); +BOOST_UNITS_STATIC_CONSTANT(metres_per_second_squared,acceleration); + } // namespace SI } // namespace units --- NEW FILE: plane_angle.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_PLANE_ANGLE_HPP #define BOOST_UNITS_SI_PLANE_ANGLE_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<plane_angle_type,SI::system> plane_angle; BOOST_UNITS_STATIC_CONSTANT(radian,plane_angle); BOOST_UNITS_STATIC_CONSTANT(radians,plane_angle); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_PLANE_ANGLE_HPP Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/base.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- base.hpp 31 Mar 2007 01:17:17 -0000 1.4 +++ base.hpp 3 Apr 2007 17:11:40 -0000 1.5 @@ -96,6 +96,13 @@ static std::string name() { return "mole"; } static std::string symbol() { return "mol"; } }; + +template<> +struct base_unit_info<luminous_intensity_tag,SI::system_tag> +{ + static std::string name() { return "candela"; } + static std::string symbol() { return "cd"; } +}; } // namespace units --- NEW FILE: luminous_flux.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_LUMINOUS_FLUX_HPP #define BOOST_UNITS_SI_LUMINOUS_FLUX_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<luminous_flux_type,SI::system> luminous_flux; BOOST_UNITS_STATIC_CONSTANT(lumen,luminous_flux); BOOST_UNITS_STATIC_CONSTANT(lumens,luminous_flux); } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_LUMINOUS_FLUX_HPP |
|
From: Matthias S. <mat...@us...> - 2007-04-03 15:58:38
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11885/si Added Files: dynamic_viscosity.hpp kinematic_viscosity.hpp Removed Files: viscosity.hpp Log Message: corrected viscosity units --- NEW FILE: dynamic_viscosity.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_DYNAMIC_VISCOSITY_HPP #define BOOST_UNITS_SI_DYNAMIC_VISCOSITY_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<dynamic_viscosity_type,SI::system> dynamic_viscosity; } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_DYNAMIC_VISCOSITY_HPP --- NEW FILE: kinematic_viscosity.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_SI_KINEMATIC_VISCOSITY_HPP #define BOOST_UNITS_SI_KINEMATIC_VISCOSITY_HPP #include <boost/units/systems/si/base.hpp> namespace boost { namespace units { namespace SI { typedef unit<kinematic_viscosity_type,SI::system> kinematic_viscosity; } // namespace SI } // namespace units } // namespace boost #endif // BOOST_UNITS_SI_KINEMATIC_VISCOSITY_HPP --- viscosity.hpp DELETED --- |
|
From: Matthias S. <mat...@us...> - 2007-04-03 15:58:37
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/cgs In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11885/cgs Added Files: dynamic_viscosity.hpp kinematic_viscosity.hpp Removed Files: viscosity.hpp Log Message: corrected viscosity units --- NEW FILE: dynamic_viscosity.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_CGS_DYNAMIC_VISCOSITY_HPP #define BOOST_UNITS_CGS_DYNAMIC_VISCOSITY_HPP #include <boost/units/systems/cgs/base.hpp> namespace boost { namespace units { namespace CGS { typedef unit<dynamic_viscosity_type,CGS::system> dynamic_viscosity; BOOST_UNITS_STATIC_CONSTANT(poise,dynamic_viscosity); } // namespace CGS } // namespace units } // namespace boost #endif // BOOST_UNITS_CGS_DYNAMIC_VISCOSITY_HPP --- NEW FILE: kinematic_viscosity.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_CGS_KINEMATIC_VISCOSITY_HPP #define BOOST_UNITS_CGS_KINEMATIC_VISCOSITY_HPP #include <boost/units/systems/cgs/base.hpp> namespace boost { namespace units { namespace CGS { typedef unit<kinematic_viscosity_type,CGS::system> kinematic_viscosity; BOOST_UNITS_STATIC_CONSTANT(stoke,kinematic_viscosity); BOOST_UNITS_STATIC_CONSTANT(stokes,kinematic_viscosity); } // namespace CGS } // namespace units } // namespace boost #endif // BOOST_UNITS_CGS_KINEMATIC_VISCOSITY_HPP --- viscosity.hpp DELETED --- |
|
From: Matthias S. <mat...@us...> - 2007-04-03 14:54:30
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16315 Modified Files: measurement.hpp quantity.hpp Log Message: minor update Index: measurement.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/measurement.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- measurement.hpp 2 Apr 2007 23:26:24 -0000 1.5 +++ measurement.hpp 3 Apr 2007 14:54:27 -0000 1.6 @@ -37,8 +37,9 @@ class measurement { public: - typedef measurement<Y> this_type; - typedef Y value_type; + typedef measurement<Y> this_type; + typedef Y value_type; + typedef numeric::interval<value_type> interval_type; measurement(const value_type& val = value_type(), const value_type& err = value_type()) : @@ -70,7 +71,7 @@ value_type lower_bound() const { return value_-uncertainty_; } value_type upper_bound() const { return value_+uncertainty_; } - interval<value_type> get_interval() const { return interval<value_type>(lower_bound(),upper_bound()); } + interval_type get_interval() const { return interval_type(lower_bound(),upper_bound()); } this_type& operator+=(const value_type& val) { Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- quantity.hpp 29 Mar 2007 22:43:48 -0000 1.9 +++ quantity.hpp 3 Apr 2007 14:54:27 -0000 1.10 @@ -261,83 +261,6 @@ return const_cast<Y&>(q.value()); } -/// swap quantities -template<class Unit,class Y> -inline void swap(quantity<Unit,Y>& lhs, quantity<Unit,Y>& rhs) -{ - using std::swap; - swap(quantity_reinterpret_cast<Y&>(lhs),quantity_reinterpret_cast<Y&>(rhs)); -} - -/// utility class to simplify construction of dimensionless quantities -template<class System,class Y> -struct dimensionless_quantity -{ - typedef quantity<typename dimensionless_unit<System>::type,Y> type; -}; - -/// check that a type is a quantity -template<typename T> -struct is_quantity : - public mpl::false_ -{ }; - -template<class Unit, - class Y> -struct is_quantity< quantity<Unit,Y> > : - public mpl::true_ -{ }; - -/// check that a type is a quantity in a specified system -template<class T,class System> -struct is_quantity_of_system : - public mpl::false_ -{ }; - -template<class Dim, - class System, - class Y> -struct is_quantity_of_system< quantity< unit<Dim,System>,Y>,System > : - public mpl::true_ -{ }; - -/// check that a type is a quantity of the specified dimension -template<class T,class Dim> -struct is_quantity_of_dimension : - public mpl::false_ -{ }; - -template<class Dim,class System,class Y> -struct is_quantity_of_dimension< quantity< unit<Dim,System>,Y>,Dim > : - public mpl::true_ -{ }; - -/// check that a type is dimensionless -template<class System,class Y> -struct is_dimensionless< quantity<unit<dimensionless_type,System>,Y> > : - public mpl::true_ -{ }; - -/// check that a type is a dimensionless quantity -template<class T> -struct is_dimensionless_quantity : - public is_quantity_of_dimension<T,dimensionless_type> -{ }; - -/// get dimension -template<class Unit,class Y> -struct get_dimension< quantity<Unit,Y> > -{ - typedef typename get_dimension<Unit>::type type; -}; - -/// get system -template<class Unit,class Y> -struct get_system< quantity<Unit,Y> > -{ - typedef typename get_system<Unit>::type type; -}; - /// helper class for quantity_cast template<class X,class Y> struct quantity_cast_helper; @@ -427,6 +350,7 @@ return qch(source); } + template<class X,class Y> inline typename quantity_cast_helper<X,const Y>::type @@ -437,6 +361,83 @@ return qch(source); } +/// swap quantities +template<class Unit,class Y> +inline void swap(quantity<Unit,Y>& lhs, quantity<Unit,Y>& rhs) +{ + using std::swap; + swap(quantity_reinterpret_cast<Y&>(lhs),quantity_reinterpret_cast<Y&>(rhs)); +} + +/// utility class to simplify construction of dimensionless quantities +template<class System,class Y> +struct dimensionless_quantity +{ + typedef quantity<typename dimensionless_unit<System>::type,Y> type; +}; + +/// check that a type is a quantity +template<typename T> +struct is_quantity : + public mpl::false_ +{ }; + +template<class Unit, + class Y> +struct is_quantity< quantity<Unit,Y> > : + public mpl::true_ +{ }; + +/// check that a type is a quantity in a specified system +template<class T,class System> +struct is_quantity_of_system : + public mpl::false_ +{ }; + +template<class Dim, + class System, + class Y> +struct is_quantity_of_system< quantity< unit<Dim,System>,Y>,System > : + public mpl::true_ +{ }; + +/// check that a type is a quantity of the specified dimension +template<class T,class Dim> +struct is_quantity_of_dimension : + public mpl::false_ +{ }; + +template<class Dim,class System,class Y> +struct is_quantity_of_dimension< quantity< unit<Dim,System>,Y>,Dim > : + public mpl::true_ +{ }; + +/// check that a type is dimensionless +template<class System,class Y> +struct is_dimensionless< quantity<unit<dimensionless_type,System>,Y> > : + public mpl::true_ +{ }; + +/// check that a type is a dimensionless quantity +template<class T> +struct is_dimensionless_quantity : + public is_quantity_of_dimension<T,dimensionless_type> +{ }; + +/// get dimension +template<class Unit,class Y> +struct get_dimension< quantity<Unit,Y> > +{ + typedef typename get_dimension<Unit>::type type; +}; + +/// get system +template<class Unit,class Y> +struct get_system< quantity<Unit,Y> > +{ + typedef typename get_system<Unit>::type type; +}; + /// specialize unary plus typeof helper template<class Unit,class Y> struct unary_plus_typeof_helper< quantity<Unit,Y> > |
|
From: Matthias S. <mat...@us...> - 2007-04-03 14:51:25
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15810 Added Files: unit_example_19.cpp Log Message: update --- NEW FILE: unit_example_19.cpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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) /** \file \brief unit_example_19.cpp \detailed CODATA physical constants. Output: @verbatim //[unit_example_19_output CODATA physical constants: Universal constants: c : 2.9979245800000e+08 (exact) m s^(-1) mu_0 : 1.2566370614359e-06 (exact) m kg s^(-2) A^(-2) epsilon_0 : 8.8541878176204e-12 (exact) m^(-3) kg^(-1) s^4 A^2 Z_0 : 3.7673031346177e+02 (exact) m^2 kg s^(-3) A^(-2) G : 6.6742800000000e-11 (rel. unc. = 1.0e-04) m^3 kg^(-1) s^(-2) h : 6.6260689600000e-34 (rel. unc. = 5.0e-08) m^2 kg s^(-1) hbar : 1.0545716280000e-34 (rel. unc. = 5.0e-08) m^2 kg s^(-1) m_P : 2.1764400000000e-08 (rel. unc. = 5.1e-05) kg T_P : 1.4167850000000e+32 (rel. unc. = 5.0e-05) K l_P : 1.6162520000000e-35 (rel. unc. = 5.0e-05) m t_P : 5.3912400000000e-44 (rel. unc. = 5.0e-05) s Electromagnetic constants: e : 1.6021764870000e-19 (rel. unc. = 2.5e-08) s A e/h : 2.4179894540000e+14 (rel. unc. = 2.5e-08) m^(-2) kg^(-1) s^2 A Phi_0 : 2.0678336670000e-15 (rel. unc. = 2.5e-08) m^2 kg s^(-2) A^(-1) G_0 : 7.7480917004000e-05 (rel. unc. = 6.8e-10) m^(-2) kg^(-1) s^3 A^2 K_J : 4.8359789100000e+14 (rel. unc. = 2.5e-08) m^(-2) kg^(-1) s^2 A R_K : 2.5812807557000e+04 (rel. unc. = 6.9e-10) m^2 kg s^(-3) A^(-2) mu_B : 9.2740091500000e-24 (rel. unc. = 2.5e-08) m^2 A mu_N : 5.0507832400000e-27 (rel. unc. = 2.6e-08) m^2 A Physico-chemical constants: N_A : 6.0221417900000e+23 (rel. unc. = 5.0e-08) mol^(-1) m_u : 1.6605387820000e-27 (rel. unc. = 5.0e-08) kg F : 9.6485339900000e+04 (rel. unc. = 2.5e-08) s A mol^(-1) R : 8.3144720000000e+00 (rel. unc. = 1.8e-06) m^2 kg s^(-2) K^(-1) mol^(-1) k_B : 1.3806504000000e-23 (rel. unc. = 1.7e-06) m^2 kg s^(-2) K^(-1) V_m : 2.2413996000000e-02 (rel. unc. = 1.7e-06) m^3 mol^(-1) sigma_SB : 5.6704000000000e-08 (rel. unc. = 7.1e-06) kg s^(-3) K^(-4) c_1 : 3.7417711800000e-16 (rel. unc. = 5.1e-08) m^4 kg s^(-3) c_2 : 1.4387752000000e-02 (rel. unc. = 1.7e-06) m K b : 2.8977685000000e-03 (rel. unc. = 1.8e-06) m K Atomic and nuclear constants: alpha : 7.2973525376000e-03 (rel. unc. = 6.9e-10) dimensionless R_infinity : 1.0973731568527e+07 (rel. unc. = 6.7e-12) m^(-1) a_0 : 5.2917720859000e-11 (rel. unc. = 6.8e-10) m E_h : 4.3597439400000e-18 (rel. unc. = 5.0e-08) m^2 kg s^(-2) electron: <<<<<<< unit_example_19.cpp m_e : 9.10938e-31 kg m_e/m_mu : 0.00483633 dimensionless m_e/m_tau : 0.000287564 dimensionless m_e/m_p : 0.000544617 dimensionless m_e/m_n : 0.000543867 dimensionless m_e/m_d : 0.000272444 dimensionless m_e/m_alpha : 0.000137093 dimensionless e/m_e : 1.75882e+11 kg^(-1) s A M_e : 5.4858e-07 kg mol^(-1) lambda_C : 2.42631e-12 m r_e : 2.81794e-15 m sigma_e : 6.65246e-29 m^2 mu_e : -9.28476e-24 m^2 A a_e : 0.00115965 dimensionless g_e : -2.00232 dimensionless mu_e/mu_mu : 206.767 dimensionless mu_e/mu_p : -658.211 dimensionless mu_e/mu_p' : -658.228 dimensionless mu_e/mu_n : 960.92 dimensionless mu_e/mu_d : -2143.92 dimensionless mu_e/mu_hp : 864.058 dimensionless gamma_e : 1.76086 kg^(-1) s A ======= m_e : 9.1093821500000e-31 (rel. unc. = 4.9e-08) kg m_e/m_mu : 4.8363317100000e-03 (rel. unc. = 2.5e-08) dimensionless m_e/m_tau : 2.8756400000000e-04 (rel. unc. = 1.6e-04) dimensionless m_e/m_p : 5.4461702177000e-04 (rel. unc. = 4.4e-10) dimensionless m_e/m_n : 5.4386734459000e-04 (rel. unc. = 6.1e-10) dimensionless m_e/m_d : 2.7244371093000e-04 (rel. unc. = 4.4e-10) dimensionless m_e/m_alpha : 1.3709335557000e-04 (rel. unc. = 4.2e-10) dimensionless e/m_e : 1.7588201500000e+11 (rel. unc. = 2.5e-08) kg^(-1) s A M_e : 5.4857990943000e-07 (rel. unc. = 4.2e-10) kg mol^(-1) lambda_C : 2.4263102175000e-12 (rel. unc. = 1.4e-09) m r_e : 2.8179402894000e-15 (rel. unc. = 2.1e-09) m sigma_e : 6.6524585580000e-29 (rel. unc. = 4.1e-09) m^2 mu_e : -9.2847637700000e-24 (rel. unc. = 2.5e-08) m^2 A a_e : 1.1596521811100e-03 (rel. unc. = 6.4e-10) dimensionless g_e : -2.0023193043622e+00 (rel. unc. = 7.5e-13) dimensionless mu_e/mu_mu : 2.0676698770000e+02 (rel. unc. = 2.5e-08) dimensionless mu_e/mu_p : -6.5821068480000e+02 (rel. unc. = 8.2e-09) dimensionless mu_e/mu_pp : -6.5822759710000e+02 (rel. unc. = 1.1e-08) dimensionless mu_e/mu_n : 9.6092050000000e+02 (rel. unc. = 2.4e-07) dimensionless mu_e/mu_d : -2.1439234980000e+03 (rel. unc. = 8.4e-09) dimensionless mu_e/mu_hp : 8.6405825700000e+02 (rel. unc. = 1.2e-08) dimensionless gamma_e : 1.7608597700000e+11 (rel. unc. = 2.5e-08) kg^(-1) s A >>>>>>> 1.4 muon: m_mu : 1.8835313000000e-28 (rel. unc. = 5.8e-08) kg m_mu/m_e : 2.0676828230000e+02 (rel. unc. = 2.5e-08) dimensionless m_mu/m_tau : 5.9459200000000e-02 (rel. unc. = 1.6e-04) dimensionless m_mu/m_p : 1.1260952610000e-01 (rel. unc. = 2.6e-08) dimensionless m_mu/m_n : 1.1245451670000e-01 (rel. unc. = 2.6e-08) dimensionless M_mu : 1.1342892560000e-04 (rel. unc. = 2.6e-08) kg mol^(-1) lambda_C_mu : 1.1734441040000e-14 (rel. unc. = 2.6e-08) m mu_mu : -4.4904478600000e-26 (rel. unc. = 3.6e-08) m^2 A a_mu : 1.1659206900000e-03 (rel. unc. = 5.1e-07) dimensionless g_mu : -2.0023318414000e+00 (rel. unc. = 6.0e-10) dimensionless mu_mu/mu_p : -3.1833451370000e+00 (rel. unc. = 2.7e-08) dimensionless tau: m_tau : 3.1677700000000e-27 (rel. unc. = 1.6e-04) kg m_tau/m_e : 3.4774800000000e+03 (rel. unc. = 1.6e-04) dimensionless m_tau/m_mu : 1.6818300000000e+01 (rel. unc. = 1.6e-04) dimensionless m_tau/m_p : 1.8939000000000e+00 (rel. unc. = 1.6e-04) dimensionless m_tau/m_n : 1.8912900000000e+00 (rel. unc. = 1.6e-04) dimensionless M_tau : 1.9076800000000e-03 (rel. unc. = 1.6e-04) kg mol^(-1) lambda_C_tau: 6.9772000000000e-16 (rel. unc. = 1.6e-04) m proton: <<<<<<< unit_example_19.cpp m_p : 1.67262e-27 kg m_p/m_e : 1836.15 dimensionless m_p/m_mu : 8.88024 dimensionless m_p/m_tau : 0.528012 dimensionless m_p/m_n : 0.998623 dimensionless e/m_p : 9.57883e+07 kg^(-1) s A M_p : 0.00100728 kg mol^(-1) R_p : 8.75e-16 m mu_p : 1.41061e-26 m^2 A g_p : 5.58569 dimensionless mu_p/mu_n : -1.4599 dimensionless mu_p' : 1.41057e-26 m^2 A gamma_p : 2.67522e+08 kg^(-1) s A gamma_p' : 2.67515e+08 kg^(-1) s A ======= m_p : 1.6726216370000e-27 (rel. unc. = 5.0e-08) kg m_p/m_e : 1.8361526724700e+03 (rel. unc. = 4.4e-10) dimensionless m_p/m_mu : 8.8802433900000e+00 (rel. unc. = 2.6e-08) dimensionless m_p/m_tau : 5.2801200000000e-01 (rel. unc. = 1.6e-04) dimensionless m_p/m_n : 9.9862347824000e-01 (rel. unc. = 4.6e-10) dimensionless e/m_p : 9.5788339200000e+07 (rel. unc. = 2.5e-08) kg^(-1) s A M_p : 1.0072764667700e-03 (rel. unc. = 9.9e-11) kg mol^(-1) R_p : 8.7680000000000e-16 (rel. unc. = 7.9e-03) m mu_p : 1.4106066620000e-26 (rel. unc. = 2.6e-08) m^2 A g_p : 5.5856947130000e+00 (rel. unc. = 8.2e-09) dimensionless mu_p/mu_n : -1.4598980600000e+00 (rel. unc. = 2.3e-07) dimensionless mu_pp : 1.4105704190000e-26 (rel. unc. = 2.7e-08) m^2 A gamma_p : 2.6752220990000e+08 (rel. unc. = 2.6e-08) kg^(-1) s A gamma_pp : 2.6751533620000e+08 (rel. unc. = 2.7e-08) kg^(-1) s A >>>>>>> 1.4 neutron: <<<<<<< unit_example_19.cpp m_n : 1.67493e-27 kg m_n/m_e : 1838.68 dimensionless m_n/m_mu : 8.89248 dimensionless m_n/m_tau : 0.52874 dimensionless m_n/m_p : 1.00138 dimensionless lambda_C_n : 1.31959e-15 m M_n : 0.00100866 kg mol^(-1) mu_n : -9.66236e-27 m^2 A g_n : -3.82609 dimensionless mu_n/mu_p : -0.684979 dimensionless mu_n/mu_p' : -0.684997 dimensionless gamma_n : 1.83247e+08 kg^(-1) s A ======= m_n : 1.6749272110000e-27 (rel. unc. = 5.0e-08) kg m_n/m_e : 1.8386836605000e+03 (rel. unc. = 6.0e-10) dimensionless m_n/m_mu : 8.8924840900000e+00 (rel. unc. = 2.6e-08) dimensionless m_n/m_tau : 5.2874000000000e-01 (rel. unc. = 1.6e-04) dimensionless m_n/m_p : 1.0013784191800e+00 (rel. unc. = 4.6e-10) dimensionless lambda_C_n : 1.3195908951000e-15 (rel. unc. = 1.5e-09) m M_n : 1.0086649159700e-03 (rel. unc. = 4.3e-10) kg mol^(-1) mu_n : -9.6623641000000e-27 (rel. unc. = 2.4e-07) m^2 A g_n : -3.8260854500000e+00 (rel. unc. = 2.4e-07) dimensionless mu_n/mu_p : -6.8497934000000e-01 (rel. unc. = 2.3e-07) dimensionless mu_n/mu_pp : -6.8499694000000e-01 (rel. unc. = 2.3e-07) dimensionless gamma_n : 1.8324718500000e+08 (rel. unc. = 2.3e-07) kg^(-1) s A >>>>>>> 1.4 deuteron: m_d : 3.3435832000000e-27 (rel. unc. = 5.1e-08) kg m_d/m_e : 3.6704829654000e+03 (rel. unc. = 4.4e-10) dimensionless m_d/m_p : 1.9990075010800e+00 (rel. unc. = 1.1e-10) dimensionless M_d : 2.0135532127240e-03 (rel. unc. = 3.9e-11) kg mol^(-1) R_d : 2.1402000000000e-15 (rel. unc. = 1.3e-03) m mu_d : 4.3307346500000e-27 (rel. unc. = 2.5e-08) m^2 A mu_d/mu_e : -4.6643455370000e-04 (rel. unc. = 8.4e-09) dimensionless mu_d/mu_p : 3.0701220700000e-01 (rel. unc. = 7.8e-09) dimensionless mu_d/mu_n : -4.4820652000000e-01 (rel. unc. = 2.5e-07) dimensionless helion: m_h : 5.0064119200000e-27 (rel. unc. = 5.0e-08) kg alpha particle: m_alpha : 6.6446562000000e-27 (rel. unc. = 5.0e-08) kg //] @endverbatim **/ #include <iostream> #include <boost/units/io.hpp> #include <boost/units/systems/si.hpp> #include <boost/units/systems/si/constants.hpp> #if BOOST_UNITS_HAS_TYPEOF int main() { using namespace boost::units::SI::constants::CODATA; std::cout << "CODATA physical constants:" << std::endl; std::cout << std::endl << "Universal constants: " << std::endl << std::endl << "c :\t" << c << std::endl << "mu_0 :\t" << mu_0 << std::endl << "epsilon_0 :\t" << epsilon_0 << std::endl << "Z_0 :\t" << Z_0 << std::endl << "G :\t" << G << std::endl << "h :\t" << h << std::endl << "hbar :\t" << hbar << std::endl << "m_P :\t" << m_P << std::endl << "T_P :\t" << T_P << std::endl << "l_P :\t" << l_P << std::endl << "t_P :\t" << t_P << std::endl << std::endl << "Electromagnetic constants: " << std::endl << std::endl << "e :\t" << e << std::endl << "e/h :\t" << e_over_h << std::endl << "Phi_0 :\t" << Phi_0 << std::endl << "G_0 :\t" << G_0 << std::endl << "K_J :\t" << K_J << std::endl << "R_K :\t" << R_K << std::endl << "mu_B :\t" << mu_B << std::endl << "mu_N :\t" << mu_N << std::endl << std::endl << "Physico-chemical constants: " << std::endl << std::endl << "N_A :\t" << N_A << std::endl << "m_u :\t" << m_u << std::endl << "F :\t" << F << std::endl << "R :\t" << R << std::endl << "k_B :\t" << k_B << std::endl << "V_m :\t" << V_m << std::endl << "sigma_SB :\t" << sigma_SB << std::endl << "c_1 :\t" << c_1 << std::endl << "c_2 :\t" << c_2 << std::endl << "b :\t" << b << std::endl << std::endl << "Atomic and nuclear constants: " << std::endl << std::endl << "alpha :\t" << alpha << std::endl << "R_infinity :\t" << R_infinity << std::endl << "a_0 :\t" << a_0 << std::endl << "E_h :\t" << E_h << std::endl << std::endl << " electron: " << std::endl << std::endl << "m_e :\t" << m_e << std::endl << "m_e/m_mu :\t" << m_e_over_m_mu << std::endl << "m_e/m_tau :\t" << m_e_over_m_tau << std::endl << "m_e/m_p :\t" << m_e_over_m_p << std::endl << "m_e/m_n :\t" << m_e_over_m_n << std::endl << "m_e/m_d :\t" << m_e_over_m_d << std::endl << "m_e/m_alpha :\t" << m_e_over_m_alpha << std::endl << "e/m_e :\t" << e_over_m_e << std::endl << "M_e :\t" << M_e << std::endl << "lambda_C :\t" << lambda_C << std::endl << "r_e :\t" << r_e << std::endl << "sigma_e :\t" << sigma_e << std::endl << "mu_e :\t" << mu_e << std::endl << "mu_e/mu_B :\t" << mu_e_over_mu_B << std::endl << "mu_e/mu_N :\t" << mu_e_over_mu_N << std::endl << "a_e :\t" << a_e << std::endl << "g_e :\t" << g_e << std::endl << "mu_e/mu_mu :\t" << mu_e_over_mu_mu << std::endl << "mu_e/mu_p :\t" << mu_e_over_mu_p << std::endl << "mu_e/mu_p' :\t" << mu_e_over_mu_p_prime << std::endl << "mu_e/mu_n :\t" << mu_e_over_mu_n << std::endl << "mu_e/mu_d :\t" << mu_e_over_mu_d << std::endl << "mu_e/mu_hp :\t" << mu_e_over_mu_h_prime << std::endl << "gamma_e :\t" << gamma_e << std::endl << std::endl << " muon: " << std::endl << std::endl << "m_mu :\t" << m_mu << std::endl << "m_mu/m_e :\t" << m_mu_over_m_e << std::endl << "m_mu/m_tau :\t" << m_mu_over_m_tau << std::endl << "m_mu/m_p :\t" << m_mu_over_m_p << std::endl << "m_mu/m_n :\t" << m_mu_over_m_n << std::endl << "M_mu :\t" << M_mu << std::endl << "lambda_C_mu :\t" << lambda_C_mu << std::endl << "mu_mu :\t" << mu_mu << std::endl << "a_mu :\t" << a_mu << std::endl << "g_mu :\t" << g_mu << std::endl << "mu_mu/mu_p :\t" << mu_mu_over_mu_p << std::endl << std::endl << " tau: " << std::endl << std::endl << "m_tau :\t" << m_tau << std::endl << "m_tau/m_e :\t" << m_tau_over_m_e << std::endl << "m_tau/m_mu :\t" << m_tau_over_m_mu << std::endl << "m_tau/m_p :\t" << m_tau_over_m_p << std::endl << "m_tau/m_n :\t" << m_tau_over_m_n << std::endl << "M_tau :\t" << M_tau << std::endl << "lambda_C_tau:\t" << lambda_C_tau << std::endl << std::endl << " proton: " << std::endl << std::endl << "m_p :\t" << m_p << std::endl << "m_p/m_e :\t" << m_p_over_m_e << std::endl << "m_p/m_mu :\t" << m_p_over_m_mu << std::endl << "m_p/m_tau :\t" << m_p_over_m_tau << std::endl << "m_p/m_n :\t" << m_p_over_m_n << std::endl << "e/m_p :\t" << e_over_m_p << std::endl << "M_p :\t" << M_p << std::endl << "R_p :\t" << R_p << std::endl << "mu_p :\t" << mu_p << std::endl << "g_p :\t" << g_p << std::endl << "mu_p/mu_n :\t" << mu_p_over_mu_n << std::endl << "mu_p' :\t" << mu_p_prime << std::endl << "gamma_p :\t" << gamma_p << std::endl << "gamma_p' :\t" << gamma_p_prime << std::endl << std::endl << " neutron: " << std::endl << std::endl << "m_n :\t" << m_n << std::endl << "m_n/m_e :\t" << m_n_over_m_e << std::endl << "m_n/m_mu :\t" << m_n_over_m_mu << std::endl << "m_n/m_tau :\t" << m_n_over_m_tau << std::endl << "m_n/m_p :\t" << m_n_over_m_p << std::endl << "lambda_C_n :\t" << lambda_C_n << std::endl << "M_n :\t" << M_n << std::endl << "mu_n :\t" << mu_n << std::endl << "g_n :\t" << g_n << std::endl << "mu_n/mu_p :\t" << mu_n_over_mu_p << std::endl << "mu_n/mu_p' :\t" << mu_n_over_mu_p_prime << std::endl << "gamma_n :\t" << gamma_n << std::endl << std::endl << " deuteron: " << std::endl << std::endl << "m_d :\t" << m_d << std::endl << "m_d/m_e :\t" << m_d_over_m_e << std::endl << "m_d/m_p :\t" << m_d_over_m_p << std::endl << "M_d :\t" << M_d << std::endl << "R_d :\t" << R_d << std::endl << "mu_d :\t" << mu_d << std::endl << "mu_d/mu_e :\t" << mu_d_over_mu_e << std::endl << "mu_d/mu_p :\t" << mu_d_over_mu_p << std::endl << "mu_d/mu_n :\t" << mu_d_over_mu_n << std::endl << std::endl << " helion: " << std::endl << std::endl << "m_h :\t" << m_h << std::endl << std::endl << " alpha particle: " << std::endl << std::endl << "m_alpha :\t" << m_alpha << std::endl << std::endl; return 0; } #else int main(void) { std::cout << "No typeof enabled" << std::endl; return 0; } #endif // BOOST_UNITS_HAS_TYPEOF |
|
From: Matthias S. <mat...@us...> - 2007-04-03 14:50:25
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15449 Modified Files: unit_example_10.cpp unit_example_22.cpp unit_example_4.cpp Removed Files: unit_example_19.cpp Log Message: update examples Index: unit_example_10.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_10.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- unit_example_10.cpp 2 Apr 2007 21:28:40 -0000 1.4 +++ unit_example_10.cpp 3 Apr 2007 14:50:19 -0000 1.5 @@ -88,8 +88,8 @@ /// test cos { quantity<angles::degrees::dimensionless> cos_thetad(cos(thetad)); - quantity<angles::gradians::dimensionless> cos_thetag(cos(thetag)); - quantity<angles::radians::dimensionless> cos_thetar(cos(thetar)); + quantity<angles::gradians::dimensionless> cos_thetag(cos(thetag)); + quantity<angles::radians::dimensionless> cos_thetar(cos(thetar)); sstream1 << "thetad = " << thetad << std::endl << "thetag = " << thetag << std::endl @@ -106,9 +106,9 @@ /// test sin { - quantity<angles::degrees::dimensionless> sin_thetad(sin(thetad)); - quantity<angles::gradians::dimensionless> sin_thetag(sin(thetag)); - quantity<angles::radians::dimensionless> sin_thetar(sin(thetar)); + quantity<angles::degrees::dimensionless> sin_thetad(sin(thetad)); + quantity<angles::gradians::dimensionless> sin_thetag(sin(thetag)); + quantity<angles::radians::dimensionless> sin_thetar(sin(thetar)); sstream1 << "thetad = " << thetad << std::endl << "thetag = " << thetag << std::endl Index: unit_example_22.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_22.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- unit_example_22.cpp 2 Apr 2007 23:26:06 -0000 1.4 +++ unit_example_22.cpp 3 Apr 2007 14:50:19 -0000 1.5 @@ -181,6 +181,53 @@ } */ /* +//// main.cpp +//// +//// Copyright (c) 2007 +//// Steven Watanabe +//// +//// Disributed 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) + +#define BOOST_NO_SFINAE + +#include <boost/units/quantity.hpp> +#include <boost/units/systems/si.hpp> + +#include <iostream> + +using namespace boost::units; + +namespace boost { namespace units { + +template<int N> +struct f { + typedef typename composite_dimension<length_tag, (1<<N) >::type dim1; + typedef typename composite_dimension<mass_tag, (1<<N) >::type dim2; + template<class T> + static void apply(const T& t) { + f<N - 1>::apply(t * unit<dim1, SI::system>()); + f<N - 1>::apply(t * unit<dim2, SI::system>()); + } +}; +template<> +struct f<0> { + template<class T> + static void apply(const T&) { + } +}; + +} } + +int main() +{ + f<7>::apply(1.0 * SI::meters); + f<7>::apply(1.0 * SI::kilograms); + return(0); +} +*/ + #include <iostream> #include <boost/units/io.hpp> #include <boost/units/systems/si.hpp> @@ -205,7 +252,8 @@ return 0; } -*/ + +/* #include <iostream> #include <boost/units/io.hpp> @@ -299,7 +347,7 @@ return 0; } - +*/ Index: unit_example_4.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_4.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- unit_example_4.cpp 2 Apr 2007 21:28:40 -0000 1.4 +++ unit_example_4.cpp 3 Apr 2007 14:50:19 -0000 1.5 @@ -372,9 +372,9 @@ //[unit_example_4_snippet_6 /// test trig stuff - quantity<angle::radian> theta = 0.375*radians; - quantity<angle::dimensionless_radian> sin_theta = sin(theta); - quantity<angle::radian> thetap = asin(sin_theta); + quantity<angles::radians::radian> theta = 0.375*radians; + quantity<angles::radians::dimensionless> sin_theta = sin(theta); + quantity<angles::radians::radian> thetap = asin(sin_theta); //] sstream1 << "theta = " << theta << std::endl --- unit_example_19.cpp DELETED --- |
|
From: Matthias S. <mat...@us...> - 2007-04-02 23:26:25
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21355 Modified Files: measurement.hpp Log Message: minor update Index: measurement.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/measurement.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- measurement.hpp 31 Mar 2007 01:17:16 -0000 1.4 +++ measurement.hpp 2 Apr 2007 23:26:24 -0000 1.5 @@ -16,6 +16,7 @@ #include <iomanip> #include <iostream> +#include <boost/numeric/interval.hpp> #include <boost/units/static_rational.hpp> namespace boost { @@ -66,6 +67,10 @@ value_type value() const { return value_; } value_type uncertainty() const { return uncertainty_; } + value_type lower_bound() const { return value_-uncertainty_; } + value_type upper_bound() const { return value_+uncertainty_; } + + interval<value_type> get_interval() const { return interval<value_type>(lower_bound(),upper_bound()); } this_type& operator+=(const value_type& val) { @@ -99,8 +104,8 @@ this_type& operator/=(const this_type& /*source*/); private: - value_type value_, - uncertainty_; + value_type value_, + uncertainty_; }; } |
|
From: Matthias S. <mat...@us...> - 2007-04-02 23:26:06
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20960/example Modified Files: unit_example_22.cpp Log Message: minor update Index: unit_example_22.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_22.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- unit_example_22.cpp 2 Apr 2007 21:28:40 -0000 1.3 +++ unit_example_22.cpp 2 Apr 2007 23:26:06 -0000 1.4 @@ -219,23 +219,32 @@ int main() { - quantity<SI::temperature> KTR(273.16*SI::kelvin); - quantity<SI::temperature,absolute<> > KTA(absolute<>(273.16)*SI::kelvin); +// quantity<SI::temperature> KTR(273.16*SI::kelvin); +// quantity<SI::temperature,absolute<> > KTA(absolute<>(273.16)*SI::kelvin); +// +// quantity<celsius::temperature> CTR(0.0*celsius::degrees); +// quantity<celsius::temperature,absolute<> > CTA(absolute<>(0.0)*celsius::degrees); +// +// quantity<fahrenheit::temperature> FTR(32.0*fahrenheit::degrees); +// quantity<fahrenheit::temperature,absolute<> > FTA(absolute<>(32.0)*fahrenheit::degrees); + + quantity<SI::temperature> KTR(373.16*SI::kelvin); + quantity<SI::temperature,absolute<> > KTA(absolute<>(373.16)*SI::kelvin); + + quantity<celsius::temperature> CTR(100.0*celsius::degrees); + quantity<celsius::temperature,absolute<> > CTA(absolute<>(100.0)*celsius::degrees); + + quantity<fahrenheit::temperature> FTR(212.0*fahrenheit::degrees); + quantity<fahrenheit::temperature,absolute<> > FTA(absolute<>(212.0)*fahrenheit::degrees); std::cout << KTR << std::endl << KTA << std::endl << std::endl; - - quantity<celsius::temperature> CTR(0.0*celsius::degrees); - quantity<celsius::temperature,absolute<> > CTA(absolute<>(0.0)*celsius::degrees); std::cout << CTR << std::endl << CTA << std::endl << std::endl; - quantity<fahrenheit::temperature> FTR(32.0*fahrenheit::degrees); - quantity<fahrenheit::temperature,absolute<> > FTA(absolute<>(32.0)*fahrenheit::degrees); - std::cout << FTR << std::endl << FTA << std::endl << std::endl; |
|
From: Steven W. <ste...@us...> - 2007-04-02 22:22:10
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26031/boost-sandbox/boost/units Modified Files: io.hpp Log Message: Made xml_archive work Index: io.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/io.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- io.hpp 29 Mar 2007 20:18:54 -0000 1.5 +++ io.hpp 2 Apr 2007 22:22:02 -0000 1.6 @@ -17,6 +17,8 @@ #include <boost/config.hpp> +#include <boost/serialization/nvp.hpp> + #include <boost/units/quantity.hpp> #include <boost/units/detail/io_impl.hpp> @@ -36,7 +38,7 @@ template<class Archive,class Unit,class Y> inline void serialize(Archive& ar,boost::units::quantity<Unit,Y>& q,const unsigned int version) { - ar & units::quantity_cast<Y&>(q); + ar & boost::serialization::make_nvp("value", units::quantity_cast<Y&>(q)); } } // namespace serialization |
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2409/example Modified Files: unit_example_10.cpp unit_example_14.cpp unit_example_19.cpp unit_example_20.cpp unit_example_22.cpp unit_example_4.cpp Log Message: temperature conversion code added Index: unit_example_10.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_10.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- unit_example_10.cpp 29 Mar 2007 22:57:45 -0000 1.3 +++ unit_example_10.cpp 2 Apr 2007 21:28:40 -0000 1.4 @@ -80,16 +80,16 @@ std::stringstream sstream1, sstream2; //[unit_example_10_snippet_1 - quantity<angle::degree> thetad((180.0/6.0)*degrees); - quantity<angle::gradian> thetag((200.0/6.0)*gradians); - quantity<angle::radian> thetar((3.1415926/6.0)*radians); + quantity<angles::degrees::degree> thetad((180.0/6.0)*degrees); + quantity<angles::gradians::gradian> thetag((200.0/6.0)*gradians); + quantity<angles::radians::radian> thetar((3.1415926/6.0)*radians); //] /// test cos { - quantity<angle::dimensionless_degree> cos_thetad(cos(thetad)); - quantity<angle::dimensionless_gradian> cos_thetag(cos(thetag)); - quantity<angle::dimensionless_radian> cos_thetar(cos(thetar)); + quantity<angles::degrees::dimensionless> cos_thetad(cos(thetad)); + quantity<angles::gradians::dimensionless> cos_thetag(cos(thetag)); + quantity<angles::radians::dimensionless> cos_thetar(cos(thetar)); sstream1 << "thetad = " << thetad << std::endl << "thetag = " << thetag << std::endl @@ -106,9 +106,9 @@ /// test sin { - quantity<angle::dimensionless_degree> sin_thetad(sin(thetad)); - quantity<angle::dimensionless_gradian> sin_thetag(sin(thetag)); - quantity<angle::dimensionless_radian> sin_thetar(sin(thetar)); + quantity<angles::degrees::dimensionless> sin_thetad(sin(thetad)); + quantity<angles::gradians::dimensionless> sin_thetag(sin(thetag)); + quantity<angles::radians::dimensionless> sin_thetar(sin(thetar)); sstream1 << "thetad = " << thetad << std::endl << "thetag = " << thetag << std::endl @@ -125,9 +125,9 @@ /// test tan { - quantity<angle::dimensionless_degree> tan_thetad(tan(thetad)); - quantity<angle::dimensionless_gradian> tan_thetag(tan(thetag)); - quantity<angle::dimensionless_radian> tan_thetar(tan(thetar)); + quantity<angles::degrees::dimensionless> tan_thetad(tan(thetad)); + quantity<angles::gradians::dimensionless> tan_thetag(tan(thetag)); + quantity<angles::radians::dimensionless> tan_thetar(tan(thetar)); sstream1 << "thetad = " << thetad << std::endl << "thetag = " << thetag << std::endl Index: unit_example_14.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_14.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_14.cpp 16 Mar 2007 18:29:52 -0000 1.1.1.1 +++ unit_example_14.cpp 2 Apr 2007 21:28:40 -0000 1.2 @@ -26,7 +26,7 @@ @endverbatim **/ - +/* #include <iostream> #include <cstdlib> @@ -187,3 +187,145 @@ return 0; } +*/ +// mcs::units - A C++ library for zero-overhead dimensional analysis and +// unit/quantity manipulation and conversion +// +// Copyright (C) 2003-2007 Matthias Christian Schabel +// Copyright (C) 2007 Steven Watanabe +// +// 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) + +#include <cstdlib> +#include <ctime> +#include <algorithm> + +#include <boost/timer.hpp> +#include <boost/numeric/ublas/matrix.hpp> +#include <boost/units/quantity.hpp> +#include <boost/units/systems/si.hpp> + +enum { + tile_block_size = 16 +}; + +template<class T0, class T1, class Out> +void tiled_multiply_carray_inner(T0* first, T1* second, Out* out, int totalwidth, int width2, int height1, int common) { + for(int j = 0; j < height1; ++j) { + for(int i = 0; i < width2; ++i) { + Out value = out[j * totalwidth + i]; + for(int k = 0; k < common; ++k) { + value += first[k + totalwidth * j] * second[k * totalwidth + i]; + } + out[j * totalwidth + i] = value; + } + } +} + +template<class T0, class T1, class Out> +void tiled_multiply_carray_outer(T0* first, T1* second, Out* out, int width2, int height1, int common) { + std::fill_n(out, width2 * height1, Out()); + int j = 0; + for(; j < height1 - tile_block_size; j += tile_block_size) { + int i = 0; + for(; i < width2 - tile_block_size; i += tile_block_size) { + int k = 0; + for(; k < common - tile_block_size; k += tile_block_size) { + tiled_multiply_carray_inner(&first[k + width2 * j], &second[k * width2 + i], &out[j * width2 + i], width2, tile_block_size, tile_block_size, tile_block_size); + } + tiled_multiply_carray_inner(&first[k + width2 * j], &second[k * width2 + i], &out[j * width2 + i], width2, tile_block_size, tile_block_size, common - k); + } + int k = 0; + for(; k < common - tile_block_size; k += tile_block_size) { + tiled_multiply_carray_inner(&first[k + width2 * j], &second[k * width2 + i], &out[j * width2 + i], width2, width2 - i, tile_block_size, tile_block_size); + } + tiled_multiply_carray_inner(&first[k + width2 * j], &second[k * width2 + i], &out[j * width2 + i], width2, width2 - i, tile_block_size, common - k); + } + int i = 0; + for(; i < width2 - tile_block_size; i += tile_block_size) { + int k = 0; + for(; k < common - tile_block_size; k += tile_block_size) { + tiled_multiply_carray_inner(&first[k + width2 * j], &second[k * width2 + i], &out[j * width2 + i], width2, tile_block_size, height1 - j, tile_block_size); + } + tiled_multiply_carray_inner(&first[k + width2 * j], &second[k * width2 + i], &out[j * width2 + i], width2, tile_block_size, height1 - j, common - k); + } + int k = 0; + for(; k < common - tile_block_size; k += tile_block_size) { + tiled_multiply_carray_inner(&first[k + width2 * j], &second[k * width2 + i], &out[j * width2 + i], width2, width2 - i, height1 - j, tile_block_size); + } + tiled_multiply_carray_inner(&first[k + width2 * j], &second[k * width2 + i], &out[j * width2 + i], width2, width2 - i, height1 - j, common - k); +} + +enum { max_value = 1000}; + +int main() { + boost::numeric::ublas::matrix<double> ublas_result; + { + boost::numeric::ublas::matrix<double> m1(max_value, max_value); + boost::numeric::ublas::matrix<double> m2(max_value, max_value); + std::srand(1492); + for(int i = 0; i < max_value; ++i) { + for(int j = 0; j < max_value; ++j) { + m1(i,j) = std::rand(); + m2(i,j) = std::rand(); + } + } + boost::timer timer; + ublas_result = (prod(m1, m2)); + std::cout << timer.elapsed() << " seconds" << std::endl; + } + boost::numeric::ublas::matrix<boost::units::quantity<boost::units::SI::dimensionless> > ublas_resultq; + { + boost::numeric::ublas::matrix<boost::units::quantity<boost::units::SI::dimensionless> > m1(max_value, max_value); + boost::numeric::ublas::matrix<boost::units::quantity<boost::units::SI::dimensionless> > m2(max_value, max_value); + std::srand(1492); + for(int i = 0; i < max_value; ++i) { + for(int j = 0; j < max_value; ++j) { + m1(i,j) = std::rand(); + m2(i,j) = std::rand(); + } + } + boost::timer timer; + ublas_resultq = (prod(m1, m2)); + std::cout << timer.elapsed() << " seconds" << std::endl; + } + std::vector<double> cresult(max_value * max_value); + { + std::vector<double> m1(max_value * max_value); + std::vector<double> m2(max_value * max_value); + std::srand(1492); + for(int i = 0; i < max_value * max_value; ++i) { + m1[i] = std::rand(); + m2[i] = std::rand(); + } + //std::vector<double> m3(max_value * max_value); + boost::timer timer; + tiled_multiply_carray_outer(&m1[0], &m2[0], &cresult[0], max_value, max_value, max_value); + //multiply_carray(&m1[0], &m2[0], &cresult[0], max_value, max_value, max_value); + std::cout << timer.elapsed() << " seconds" << std::endl; + } + std::vector<boost::units::quantity<boost::units::SI::energy> > cresultq(max_value * max_value); + { + std::vector<boost::units::quantity<boost::units::SI::force> > m1(max_value * max_value); + std::vector<boost::units::quantity<boost::units::SI::length> > m2(max_value * max_value); + std::srand(1492); + for(int i = 0; i < max_value * max_value; ++i) { + m1[i] = std::rand() * boost::units::SI::newtons; + m2[i] = std::rand() * boost::units::SI::meters; + } + boost::timer timer; + tiled_multiply_carray_outer(&m1[0], &m2[0], &cresultq[0], max_value, max_value, max_value); + std::cout << timer.elapsed() << " seconds" << std::endl; + } + for(int i = 0; i < max_value; ++i) { + for(int j = 0; j < max_value; ++j) { + if(std::abs(ublas_result(i,j) - cresult[i * max_value + j]) > .000001) { + std::cout << "i = " << i << ", j = " << j << std::endl; + std::cout << "ublas = " << ublas_result(i,j) << ", c = " << cresult[i * max_value + j] << std::endl; + return(EXIT_FAILURE); + } + } + } +} \ No newline at end of file Index: unit_example_20.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_20.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- unit_example_20.cpp 30 Mar 2007 23:50:10 -0000 1.3 +++ unit_example_20.cpp 2 Apr 2007 21:28:40 -0000 1.4 @@ -45,89 +45,7 @@ #include <boost/units/detail/utility.hpp> using namespace boost::units; -/* -template<class Y = double> -class absolute -{ - public: - typedef absolute<Y> this_type; - typedef Y value_type; - - absolute() : val_() { } - absolute(const value_type& val) : val_(val) { } - absolute(const this_type& p) : val_(p.val_) { } - - value_type& value() { return val_; } - const value_type& value() const { return val_; } - - private: - Y val_; -}; - -template<class Y = double> -class relative -{ - public: - typedef relative<Y> this_type; - typedef Y value_type; - - relative() : val_() { } - relative(const value_type& val) : val_(val) { } - relative(const this_type& v) : val_(v.val_) { } - - value_type& value() { return val_; } - const value_type& value() const { return val_; } - - private: - Y val_; -}; - -template<class Y> -absolute<Y> operator+(const absolute<Y>& p,const relative<Y>& v) -{ - return absolute<Y>(p.value()+v.value()); -} -template<class Y> -absolute<Y> operator-(const absolute<Y>& p,const relative<Y>& v) -{ - return absolute<Y>(p.value()-v.value()); -} - -template<class Y> -relative<Y> operator-(const absolute<Y>& p1,const absolute<Y>& p2) -{ - return relative<Y>(p1.value()-p2.value()); -} - -template<class Y> -relative<Y> operator+(const relative<Y>& v1,const relative<Y>& v2) -{ - return relative<Y>(v1.value()+v2.value()); -} - -template<class Y> -relative<Y> operator-(const relative<Y>& v1,const relative<Y>& v2) -{ - return relative<Y>(v1.value()-v2.value()); -} - -template<class Y> -std::ostream& operator<<(std::ostream& os,const absolute<Y>& p) -{ - os << "{ " << p.value() << " }"; - - return os; -} - -template<class Y> -std::ostream& operator<<(std::ostream& os,const relative<Y>& v) -{ - os << "[ " << v.value() << " ]"; - - return os; -} -*/ namespace boost { namespace units { Index: unit_example_22.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_22.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- unit_example_22.cpp 29 Mar 2007 19:39:28 -0000 1.2 +++ unit_example_22.cpp 2 Apr 2007 21:28:40 -0000 1.3 @@ -121,6 +121,7 @@ return 0; } */ +/* #include <iostream> #include <boost/units/io.hpp> #include <boost/units/systems/si.hpp> @@ -178,6 +179,118 @@ return 0; } +*/ +/* +#include <iostream> +#include <boost/units/io.hpp> +#include <boost/units/systems/si.hpp> +#include <boost/units/systems/cgs.hpp> +#include <boost/units/systems/si/prefixes.hpp> + +using namespace boost::units; + +template<class System,class Y> +typeof(quantity<unit<length_type,System>,Y>()*quantity<unit<length_type,System>,Y>()) +compute_area(const quantity<unit<length_type,System>,Y>& L) +{ + return L*L; +} + +int main() +{ + std::cout << compute_area(2.0*SI::meters) << std::endl + << compute_area(20.0*root<2>(SI::meters)*root<2>(CGS::centimeters)) << std::endl + << quantity<SI::area>(compute_area(20.0*root<2>(SI::meters)*root<2>(CGS::centimeters))) << std::endl + << std::endl; + + return 0; +} +*/ +#include <iostream> + +#include <boost/units/io.hpp> +#include <boost/units/absolute.hpp> +#include <boost/units/systems/si/temperature.hpp> +#include <boost/units/systems/temperature/celsius.hpp> +#include <boost/units/systems/temperature/fahrenheit.hpp> +#include <boost/units/systems/conversions/conversion_headers.hpp> + +using namespace boost::units; + +int main() +{ + quantity<SI::temperature> KTR(273.16*SI::kelvin); + quantity<SI::temperature,absolute<> > KTA(absolute<>(273.16)*SI::kelvin); + + std::cout << KTR << std::endl + << KTA << std::endl + << std::endl; + + quantity<celsius::temperature> CTR(0.0*celsius::degrees); + quantity<celsius::temperature,absolute<> > CTA(absolute<>(0.0)*celsius::degrees); + + std::cout << CTR << std::endl + << CTA << std::endl + << std::endl; + + quantity<fahrenheit::temperature> FTR(32.0*fahrenheit::degrees); + quantity<fahrenheit::temperature,absolute<> > FTA(absolute<>(32.0)*fahrenheit::degrees); + + std::cout << FTR << std::endl + << FTA << std::endl + << std::endl; + + // kelvin->celsius + quantity<celsius::temperature> CTR2(KTR); + quantity<celsius::temperature,absolute<> > CTA2(KTA); + + std::cout << KTR << " = " << CTR2 << std::endl + << KTA << " = " << CTA2 << std::endl + << std::endl; + + // celsius->kelvin + quantity<SI::temperature> KTR2(CTR); + quantity<SI::temperature,absolute<> > KTA2(CTA); + + std::cout << CTR << " = " << KTR2 << std::endl + << CTA << " = " << KTA2 << std::endl + << std::endl; + + // kelvin->fahrenheit + quantity<celsius::temperature> FTR2(KTR); + quantity<celsius::temperature,absolute<> > FTA2(KTA); + + std::cout << KTR << " = " << FTR2 << std::endl + << KTA << " = " << FTA2 << std::endl + << std::endl; + + // fahrenheit->kelvin + quantity<SI::temperature> KTR3(FTR); + quantity<SI::temperature,absolute<> > KTA3(FTA); + + std::cout << FTR << " = " << KTR3 << std::endl + << FTA << " = " << KTA3 << std::endl + << std::endl; + + // fahrenheit->celsius + quantity<celsius::temperature> CTR3(FTR); + quantity<celsius::temperature,absolute<> > CTA3(FTA); + + std::cout << FTR << " = " << CTR3 << std::endl + << FTA << " = " << CTA3 << std::endl + << std::endl; + + // celsius->fahrenheit + quantity<fahrenheit::temperature> FTR3(CTR); + quantity<fahrenheit::temperature,absolute<> > FTA3(CTA); + + std::cout << CTR << " = " << FTR3 << std::endl + << CTA << " = " << FTA3 << std::endl + << std::endl; + + return 0; +} + Index: unit_example_4.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_4.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- unit_example_4.cpp 30 Mar 2007 23:50:10 -0000 1.3 +++ unit_example_4.cpp 2 Apr 2007 21:28:40 -0000 1.4 @@ -43,7 +43,7 @@ U1/U1 : dimensionless U1*U2 : m^3 kg^2 s^(-4) U1/U2 : m^(-1) -U1^X : m^2 kg^2 s^(-4) +U1^X : m^2 kg^2 s^(-4) X1vU1 : m^(1/2) kg^(1/2) s^(-1) U1^X2 : m^(4/3) kg^(4/3) s^(-8/3) X2vU1 : m^(3/4) kg^(3/4) s^(-3/2) @@ -262,7 +262,7 @@ //<< "U1-U2 : " << u1-u2 << std::endl // illegal << "U1*U2 : " << u1*u2 << std::endl << "U1/U2 : " << u1/u2 << std::endl - << "U1^X : " << pow<2>(u1) << std::endl + << "U1^X : " << pow<2>(u1) << std::endl << "X1vU1 : " << root<2>(u1) << std::endl << "U1^X2 : " << pow<static_rational<4,3> >(u1) << std::endl << "X2vU1 : " << root<static_rational<4,3> >(u1) << std::endl @@ -443,7 +443,7 @@ sstream2 << "U1/U1 : dimensionless" << std::endl; sstream2 << "U1*U2 : m^3 kg^2 s^(-4)" << std::endl; sstream2 << "U1/U2 : m^(-1)" << std::endl; - sstream2 << "U1^X : m^2 kg^2 s^(-4)" << std::endl; + sstream2 << "U1^X : m^2 kg^2 s^(-4)" << std::endl; sstream2 << "X1vU1 : m^(1/2) kg^(1/2) s^(-1)" << std::endl; sstream2 << "U1^X2 : m^(4/3) kg^(4/3) s^(-8/3)" << std::endl; sstream2 << "X2vU1 : m^(3/4) kg^(3/4) s^(-3/2)" << std::endl; Index: unit_example_19.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_19.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- unit_example_19.cpp 1 Apr 2007 17:32:51 -0000 1.3 +++ unit_example_19.cpp 2 Apr 2007 21:28:40 -0000 1.4 @@ -24,150 +24,149 @@ Universal constants: -c : 2.99792e+08 m s^(-1) -mu_0 : 1.25664e-06 m kg s^(-2) A^(-2) -epsilon_0 : 8.85419e-12 m^(-3) kg^(-1) s^4 A^2 -Z_0 : 376.73 m^2 kg s^(-3) A^(-2) -G : 6.6742e-11 m^3 kg^(-1) s^(-2) -h : 6.62607e-34 m^2 kg s^(-1) -hbar : 1.05457e-34 m^2 kg s^(-1) -m_P : 2.17645e-08 kg -T_P : 1.41679e+32 K -l_P : 1.61624e-35 m -t_P : 5.39121e-44 s +c : 2.9979245800000e+08 (exact) m s^(-1) +mu_0 : 1.2566370614359e-06 (exact) m kg s^(-2) A^(-2) +epsilon_0 : 8.8541878176204e-12 (exact) m^(-3) kg^(-1) s^4 A^2 +Z_0 : 3.7673031346177e+02 (exact) m^2 kg s^(-3) A^(-2) +G : 6.6742800000000e-11 (rel. unc. = 1.0e-04) m^3 kg^(-1) s^(-2) +h : 6.6260689600000e-34 (rel. unc. = 5.0e-08) m^2 kg s^(-1) +hbar : 1.0545716280000e-34 (rel. unc. = 5.0e-08) m^2 kg s^(-1) +m_P : 2.1764400000000e-08 (rel. unc. = 5.1e-05) kg +T_P : 1.4167850000000e+32 (rel. unc. = 5.0e-05) K +l_P : 1.6162520000000e-35 (rel. unc. = 5.0e-05) m +t_P : 5.3912400000000e-44 (rel. unc. = 5.0e-05) s Electromagnetic constants: -e : 1.60218e-19 s A -e/h : 2.41799 m^(-2) kg^(-1) s^2 A -Phi_0 : 2.06783 m^2 kg s^(-2) A^(-1) -G_0 : 7.74809e-05 m^(-2) kg^(-1) s^3 A^2 -K_J : 4.83598e+14 m^(-2) kg^(-1) s^2 A -R_K : 25812.8 m^2 kg s^(-3) A^(-2) -mu_B : 9.27401e-24 m^2 A -mu_N : 5.05078e-27 m^2 A +e : 1.6021764870000e-19 (rel. unc. = 2.5e-08) s A +e/h : 2.4179894540000e+14 (rel. unc. = 2.5e-08) m^(-2) kg^(-1) s^2 A +Phi_0 : 2.0678336670000e-15 (rel. unc. = 2.5e-08) m^2 kg s^(-2) A^(-1) +G_0 : 7.7480917004000e-05 (rel. unc. = 6.8e-10) m^(-2) kg^(-1) s^3 A^2 +K_J : 4.8359789100000e+14 (rel. unc. = 2.5e-08) m^(-2) kg^(-1) s^2 A +R_K : 2.5812807557000e+04 (rel. unc. = 6.9e-10) m^2 kg s^(-3) A^(-2) +mu_B : 9.2740091500000e-24 (rel. unc. = 2.5e-08) m^2 A +mu_N : 5.0507832400000e-27 (rel. unc. = 2.6e-08) m^2 A Physico-chemical constants: -N_A : 6.02214e+23 mol^(-1) -m_u : 1.66054e-27 kg -F : 96485.3 s A mol^(-1) -R : 8.31447 m^2 kg s^(-2) K^(-1) mol^(-1) -k_B : 1.38065e-23 m^2 kg s^(-2) K^(-1) -V_m : 0.022414 m^3 mol^(-1) -sigma_SB : 5.6704e-08 kg s^(-3) K^(-4) -c_1 : 3.74177e-16 m^4 kg s^(-3) -c_2 : 0.0143878 m K -b : 0.00289777 m K +N_A : 6.0221417900000e+23 (rel. unc. = 5.0e-08) mol^(-1) +m_u : 1.6605387820000e-27 (rel. unc. = 5.0e-08) kg +F : 9.6485339900000e+04 (rel. unc. = 2.5e-08) s A mol^(-1) +R : 8.3144720000000e+00 (rel. unc. = 1.8e-06) m^2 kg s^(-2) K^(-1) mol^(-1) +k_B : 1.3806504000000e-23 (rel. unc. = 1.7e-06) m^2 kg s^(-2) K^(-1) +V_m : 2.2413996000000e-02 (rel. unc. = 1.7e-06) m^3 mol^(-1) +sigma_SB : 5.6704000000000e-08 (rel. unc. = 7.1e-06) kg s^(-3) K^(-4) +c_1 : 3.7417711800000e-16 (rel. unc. = 5.1e-08) m^4 kg s^(-3) +c_2 : 1.4387752000000e-02 (rel. unc. = 1.7e-06) m K +b : 2.8977685000000e-03 (rel. unc. = 1.8e-06) m K Atomic and nuclear constants: -alpha : 0.00729735 dimensionless -R_infinity : 1.09737e+07 m^(-1) -a_0 : 5.29177e-11 m -E_h : 4.35974e-18 m^2 kg s^(-2) +alpha : 7.2973525376000e-03 (rel. unc. = 6.9e-10) dimensionless +R_infinity : 1.0973731568527e+07 (rel. unc. = 6.7e-12) m^(-1) +a_0 : 5.2917720859000e-11 (rel. unc. = 6.8e-10) m +E_h : 4.3597439400000e-18 (rel. unc. = 5.0e-08) m^2 kg s^(-2) electron: -m_e : 9.10938e-31 kg -m_e/m_mu : 0.00483633 dimensionless -m_e/m_tau : 0.000287564 dimensionless -m_e/m_p : 0.000544617 dimensionless -m_e/m_n : 0.000543867 dimensionless -m_e/m_d : 0.000272444 dimensionless -m_e/m_alpha : 0.000137093 dimensionless -e/m_e : 1.75882e+11 kg^(-1) s A -M_e : 5.4858e-07 kg mol^(-1) -lambda_C : 2.42631e-12 m -r_e : 2.81794e-15 m -sigma_e : 6.65246e-29 m^2 -mu_e : -9.28476e-24 m^2 A -a_e : 0.00115965 dimensionless -g_e : -2.00232 dimensionless -mu_e/mu_mu : 206.767 dimensionless -mu_e/mu_p : -658.211 dimensionless -mu_e/mu_pp : -658.228 dimensionless -mu_e/mu_n : 960.92 dimensionless -mu_e/mu_d : -2143.92 dimensionless -mu_e/mu_hp : 864.058 dimensionless -gamma_e : 1.76086 kg^(-1) s A +m_e : 9.1093821500000e-31 (rel. unc. = 4.9e-08) kg +m_e/m_mu : 4.8363317100000e-03 (rel. unc. = 2.5e-08) dimensionless +m_e/m_tau : 2.8756400000000e-04 (rel. unc. = 1.6e-04) dimensionless +m_e/m_p : 5.4461702177000e-04 (rel. unc. = 4.4e-10) dimensionless +m_e/m_n : 5.4386734459000e-04 (rel. unc. = 6.1e-10) dimensionless +m_e/m_d : 2.7244371093000e-04 (rel. unc. = 4.4e-10) dimensionless +m_e/m_alpha : 1.3709335557000e-04 (rel. unc. = 4.2e-10) dimensionless +e/m_e : 1.7588201500000e+11 (rel. unc. = 2.5e-08) kg^(-1) s A +M_e : 5.4857990943000e-07 (rel. unc. = 4.2e-10) kg mol^(-1) +lambda_C : 2.4263102175000e-12 (rel. unc. = 1.4e-09) m +r_e : 2.8179402894000e-15 (rel. unc. = 2.1e-09) m +sigma_e : 6.6524585580000e-29 (rel. unc. = 4.1e-09) m^2 +mu_e : -9.2847637700000e-24 (rel. unc. = 2.5e-08) m^2 A +a_e : 1.1596521811100e-03 (rel. unc. = 6.4e-10) dimensionless +g_e : -2.0023193043622e+00 (rel. unc. = 7.5e-13) dimensionless +mu_e/mu_mu : 2.0676698770000e+02 (rel. unc. = 2.5e-08) dimensionless +mu_e/mu_p : -6.5821068480000e+02 (rel. unc. = 8.2e-09) dimensionless +mu_e/mu_pp : -6.5822759710000e+02 (rel. unc. = 1.1e-08) dimensionless +mu_e/mu_n : 9.6092050000000e+02 (rel. unc. = 2.4e-07) dimensionless +mu_e/mu_d : -2.1439234980000e+03 (rel. unc. = 8.4e-09) dimensionless +mu_e/mu_hp : 8.6405825700000e+02 (rel. unc. = 1.2e-08) dimensionless +gamma_e : 1.7608597700000e+11 (rel. unc. = 2.5e-08) kg^(-1) s A muon: -m_mu : 1.88353e-28 kg -m_mu/m_e : 206.768 dimensionless -m_mu/m_tau : 0.0594592 dimensionless -m_mu/m_p : 0.11261 dimensionless -m_mu/m_n : 0.112455 dimensionless -M_mu : 0.000113429 kg mol^(-1) -lambda_C_mu : 1.17344e-14 m -mu_m : -4.49045e-26 m^2 A -a_mu : 0.00116592 dimensionless -g_mu : -2.00233 dimensionless -mu_mu/mu_p : -3.18335 dimensionless +m_mu : 1.8835313000000e-28 (rel. unc. = 5.8e-08) kg +m_mu/m_e : 2.0676828230000e+02 (rel. unc. = 2.5e-08) dimensionless +m_mu/m_tau : 5.9459200000000e-02 (rel. unc. = 1.6e-04) dimensionless +m_mu/m_p : 1.1260952610000e-01 (rel. unc. = 2.6e-08) dimensionless +m_mu/m_n : 1.1245451670000e-01 (rel. unc. = 2.6e-08) dimensionless +M_mu : 1.1342892560000e-04 (rel. unc. = 2.6e-08) kg mol^(-1) +lambda_C_mu : 1.1734441040000e-14 (rel. unc. = 2.6e-08) m +mu_mu : -4.4904478600000e-26 (rel. unc. = 3.6e-08) m^2 A +a_mu : 1.1659206900000e-03 (rel. unc. = 5.1e-07) dimensionless +g_mu : -2.0023318414000e+00 (rel. unc. = 6.0e-10) dimensionless +mu_mu/mu_p : -3.1833451370000e+00 (rel. unc. = 2.7e-08) dimensionless tau: -m_tau : 3.16777e-27 kg -m_tau/m_e : 3477.48 dimensionless -m_tau/m_mu : 16.8183 dimensionless -m_tau/m_p : 1.8939 dimensionless -m_tau/m_n : 1.89129 dimensionless -M_tau : 0.0019077 kg mol^(-1) -lambda_C_tau: 6.9772e-16 m +m_tau : 3.1677700000000e-27 (rel. unc. = 1.6e-04) kg +m_tau/m_e : 3.4774800000000e+03 (rel. unc. = 1.6e-04) dimensionless +m_tau/m_mu : 1.6818300000000e+01 (rel. unc. = 1.6e-04) dimensionless +m_tau/m_p : 1.8939000000000e+00 (rel. unc. = 1.6e-04) dimensionless +m_tau/m_n : 1.8912900000000e+00 (rel. unc. = 1.6e-04) dimensionless +M_tau : 1.9076800000000e-03 (rel. unc. = 1.6e-04) kg mol^(-1) +lambda_C_tau: 6.9772000000000e-16 (rel. unc. = 1.6e-04) m proton: -m_p : 1.67262e-27 kg -m_p/m_e : 1836.15 dimensionless -m_p/m_mu : 8.88024 dimensionless -m_p/m_tau : 0.528012 dimensionless -m_p/m_n : 0.998623 dimensionless -e/m_p : 9.57883e+07 kg^(-1) s A -M_p : 0.00100728 kg mol^(-1) -R_p : 8.75e-16 m -mu_p : 1.41061e-26 m^2 A -g_p : 5.58569 dimensionless -mu_p/mu_n : -1.4599 dimensionless -mu_pp : 1.41057e-26 m^2 A -gamma_p : 2.67522e+08 kg^(-1) s A -gamma_pp : 2.67515e+08 kg^(-1) s A +m_p : 1.6726216370000e-27 (rel. unc. = 5.0e-08) kg +m_p/m_e : 1.8361526724700e+03 (rel. unc. = 4.4e-10) dimensionless +m_p/m_mu : 8.8802433900000e+00 (rel. unc. = 2.6e-08) dimensionless +m_p/m_tau : 5.2801200000000e-01 (rel. unc. = 1.6e-04) dimensionless +m_p/m_n : 9.9862347824000e-01 (rel. unc. = 4.6e-10) dimensionless +e/m_p : 9.5788339200000e+07 (rel. unc. = 2.5e-08) kg^(-1) s A +M_p : 1.0072764667700e-03 (rel. unc. = 9.9e-11) kg mol^(-1) +R_p : 8.7680000000000e-16 (rel. unc. = 7.9e-03) m +mu_p : 1.4106066620000e-26 (rel. unc. = 2.6e-08) m^2 A +g_p : 5.5856947130000e+00 (rel. unc. = 8.2e-09) dimensionless +mu_p/mu_n : -1.4598980600000e+00 (rel. unc. = 2.3e-07) dimensionless +mu_pp : 1.4105704190000e-26 (rel. unc. = 2.7e-08) m^2 A +gamma_p : 2.6752220990000e+08 (rel. unc. = 2.6e-08) kg^(-1) s A +gamma_pp : 2.6751533620000e+08 (rel. unc. = 2.7e-08) kg^(-1) s A neutron: -m_n : 1.67493e-27 kg -m_n/m_e : 1838.68 dimensionless -m_n/m_mu : 8.89248 dimensionless -m_n/m_tau : 0.52874 dimensionless -m_n/m_p : 1.00138 dimensionless -lambda_C_n : 1.31959e-15 m -M_n : 0.00100866 kg mol^(-1) -mu_n : -9.66236e-27 m^2 A -g_n : -3.82609 dimensionless -mu_n/mu_p : -0.684979 dimensionless -mu_n/mu_pp : -0.684997 dimensionless -gamma_n : 1.83247e+08 kg^(-1) s A +m_n : 1.6749272110000e-27 (rel. unc. = 5.0e-08) kg +m_n/m_e : 1.8386836605000e+03 (rel. unc. = 6.0e-10) dimensionless +m_n/m_mu : 8.8924840900000e+00 (rel. unc. = 2.6e-08) dimensionless +m_n/m_tau : 5.2874000000000e-01 (rel. unc. = 1.6e-04) dimensionless +m_n/m_p : 1.0013784191800e+00 (rel. unc. = 4.6e-10) dimensionless +lambda_C_n : 1.3195908951000e-15 (rel. unc. = 1.5e-09) m +M_n : 1.0086649159700e-03 (rel. unc. = 4.3e-10) kg mol^(-1) +mu_n : -9.6623641000000e-27 (rel. unc. = 2.4e-07) m^2 A +g_n : -3.8260854500000e+00 (rel. unc. = 2.4e-07) dimensionless +mu_n/mu_p : -6.8497934000000e-01 (rel. unc. = 2.3e-07) dimensionless +mu_n/mu_pp : -6.8499694000000e-01 (rel. unc. = 2.3e-07) dimensionless +gamma_n : 1.8324718500000e+08 (rel. unc. = 2.3e-07) kg^(-1) s A deuteron: -m_d : 3.34358e-27 kg -m_d/m_e : 3670.48 dimensionless -m_d/m_p : 1.99901 dimensionless -M_d : 0.00201355 kg mol^(-1) -R_d : 2.1394e-15 m -mu_d : 4.33071e-27 m^2 A -g_n : -3.82609 dimensionless -mu_d/mu_e : -0.000466435 dimensionless -mu_d/mu_p : 0.307012 dimensionless -mu_d/mu_n : -0.448207 dimensionless +m_d : 3.3435832000000e-27 (rel. unc. = 5.1e-08) kg +m_d/m_e : 3.6704829654000e+03 (rel. unc. = 4.4e-10) dimensionless +m_d/m_p : 1.9990075010800e+00 (rel. unc. = 1.1e-10) dimensionless +M_d : 2.0135532127240e-03 (rel. unc. = 3.9e-11) kg mol^(-1) +R_d : 2.1402000000000e-15 (rel. unc. = 1.3e-03) m +mu_d : 4.3307346500000e-27 (rel. unc. = 2.5e-08) m^2 A +mu_d/mu_e : -4.6643455370000e-04 (rel. unc. = 8.4e-09) dimensionless +mu_d/mu_p : 3.0701220700000e-01 (rel. unc. = 7.8e-09) dimensionless +mu_d/mu_n : -4.4820652000000e-01 (rel. unc. = 2.5e-07) dimensionless helion: -m_h : 5.00641e-27 kg +m_h : 5.0064119200000e-27 (rel. unc. = 5.0e-08) kg alpha particle: -m_alpha : 6.64466e-27 kg +m_alpha : 6.6446562000000e-27 (rel. unc. = 5.0e-08) kg //] @endverbatim @@ -302,7 +301,6 @@ << "M_d :\t" << M_d << std::endl << "R_d :\t" << R_d << std::endl << "mu_d :\t" << mu_d << std::endl - << "g_n :\t" << g_n << std::endl << "mu_d/mu_e :\t" << mu_d_over_mu_e << std::endl << "mu_d/mu_p :\t" << mu_d_over_mu_p << std::endl << "mu_d/mu_n :\t" << mu_d_over_mu_n << std::endl |
|
From: Matthias S. <mat...@us...> - 2007-04-02 21:25:32
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/temperature In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1080/temperature Added Files: celsius.hpp fahrenheit.hpp Log Message: temperature in celsius and fahrenheit --- NEW FILE: celsius.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_CELSIUS_HPP #define BOOST_UNITS_CELSIUS_HPP #include <string> #include <boost/units/absolute.hpp> #include <boost/units/io.hpp> #include <boost/units/static_constant.hpp> #include <boost/units/system.hpp> #include <boost/units/systems/physical_units.hpp> namespace boost { namespace units { namespace celsius { struct system_tag : public ordinal<111> { }; typedef homogeneous_system<system_tag> system; typedef unit<temperature_type,system> temperature; BOOST_UNITS_STATIC_CONSTANT(degree,temperature); BOOST_UNITS_STATIC_CONSTANT(degrees,temperature); } // namespace celsius template<> struct base_unit_info<temperature_tag,celsius::system_tag> { static std::string name() { return "Celsius"; } static std::string symbol() { return "C"; } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_CELSIUS_HPP --- NEW FILE: fahrenheit.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_FAHRENHEIT_HPP #define BOOST_UNITS_FAHRENHEIT_HPP #include <string> #include <boost/units/absolute.hpp> #include <boost/units/io.hpp> #include <boost/units/static_constant.hpp> #include <boost/units/system.hpp> #include <boost/units/systems/physical_units.hpp> namespace boost { namespace units { namespace fahrenheit { struct system_tag : public ordinal<110> { }; typedef homogeneous_system<system_tag> system; typedef unit<temperature_type,system> temperature; BOOST_UNITS_STATIC_CONSTANT(degree,temperature); BOOST_UNITS_STATIC_CONSTANT(degrees,temperature); } // namespace fahrenheit template<> struct base_unit_info<temperature_tag,fahrenheit::system_tag> { static std::string name() { return "Fahrenheit"; } static std::string symbol() { return "F"; } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_FAHRENHEIT_HPP |
|
From: Matthias S. <mat...@us...> - 2007-04-02 21:24:49
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv663/conversions Modified Files: conversion_headers.hpp Added Files: convert_celsius_to_fahrenheit.hpp convert_celsius_to_kelvin.hpp convert_fahrenheit_to_celsius.hpp convert_fahrenheit_to_kelvin.hpp convert_kelvin_to_celsius.hpp convert_kelvin_to_fahrenheit.hpp Log Message: temperature conversions Index: conversion_headers.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/conversions/conversion_headers.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- conversion_headers.hpp 29 Mar 2007 22:39:47 -0000 1.3 +++ conversion_headers.hpp 2 Apr 2007 21:24:44 -0000 1.4 @@ -16,6 +16,8 @@ #include <boost/units/systems/conversions/convert_si_to_cgs.hpp> #endif +// angle conversions + #if defined(BOOST_UNITS_DEGREES_HPP) && defined(BOOST_UNITS_GRADIANS_HPP) #include <boost/units/systems/conversions/convert_degrees_to_gradians.hpp> #include <boost/units/systems/conversions/convert_gradians_to_degrees.hpp> @@ -30,3 +32,20 @@ #include <boost/units/systems/conversions/convert_gradians_to_radians.hpp> #include <boost/units/systems/conversions/convert_radians_to_gradians.hpp> #endif + +// temperature conversions + +#if defined(BOOST_UNITS_CELSIUS_HPP) && defined(BOOST_UNITS_FAHRENHEIT_HPP) + #include <boost/units/systems/conversions/convert_celsius_to_fahrenheit.hpp> + #include <boost/units/systems/conversions/convert_fahrenheit_to_celsius.hpp> +#endif + +#if defined(BOOST_UNITS_CELSIUS_HPP) && defined(BOOST_UNITS_SI_TEMPERATURE_HPP) + #include <boost/units/systems/conversions/convert_celsius_to_kelvin.hpp> + #include <boost/units/systems/conversions/convert_kelvin_to_celsius.hpp> +#endif + +#if defined(BOOST_UNITS_FAHRENHEIT_HPP) && defined(BOOST_UNITS_SI_TEMPERATURE_HPP) + #include <boost/units/systems/conversions/convert_fahrenheit_to_kelvin.hpp> + #include <boost/units/systems/conversions/convert_kelvin_to_fahrenheit.hpp> +#endif --- NEW FILE: convert_kelvin_to_celsius.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_CONVERT_KELVIN_TO_CELSIUS_HPP #define BOOST_UNITS_CONVERT_KELVIN_TO_CELSIUS_HPP #include <boost/units/conversion.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/temperature/celsius.hpp> #include <boost/units/systems/conversions/convert_celsius_to_kelvin.hpp> namespace boost { namespace units { // convert absolute temperature in Kelvin to Celsius template<class Y> class conversion_helper< quantity<unit<temperature_type,SI::system>,absolute<Y> >, quantity<unit<temperature_type,celsius::system>,absolute<Y> > > { public: typedef unit<temperature_type,SI::system> unit1_type; typedef unit<temperature_type,celsius::system> unit2_type; typedef quantity<unit1_type,absolute<Y> > from_quantity_type; typedef quantity<unit2_type,absolute<Y> > to_quantity_type; static to_quantity_type convert(const from_quantity_type& source) { const typename from_quantity_type::value_type& in(source.value()); return to_quantity_type::from_value(in.value() - 273.16); } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_CONVERT_KELVIN_TO_CELSIUS_HPP --- NEW FILE: convert_fahrenheit_to_kelvin.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_CONVERT_FAHRENHEIT_TO_KELVIN_HPP #define BOOST_UNITS_CONVERT_FAHRENHEIT_TO_KELVIN_HPP #include <boost/units/conversion.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/temperature/fahrenheit.hpp> namespace boost { namespace units { // convert temperature differences in Fahrenheit to Kelvin template<> struct base_unit_converter<temperature_tag,fahrenheit::system_tag,SI::system_tag> : #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION public implicitly_convertible, #endif public trivial_inverse_conversion { typedef double type; static type value() { return (5.0/9.0); } }; // convert absolute temperature in Fahrenheit to Kelvin template<class Y> class conversion_helper< quantity<unit<temperature_type,fahrenheit::system>,absolute<Y> >, quantity<unit<temperature_type,SI::system>,absolute<Y> > > { public: typedef unit<temperature_type,fahrenheit::system> unit1_type; typedef unit<temperature_type,SI::system> unit2_type; typedef quantity<unit1_type,absolute<Y> > from_quantity_type; typedef quantity<unit2_type,absolute<Y> > to_quantity_type; static to_quantity_type convert(const from_quantity_type& source) { const typename from_quantity_type::value_type& in(source.value()); return to_quantity_type::from_value((in.value()-32.0)*(5.0/9.0) + 273.16); } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_CONVERT_FAHRENHEIT_TO_KELVIN_HPP --- NEW FILE: convert_celsius_to_kelvin.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_CONVERT_CELSIUS_TO_KELVIN_HPP #define BOOST_UNITS_CONVERT_CELSIUS_TO_KELVIN_HPP #include <boost/units/conversion.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/temperature/celsius.hpp> namespace boost { namespace units { // convert temperature differences in Celsius to Kelvin template<> struct base_unit_converter<temperature_tag,celsius::system_tag,SI::system_tag> : #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION public implicitly_convertible, #endif public trivial_conversion, public trivial_inverse_conversion { }; // convert absolute temperature in Celsius to Kelvin template<class Y> class conversion_helper< quantity<unit<temperature_type,celsius::system>,absolute<Y> >, quantity<unit<temperature_type,SI::system>,absolute<Y> > > { public: typedef unit<temperature_type,celsius::system> unit1_type; typedef unit<temperature_type,SI::system> unit2_type; typedef quantity<unit1_type,absolute<Y> > from_quantity_type; typedef quantity<unit2_type,absolute<Y> > to_quantity_type; static to_quantity_type convert(const from_quantity_type& source) { const typename from_quantity_type::value_type& in(source.value()); return to_quantity_type::from_value(in.value() + 273.16); } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_CONVERT_CELSIUS_TO_KELVIN_HPP --- NEW FILE: convert_fahrenheit_to_celsius.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_CONVERT_FAHRENHEIT_TO_CELSIUS_HPP #define BOOST_UNITS_CONVERT_FAHRENHEIT_TO_CELSIUS_HPP #include <boost/units/conversion.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/temperature/celsius.hpp> #include <boost/units/systems/conversions/convert_celsius_to_fahrenheit.hpp> namespace boost { namespace units { // convert absolute temperature in Fahrenheit to Celsius template<class Y> class conversion_helper< quantity<unit<temperature_type,fahrenheit::system>,absolute<Y> >, quantity<unit<temperature_type,celsius::system>,absolute<Y> > > { public: typedef unit<temperature_type,fahrenheit::system> unit1_type; typedef unit<temperature_type,celsius::system> unit2_type; typedef quantity<unit1_type,absolute<Y> > from_quantity_type; typedef quantity<unit2_type,absolute<Y> > to_quantity_type; static to_quantity_type convert(const from_quantity_type& source) { const typename from_quantity_type::value_type& in(source.value()); return to_quantity_type::from_value((in.value() - 32.0)*(5.0/9.0)); } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_CONVERT_FAHRENHEIT_TO_CELSIUS_HPP --- NEW FILE: convert_kelvin_to_fahrenheit.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_CONVERT_KELVIN_TO_FAHRENHEIT_HPP #define BOOST_UNITS_CONVERT_KELVIN_TO_FAHRENHEIT_HPP #include <boost/units/conversion.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/temperature/fahrenheit.hpp> #include <boost/units/systems/conversions/convert_fahrenheit_to_kelvin.hpp> namespace boost { namespace units { // convert absolute temperature in Kelvin to Fahrenheit template<class Y> class conversion_helper< quantity<unit<temperature_type,SI::system>,absolute<Y> >, quantity<unit<temperature_type,fahrenheit::system>,absolute<Y> > > { public: typedef unit<temperature_type,SI::system> unit1_type; typedef unit<temperature_type,fahrenheit::system> unit2_type; typedef quantity<unit1_type,absolute<Y> > from_quantity_type; typedef quantity<unit2_type,absolute<Y> > to_quantity_type; static to_quantity_type convert(const from_quantity_type& source) { const typename from_quantity_type::value_type& in(source.value()); return to_quantity_type::from_value((in.value()-273.16)*(9.0/5.0) + 32.0); } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_CONVERT_KELVIN_TO_FAHRENHEIT_HPP --- NEW FILE: convert_celsius_to_fahrenheit.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // 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_UNITS_CONVERT_CELSIUS_TO_FAHRENHEIT_HPP #define BOOST_UNITS_CONVERT_CELSIUS_TO_FAHRENHEIT_HPP #include <boost/units/conversion.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/temperature/celsius.hpp> namespace boost { namespace units { // convert temperature differences in Celsius to Fahrenheit template<> struct base_unit_converter<temperature_tag,celsius::system_tag,fahrenheit::system_tag> : #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION public implicitly_convertible, #endif public trivial_inverse_conversion { typedef double type; static type value() { return (9.0/5.0); } }; // convert absolute temperature in Celsius to Kelvin template<class Y> class conversion_helper< quantity<unit<temperature_type,celsius::system>,absolute<Y> >, quantity<unit<temperature_type,fahrenheit::system>,absolute<Y> > > { public: typedef unit<temperature_type,celsius::system> unit1_type; typedef unit<temperature_type,fahrenheit::system> unit2_type; typedef quantity<unit1_type,absolute<Y> > from_quantity_type; typedef quantity<unit2_type,absolute<Y> > to_quantity_type; static to_quantity_type convert(const from_quantity_type& source) { const typename from_quantity_type::value_type& in(source.value()); return to_quantity_type::from_value(in.value()*(9.0/5.0) + 32.0); } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_CONVERT_CELSIUS_TO_FAHRENHEIT_HPP |
|
From: Matthias S. <mat...@us...> - 2007-04-02 20:12:57
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/other In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7108/other Modified Files: non_si_units.hpp Removed Files: temperature_fahrenheit.hpp Log Message: initial implementation of fahrenheit and celsius temperature (not tested yet) Index: non_si_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/other/non_si_units.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- non_si_units.hpp 30 Mar 2007 17:16:06 -0000 1.1 +++ non_si_units.hpp 2 Apr 2007 20:12:51 -0000 1.2 @@ -11,6 +11,8 @@ #ifndef BOOST_UNITS_NON_SI_CONSTANTS_HPP #define BOOST_UNITS_NON_SI_CONSTANTS_HPP +// SI conversion factors for various non-SI units + #include <boost/units/systems/si.hpp> namespace boost { @@ -60,14 +62,14 @@ BOOST_UNITS_STATIC_CONSTANT(tonnes,mass) = 1.0e3*kilograms; // units of time -BOOST_UNITS_STATIC_CONSTANT(day,time) = 86400*seconds; -BOOST_UNITS_STATIC_CONSTANT(days,time) = 86400*seconds; +BOOST_UNITS_STATIC_CONSTANT(day,time) = 86400.0*seconds; +BOOST_UNITS_STATIC_CONSTANT(days,time) = 86400.0*seconds; -BOOST_UNITS_STATIC_CONSTANT(hour,time) = 3600*seconds; -BOOST_UNITS_STATIC_CONSTANT(hours,time) = 3600*seconds; +BOOST_UNITS_STATIC_CONSTANT(hour,time) = 3600.0*seconds; +BOOST_UNITS_STATIC_CONSTANT(hours,time) = 3600.0*seconds; -BOOST_UNITS_STATIC_CONSTANT(minute,time) = 60*seconds; -BOOST_UNITS_STATIC_CONSTANT(minutes,time) = 60*seconds; +BOOST_UNITS_STATIC_CONSTANT(minute,time) = 60.0*seconds; +BOOST_UNITS_STATIC_CONSTANT(minutes,time) = 60.0*seconds; // units of planar angle //BOOST_UNITS_STATIC_CONSTANT(arc_degree,angle) = (pi/180)*radians; @@ -102,6 +104,9 @@ BOOST_UNITS_STATIC_CONSTANT(fathom,length) = 1.852*meters; BOOST_UNITS_STATIC_CONSTANT(fathoms,length) = 1.852*meters; +BOOST_UNITS_STATIC_CONSTANT(knot,velocity) = (1852.0/3600.0)*meters_per_second; +BOOST_UNITS_STATIC_CONSTANT(knots,velocity) = (1852.0/3600.0)*meters_per_second; + BOOST_UNITS_STATIC_CONSTANT(league,length) = 5556.0*meters; BOOST_UNITS_STATIC_CONSTANT(leagues,length) = 5556.0*meters; @@ -111,7 +116,7 @@ } // namespace nautical // US customary units -namespace us_customary { +namespace us { // conversions from http://ts.nist.gov/WeightsAndMeasures/Publications/appxc.cfm#2 @@ -233,10 +238,15 @@ BOOST_UNITS_STATIC_CONSTANT(troy_pound,mass) = 3.732417216e-1*kilograms; BOOST_UNITS_STATIC_CONSTANT(troy_pounds,mass) = 3.732417216e-1*kilograms; -} // namespace us_customary +// units of velocity +BOOST_UNITS_STATIC_CONSTANT(miles_per_hour,velocity) = (1609.344/3600.0)*meters_per_second; + +} // namespace us // US survey units -namespace us_survey { +namespace us { + +namespace survey { // conversions from http://ts.nist.gov/WeightsAndMeasures/Publications/appxc.cfm#2 @@ -272,7 +282,9 @@ BOOST_UNITS_STATIC_CONSTANT(square_mile,area) = 2589998.0*square_meters; BOOST_UNITS_STATIC_CONSTANT(square_miles,area) = 2589998.0*square_meters; -} // namespace us_survey +} // namespace survey + +} // namespace us /* namespace english { --- temperature_fahrenheit.hpp DELETED --- |