|
From: Matthias S. <mat...@us...> - 2007-04-04 19:53:56
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31952 Modified Files: physical_units.hpp trig.hpp Log Message: fundamental_dimension->base_dimension composite_dimension->derived_dimension various changes for compatibility with SI nomenclature Index: trig.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/trig.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- trig.hpp 3 Apr 2007 17:12:25 -0000 1.6 +++ trig.hpp 4 Apr 2007 19:53:53 -0000 1.7 @@ -14,7 +14,7 @@ #include <cmath> #include <boost/units/quantity.hpp> -#include <boost/units/systems/angles/radians.hpp> +#include <boost/units/systems/si/plane_angle.hpp> namespace boost { @@ -22,24 +22,24 @@ /// cos of theta in radians template<class Y> -typename dimensionless_quantity<angles::radians::radian,Y>::type -cos(const quantity<angles::radians::radian,Y>& theta) +typename dimensionless_quantity<SI::plane_angle,Y>::type +cos(const quantity<SI::plane_angle,Y>& theta) { return std::cos(theta.value()); } /// sin of theta in radians template<class Y> -typename dimensionless_quantity<angles::radians::radian,Y>::type -sin(const quantity<angles::radians::radian,Y>& theta) +typename dimensionless_quantity<SI::plane_angle,Y>::type +sin(const quantity<SI::plane_angle,Y>& theta) { return std::sin(theta.value()); } /// tan of theta in radians template<class Y> -typename dimensionless_quantity<angles::radians::radian,Y>::type -tan(const quantity<angles::radians::radian,Y>& theta) +typename dimensionless_quantity<SI::plane_angle,Y>::type +tan(const quantity<SI::plane_angle,Y>& theta) { return std::tan(theta.value()); } @@ -49,7 +49,7 @@ typename dimensionless_quantity<Unit,Y>::type cos(const quantity<Unit,Y>& theta) { - return cos(quantity<angles::radians::radian,Y>(theta)); + return cos(quantity<SI::plane_angle,Y>(theta)); } /// sin of theta in other angular units @@ -57,7 +57,7 @@ typename dimensionless_quantity<Unit,Y>::type sin(const quantity<Unit,Y>& theta) { - return sin(quantity<angles::radians::radian,Y>(theta)); + return sin(quantity<SI::plane_angle,Y>(theta)); } /// tan of theta in other angular units @@ -65,15 +65,15 @@ typename dimensionless_quantity<Unit,Y>::type tan(const quantity<Unit,Y>& theta) { - return tan(quantity<angles::radians::radian,Y>(theta)); + return tan(quantity<SI::plane_angle,Y>(theta)); } /// acos of @c value_type returning angle in radians template<class Y> -quantity<angles::radians::radian,Y> +quantity<SI::plane_angle,Y> acos(const Y& val) { - return quantity<angles::radians::radian,Y>(std::acos(val)*radians); + return quantity<SI::plane_angle,Y>(std::acos(val)*SI::radians); } /// acos of dimensionless quantity returning angle in same system @@ -81,15 +81,15 @@ quantity<unit<plane_angle_type,System>,Y> acos(const quantity<unit<dimensionless_type,System>,Y>& val) { - return quantity<unit<plane_angle_type,System>,Y>(std::acos(val)*radians); + return quantity<unit<plane_angle_type,System>,Y>(std::acos(val)*SI::radians); } /// asin of @c value_type returning angle in radians template<class Y> -quantity<angles::radians::radian,Y> +quantity<SI::plane_angle,Y> asin(const Y& val) { - return quantity<angles::radians::radian,Y>(std::asin(val)*radians); + return quantity<SI::plane_angle,Y>(std::asin(val)*SI::radians); } /// asin of dimensionless quantity returning angle in same system @@ -97,15 +97,15 @@ quantity<unit<plane_angle_type,System>,Y> asin(const quantity<unit<dimensionless_type,System>,Y>& val) { - return quantity<unit<plane_angle_type,System>,Y>(std::asin(val)*radians); + return quantity<unit<plane_angle_type,System>,Y>(std::asin(val)*SI::radians); } /// atan of @c value_type returning angle in radians template<class Y> -quantity<angles::radians::radian,Y> +quantity<SI::plane_angle,Y> atan(const Y& val) { - return quantity<angles::radians::radian,Y>(std::atan(val)*radians); + return quantity<SI::plane_angle,Y>(std::atan(val)*SI::radians); } /// atan of dimensionless quantity returning angle in same system @@ -113,15 +113,15 @@ quantity<unit<plane_angle_type,System>,Y> atan(const quantity<unit<dimensionless_type,System>,Y>& val) { - return quantity<unit<plane_angle_type,System>,Y>(std::atan(val)*radians); + return quantity<unit<plane_angle_type,System>,Y>(std::atan(val)*SI::radians); } /// atan2 of @c value_type returning angle in radians template<class Y> -quantity<angles::radians::radian,Y> +quantity<SI::plane_angle,Y> atan2(const Y& y,const Y& x) { - return quantity<angles::radians::radian,Y>(std::atan2(y,x)*radians); + return quantity<SI::plane_angle,Y>(std::atan2(y,x)*SI::radians); } } // namespace units Index: physical_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/physical_units.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- physical_units.hpp 4 Apr 2007 19:14:45 -0000 1.9 +++ physical_units.hpp 4 Apr 2007 19:53:53 -0000 1.10 @@ -27,12 +27,12 @@ namespace units { -template<long N> -struct base_dimension : - public mpl::int_<N> -{ - typedef mpl::int_<N> value; -}; +//template<long N> +//struct base_dimension : +// public mpl::int_<N> +//{ +// typedef mpl::int_<N> value; +//}; /// tag representing length typedef base_dimension<-9> length_tag; @@ -61,33 +61,6 @@ /// tag representing solid angle typedef base_dimension<-1> solid_angle_tag; -///// tag representing length -////struct length_tag : public ordinal<-9> { }; -// -///// tag representing mass -//struct mass_tag : public ordinal<-8> { }; -// -///// tag representing time -//struct time_tag : public ordinal<-7> { }; -// -///// tag representing electrical current -//struct current_tag : public ordinal<-6> { }; -// -///// tag representing temperature -//struct temperature_tag : public ordinal<-5> { }; -// -///// tag representing amount of substance -//struct amount_tag : public ordinal<-4> { }; -// -///// tag representing luminous intensity - demoted from status as a fundamental SI unit in 1979 -//struct luminous_intensity_tag : public ordinal<-3> { }; -// -///// tag representing plane angle -//struct plane_angle_tag : public ordinal<-2> { }; -// -///// tag representing solid angle -//struct solid_angle_tag : public ordinal<-1> { }; - } } @@ -113,101 +86,100 @@ namespace units { /// fundamental dimension of length (L) -typedef fundamental_dimension<length_tag>::type length_type; +typedef length_tag::type length_type; /// fundamental dimension of mass (M) -typedef fundamental_dimension<mass_tag>::type mass_type; +typedef mass_tag::type mass_type; /// fundamental dimension of time (T) -typedef fundamental_dimension<time_tag>::type time_type; +typedef time_tag::type time_type; -/// fundamental dimension of electric current (C) -typedef fundamental_dimension<current_tag>::type current_type; +/// fundamental dimension of electric current (I) +typedef current_tag::type current_type; -/// fundamental dimension of temperature (K) -typedef fundamental_dimension<temperature_tag>::type temperature_type; +/// fundamental dimension of temperature (Theta) +typedef temperature_tag::type temperature_type; -/// fundamental dimension of amount of substance (A) -typedef fundamental_dimension<amount_tag>::type amount_type; +/// fundamental dimension of amount of substance (N) +typedef amount_tag::type amount_type; -/// fundamental dimension of luminous intensity (I, deprecated by SI) -typedef fundamental_dimension<luminous_intensity_tag>::type luminous_intensity_type; +/// fundamental dimension of luminous intensity (J) +typedef luminous_intensity_tag::type luminous_intensity_type; /// fundamental dimension of planar angle (QP) -typedef fundamental_dimension<plane_angle_tag>::type plane_angle_type; +typedef plane_angle_tag::type plane_angle_type; /// fundamental dimension of solid angle (QS) -typedef fundamental_dimension<solid_angle_tag>::type solid_angle_type; - +typedef 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; +typedef derived_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 derived_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; +typedef derived_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; +typedef derived_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; +typedef derived_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; +typedef derived_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; +typedef derived_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 derived_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 derived_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 derived_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; +typedef derived_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; +typedef derived_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; +typedef derived_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 derived_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 derived_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 derived_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 derived_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; +typedef derived_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; +typedef derived_dimension<length_tag,-1,mass_tag,1,time_tag,-2>::type stress_type; /// composite dimension for surface density : L^-2 M -typedef composite_dimension<length_tag,-2,mass_tag,1>::type surface_density_type; +typedef derived_dimension<length_tag,-2,mass_tag,1>::type surface_density_type; /// composite dimension for velocity : L T^-1 -typedef composite_dimension<length_tag,1,time_tag,-1>::type velocity_type; +typedef derived_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 derived_dimension<length_tag,3>::type volume_type; /// composite dimension for wavenumber : L^-1 -typedef composite_dimension<length_tag,-1>::type wavenumber_type; +typedef derived_dimension<length_tag,-1>::type wavenumber_type; } // namespace units |