|
From: Matthias S. <mat...@us...> - 2007-04-04 20:07:04
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5276/example Modified Files: test_system.hpp unit_example_1.cpp unit_example_10.cpp unit_example_15.cpp unit_example_20.cpp unit_example_22.cpp unit_example_4.cpp Log Message: change angle syntax, fundamental_dimension, etc... Index: unit_example_1.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_1.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- unit_example_1.cpp 29 Mar 2007 19:39:28 -0000 1.2 +++ unit_example_1.cpp 4 Apr 2007 20:06:57 -0000 1.3 @@ -62,10 +62,10 @@ dim<mass_tag, static_rational<1L, 1L> > >::type, dim<length_tag, static_rational<2L, 1L> > >::type>)); - std::cout << "length_type = " << simplify_mpl_typename(length_type()) << std::endl - << "mass_type = " << simplify_mpl_typename(mass_type()) << std::endl - << "time_type = " << simplify_mpl_typename(time_type()) << std::endl - << "energy_type = " << simplify_mpl_typename(energy_type()) << std::endl; + 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; //[unit_example_1_snippet_1 typedef static_multiply<length_type,mass_type>::type LM_type; @@ -94,9 +94,9 @@ dim<time_tag, static_rational<-1L, 1L> > >::type, dim<length_tag, static_rational<1L, 1L> > >::type>)); - std::cout << "LM_type = " << simplify_mpl_typename(LM_type()) << std::endl - << "L_T_type = " << simplify_mpl_typename(L_T_type()) << std::endl - << "V_type = " << simplify_mpl_typename(V_type()) << std::endl; + std::cout << "LM_type = " << simplify_typename(LM_type()) << std::endl + << "L_T_type = " << simplify_typename(L_T_type()) << std::endl + << "V_type = " << simplify_typename(V_type()) << std::endl; return 0; } Index: unit_example_10.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_10.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- unit_example_10.cpp 3 Apr 2007 14:50:19 -0000 1.5 +++ unit_example_10.cpp 4 Apr 2007 20:06:57 -0000 1.6 @@ -65,9 +65,9 @@ #include <boost/units/quantity.hpp> #include <boost/units/conversion.hpp> #include <boost/units/systems/si.hpp> -#include <boost/units/systems/angles/degrees.hpp> -#include <boost/units/systems/angles/gradians.hpp> -#include <boost/units/systems/angles/radians.hpp> +#include <boost/units/systems/angle/degrees.hpp> +#include <boost/units/systems/angle/gradians.hpp> +#include <boost/units/systems/si/plane_angle.hpp> #include <boost/units/systems/trig.hpp> #include <boost/units/systems/conversions/convert_degrees_to_radians.hpp> @@ -80,16 +80,16 @@ std::stringstream sstream1, sstream2; //[unit_example_10_snippet_1 - 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); + quantity<degree::plane_angle> thetad((180.0/6.0)*degree::degrees); + quantity<gradian::plane_angle> thetag((200.0/6.0)*gradian::gradians); + quantity<SI::plane_angle> thetar((3.1415926/6.0)*SI::radians); //] /// 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<degree::dimensionless> cos_thetad(cos(thetad)); + quantity<gradian::dimensionless> cos_thetag(cos(thetag)); + quantity<SI::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<degree::dimensionless> sin_thetad(sin(thetad)); + quantity<gradian::dimensionless> sin_thetag(sin(thetag)); + quantity<SI::dimensionless> sin_thetar(sin(thetar)); sstream1 << "thetad = " << thetad << std::endl << "thetag = " << thetag << std::endl @@ -125,9 +125,9 @@ /// test tan { - quantity<angles::degrees::dimensionless> tan_thetad(tan(thetad)); - quantity<angles::gradians::dimensionless> tan_thetag(tan(thetag)); - quantity<angles::radians::dimensionless> tan_thetar(tan(thetar)); + quantity<degree::dimensionless> tan_thetad(tan(thetad)); + quantity<gradian::dimensionless> tan_thetag(tan(thetag)); + quantity<SI::dimensionless> tan_thetar(tan(thetar)); sstream1 << "thetad = " << thetad << std::endl << "thetag = " << thetag << std::endl Index: unit_example_20.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_20.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- unit_example_20.cpp 3 Apr 2007 22:43:40 -0000 1.5 +++ unit_example_20.cpp 4 Apr 2007 20:06:57 -0000 1.6 @@ -56,8 +56,6 @@ typedef homogeneous_system<system_tag> system; -typedef fundamental_dimension<temperature_tag>::type temperature_type; - typedef unit<temperature_type,system> temperature; BOOST_UNITS_STATIC_CONSTANT(degree,temperature); Index: unit_example_22.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_22.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- unit_example_22.cpp 4 Apr 2007 05:49:18 -0000 1.8 +++ unit_example_22.cpp 4 Apr 2007 20:06:57 -0000 1.9 @@ -203,8 +203,8 @@ 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; + typedef typename derived_dimension<length_tag, (1<<N) >::type dim1; + typedef typename derived_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>()); @@ -348,6 +348,7 @@ return 0; } */ + #include <iostream> #include <boost/units/io.hpp> @@ -389,4 +390,28 @@ return 0; } +/* +#define MCS_USE_BOOST_REGEX_DEMANGLING + +#include <iostream> + +#include <boost/units/io.hpp> +#include <boost/units/quantity.hpp> +#include <boost/units/experimental/make_system.hpp> +#include <boost/units/experimental/fundamental_units.hpp> +#include <boost/units/detail/utility.hpp> + +int main() +{ + using namespace boost; + using namespace boost::units; + + typedef make_system<mpl::list<meter_tag,gram_tag,second_tag> >::type system1_type; + + std::cout << simplify_typename(system1_type()) << 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.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- unit_example_4.cpp 4 Apr 2007 19:20:10 -0000 1.7 +++ unit_example_4.cpp 4 Apr 2007 20:06:57 -0000 1.8 @@ -372,9 +372,9 @@ //[unit_example_4_snippet_6 /// test trig stuff - quantity<angles::radians::radian> theta = 0.375*boost::units::radians; - quantity<angles::radians::dimensionless> sin_theta = sin(theta); - quantity<angles::radians::radian> thetap = asin(sin_theta); + quantity<plane_angle> theta = 0.375*radians; + quantity<dimensionless> sin_theta = sin(theta); + quantity<plane_angle> thetap = asin(sin_theta); //] sstream1 << "theta = " << theta << std::endl Index: unit_example_15.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_15.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_15.cpp 16 Mar 2007 18:29:52 -0000 1.1.1.1 +++ unit_example_15.cpp 4 Apr 2007 20:06:57 -0000 1.2 @@ -35,11 +35,11 @@ namespace wo { -struct world_space_tag : public ordinal<101> { }; -struct object_space_tag : public ordinal<102> { }; +typedef base_dimension<101> world_space_tag; +typedef base_dimension<102> object_space_tag; -typedef fundamental_dimension<world_space_tag>::type world_space_type; -typedef fundamental_dimension<object_space_tag>::type object_space_type; +typedef world_space_tag::type world_space_type; +typedef object_space_tag::type object_space_type; /// placeholder class defining test unit system struct system { }; Index: test_system.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/test_system.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test_system.hpp 29 Mar 2007 17:10:55 -0000 1.2 +++ test_system.hpp 4 Apr 2007 20:06:57 -0000 1.3 @@ -23,9 +23,9 @@ namespace units { //[test_system_snippet_1 -struct length_tag : public ordinal<1> { }; -struct mass_tag : public ordinal<2> { }; -struct time_tag : public ordinal<3> { }; +typedef base_dimension<1> length_tag; +typedef base_dimension<2> mass_tag; +typedef base_dimension<3> time_tag; //] #if 0 @@ -37,9 +37,9 @@ #endif //[test_system_snippet_3 -typedef fundamental_dimension<length_tag>::type length_type; -typedef fundamental_dimension<mass_tag>::type mass_type; -typedef fundamental_dimension<time_tag>::type time_type; +typedef length_tag::type length_type; +typedef mass_tag::type mass_type; +typedef time_tag::type time_type; //] #if 0 @@ -52,10 +52,10 @@ #endif //[test_system_snippet_5 -typedef composite_dimension<length_tag,2>::type area_type; -typedef composite_dimension<mass_tag,1, - length_tag,2, - time_tag,-2>::type energy_type; +typedef derived_dimension<length_tag,2>::type area_type; +typedef derived_dimension<mass_tag,1, + length_tag,2, + time_tag,-2>::type energy_type; //] namespace test { |