Boost logo

Boost-Commit :

From: matthiasschabel_at_[hidden]
Date: 2007-05-31 12:46:50


Author: matthiasschabel
Date: 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
New Revision: 4381
URL: http://svn.boost.org/trac/boost/changeset/4381

Log:
examples and test run

Text files modified:
   sandbox/units/libs/units/example/measurement.hpp | 4 +-
   sandbox/units/libs/units/example/scaled_value.hpp | 2
   sandbox/units/libs/units/example/test_system.hpp | 69 ++++++++++++++++++++++-----------------
   sandbox/units/libs/units/example/unit_example_1.cpp | 52 +++++++++++++++---------------
   sandbox/units/libs/units/example/unit_example_14.cpp | 20 +++++++++++
   sandbox/units/libs/units/example/unit_example_16.cpp | 20 +++++-----
   sandbox/units/libs/units/example/unit_example_20.cpp | 10 ++--
   sandbox/units/libs/units/example/unit_example_21.cpp | 50 ++++++++++++++++++++++++----
   sandbox/units/libs/units/example/unit_example_22.cpp | 8 ++--
   sandbox/units/libs/units/example/unit_example_4.cpp | 8 ++--
   sandbox/units/libs/units/example/unit_example_8.cpp | 18 +++++-----
   sandbox/units/libs/units/example/unit_example_9.cpp | 18 +++++-----
   sandbox/units/libs/units/test/fail_heterogeneous_unit.cpp | 4 +-
   sandbox/units/libs/units/test/test_header.hpp | 60 +++++++++++++++++-----------------
   sandbox/units/libs/units/test/test_implicit_conversion.cpp | 48 +++++++++++++-------------
   15 files changed, 227 insertions(+), 164 deletions(-)

Modified: sandbox/units/libs/units/example/measurement.hpp
==============================================================================
--- sandbox/units/libs/units/example/measurement.hpp (original)
+++ sandbox/units/libs/units/example/measurement.hpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -273,9 +273,9 @@
 
 /// specialize power typeof helper
 template<class Y,long N,long D>
-struct power_typeof_helper<measurement<Y>,static_rational<N,D> >
+struct power_dimof_helper<measurement<Y>,static_rational<N,D> >
 {
- typedef measurement<typename power_typeof_helper<Y,static_rational<N,D> >::type> type;
+ typedef measurement<typename power_dimof_helper<Y,static_rational<N,D> >::type> type;
     
     static type value(const measurement<Y>& x)
     {

Modified: sandbox/units/libs/units/example/scaled_value.hpp
==============================================================================
--- sandbox/units/libs/units/example/scaled_value.hpp (original)
+++ sandbox/units/libs/units/example/scaled_value.hpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -284,7 +284,7 @@
 
 /// specialize power typeof helper
 template<class Y,long Base,class Exp,long N,long D>
-struct power_typeof_helper<scaled_value<Y,scale<Base,Exp> >,static_rational<N,D> >
+struct power_dimof_helper<scaled_value<Y,scale<Base,Exp> >,static_rational<N,D> >
 {
     typedef scaled_value<Y,scale<Base,typename mpl::times<Exp,static_rational<N> >::type> > type;
     

Modified: sandbox/units/libs/units/example/test_system.hpp
==============================================================================
--- sandbox/units/libs/units/example/test_system.hpp (original)
+++ sandbox/units/libs/units/example/test_system.hpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -2,6 +2,7 @@
 // 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
@@ -27,60 +28,68 @@
 namespace units {
 
 //[test_system_snippet_1
-struct length_dim : boost::units::base_dimension<length_dim, 1> {}; ///> base dimension of length
-struct mass_dim : boost::units::base_dimension<mass_dim,2> {}; ///> base dimension of mass
-struct time_dim : boost::units::base_dimension<time_dim,3> {}; ///> base dimension of time
+struct length_base_dimension : boost::units::base_dimension<length_base_dimension, 1> { }; ///> base dimension of length
+struct mass_base_dimension : boost::units::base_dimension<mass_base_dimension,2> { }; ///> base dimension of mass
+struct time_base_dimension : boost::units::base_dimension<time_base_dimension,3> { }; ///> base dimension of time
 //]
 
 #if 0
 //[test_system_snippet_2
-typedef make_dimension_list< boost::mpl::list< dim< length_dim,static_rational<1> > > >::type length_type;
-typedef make_dimension_list< boost::mpl::list< dim< mass_dim,static_rational<1> > > >::type mass_type;
-typedef make_dimension_list< boost::mpl::list< dim< time_dim,static_rational<1> > > >::type time_type;
+typedef make_dimension_list< boost::mpl::list< dim< length_base_dimension,static_rational<1> > > >::type length_dimension;
+typedef make_dimension_list< boost::mpl::list< dim< mass_base_dimension,static_rational<1> > > >::type mass_dimension;
+typedef make_dimension_list< boost::mpl::list< dim< time_base_dimension,static_rational<1> > > >::type time_dimension;
 //]
 #endif
 
 //[test_system_snippet_3
-typedef length_dim::type length_type;
-typedef mass_dim::type mass_type;
-typedef time_dim::type time_type;
+typedef length_base_dimension::type length_dimension;
+typedef mass_base_dimension::type mass_dimension;
+typedef time_base_dimension::type time_dimension;
 //]
 
 #if 0
 //[test_system_snippet_4
-typedef make_dimension_list< boost::mpl::list< dim< length_dim,static_rational<2> > > >::type area_type;
-typedef make_dimension_list< boost::mpl::list< dim< mass_dim,static_rational<1> >,
- dim< length_dim,static_rational<2> >,
- dim< time_dim,static_rational<-2> > > >::type energy_type;
+typedef make_dimension_list< boost::mpl::list< dim< length_base_dimension,static_rational<2> > > >::type area_dim;
+typedef make_dimension_list< boost::mpl::list< dim< mass_base_dimension,static_rational<1> >,
+ dim< length_base_dimension,static_rational<2> >,
+ dim< time_base_dimension,static_rational<-2> > > >::type energy_dim;
 //]
 #endif
 
 //[test_system_snippet_5
-typedef derived_dimension<length_dim,2>::type area_type;
-typedef derived_dimension<mass_dim,1,
- length_dim,2,
- time_dim,-2>::type energy_type;
+typedef derived_dimension<length_base_dimension,2>::type area_dim;
+typedef derived_dimension<mass_base_dimension,1,
+ length_base_dimension,2,
+ time_base_dimension,-2>::type energy_dim;
 //]
 
 namespace test {
 
 //[test_system_snippet_6
 
-struct length_unit : base_unit<length_unit, length_type, 1> {};
-struct mass_unit : base_unit<mass_unit, mass_type, 2> {};
-struct time_unit : base_unit<time_unit, time_type, 3> {};
+struct meter_base_unit : base_unit<meter_base_unit, length_dimension, 1> { };
+struct kilogram_base_unit : base_unit<kilogram_base_unit, mass_dimension, 2> { };
+struct second_base_unit : base_unit<second_base_unit, time_dimension, 3> { };
+
+typedef make_system<meter_base_unit>::type m_system;
+typedef make_system<kilogram_base_unit>::type kg_system;
+typedef make_system<second_base_unit>::type s_system;
 
-typedef make_system<length_unit, mass_unit, time_unit>::type system;
+typedef make_system<meter_base_unit,kilogram_base_unit,second_base_unit>::type mks_system;
 
 /// unit typedefs
-typedef unit<dimensionless_type,system> dimensionless;
+typedef unit<dimensionless_type,mks_system> dimensionless;
 
-typedef unit<length_type,system> length;
-typedef unit<mass_type,system> mass;
-typedef unit<time_type,system> time;
+//typedef unit<length_dimension,m_system> length;
+//typedef unit<mass_dimension,kg_system> mass;
+//typedef unit<time_dimension,s_system> time;
+
+typedef unit<length_dimension,mks_system> length;
+typedef unit<mass_dimension,mks_system> mass;
+typedef unit<time_dimension,mks_system> time;
 
-typedef unit<area_type,system> area;
-typedef unit<energy_type,system> energy;
+typedef unit<area_dim,mks_system> area;
+typedef unit<energy_dim,mks_system> energy;
 //]
 
 //[test_system_snippet_7
@@ -101,20 +110,20 @@
 } // namespace test
 
 //[test_system_snippet_8
-template<> struct base_unit_info<test::length_unit>
+template<> struct base_unit_info<test::meter_base_unit>
 {
     static std::string name() { return "meter"; }
     static std::string symbol() { return "m"; }
 };
 //]
 
-template<> struct base_unit_info<test::mass_unit>
+template<> struct base_unit_info<test::kilogram_base_unit>
 {
     static std::string name() { return "kilogram"; }
     static std::string symbol() { return "kg"; }
 };
 
-template<> struct base_unit_info<test::time_unit>
+template<> struct base_unit_info<test::second_base_unit>
 {
     static std::string name() { return "second"; }
     static std::string symbol() { return "s"; }

Modified: sandbox/units/libs/units/example/unit_example_1.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_1.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_1.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -20,13 +20,13 @@
 @verbatim
 
 //[unit_example_1_output
-length_type = l_item<long_<1L>, dim<length_dim, static_rational<1L, 1L> > >
-mass_type = l_item<long_<1L>, dim<mass_dim, static_rational<1L, 1L> > >
-time_type = l_item<long_<1L>, dim<time_dim, static_rational<1L, 1L> > >
-energy_type = l_item<long_<3L>, dim<length_dim, static_rational<2L, 1L> >, l_item<long_<2L>, dim<mass_dim, static_rational<1L, 1L> >, l_item<long_<1L>, dim<time_dim, static_rational<-2L, 1L> > > > >
-LM_type = l_item<long_<2L>, dim<length_dim, static_rational<1L, 1L> >, l_item<long_<1L>, dim<mass_dim, static_rational<1L, 1L> > > >
-L_T_type = l_item<long_<2L>, dim<length_dim, static_rational<1L, 1L> >, l_item<long_<1L>, dim<time_dim, static_rational<-1L, 1L> > > >
-V_type = l_item<long_<2L>, dim<length_dim, static_rational<1L, 1L> >, l_item<long_<1L>, dim<time_dim, static_rational<-1L, 1L> > > >
+length_dimension = dimension_list<dim<length_base_dimension, static_rational<1l, 1l> >, dimensionless_type>
+mass_dimension = dimension_list<dim<mass_base_dimension, static_rational<1l, 1l> >, dimensionless_type>
+time_dimension = dimension_list<dim<time_base_dimension, static_rational<1l, 1l> >, dimensionless_type>
+energy_dim = dimension_list<dim<length_base_dimension, static_rational<2l, 1l> >, dimension_list<dim<mass_base_dimension, static_rational<1l, 1l> >, dimension_list<dim<time_base_dimension, static_rational<-2l, 1l> >, dimensionless_type> > >
+LM_type = dimension_list<dim<length_base_dimension, static_rational<1l, 1l> >, dimension_list<dim<mass_base_dimension, static_rational<1l, 1l> >, dimensionless_type> >
+L_T_type = dimension_list<dim<length_base_dimension, static_rational<1l, 1l> >, dimension_list<dim<time_base_dimension, static_rational<-1l, 1l> >, dimensionless_type> >
+V_type = dimension_list<dim<length_base_dimension, static_rational<1l, 1l> >, dimension_list<dim<time_base_dimension, static_rational<-1l, 1l> >, dimensionless_type> >
 //]
 
 @endverbatim
@@ -51,48 +51,48 @@
 {
     using namespace boost::units;
 
- BOOST_MPL_ASSERT((boost::is_same<length_type, mpl::push_front<dimensionless_type, dim<length_dim, static_rational<1L, 1L> > >::type>));
- BOOST_MPL_ASSERT((boost::is_same<mass_type, mpl::push_front<dimensionless_type, dim<mass_dim, static_rational<1L, 1L> > >::type>));
- BOOST_MPL_ASSERT((boost::is_same<energy_type,
+ BOOST_MPL_ASSERT((boost::is_same<length_dimension, mpl::push_front<dimensionless_type, dim<length_base_dimension, static_rational<1L, 1L> > >::type>));
+ BOOST_MPL_ASSERT((boost::is_same<mass_dimension, mpl::push_front<dimensionless_type, dim<mass_base_dimension, static_rational<1L, 1L> > >::type>));
+ BOOST_MPL_ASSERT((boost::is_same<energy_dim,
         mpl::push_front<
         mpl::push_front<
         mpl::push_front<
         dimensionless_type,
- dim<time_dim, static_rational<-2L, 1L> > >::type,
- dim<mass_dim, static_rational<1L, 1L> > >::type,
- dim<length_dim, static_rational<2L, 1L> > >::type>));
+ dim<time_base_dimension, static_rational<-2L, 1L> > >::type,
+ dim<mass_base_dimension, static_rational<1L, 1L> > >::type,
+ dim<length_base_dimension, static_rational<2L, 1L> > >::type>));
                               
- std::cout << "length_type = " << simplify_typename(length_type()) << std::endl
- << "mass_type = " << simplify_typename(mass_type()) << std::endl
- << "time_type = " << simplify_typename(time_type()) << std::endl
- << "energy_type = " << simplify_typename(energy_type()) << std::endl;
+ std::cout << "length_dimension = " << simplify_typename(length_dimension()) << std::endl
+ << "mass_dimension = " << simplify_typename(mass_dimension()) << std::endl
+ << "time_dimension = " << simplify_typename(time_dimension()) << std::endl
+ << "energy_dim = " << simplify_typename(energy_dim()) << std::endl;
     
     //[unit_example_1_snippet_1
- typedef mpl::times<length_type,mass_type>::type LM_type;
- typedef mpl::divides<length_type,time_type>::type L_T_type;
- typedef static_root<mpl::divides<energy_type,mass_type>::type,static_rational<2> >::type V_type;
+ typedef mpl::times<length_dimension,mass_dimension>::type LM_type;
+ typedef mpl::divides<length_dimension,time_dimension>::type L_T_type;
+ typedef static_root<mpl::divides<energy_dim,mass_dimension>::type,static_rational<2> >::type V_type;
     //]
     
     BOOST_MPL_ASSERT((boost::is_same<LM_type,
         mpl::push_front<
         mpl::push_front<
         dimensionless_type,
- dim<mass_dim, static_rational<1L, 1L> > >::type,
- dim<length_dim, static_rational<1L, 1L> > >::type>));
+ dim<mass_base_dimension, static_rational<1L, 1L> > >::type,
+ dim<length_base_dimension, static_rational<1L, 1L> > >::type>));
 
     BOOST_MPL_ASSERT((boost::is_same<L_T_type,
         mpl::push_front<
         mpl::push_front<
         dimensionless_type,
- dim<time_dim, static_rational<-1L, 1L> > >::type,
- dim<length_dim, static_rational<1L, 1L> > >::type>));
+ dim<time_base_dimension, static_rational<-1L, 1L> > >::type,
+ dim<length_base_dimension, static_rational<1L, 1L> > >::type>));
 
     BOOST_MPL_ASSERT((boost::is_same<V_type,
         mpl::push_front<
         mpl::push_front<
         dimensionless_type,
- dim<time_dim, static_rational<-1L, 1L> > >::type,
- dim<length_dim, static_rational<1L, 1L> > >::type>));
+ dim<time_base_dimension, static_rational<-1L, 1L> > >::type,
+ dim<length_base_dimension, static_rational<1L, 1L> > >::type>));
     
     std::cout << "LM_type = " << simplify_typename(LM_type()) << std::endl
               << "L_T_type = " << simplify_typename(L_T_type()) << std::endl

Modified: sandbox/units/libs/units/example/unit_example_14.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_14.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_14.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -198,6 +198,26 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+/**
+\file
+
+\brief unit_example_14.cpp
+
+\detailed
+Test runtime performance.
+
+Output:
+@verbatim
+
+multiplying ublas::matrix<double>(1000, 1000) : 25.03 seconds
+multiplying ublas::matrix<quantity>(1000, 1000) : 24.49 seconds
+tiled_matrix_multiply<double>(1000, 1000) : 1.12 seconds
+tiled_matrix_multiply<quantity>(1000, 1000) : 1.16 seconds
+solving y' = 1 - x + 4 * y with double: 1.97 seconds
+solving y' = 1 - x + 4 * y with quantity: 1.84 seconds
+
+@endverbatim
+**/
 #include <cstdlib>
 #include <ctime>
 #include <algorithm>

Modified: sandbox/units/libs/units/example/unit_example_16.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_16.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_16.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -54,7 +54,7 @@
 
 //typedef homogeneous_system<system_tag> system;
 
-struct length_base_unit : base_unit<length_base_unit, length_type, 1>
+struct length_base_unit : base_unit<length_base_unit, length_dimension, 1>
 {
     static std::string name() { return "nautical mile"; }
     static std::string symbol() { return "nmi"; }
@@ -63,7 +63,7 @@
 typedef make_system<length_base_unit>::type system;
 
 /// unit typedefs
-typedef unit<length_type,system> length;
+typedef unit<length_dimension,system> length;
 
 static const length mile,miles;
 
@@ -91,7 +91,7 @@
 //
 //typedef homogeneous_system<system_tag> system;
 
-struct length_base_unit : base_unit<length_base_unit, length_type, 2>
+struct length_base_unit : base_unit<length_base_unit, length_dimension, 2>
 {
     static std::string name() { return "foot"; }
     static std::string symbol() { return "ft"; }
@@ -100,7 +100,7 @@
 typedef make_system<length_base_unit>::type system;
 
 /// unit typedefs
-typedef unit<length_type,system> length;
+typedef unit<length_dimension,system> length;
 
 static const length foot,feet;
 
@@ -121,20 +121,20 @@
 // radar beam height functions
 //[unit_example_16_function_snippet_1
 template<class System,typename T>
-quantity<unit<length_type,System>,T>
-radar_beam_height(const quantity<unit<length_type,System>,T>& radar_range,
- const quantity<unit<length_type,System>,T>& earth_radius,
+quantity<unit<length_dimension,System>,T>
+radar_beam_height(const quantity<unit<length_dimension,System>,T>& radar_range,
+ const quantity<unit<length_dimension,System>,T>& earth_radius,
                   T k = 4.0/3.0)
 {
- return quantity<unit<length_type,System>,T>(pow<2>(radar_range)/(2.0*k*earth_radius));
+ return quantity<unit<length_dimension,System>,T>(pow<2>(radar_range)/(2.0*k*earth_radius));
 }
 //]
 
 //[unit_example_16_function_snippet_2
 template<class return_type,class System1,class System2,typename T>
 return_type
-radar_beam_height(const quantity<unit<length_type,System1>,T>& radar_range,
- const quantity<unit<length_type,System2>,T>& earth_radius,
+radar_beam_height(const quantity<unit<length_dimension,System1>,T>& radar_range,
+ const quantity<unit<length_dimension,System2>,T>& earth_radius,
                   T k = 4.0/3.0)
 {
     // need to decide which system to use for calculation

Modified: sandbox/units/libs/units/example/unit_example_20.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_20.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_20.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -54,7 +54,7 @@
 
 typedef make_system<fahrenheit_tag>::type system;
 
-typedef unit<temperature_type,system> temperature;
+typedef unit<temperature_dimension,system> temperature;
 
 BOOST_UNITS_STATIC_CONSTANT(degree,temperature);
 BOOST_UNITS_STATIC_CONSTANT(degrees,temperature);
@@ -62,14 +62,14 @@
 } // fahrenheit
 
 template<>
-struct is_implicitly_convertible< unit<temperature_type,fahrenheit::system>,
- unit<temperature_type,SI::system> > :
+struct is_implicitly_convertible< unit<temperature_dimension,fahrenheit::system>,
+ unit<temperature_dimension,SI::system> > :
     public mpl::true_
 { };
 
 template<>
-struct is_implicitly_convertible<absolute< unit<temperature_type,fahrenheit::system> >,
- absolute< unit<temperature_type,SI::system> > > :
+struct is_implicitly_convertible<absolute< unit<temperature_dimension,fahrenheit::system> >,
+ absolute< unit<temperature_dimension,SI::system> > > :
     public mpl::true_
 { };
 

Modified: sandbox/units/libs/units/example/unit_example_21.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_21.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_21.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -39,27 +39,61 @@
 
 namespace units {
 
-struct imperial_gallon_tag : base_unit<imperial_gallon_tag, volume_type, 1> {};
+struct imperial_gallon_tag : base_unit<imperial_gallon_tag, volume_dim, 1> { };
 
 typedef make_system<imperial_gallon_tag>::type imperial;
 
-typedef unit<volume_type,imperial> imperial_gallon;
+typedef unit<volume_dim,imperial> imperial_gallon;
 
-struct us_gallon_tag : base_unit<us_gallon_tag, volume_type, 2> {};
+struct us_gallon_tag : base_unit<us_gallon_tag, volume_dim, 2> { };
 
 typedef make_system<us_gallon_tag>::type us;
 
-typedef unit<volume_type,us> us_gallon;
+typedef unit<volume_dim,us> us_gallon;
+
+///// convert imperial gallons to us gallons
+//template<class Y>
+//class conversion_helper< quantity<unit<volume_dim,imperial>,Y>,
+// quantity<unit<volume_dim,us>,Y> >
+//{
+// public:
+// typedef quantity<unit<volume_dim,imperial>,Y> from_quantity_type;
+// typedef quantity<unit<volume_dim,us>,Y> to_quantity_type;
+//
+// static
+// to_quantity_type
+// convert(const from_quantity_type& source)
+// {
+// return to_quantity_type::from_value(source.value()*1.2009499255);
+// }
+//};
+//
+///// convert us gallons to imperial gallons
+//template<class Y>
+//class conversion_helper< quantity<unit<volume_dim,us>,Y>,
+// quantity<unit<volume_dim,imperial>,Y> >
+//{
+// public:
+// typedef quantity<unit<volume_dim,us>,Y> from_quantity_type;
+// typedef quantity<unit<volume_dim,imperial>,Y> to_quantity_type;
+//
+// static
+// to_quantity_type
+// convert(const from_quantity_type& source)
+// {
+// return to_quantity_type::from_value(source.value()/1.2009499255);
+// }
+//};
 
 template<>
-struct is_implicitly_convertible<unit<volume_type,imperial>,
- unit<volume_type,us> > :
+struct is_implicitly_convertible<unit<volume_dim,imperial>,
+ unit<volume_dim,us> > :
     public mpl::true_
 { };
 
 template<>
-struct is_implicitly_convertible<unit<volume_type,us>,
- unit<volume_type,imperial> > :
+struct is_implicitly_convertible<unit<volume_dim,us>,
+ unit<volume_dim,imperial> > :
     public mpl::true_
 { };
 

Modified: sandbox/units/libs/units/example/unit_example_22.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_22.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_22.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -203,8 +203,8 @@
 
 template<int N>
 struct f {
- typedef typename derived_dimension<length_dim, (1<<N) >::type dim1;
- typedef typename derived_dimension<mass_dim, (1<<N) >::type dim2;
+ typedef typename derived_dimension<length_base_dimension, (1<<N) >::type dim1;
+ typedef typename derived_dimension<mass_base_dimension, (1<<N) >::type dim2;
     template<class T>
     static void apply(const T& t) {
         f<N - 1>::apply(t * unit<dim1, SI::system>());
@@ -237,8 +237,8 @@
 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)
+typeof(quantity<unit<length_dimension,System>,Y>()*quantity<unit<length_dimension,System>,Y>())
+compute_area(const quantity<unit<length_dimension,System>,Y>& L)
 {
     return L*L;
 }

Modified: sandbox/units/libs/units/example/unit_example_4.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_4.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_4.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -157,7 +157,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<plane_angle_dim,System>,Y>& theta)
+sin(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
 {
     return quantity<unit<dimensionless_type,System>,Y>(std::sin(theta.value()));
 }
@@ -166,10 +166,10 @@
 //[unit_example_4_function_snippet_2
 /// asin takes a dimensionless quantity and returns a quantity
 template<class System,class Y>
-quantity<unit<plane_angle_dim,System>,Y>
+quantity<unit<plane_angle_dimension,System>,Y>
 asin(const quantity<unit<dimensionless_type,System>,Y>& val)
 {
- typedef quantity<unit<plane_angle_dim,System>,Y> quantity_type;
+ typedef quantity<unit<plane_angle_dimension,System>,Y> quantity_type;
     
     return quantity_type::from_value(std::asin(val.value()));
 }
@@ -181,7 +181,7 @@
 template<class System,class Y>
 quantity<unit<energy_dim,System>,Y>
 work(quantity<unit<force_dim,System>,Y> F,
- quantity<unit<length_dim,System>,Y> dx)
+ quantity<unit<length_dimension,System>,Y> dx)
 {
     return F*dx;
 }

Modified: sandbox/units/libs/units/example/unit_example_8.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_8.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_8.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -68,12 +68,12 @@
 //[unit_example_8_class_snippet_1
 /// specialize power typeof helper
 template<class Y,long N,long D>
-struct power_typeof_helper<boost::math::quaternion<Y>,static_rational<N,D> >
+struct power_dimof_helper<boost::math::quaternion<Y>,static_rational<N,D> >
 {
     // boost::math::quaternion only supports integer powers
     BOOST_STATIC_ASSERT(D==1);
     
- typedef boost::math::quaternion<typename power_typeof_helper<Y,static_rational<N,D> >::type> type;
+ typedef boost::math::quaternion<typename power_dimof_helper<Y,static_rational<N,D> >::type> type;
     
     static type value(const boost::math::quaternion<Y>& x)
     {
@@ -108,10 +108,10 @@
 //[unit_example_8_class_snippet_2
 /// specialize power typeof helper for quaternion<quantity<Unit,Y> >
 template<class Unit,long N,long D,class Y>
-struct power_typeof_helper<boost::math::quaternion<quantity<Unit,Y> >,static_rational<N,D> >
+struct power_dimof_helper<boost::math::quaternion<quantity<Unit,Y> >,static_rational<N,D> >
 {
- typedef typename power_typeof_helper<Y,static_rational<N,D> >::type value_type;
- typedef typename power_typeof_helper<Unit,static_rational<N,D> >::type unit_type;
+ typedef typename power_dimof_helper<Y,static_rational<N,D> >::type value_type;
+ typedef typename power_dimof_helper<Unit,static_rational<N,D> >::type unit_type;
     typedef quantity<unit_type,value_type> quantity_type;
     typedef boost::math::quaternion<quantity_type> type;
     
@@ -169,9 +169,9 @@
     
     {
     //[unit_example_8_snippet_1
- typedef quantity<length,quaternion<double> > length_type;
+ typedef quantity<length,quaternion<double> > length_dimension;
         
- length_type L(quaternion<double>(4.0,3.0,2.0,1.0)*meters);
+ length_dimension L(quaternion<double>(4.0,3.0,2.0,1.0)*meters);
     //]
     
     sstream1 << "+L = " << +L << std::endl
@@ -189,9 +189,9 @@
     
     {
     //[unit_example_8_snippet_2
- typedef quaternion<quantity<length> > length_type;
+ typedef quaternion<quantity<length> > length_dimension;
         
- length_type L(4.0*meters,3.0*meters,2.0*meters,1.0*meters);
+ length_dimension L(4.0*meters,3.0*meters,2.0*meters,1.0*meters);
     //]
     
     sstream1 << "+L = " << +L << std::endl

Modified: sandbox/units/libs/units/example/unit_example_9.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_9.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_9.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -198,9 +198,9 @@
 
 /// specialize power typeof helper
 template<class Y,long N,long D>
-struct power_typeof_helper<complex<Y>,static_rational<N,D> >
+struct power_dimof_helper<complex<Y>,static_rational<N,D> >
 {
- typedef complex<typename power_typeof_helper<Y,static_rational<N,D> >::type> type;
+ typedef complex<typename power_dimof_helper<Y,static_rational<N,D> >::type> type;
     
     static type value(const complex<Y>& x)
     {
@@ -230,10 +230,10 @@
 
 /// specialize power typeof helper for complex<quantity<Unit,Y> >
 template<class Y,class Unit,long N,long D>
-struct power_typeof_helper<complex<quantity<Unit,Y> >,static_rational<N,D> >
+struct power_dimof_helper<complex<quantity<Unit,Y> >,static_rational<N,D> >
 {
- typedef typename power_typeof_helper<Y,static_rational<N,D> >::type value_type;
- typedef typename power_typeof_helper<Unit,static_rational<N,D> >::type unit_type;
+ typedef typename power_dimof_helper<Y,static_rational<N,D> >::type value_type;
+ typedef typename power_dimof_helper<Unit,static_rational<N,D> >::type unit_type;
     typedef quantity<unit_type,value_type> quantity_type;
     typedef complex<quantity_type> type;
     
@@ -277,9 +277,9 @@
     
     {
     //[unit_example_9_snippet_1
- typedef quantity<length,complex<double> > length_type;
+ typedef quantity<length,complex<double> > length_dimension;
         
- length_type L(complex<double>(2.0,1.0)*meters);
+ length_dimension L(complex<double>(2.0,1.0)*meters);
     //]
     
     sstream1 << "+L = " << +L << std::endl
@@ -297,9 +297,9 @@
     
     {
     //[unit_example_9_snippet_2
- typedef complex<quantity<length> > length_type;
+ typedef complex<quantity<length> > length_dimension;
         
- length_type L(2.0*meters,1.0*meters);
+ length_dimension L(2.0*meters,1.0*meters);
     //]
     
     sstream1 << "+L = " << +L << std::endl

Modified: sandbox/units/libs/units/test/fail_heterogeneous_unit.cpp
==============================================================================
--- sandbox/units/libs/units/test/fail_heterogeneous_unit.cpp (original)
+++ sandbox/units/libs/units/test/fail_heterogeneous_unit.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -30,8 +30,8 @@
 namespace bu = boost::units;
 
 template<class System>
-bu::quantity<bu::unit<bu::energy_type, System> > f(bu::quantity<bu::unit<bu::length_type, System> > l) {
- return(static_cast<bu::quantity<bu::unit<bu::energy_type, System> > >(f(static_cast<bu::quantity<bu::SI::length> >(l))));
+bu::quantity<bu::unit<bu::energy_dim, System> > f(bu::quantity<bu::unit<bu::length_dimension, System> > l) {
+ return(static_cast<bu::quantity<bu::unit<bu::energy_dim, System> > >(f(static_cast<bu::quantity<bu::SI::length> >(l))));
 }
 bu::quantity<bu::SI::energy> f(bu::quantity<bu::SI::length> l) {
     return(l * l * 2.0 * bu::SI::kilograms / bu::pow<2>(bu::SI::seconds));

Modified: sandbox/units/libs/units/test/test_header.hpp
==============================================================================
--- sandbox/units/libs/units/test/test_header.hpp (original)
+++ sandbox/units/libs/units/test/test_header.hpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -40,44 +40,44 @@
 
 namespace units {
 
-struct length_dim : boost::units::base_dimension<length_dim,1> { }; ///> base dimension of length
-struct mass_dim : boost::units::base_dimension<mass_dim,2> { }; ///> base dimension of mass
-struct time_dim : boost::units::base_dimension<time_dim,3> { }; ///> base dimension of time
-
-typedef length_dim::type length_type;
-typedef mass_dim::type mass_type;
-typedef time_dim::type time_type;
-
-typedef derived_dimension<length_dim,2>::type area_type;
-typedef derived_dimension<mass_dim,1,
- length_dim,2,
- time_dim,-2>::type energy_type;
-typedef derived_dimension<mass_dim,-1,
- length_dim,-2,
- time_dim,2>::type inverse_energy_type;
-typedef derived_dimension<length_dim,1,
- time_dim,-1>::type velocity_type;
-typedef derived_dimension<length_dim,3>::type volume_type;
+struct length_base_dimension : boost::units::base_dimension<length_base_dimension,1> { }; ///> base dimension of length
+struct mass_base_dimension : boost::units::base_dimension<mass_base_dimension,2> { }; ///> base dimension of mass
+struct time_base_dimension : boost::units::base_dimension<time_base_dimension,3> { }; ///> base dimension of time
+
+typedef length_base_dimension::type length_dimension;
+typedef mass_base_dimension::type mass_dimension;
+typedef time_base_dimension::type time_dimension;
+
+typedef derived_dimension<length_base_dimension,2>::type area_dim;
+typedef derived_dimension<mass_base_dimension,1,
+ length_base_dimension,2,
+ time_base_dimension,-2>::type energy_dim;
+typedef derived_dimension<mass_base_dimension,-1,
+ length_base_dimension,-2,
+ time_base_dimension,2>::type inverse_energy_dim;
+typedef derived_dimension<length_base_dimension,1,
+ time_base_dimension,-1>::type velocity_dim;
+typedef derived_dimension<length_base_dimension,3>::type volume_dim;
 
 /// placeholder class defining test unit system
-struct length_unit : base_unit<length_unit, length_type, 4> {};
-struct mass_unit : base_unit<mass_unit, mass_type, 5> {};
-struct time_unit : base_unit<time_unit, time_type, 6> {};
+struct length_unit : base_unit<length_unit, length_dimension, 4> {};
+struct mass_unit : base_unit<mass_unit, mass_dimension, 5> {};
+struct time_unit : base_unit<time_unit, time_dimension, 6> {};
 
 typedef make_system<length_unit, mass_unit, time_unit>::type system;
 
 /// unit typedefs
 typedef unit<dimensionless_type,system> dimensionless;
 
-typedef unit<length_type,system> length;
-typedef unit<mass_type,system> mass;
-typedef unit<time_type,system> time;
-
-typedef unit<area_type,system> area;
-typedef unit<energy_type,system> energy;
-typedef unit<inverse_energy_type,system> inverse_energy;
-typedef unit<velocity_type,system> velocity;
-typedef unit<volume_type,system> volume;
+typedef unit<length_dimension,system> length;
+typedef unit<mass_dimension,system> mass;
+typedef unit<time_dimension,system> time;
+
+typedef unit<area_dim,system> area;
+typedef unit<energy_dim,system> energy;
+typedef unit<inverse_energy_dim,system> inverse_energy;
+typedef unit<velocity_dim,system> velocity;
+typedef unit<volume_dim,system> volume;
 
 /// unit constants
 BOOST_UNITS_STATIC_CONSTANT(meter,length);

Modified: sandbox/units/libs/units/test/test_implicit_conversion.cpp
==============================================================================
--- sandbox/units/libs/units/test/test_implicit_conversion.cpp (original)
+++ sandbox/units/libs/units/test/test_implicit_conversion.cpp 2007-05-31 12:46:48 EDT (Thu, 31 May 2007)
@@ -35,31 +35,31 @@
 int test_main(int,char *[])
 {
     //// SI->SI always true
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::length_dim,bu::SI::system_tag,bu::SI::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::mass_dim,bu::SI::system_tag,bu::SI::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::time_dim,bu::SI::system_tag,bu::SI::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::current_dim,bu::SI::system_tag,bu::SI::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::temperature_dim,bu::SI::system_tag,bu::SI::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::amount_dim,bu::SI::system_tag,bu::SI::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::luminous_intensity_dim,bu::SI::system_tag,bu::SI::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::plane_angle_dim,bu::SI::system_tag,bu::SI::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::solid_angle_dim,bu::SI::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::length_base_dimension,bu::SI::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::mass_base_dimension,bu::SI::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::time_base_dimension,bu::SI::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::current_base_dimension,bu::SI::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::temperature_base_dimension,bu::SI::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::amount_base_dimension,bu::SI::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::luminous_intensity_base_dimension,bu::SI::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::plane_angle_base_dimension,bu::SI::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::solid_angle_base_dimension,bu::SI::system_tag,bu::SI::system_tag>::value == true));
 
     //// CGS->CGS always true
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::length_dim,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::mass_dim,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::time_dim,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::current_dim,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::temperature_dim,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::amount_dim,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::luminous_intensity_dim,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::plane_angle_dim,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::solid_angle_dim,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::length_base_dimension,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::mass_base_dimension,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::time_base_dimension,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::current_base_dimension,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::temperature_base_dimension,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::amount_base_dimension,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::luminous_intensity_base_dimension,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::plane_angle_base_dimension,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::solid_angle_base_dimension,bu::CGS::system_tag,bu::CGS::system_tag>::value == true));
 
     //// SI->CGS
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::length_dim,bu::SI::system_tag,bu::CGS::system_tag>::value == false));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::mass_dim,bu::SI::system_tag,bu::CGS::system_tag>::value == false));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::time_dim,bu::SI::system_tag,bu::CGS::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::length_base_dimension,bu::SI::system_tag,bu::CGS::system_tag>::value == false));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::mass_base_dimension,bu::SI::system_tag,bu::CGS::system_tag>::value == false));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::time_base_dimension,bu::SI::system_tag,bu::CGS::system_tag>::value == true));
     
     BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::length,bu::CGS::length>::value == false));
     BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::mass,bu::CGS::mass>::value == false));
@@ -78,9 +78,9 @@
     BOOST_CHECK((bu::is_implicitly_convertible<bu::SI::wavenumber,bu::CGS::wavenumber>::value == false));
     
     //// CGS->SI
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::length_dim,bu::CGS::system_tag,bu::SI::system_tag>::value == false));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::mass_dim,bu::CGS::system_tag,bu::SI::system_tag>::value == false));
- //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::time_dim,bu::CGS::system_tag,bu::SI::system_tag>::value == true));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::length_base_dimension,bu::CGS::system_tag,bu::SI::system_tag>::value == false));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::mass_base_dimension,bu::CGS::system_tag,bu::SI::system_tag>::value == false));
+ //BOOST_CHECK((bu::base_unit_is_implicitly_convertible<bu::time_base_dimension,bu::CGS::system_tag,bu::SI::system_tag>::value == true));
               
     BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::length,bu::SI::length>::value == false));
     BOOST_CHECK((bu::is_implicitly_convertible<bu::CGS::mass,bu::SI::mass>::value == false));


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk