Boost logo

Boost-Commit :

From: steven_at_[hidden]
Date: 2007-08-15 20:54:26


Author: steven_watanabe
Date: 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
New Revision: 38706
URL: http://svn.boost.org/trac/boost/changeset/38706

Log:
New examples--rename old ones
Added:
   sandbox/units/libs/units/example/complex.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_9.cpp
   sandbox/units/libs/units/example/composite_output.cpp (contents, props changed)
   sandbox/units/libs/units/example/conversion.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_5.cpp
   sandbox/units/libs/units/example/conversion_factor.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_22.cpp
   sandbox/units/libs/units/example/dimension.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_1.cpp
   sandbox/units/libs/units/example/heterogeneous_unit.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_18.cpp
   sandbox/units/libs/units/example/kitchen_sink.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_4.cpp
   sandbox/units/libs/units/example/non_base_dimension.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_21.cpp
   sandbox/units/libs/units/example/performance.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_14.cpp
   sandbox/units/libs/units/example/quantity.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_3.cpp
   sandbox/units/libs/units/example/quaternion.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_8.cpp
   sandbox/units/libs/units/example/radar_beam_height.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_16.cpp
   sandbox/units/libs/units/example/runtime_conversion_factor.cpp (contents, props changed)
   sandbox/units/libs/units/example/runtime_unit.cpp (contents, props changed)
   sandbox/units/libs/units/example/temperature.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_20.cpp
   sandbox/units/libs/units/example/unit.cpp
      - copied, changed from r38663, /sandbox/units/libs/units/example/unit_example_2.cpp
Removed:
   sandbox/units/libs/units/example/scaled_value.hpp
   sandbox/units/libs/units/example/unit_example_1.cpp
   sandbox/units/libs/units/example/unit_example_10.cpp
   sandbox/units/libs/units/example/unit_example_11.cpp
   sandbox/units/libs/units/example/unit_example_12.cpp
   sandbox/units/libs/units/example/unit_example_13.cpp
   sandbox/units/libs/units/example/unit_example_14.cpp
   sandbox/units/libs/units/example/unit_example_15.cpp
   sandbox/units/libs/units/example/unit_example_16.cpp
   sandbox/units/libs/units/example/unit_example_17.cpp
   sandbox/units/libs/units/example/unit_example_18.cpp
   sandbox/units/libs/units/example/unit_example_19.cpp
   sandbox/units/libs/units/example/unit_example_2.cpp
   sandbox/units/libs/units/example/unit_example_20.cpp
   sandbox/units/libs/units/example/unit_example_21.cpp
   sandbox/units/libs/units/example/unit_example_22.cpp
   sandbox/units/libs/units/example/unit_example_3.cpp
   sandbox/units/libs/units/example/unit_example_4.cpp
   sandbox/units/libs/units/example/unit_example_5.cpp
   sandbox/units/libs/units/example/unit_example_6.cpp
   sandbox/units/libs/units/example/unit_example_7.cpp
   sandbox/units/libs/units/example/unit_example_8.cpp
   sandbox/units/libs/units/example/unit_example_9.cpp
Text files modified:
   sandbox/units/boost/units/base_dimension.hpp | 13 +
   sandbox/units/boost/units/base_unit.hpp | 13 +
   sandbox/units/boost/units/conversion.hpp | 2
   sandbox/units/libs/units/doc/units.qbk | 403 +++++++++++++++------------------------
   sandbox/units/libs/units/example/Jamfile.v2 | 42 +--
   sandbox/units/libs/units/example/complex.cpp | 12
   sandbox/units/libs/units/example/conversion.cpp | 18
   sandbox/units/libs/units/example/conversion_factor.cpp | 36 +--
   sandbox/units/libs/units/example/dimension.cpp | 6
   sandbox/units/libs/units/example/heterogeneous_unit.cpp | 10
   sandbox/units/libs/units/example/kitchen_sink.cpp | 54 ++--
   sandbox/units/libs/units/example/non_base_dimension.cpp | 8
   sandbox/units/libs/units/example/performance.cpp | 192 ------------------
   sandbox/units/libs/units/example/quantity.cpp | 10
   sandbox/units/libs/units/example/quaternion.cpp | 14
   sandbox/units/libs/units/example/radar_beam_height.cpp | 16
   sandbox/units/libs/units/example/temperature.cpp | 8
   sandbox/units/libs/units/example/unit.cpp | 6
   18 files changed, 291 insertions(+), 572 deletions(-)

Modified: sandbox/units/boost/units/base_dimension.hpp
==============================================================================
--- sandbox/units/boost/units/base_dimension.hpp (original)
+++ sandbox/units/boost/units/base_dimension.hpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -31,6 +31,16 @@
 /// INTERNAL ONLY
 template<class T, long N> struct base_dimension_pair { };
 
+/// INTERNAL ONLY
+template<class T, long N>
+struct check_base_dimension {
+ enum {
+ value =
+ sizeof(boost_units_is_registered(units::base_dimension_ordinal<N>())) == sizeof(detail::yes) &&
+ sizeof(boost_units_is_registered(units::base_dimension_pair<T, N>())) != sizeof(detail::yes)
+ };
+};
+
 /// Defines a base dimension. To define a dimension you need to provide
 /// the derived class (CRTP) and a unique integer.
 /// struct my_dimension : boost::units::base_dimension<my_dimension, 1> {};
@@ -41,8 +51,7 @@
 #ifndef BOOST_UNITS_DOXYGEN
          ,
          class = typename detail::ordinal_has_already_been_defined<
- sizeof(boost_units_is_registered(units::base_dimension_ordinal<N>())) == sizeof(detail::yes) &&
- sizeof(boost_units_is_registered(units::base_dimension_pair<Derived, N>())) != sizeof(detail::yes)
+ check_base_dimension<Derived, N>::value
>::type
 #endif
>

Modified: sandbox/units/boost/units/base_unit.hpp
==============================================================================
--- sandbox/units/boost/units/base_unit.hpp (original)
+++ sandbox/units/boost/units/base_unit.hpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -33,6 +33,16 @@
 /// INTERNAL ONLY
 template<class T, long N> struct base_unit_pair { };
 
+/// INTERNAL ONLY
+template<class T, long N>
+struct check_base_unit {
+ enum {
+ value =
+ sizeof(boost_units_unit_is_registered(units::base_unit_ordinal<N>())) == sizeof(detail::yes) &&
+ sizeof(boost_units_unit_is_registered(units::base_unit_pair<T, N>())) != sizeof(detail::yes)
+ };
+};
+
 /// Defines a base dimension. To define a unit you need to provide
 /// the derived class (CRTP), a dimension list and a unique integer.
 /// struct my_unit : boost::units::base_unit<my_dimension, length_dimension, 1> {};
@@ -44,8 +54,7 @@
 #ifndef BOOST_UNITS_DOXYGEN
          ,
          class = typename detail::ordinal_has_already_been_defined<
- sizeof(boost_units_unit_is_registered(units::base_unit_ordinal<N>())) == sizeof(detail::yes) &&
- sizeof(boost_units_unit_is_registered(units::base_unit_pair<Derived, N>())) != sizeof(detail::yes)
+ check_base_unit<Derived, N>::value
>::type
 #endif
>

Modified: sandbox/units/boost/units/conversion.hpp
==============================================================================
--- sandbox/units/boost/units/conversion.hpp (original)
+++ sandbox/units/boost/units/conversion.hpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -418,7 +418,7 @@
         homogeneous_system<L2>
> impl;
     typedef typename impl::type type;
- static type convert()
+ static type value()
     {
         return(impl::value());
     }

Modified: sandbox/units/libs/units/doc/units.qbk
==============================================================================
--- sandbox/units/libs/units/doc/units.qbk (original)
+++ sandbox/units/libs/units/doc/units.qbk 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -408,163 +408,163 @@
 
 [section:Examples Examples]
 
-[section:Example_1 Example 1]
+[section:DimensionExample Dimension Example]
 
-([@../../libs/units/example/unit_example_1.cpp unit_example_1.cpp])
+([@../../libs/units/example/dimension.cpp dimension.cpp])
 
 By using MPL metafunctions and the template specializations for operations on composite dimensions
 defined in [headerref boost/units/dimension.hpp], it is possible to perform compile time arithmetic
 according to the dimensional analysis rules described [link boost_units.Dimensional_Analysis above]
 to produce new composite dimensions :
 
-[import ../example/unit_example_1.cpp]
+[import ../example/dimension.cpp]
 
-[unit_example_1_snippet_1]
+[dimension_snippet_1]
 
 outputting (with symbol demangling, implemented in [headerref boost/units/detail/utility.hpp])
 
-[unit_example_1_output]
+[dimension_output]
 
 [endsect]
 
-[section:Example_2 Example 2]
+[section:UnitExample Unit Example]
 
-([@../../libs/units/example/unit_example_2.cpp unit_example_2.cpp])
+([@../../libs/units/example/unit.cpp unit.cpp])
 
 This example demonstrates the use of the simple but functional unit system implemented in
 [headerref libs/units/example/test_system.hpp] :
 
-[import ../example/unit_example_2.cpp]
+[import ../example/unit.cpp]
 
-[unit_example_2_snippet_1]
+[unit_snippet_1]
 
 We can perform various algebraic operations on these units, resulting in the following output:
 
-[unit_example_2_output]
+[unit_output]
 
 [endsect]
 
-[section:Example_3 Example 3]
+[section:QuantityExample Quantity Example]
 
-([@../../libs/units/example/unit_example_3.cpp unit_example_3.cpp])
+([@../../libs/units/example/quantity.cpp quantity.cpp])
 
 This example demonstrates how to use quantities of our toy unit system :
 
-[import ../example/unit_example_3.cpp]
+[import ../example/quantity.cpp]
 
-[unit_example_3_snippet_1]
+[quantity_snippet_1]
 
 giving us the basic quantity functionality :
 
-[unit_example_3_output_double]
+[quantity_output_double]
 
 As a further demonstration of the flexibility of the system, we replace the `double` value type
 with a `std::complex<double>` value type (ignoring the question of the meaningfulness of
 complex lengths and energies) :
 
-[unit_example_3_snippet_2]
+[quantity_snippet_2]
 
 and find that the code functions exactly as expected with no additional work, delegating operations
 to `std::complex<double>` and performing the appropriate dimensional analysis :
 
-[unit_example_3_output_complex]
+[quantity_output_complex]
 
 [endsect]
 
-[section:Example_4 Example 4]
+[section:KitchenSinkExample Kitchen Sink Example]
 
-([@../../libs/units/example/unit_example_4.cpp unit_example_4.cpp])
+([@../../libs/units/example/kitchen_sink.cpp kitchen_sink.cpp])
 
 This example provides a fairly extensive set of tests covering most of the [___quantity] functionality.
 It uses the SI unit system defined in [headerref boost/units/systems/si.hpp].
 
 If we define a few units and associated quantities,
 
-[import ../example/unit_example_4.cpp]
+[import ../example/kitchen_sink.cpp]
 
-[unit_example_4_snippet_1]
+[kitchen_sink_snippet_1]
 
 the various algebraic operations between scalars, units, and quantities give
 
-[unit_example_4_output_1]
+[kitchen_sink_output_1]
 
 Scalar/unit operations :
 
-[unit_example_4_output_2]
+[kitchen_sink_output_2]
 
 Unit/unit operations and integral/rational powers of units :
 
-[unit_example_4_output_3]
+[kitchen_sink_output_3]
 
 Scalar/quantity operations :
 
-[unit_example_4_output_4]
+[kitchen_sink_output_4]
 
 Unit/quantity operations :
 
-[unit_example_4_output_5]
+[kitchen_sink_output_5]
 
 Quantity/quantity operations and integral/rational powers of quantities :
 
-[unit_example_4_output_6]
+[kitchen_sink_output_6]
 
 Logical comparison operators are also defined between quantities :
 
-[unit_example_4_snippet_2]
+[kitchen_sink_snippet_2]
 
 giving
 
-[unit_example_4_output_7]
+[kitchen_sink_output_7]
 
 Implicit conversion is allowed between dimensionless quantities and their corresponding value types :
 
-[unit_example_4_snippet_3]
+[kitchen_sink_snippet_3]
 
 A generic function for computing mechanical work can be defined that takes force and distance arguments
 in an arbitrary unit system and returns energy in the same system:
 
-[unit_example_4_function_snippet_3]
+[kitchen_sink_function_snippet_3]
 
-[unit_example_4_snippet_4]
+[kitchen_sink_snippet_4]
 
 which functions as expected for SI quantities :
 
-[unit_example_4_output_9]
+[kitchen_sink_output_9]
 
 The ideal gas law can also be implemented in SI units :
 
-[unit_example_4_function_snippet_4]
+[kitchen_sink_function_snippet_4]
 
-[unit_example_4_snippet_5]
+[kitchen_sink_snippet_5]
 
 with the resulting output :
 
-[unit_example_4_output_10]
+[kitchen_sink_output_10]
 
 Trigonometric and inverse trigonometric functions can be implemented for any unit system
 that provides an angular fundamental dimension. These behave as one expects, with trigonometric functions
 taking an angular quantity and returning a dimensionless quantity, while the inverse trigonometric functions
 take a dimensionless quantity and return an angular quantity :
 
-[unit_example_4_function_snippet_1]
+[kitchen_sink_function_snippet_1]
 
-[unit_example_4_function_snippet_2]
+[kitchen_sink_function_snippet_2]
 
 Defining a few angular quantities,
 
-[unit_example_4_snippet_6]
+[kitchen_sink_snippet_6]
 
 yields
 
-[unit_example_4_output_11]
+[kitchen_sink_output_11]
 
 Dealing with complex quantities is trivial. Here is the calculation of complex impedance :
 
-[unit_example_4_snippet_7]
+[kitchen_sink_snippet_7]
 
 giving
 
-[unit_example_4_output_12]
+[kitchen_sink_output_12]
 
 [section:UDT_Quantities User-defined value types]
 
@@ -578,31 +578,31 @@
 
 Then, defining some `measurement` [___quantity] variables
 
-[unit_example_4_snippet_8]
+[kitchen_sink_snippet_8]
 
 gives
 
-[unit_example_4_output_13]
+[kitchen_sink_output_13]
 
 If we implement the overloaded helper classes for rational powers and roots
 then we can also compute rational powers of measurement quantities :
 
-[unit_example_4_output_14]
+[kitchen_sink_output_14]
 
 [endsect]
 
 [endsect]
 
-[section:Example_5 Example 5]
+[section:ConversionExample Conversion Example]
 
-([@../../libs/units/example/unit_example_5.cpp unit_example_5.cpp])
+([@../../libs/units/example/conversion.cpp conversion.cpp])
 
 This example demonstrates the various allowed conversions between SI and CGS units. Defining some
 quantities
 
-[import ../example/unit_example_5.cpp]
+[import ../example/conversion.cpp]
 
-[unit_example_5_snippet_1]
+[conversion_snippet_1]
 
 illustrates implicit conversion of quantities of different value types where implicit conversion
 of the value types themselves is allowed. N.B. The conversion from double to int is treated
@@ -611,34 +611,34 @@
 
 * explicit casting of a [___quantity] to a different `value_type` :
 
-[unit_example_5_snippet_3]
+[conversion_snippet_3]
 
 * and explicit casting of a [___quantity] to a different unit :
 
-[unit_example_5_snippet_4]
+[conversion_snippet_4]
 
 giving the following output :
 
-[unit_example_5_output_1]
+[conversion_output_1]
 
 A few more explicit unit system conversions :
 
-[unit_example_5_snippet_5]
+[conversion_snippet_5]
 
 which produces the following output:
 
-[unit_example_5_output_2]
+[conversion_output_2]
 
 While the library default is to enable only those unit conversions for which the conversion of every
 base unit present in a quantity is specifically enabled as implicit, it is possible to
 supersede this behavior and enable all implicit conversions by defining the preprocessor
 constant [___BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSIONS]. This allows us to do things like the following:
 
-[unit_example_5_snippet_6]
+[conversion_snippet_6]
 
 which produces the following output:
 
-[unit_example_5_output_3]
+[conversion_output_3]
 
 Of course, blindly enabling implicit conversions entails some risk of unnecessary conversions being done
 in the background, with the potential for loss of precision and other related concerns. These issues should
@@ -648,75 +648,31 @@
 
 [endsect]
 
-[section:Example_6 Example 6]
+[section:UDTExample User Defined Types]
 
-([@../../libs/units/example/unit_example_6.cpp unit_example_6.cpp])
-
-This example demonstrates use of a user-defined `scaled_value` value type that carries with it
-a base and exponent as a compile-time prefactor and has a heterogeneous algebra. That is, the result of the product
-of two scaled values is not normally the same scaled value as either of the arguments. This class can be
-used, for example, to represent numbers in scientific notation over a dramatically larger range than even
-double precision floating point variables. For example,
-
-[import ../example/unit_example_6.cpp]
-
-[unit_example_6_snippet_1]
-
-defines the variable `length` as `4.0 * 10^3` meters and `time` as `10.0 * 10^{-2}` seconds.
-Performing various operations on these variables correctly handles the heterogeneous algebra both for the value
-type and for the dimensional analysis:
-
-[unit_example_6_output_1]
-
-[endsect]
-
-[section:Example_7 Example 7]
-
-([@../../libs/units/example/unit_example_7.cpp unit_example_7.cpp])
-
-This example integrates Boost.Units into an N-dimensional array class, again demonstrating the ability
-to propagate quantities seamlessly through calculations. It is worthwhile noting that the `Array` class itself has no
-knowledge of quantities, other than carefully implementing the various operators necessary. Because the associated
-array code is extensive, the array headers are not included (a similar example using built in C++ arrays is also
-found in the source code to this example). This code
-
-[import ../example/unit_example_7.cpp]
-
-[unit_example_7_snippet_1]
-
-[unit_example_7_snippet_2]
-
-gives the following:
-
-[unit_example_7_output_1]
-
-[endsect]
-
-[section:Example_8 Example 8]
-
-([@../../libs/units/example/unit_example_8.cpp unit_example_8.cpp])
+([@../../libs/units/example/quaternion.cpp quaternion.cpp])
 
 This example demonstrates the use of `boost::math::quaternion` as a value type for [___quantity] and the converse.
 For the first case, we first define specializations of [___power_dimof_helper] and [___root_typeof_helper] for
 powers and roots, respectively:
 
-[import ../example/unit_example_8.cpp]
+[import ../example/quaternion.cpp]
 
-[unit_example_8_class_snippet_1]
+[quaternion_class_snippet_1]
 
 We can now declare a [___quantity] of a `quaternion` :
 
-[unit_example_8_snippet_1]
+[quaternion_snippet_1]
 
 so that all operations that are defined in the `quaternion` class behave correctly. If rational
 powers were defined for this class, it would be possible to compute rational powers and roots with
 no additional changes.
 
-[unit_example_8_output_1]
+[quaternion_output_1]
 
 Now, if for some reason we preferred the [___quantity] to be the value type of the `quaternion` class we would have :
 
-[unit_example_8_snippet_2]
+[quaternion_snippet_2]
 
 Here, the unary plus and minus and addition and subtraction operators function correctly. Unfortunately,
 the multiplication and division operations fail because `quaternion` implements them in terms of the `*=` and
@@ -725,17 +681,17 @@
 occurs with `std::complex<T>`, for the same reason). In order to compute rational powers and roots, we need to
 specialize [___power_dimof_helper] and [___root_typeof_helper] as follows:
 
-[unit_example_8_class_snippet_2]
+[quaternion_class_snippet_2]
 
 giving:
 
-[unit_example_8_output_2]
+[quaternion_output_2]
 
 [endsect]
 
-[section:Example_9 Example 9]
+[section:ComplexExample Complex Example]
 
-([@../../libs/units/example/unit_example_9.cpp unit_example_9.cpp])
+([@../../libs/units/example/complex.cpp complex.cpp])
 
 This example demonstrates how to implement a replacement `complex` class that functions correctly both as a
 quantity value type and as a quantity container class, including heterogeneous multiplication and division
@@ -745,236 +701,193 @@
 [___multiply_typeof_helper], and [___divide_typeof_helper]. In addition, [___power_dimof_helper] and
 [___root_typeof_helper] are defined for both cases :
 
-[import ../example/unit_example_9.cpp]
+[import ../example/complex.cpp]
 
-[unit_example_9_class_snippet_1]
+[complex_class_snippet_1]
 
 With this replacement `complex` class, we can declare a complex variable :
 
-[unit_example_9_snippet_1]
+[complex_snippet_1]
 
 to get the correct behavior for all cases supported by [___quantity] with a `complex` value type :
 
-[unit_example_9_output_1]
+[complex_output_1]
 
 and, similarly, `complex` with a [___quantity] value type
 
-[unit_example_9_snippet_2]
+[complex_snippet_2]
 
 gives
 
-[unit_example_9_output_2]
-
-[endsect]
-
-[section:Example_10 Example 10]
-
-([@../../libs/units/example/unit_example_10.cpp unit_example_10.cpp])
-
-This is an extended example of use of quantities with trigonometric functions. Angle representations in
-degrees, radians, and gradians are implemented in [headerref boost/units/systems/trig.hpp]. Defining angles
-in each system as :
-
-[import ../example/unit_example_10.cpp]
-
-[unit_example_10_snippet_1]
-
-we can use them as arguments to the trigonometric functions to obtain :
-
-[unit_example_10_output]
-
-[endsect]
-
-[section:Example_11 Example 11]
-
-([@../../libs/units/example/unit_example_11.cpp unit_example_11.cpp])
-
-This example demonstrates overloaded `cmath` functions from [headerref boost/units/cmath.hpp]. The support
-for C99 standard functions in <cmath> is variable between compilers, so some functions may not be provided.
-
-[import ../example/unit_example_11.cpp]
-
-[unit_example_11_output]
+[complex_output_2]
 
 [endsect]
 
-[section:Example_12 Example 12]
-
-([@../../libs/units/example/unit_example_12.cpp unit_example_12.cpp])
-
-This example demonstrates interoperability with `boost::numeric::interval`, with
-
-[import ../example/unit_example_12.cpp]
-
-[unit_example_12_snippet_1]
-
-giving
-
-[unit_example_12_output_1]
-
-[endsect]
-
-[section:Example_13 Example 13]
-
-([@../../libs/units/example/unit_example_13.cpp unit_example_13.cpp])
-
-This example demonstrates Boost.Serialization support, provided for units and quantities, with
-
-[import ../example/unit_example_13.cpp]
-
-[unit_example_13_snippet_1]
-
-giving
-
-[unit_example_13_output]
-
-[endsect]
+[section:PerformanceExample Performance Example]
 
-[section:Example_14 Example 14]
-
-([@../../libs/units/example/unit_example_14.cpp unit_example_14.cpp])
+([@../../libs/units/example/performance.cpp performance.cpp])
 
 This example provides an ad hoc performance test to verify that zero runtime overhead
 is incurred when using [___quantity] in place of `double`.
 
 [endsect]
 
-[section:Example_15 Example 15]
-
-([@../../libs/units/example/unit_example_15.cpp unit_example_15.cpp])
+[section:RadarBeamHeightExample Radar Beam Height]
 
-This example demonstrates use of Boost.Units to differentiate coordinate systems.
-Conversions between unit systems (either explicit or implicit) could also be added,
-if desired.
-
-[endsect]
+([@../../libs/units/example/radar_beam_height.cpp radar_beam_height.cpp])
 
-[section:Example_16 Example 16]
-
-([@../../libs/units/example/unit_example_16.cpp unit_example_16.cpp])
-
-[import ../example/unit_example_16.cpp]
+[import ../example/radar_beam_height.cpp]
 
 This example demonstrates the implementation of two non-SI units of length, the
 nautical mile :
 
-[unit_example_16_class_snippet_1]
+[radar_beam_height_class_snippet_1]
 
 and the imperial foot :
 
-[unit_example_16_class_snippet_2]
+[radar_beam_height_class_snippet_2]
 
 These units include conversions between themselves and the meter. Three functions
 for computing radar beam height from radar range and the local earth radius are
 defined. The first takes arguments in one system and returns a value in the same
 system :
 
-[unit_example_16_function_snippet_1]
+[radar_beam_height_function_snippet_1]
 
 The second is similar, but is templated on return type, so that the arguments are
 converted to the return unit system internally :
 
-[unit_example_16_function_snippet_2]
+[radar_beam_height_function_snippet_2]
 
 Finally, the third function is an empirical approximation that is only valid for
 radar ranges specified in nautical miles, returning beam height in feet. This
 function uses the heterogeneous unit of nautical miles per square root of feet to
 ensure dimensional correctness :
 
-[unit_example_16_function_snippet_3]
+[radar_beam_height_function_snippet_3]
 
 With these, we can compute radar beam height in various unit systems :
 
-[unit_example_16_snippet_1]
+[radar_beam_height_snippet_1]
 
 giving
 
-[unit_example_16_output]
+[radar_beam_height_output]
 
 [endsect]
 
-[section:Example_17 Example 17]
+[section:HeterogeneousUnitExample Heterogeneous Unit Example]
+
+([@../../libs/units/example/heterogeneous_unit.cpp heterogeneous_unit.cpp])
 
-([@../../libs/units/example/unit_example_17.cpp unit_example_17.cpp])
+[import ../example/heterogeneous_unit.cpp]
 
-This example demonstrates the abstract physical unit system provided for strictly
-dimensional analysis calculations. This system explicitly prohibits quantity
-conversions of any sort to ensure that it cannot be mixed with other unit systems.
+Mixed units and mixed unit conversions.
 
-[import ../example/unit_example_17.cpp]
+First a look at the output:
 
-[unit_example_17_snippet_1]
+[heterogeneous_unit_snippet_1]
 
-gives
+printing
+
+[heterogeneous_unit_output_1]
+
+Arbitrary conversions also work:
 
-[unit_example_17_output]
+[heterogeneous_unit_snippet_2]
+
+yielding
+
+[heterogeneous_unit_output_2]
 
 [endsect]
 
-[section:Example_18 Example 18]
+[section:AbsoluteRelativeTemperatureExample Absolute and Relative Temperature Example]
 
-([@../../libs/units/example/unit_example_18.cpp unit_example_18.cpp])
+([@../../libs/units/example/temperature.cpp temperature.cpp])
 
-[import ../example/unit_example_18.cpp]
+[import ../example/temperature.cpp]
 
-Mixed units and mixed unit conversions.
+This example demonstrates using of absolute temperatures and relative temperature differences in Fahrenheit
+and converting between these and the Kelvin temperature scale. This issue touches on some surprisingly deep mathematical
+concepts (see [@http://en.wikipedia.org/wiki/Affine_space Wikipedia] for a basic review), but for our purposes here, we
+will simply observe that it is important to be able to differentiate between an absolute temperature measurement and a
+measurement of temperature difference. This is accomplished by using the [___absolute] wrapper class.
 
-First a look at the output:
+First we define a system using the predefined fahrenheit base unit:
 
-[unit_example_18_snippet_1]
+[temperature_snippet_1]
 
-printing
+For convenience we make conversions implicit:
 
-[unit_example_18_output_1]
+[temperature_snippet_2]
 
-Arbitrary conversions also work:
+Now we can create some quantities:
 
-[unit_example_18_snippet_2]
+[temperature_snippet_3]
 
-yielding
+Note the use of [___absolute] to wrap a unit.
+
+[endsect]
+
+[section:RuntimeConversionFactorExample Runtime Conversion Factor Example]
 
-[unit_example_18_output_2]
+([@../../libs/units/example/runtime_conversion_factor.cpp runtime_conversion_factor.cpp])
+
+[import ../example/runtime_conversion_factor.cpp]
+
+The Units library does not require that the conversion factors
+be compile time constants.
+
+[runtime_conversion_factor_snippet_1]
 
 [endsect]
 
-[section:Example_19 Example 19]
+[section:UnitsWithNonbaseDimensions Units with Non-base Dimensions]
 
-([@../../libs/units/example/unit_example_19.cpp unit_example_19.cpp])
+([@../../libs/units/example/non_base_dimension.cpp non_base_dimension.cpp])
 
-This example demonstrates the fairly complete subset of the [@http://physics.nist.gov/cuu/Constants/index.html CODATA physical
-constants] in SI units provided in [headerref boost/units/systems/si/codata_constants.hpp].
+[import ../example/non_base_dimension.cpp]
 
-[import ../example/unit_example_19.cpp]
+It is possible to define base units that do
+not have base dimensions.
 
-[unit_example_19_output]
+[non_base_dimension_snippet_1]
 
 [endsect]
 
-[section:Example_20 Example 20]
+[section:OutputForCompositeUnits Output for Composite Units]
 
-([@../../libs/units/example/unit_example_20.cpp unit_example_20.cpp])
+([@../../libs/units/example/composite_output.cpp composite_output.cpp])
 
-[import ../example/unit_example_20.cpp]
+[import ../example/composite_output.cpp]
 
-This example demonstrates using of absolute temperatures and relative temperature differences in Fahrenheit
-and converting between these and the Kelvin temperature scale. This issue touches on some surprisingly deep mathematical
-concepts (see [@http://en.wikipedia.org/wiki/Affine_space Wikipedia] for a basic review), but for our purposes here, we
-will simply observe that it is important to be able to differentiate between an absolute temperature measurement and a
-measurement of temperature difference. This is accomplished by using the [___absolute] wrapper class.
+You can overload the ostream operator for a unit if
+it has a special symbol, in this case Newtons.
 
-First we define a system using the predefined fahrenheit base unit:
+[composite_output_snippet_1]
 
-[unit_example_20_snippet_1]
+[endsect]
 
-For convenience we make conversions implicit:
+[section:ConversionFactor Conversion Factor]
 
-[unit_example_20_snippet_2]
+([@../../libs/units/example/conversion_factor.cpp conversion_factor.cpp])
 
-Now we can create some quantities:
+[import ../example/conversion_factor.cpp]
 
-[unit_example_20_snippet_3]
+[conversion_factor_snippet_1]
 
-Note the use of [___absolute] to wrap a unit.
+Produces
+
+[conversion_factor_output]
+
+[endsect]
+
+[section:RuntimeUnits Runtime Units]
+
+([@../../libs/units/example/runtime_unit.cpp runtime_unit.cpp])
+
+TODO: finish this example.
 
 [endsect]
 
@@ -1197,7 +1110,7 @@
 * added abstract units in [headerref boost/units/systems/abstract.hpp] to allow abstract dimensional
   analysis
 * new example demonstrating implementation of code based on requirements from
- Michael Fawcett ([@../../libs/units/example/unit_example_16.hpp unit_example_16.cpp])
+ Michael Fawcett ([@../../libs/units/example/radar_beam_height.hpp radar_beam_height.cpp])
 
 0.6.1 (February 13, 2007) :
 

Modified: sandbox/units/libs/units/example/Jamfile.v2
==============================================================================
--- sandbox/units/libs/units/example/Jamfile.v2 (original)
+++ sandbox/units/libs/units/example/Jamfile.v2 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -7,39 +7,25 @@
 # accomanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt
 
-UNITS_REQUIREMENTS = <include>$(BOOST_ROOT) <include>../../.. <warnings>all ;
-
 import testing ;
+import path ;
+
+project units_examples :
+ : requirements <include>$(BOOST_ROOT) <include>../../.. <warnings>all
+;
+
+rule make_tests ( files * ) {
+ local results = ;
+ for local file in $(files) {
+ results += [ run $(file) : : : ] ;
+ }
+}
 
 {
   test-suite units
    :
- [ run tutorial.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_1.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_2.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_3.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_4.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_5.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_6.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_7.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_8.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_9.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_10.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_11.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_12.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_13.cpp $(BOOST_ROOT)/libs/serialization/build//boost_serialization : : : $(UNITS_REQUIREMENTS) <define>BOOST_SERIALIZATION_NO_LIB : ]
- [ compile unit_example_14.cpp : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_15.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ compile-fail unit_example_15.cpp : $(UNITS_REQUIREMENTS) <define>BOOST_UNITS_EXAMPLE_15_FAIL=1 : unit_example_15_fail_1 ]
- [ compile-fail unit_example_15.cpp : $(UNITS_REQUIREMENTS) <define>BOOST_UNITS_EXAMPLE_15_FAIL=2 : unit_example_15_fail_2 ]
- [ compile-fail unit_example_15.cpp : $(UNITS_REQUIREMENTS) <define>BOOST_UNITS_EXAMPLE_15_FAIL=3 : unit_example_15_fail_3 ]
- [ run unit_example_16.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_17.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_18.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_19.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_20.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_21.cpp : : : $(UNITS_REQUIREMENTS) : ]
- [ run unit_example_22.cpp : : : $(UNITS_REQUIREMENTS) : ]
+ [ make_tests [ path.glob . : *.cpp : performance.* ] ]
+ [ compile performance.cpp ]
    ;
 
 }

Copied: sandbox/units/libs/units/example/complex.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_9.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_9.cpp (original)
+++ sandbox/units/libs/units/example/complex.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_9.cpp
+\brief complex.cpp
 
 \detailed
 Demonstrate a complex number class that functions correctly with quantities.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_9_output_1
+//[complex_output_1
 +L = 2 + 1 i m
 -L = -2 + -1 i m
 L+L = 4 + 2 i m
@@ -32,7 +32,7 @@
 (3/2)vL = 1.62894 + 0.520175 i m^(2/3)
 //]
 
-//[unit_example_9_output_2
+//[complex_output_2
 +L = 2 m + 1 m i
 -L = -2 m + -1 m i
 L+L = 4 m + 2 m i
@@ -61,7 +61,7 @@
 
 #include "test_system.hpp"
 
-//[unit_example_9_class_snippet_1
+//[complex_class_snippet_1
 namespace boost {
 
 namespace units {
@@ -276,7 +276,7 @@
     std::stringstream sstream1, sstream2;
     
     {
- //[unit_example_9_snippet_1
+ //[complex_snippet_1
     typedef quantity<length,complex<double> > length_dimension;
         
     length_dimension L(complex<double>(2.0,1.0)*meters);
@@ -296,7 +296,7 @@
     }
     
     {
- //[unit_example_9_snippet_2
+ //[complex_snippet_2
     typedef complex<quantity<length> > length_dimension;
         
     length_dimension L(2.0*meters,1.0*meters);

Added: sandbox/units/libs/units/example/composite_output.cpp
==============================================================================
--- (empty file)
+++ sandbox/units/libs/units/example/composite_output.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -0,0 +1,34 @@
+// 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 <boost/units/quantity.hpp>
+#include <boost/units/systems/si.hpp>
+#include <boost/units/io.hpp>
+#include <iostream>
+
+namespace boost {
+
+namespace units {
+
+//[composite_output_snippet_1
+
+std::ostream& operator<<(std::ostream& os, const boost::units::SI::force&) {
+ return(os << "N");
+}
+
+//]
+
+}
+
+}
+
+int main() {
+ std::cout << 2.0 * boost::units::SI::newton << std::endl;
+}

Copied: sandbox/units/libs/units/example/conversion.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_5.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_5.cpp (original)
+++ sandbox/units/libs/units/example/conversion.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_5.cpp
+\brief conversion.cpp
 
 \detailed
 Test explicit and implicit unit conversion.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_5_output_1
+//[conversion_output_1
 L1 = 2 m
 L2 = 2 m
 L3 = 2 m
@@ -29,7 +29,7 @@
 L7 = 200 cm
 //]
 
-//[unit_example_5_output_2
+//[conversion_output_2
 volume (m^3) = 1 m^3
 volume (cm^3) = 1e+06 cm^3
 volume (m^3) = 1 m^3
@@ -42,7 +42,7 @@
 velocity (2 cm/s) = 0.02 m s^-1
 //]
 
-//[unit_example_5_output_3
+//[conversion_output_3
 implicit conversions enabled
 volume (m^3) = 1 m^3
 volume (cm^3) = 1e+06 cm^3
@@ -77,16 +77,16 @@
     // test quantity_cast
     {
     // implicit value_type conversions
- //[unit_example_5_snippet_1
+ //[conversion_snippet_1
     quantity<SI::length> L1 = quantity<SI::length,int>(int(2.5)*SI::meters);
     quantity<SI::length,int> L2(quantity<SI::length,double>(2.5*SI::meters));
     //]
     
- //[unit_example_5_snippet_3
+ //[conversion_snippet_3
     quantity<SI::length,int> L3 = static_cast<quantity<SI::length,int> >(L1);
     //]
     
- //[unit_example_5_snippet_4
+ //[conversion_snippet_4
     quantity<CGS::length> L4 = static_cast<quantity<CGS::length> >(L1);
     //]
     
@@ -108,7 +108,7 @@
     
     // test explicit unit system conversion
     {
- //[unit_example_5_snippet_5
+ //[conversion_snippet_5
     quantity<SI::volume> vs(1.0*pow<3>(SI::meter));
     quantity<CGS::volume> vc(vs);
     quantity<SI::volume> vs2(vc);
@@ -142,7 +142,7 @@
              << "implicit conversions enabled"
              << std::endl;
               
- //[unit_example_5_snippet_6
+ //[conversion_snippet_6
     quantity<SI::volume> vs(1.0*pow<3>(SI::meter));
     quantity<CGS::volume> vc;
     

Copied: sandbox/units/libs/units/example/conversion_factor.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_22.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_22.cpp (original)
+++ sandbox/units/libs/units/example/conversion_factor.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,17 +11,19 @@
 /**
 \file
     
-\brief unit_example_22.cpp
+\brief conversion_factor.cpp
 
-\detailed Another example of defining units.
+\detailed An example of using conversion_factor.
 
 Output:
 @verbatim
 
-//[unit_example_22_output
-kg s^(-3) K^(-1)
-kg s^(-3) K^(-1)
-1 kg s^(-3) K^(-1)
+//[conversion_factor_output
+1e-005
+100
+1e-005
+100
+0.01
 //]
 
 @endverbatim
@@ -43,34 +45,20 @@
 
 #include <boost/units/systems/other/non_si_units.hpp>
 
-struct blah { };
-struct blahblah { };
-
-blahblah operator+(const blah&) { return blahblah(); }
-
-template<typename I,I N,I D>
-class static_rational
-{ };
-
 int main()
 {
     using namespace boost;
     using namespace boost::units;
+
+ //[conversion_factor_snippet_1
     
- std::cout << quantity<SI::dimensionless>(1.0*CGS::dyne/SI::newton) << std::endl;
-// std::cout << exp(1.0*(SI::newtons*CGS::dynes)/(SI::newtons*CGS::dynes)) << std::endl;
- std::cout << exp(quantity<SI::dimensionless>(1.0*(SI::newtons*CGS::dynes)/(SI::newtons*CGS::dynes))) << std::endl;
     std::cout << conversion_factor<double>(CGS::dyne,SI::newton) << std::endl;
     std::cout << conversion_factor<double>(SI::newton/SI::kilogram,CGS::dyne/CGS::gram) << std::endl;
     std::cout << conversion_factor<double>(CGS::momentum(),SI::momentum()) << std::endl;
     std::cout << conversion_factor<double>(SI::momentum()/SI::mass(),CGS::momentum()/CGS::mass()) << std::endl;
     std::cout << conversion_factor<double>(CGS::gal,SI::meter_per_second_squared) << std::endl;
     
- blah b;
-
- std::cout << typeid(+b).name() << std::cout;
-
+ //]
+
     return 0;
 }
-
-

Copied: sandbox/units/libs/units/example/dimension.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_1.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_1.cpp (original)
+++ sandbox/units/libs/units/example/dimension.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_1.cpp
+\brief dimension.cpp
 
 \detailed
 Test dimension list manipulation.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_1_output
+//[dimension_output
 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>
@@ -67,7 +67,7 @@
               << "time_dimension = " << simplify_typename(time_dimension()) << std::endl
               << "energy_dimension = " << simplify_typename(energy_dimension()) << std::endl;
     
- //[unit_example_1_snippet_1
+ //[dimension_snippet_1
     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_dimension,mass_dimension>::type,static_rational<2> >::type V_type;

Copied: sandbox/units/libs/units/example/heterogeneous_unit.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_18.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_18.cpp (original)
+++ sandbox/units/libs/units/example/heterogeneous_unit.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_18.cpp
+\brief heterogeneous_unit.cpp
 
 \detailed
 Test heterogeneous units and quantities.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_18_output_1
+//[heterogeneous_unit_output_1
 1.5 m
 1 g
 1.5 m g
@@ -32,7 +32,7 @@
 1 cm m^-1 kg s^-2
 //]
 
-//[unit_example_18_output_2
+//[heterogeneous_unit_output_2
 0.015 m^2
 //]
 
@@ -57,7 +57,7 @@
 {
     std::stringstream sstream1, sstream2;
 
- //[unit_example_18_snippet_1
+ //[heterogeneous_unit_snippet_1
     quantity<SI::length> L(1.5*SI::meter);
     quantity<CGS::mass> M(1.0*CGS::gram);
     
@@ -76,7 +76,7 @@
              << std::endl;
     //]
     
- //unit_example_18_snippet_2
+ //heterogeneous_unit_snippet_2
     quantity<SI::area> A(1.5*SI::meter*CGS::centimeter);
     
     sstream1 << A << std::endl

Copied: sandbox/units/libs/units/example/kitchen_sink.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_4.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_4.cpp (original)
+++ sandbox/units/libs/units/example/kitchen_sink.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_4.cpp
+\brief kitchen_sink.cpp
 
 \detailed
 More extensive quantity tests.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_4_output_1
+//[kitchen_sink_output_1
 S1 : 2
 X1 : 2
 X2 : (4/3)
@@ -29,14 +29,14 @@
 Q2 : 2 m^2 kg s^-2
 //]
 
-//[unit_example_4_output_2
+//[kitchen_sink_output_2
 U1*S1 : 2 m kg s^-2
 S1*U1 : 2 m kg s^-2
 U1/S1 : 0.5 m kg s^-2
 S1/U1 : 2 m^-1 kg^-1 s^2
 //]
 
-//[unit_example_4_output_3
+//[kitchen_sink_output_3
 U1+U1 : m kg s^-2
 U1-U1 : m kg s^-2
 U1*U1 : m^2 kg^2 s^-4
@@ -49,21 +49,21 @@
 X2vU1 : m^(3/4) kg^(3/4) s^(-3/2)
 //]
 
-//[unit_example_4_output_4
+//[kitchen_sink_output_4
 Q1*S1 : 2 m kg s^-2
 S1*Q1 : 2 m kg s^-2
 Q1/S1 : 0.5 m kg s^-2
 S1/Q1 : 2 m^-1 kg^-1 s^2
 //]
 
-//[unit_example_4_output_5
+//[kitchen_sink_output_5
 U1*Q1 : 1 m^2 kg^2 s^-4
 Q1*U1 : 1 m^2 kg^2 s^-4
 U1/Q1 : 1 dimensionless
 Q1/U1 : 1 dimensionless
 //]
 
-//[unit_example_4_output_6
+//[kitchen_sink_output_6
 +Q1 : 1 m kg s^-2
 -Q1 : -1 m kg s^-2
 Q1+Q1 : 2 m kg s^-2
@@ -78,7 +78,7 @@
 X2vQ1 : 1 m^(3/4) kg^(3/4) s^(-3/2)
 //]
 
-//[unit_example_4_output_7
+//[kitchen_sink_output_7
 l1 == l2 false
 l1 != l2 true
 l1 <= l2 true
@@ -89,17 +89,17 @@
 
 dimless = 1
 
-//[unit_example_4_output_8
+//[kitchen_sink_output_8
 v1 = 2 m s^-1
 //]
 
-//[unit_example_4_output_9
+//[kitchen_sink_output_9
 F = 1 m kg s^-2
 dx = 1 m
 E = 1 m^2 kg s^-2
 //]
 
-//[unit_example_4_output_10
+//[kitchen_sink_output_10
 r = 5e-07 m
 P = 101325 m^-1 kg s^-2
 V = 5.23599e-19 m^3
@@ -108,26 +108,26 @@
 R = 8.31447 m^2 kg s^-2 K^-1 mol^-1
 //]
 
-//[unit_example_4_output_11
+//[kitchen_sink_output_11
 theta = 0.375 rd
 sin(theta) = 0.366273 dimensionless
 asin(sin(theta)) = 0.375 rd
 //]
 
-//[unit_example_4_output_12
+//[kitchen_sink_output_12
 V = (12.5,0) m^2 kg s^-3 A^-1
 I = (3,4) A
 Z = (1.5,-2) m^2 kg s^-3 A^-2
 I*Z = (12.5,0) m^2 kg s^-3 A^-1
 //]
 
-//[unit_example_4_output_13
+//[kitchen_sink_output_13
 x+y-w = 0.48(+/-0.632772) m
 w*x = 9.04(+/-0.904885) m^2
 x/y = 0.666667(+/-0.149071) dimensionless
 //]
 
-//[unit_example_4_output_14
+//[kitchen_sink_output_14
 w*y^2/(u*x)^2 = 10.17(+/-3.52328) m^-1
 w/(u*x)^(1/2) = 3.19612(+/-0.160431) dimensionless
 //]
@@ -155,7 +155,7 @@
 namespace units {
 
 /*
-//[unit_example_4_function_snippet_1
+//[kitchen_sink_function_snippet_1
 /// sin takes a quantity and returns a dimensionless quantity
 template<class System,class Y>
 quantity<unit<dimensionless_type,System>,Y>
@@ -165,7 +165,7 @@
 }
 //]
 
-//[unit_example_4_function_snippet_2
+//[kitchen_sink_function_snippet_2
 /// asin takes a dimensionless quantity and returns a quantity
 template<class System,class Y>
 quantity<unit<plane_angle_dimension,System>,Y>
@@ -178,7 +178,7 @@
 //]
 */
 
-//[unit_example_4_function_snippet_3
+//[kitchen_sink_function_snippet_3
 /// the physical definition of work - computed for an arbitrary unit system
 template<class System,class Y>
 quantity<unit<energy_dimension,System>,Y>
@@ -189,7 +189,7 @@
 }
 //]
 
-//[unit_example_4_function_snippet_4
+//[kitchen_sink_function_snippet_4
 /// the ideal gas law in SI units
 template<class Y>
 quantity<SI::amount,Y>
@@ -219,7 +219,7 @@
     std::stringstream sstream1, sstream2;
 
     {
- //[unit_example_4_snippet_1
+ //[kitchen_sink_snippet_1
     /// scalar
     const double s1 = 2;
     
@@ -310,7 +310,7 @@
               << "X2vQ1 : " << root<static_rational<4,3> >(q1) << std::endl
               << std::endl;
     
- //[unit_example_4_snippet_2
+ //[kitchen_sink_snippet_2
     /// check comparison tests
     quantity<length> l1(1.0*meter),
                         l2(2.0*meters);
@@ -325,7 +325,7 @@
               << "l1 > l2 " << "\t" << (l1 > l2) << std::endl
               << std::endl;
     
- //[unit_example_4_snippet_3
+ //[kitchen_sink_snippet_3
     /// check implicit unit conversion from dimensionless to value_type
     const double dimless = (q1/q1);
     //]
@@ -338,7 +338,7 @@
     sstream1 << "v1 = " << v1 << std::endl
               << std::endl;
     
- //[unit_example_4_snippet_4
+ //[kitchen_sink_snippet_4
     /// test calcuation of work
     quantity<force> F(1.0*newton);
     quantity<length> dx(1.0*meter);
@@ -351,7 +351,7 @@
               << std::endl;
     
     {
- //[unit_example_4_snippet_5
+ //[kitchen_sink_snippet_5
     /// test ideal gas law
     quantity<temperature> T = (273.+37.)*kelvin;
     quantity<pressure> P = 1.01325e5*pascals;
@@ -373,7 +373,7 @@
               << std::endl;
     }
     
- //[unit_example_4_snippet_6
+ //[kitchen_sink_snippet_6
     /// test trig stuff
     quantity<plane_angle> theta = 0.375*radians;
     quantity<dimensionless> sin_theta = sin(theta);
@@ -398,7 +398,7 @@
     /// check complex quantities
     typedef std::complex<double> complex_type;
     
- //[unit_example_4_snippet_7
+ //[kitchen_sink_snippet_7
     quantity<electric_potential,complex_type> v = complex_type(12.5,0.0)*volts;
     quantity<current,complex_type> i = complex_type(3.0,4.0)*amperes;
     quantity<resistance,complex_type> z = complex_type(1.5,-2.0)*ohms;
@@ -412,7 +412,7 @@
     
     /// check quantities using user-defined type encapsulating error propagation
 
- //[unit_example_4_snippet_8
+ //[kitchen_sink_snippet_8
     quantity<length,measurement<double> > u(measurement<double>(1.0,0.0)*meters),
                                             w(measurement<double>(4.52,0.02)*meters),
                                             x(measurement<double>(2.0,0.2)*meters),

Copied: sandbox/units/libs/units/example/non_base_dimension.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_21.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_21.cpp (original)
+++ sandbox/units/libs/units/example/non_base_dimension.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_21.cpp
+\brief non_base_dimension.cpp
 
 \detailed
 Another example of user-defined units with conversions.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_21_output
+//[non_base_dimension_output
 //]
 
 @endverbatim
@@ -39,6 +39,8 @@
 
 namespace units {
 
+//[non_base_dimension_snippet_1
+
 struct imperial_gallon_tag : base_unit<imperial_gallon_tag, volume_dimension, 1> { };
 
 typedef make_system<imperial_gallon_tag>::type imperial;
@@ -51,6 +53,8 @@
 
 typedef unit<volume_dimension,us> us_gallon;
 
+//]
+
 template<>
 struct is_implicitly_convertible<unit<volume_dimension,imperial>,
                                  unit<volume_dimension,us> > :

Copied: sandbox/units/libs/units/example/performance.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_14.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_14.cpp (original)
+++ sandbox/units/libs/units/example/performance.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,197 +11,7 @@
 /**
 \file
     
-\brief unit_example_14.cpp
-
-\detailed
-Test runtime performance.
-
-Output:
-_at_verbatim
-
-f(x,y,z) took 0.26 seconds to run 5e+07 iterations with double = 7.69231e+08 flops
-f(x,y,z) took 0.24 seconds to run 5e+07 iterations with quantity<double> = 8.33333e+08 flops
-g(x,y,z) took 0.26 seconds to run 5e+07 iterations with double = 7.69231e+08 flops
-g(x,y,z) took 0.25 seconds to run 5e+07 iterations with quantity<double> = 8e+08 flops
-
-_at_endverbatim
-**/
-/*
-#include <iostream>
-#include <cstdlib>
-
-#include <boost/timer.hpp>
-
-#include <boost/units/quantity.hpp>
-#include <boost/units/io.hpp>
-#include <boost/units/systems/si.hpp>
-#include <boost/units/systems/si/constants.hpp>
-
-using namespace boost::units;
-using namespace boost::units::SI;
-
-// faster if TEST_LIMIT is large and REPETITIONS is smalle
-// because there are more function calls in the outer loop?
-static const int TEST_LIMIT = 1000000,
- REPETITIONS = 1000;
-
-inline
-double f(double x,double y,double z)
-{
- double V = 0,
- C = 0;
-
- for (int i = 0; i < TEST_LIMIT; ++i)
- {
- if (i % 100000 == 0)
- C = double(std::rand())/RAND_MAX;
-
- V = V + ((x + y) * z * C);
- }
-
- return V;
-}
-
-inline
-double g(double x,double y,double z)
-{
- double V = 0,
- C = 0;
-
- for (int i = 0; i < TEST_LIMIT; ++i)
- {
- if (i % 100000 == 0)
- C = double(std::rand())/RAND_MAX;
-
- V += ((x + y) * z * C);
- }
-
- return V;
-}
-
-inline
-quantity<volume> f_mcs(const quantity<length>& x,const quantity<length>& y,const quantity<length>& z)
-{
- quantity<volume> V = 0 * cubic_meters;
- quantity<length> C = 0 * meters;
-
- for (int i = 0; i < TEST_LIMIT; ++i)
- {
- if (i % 100000 == 0)
- C = double(std::rand())/RAND_MAX * meters;
-
- V = V + ((x + y) * z * C);
- }
-
- return V;
-}
-
-inline
-quantity<volume> g_mcs(const quantity<length>& x,const quantity<length>& y,const quantity<length>& z)
-{
- quantity<volume> V = 0 * cubic_meters;
- quantity<length> C = 0 * meters;
-
- for (int i = 0; i < TEST_LIMIT; ++i)
- {
- if (i % 100000 == 0)
- C = double(std::rand())/RAND_MAX * meters;
-
- V += ((x + y) * z * C);
- }
-
- return V;
-}
-
-int main()
-{
- boost::timer bench;
-
- {
- bench.restart();
-
- for (int i=0;i<REPETITIONS;++i)
- f(1.0,2.0,3.0);
-
- const double elapsed = bench.elapsed(),
- iterations = REPETITIONS*double(TEST_LIMIT),
- flops = iterations*4/elapsed;
-
- std::cout << "f(x,y,z) took " << elapsed
- << " seconds to run " << iterations
- << " iterations with double"
- << " = " << flops << " flops"
- << std::endl;
- }
-
- {
- bench.restart();
-
- for (int i=0;i<REPETITIONS;++i)
- f_mcs(1.0*meters,2.0*meters,3.0*meters);
-
- const double elapsed = bench.elapsed(),
- iterations = REPETITIONS*double(TEST_LIMIT),
- flops = iterations*4/elapsed;
-
- std::cout << "f(x,y,z) took " << elapsed
- << " seconds to run " << iterations
- << " iterations with quantity<double>"
- << " = " << flops << " flops"
- << std::endl;
- }
-
- {
- bench.restart();
-
- for (int i=0;i<REPETITIONS;++i)
- g(1.0,2.0,3.0);
-
- const double elapsed = bench.elapsed(),
- iterations = REPETITIONS*double(TEST_LIMIT),
- flops = iterations*4/elapsed;
-
- std::cout << "g(x,y,z) took " << elapsed
- << " seconds to run " << iterations
- << " iterations with double"
- << " = " << flops << " flops"
- << std::endl;
- }
-
- {
- bench.restart();
-
- for (int i=0;i<REPETITIONS;++i)
- g_mcs(1.0*meters,2.0*meters,3.0*meters);
-
- const double elapsed = bench.elapsed(),
- iterations = REPETITIONS*double(TEST_LIMIT),
- flops = iterations*4/elapsed;
-
- std::cout << "g(x,y,z) took " << elapsed
- << " seconds to run " << iterations
- << " iterations with quantity<double>"
- << " = " << flops << " flops"
- << std::endl;
- }
-
- 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)
-
-/**
-\file
-
-\brief unit_example_14.cpp
+\brief performance.cpp
 
 \detailed
 Test runtime performance.

Copied: sandbox/units/libs/units/example/quantity.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_3.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_3.cpp (original)
+++ sandbox/units/libs/units/example/quantity.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_3.cpp
+\brief quantity.cpp
 
 \detailed
 Test quantity algebra.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_3_output_double
+//[quantity_output_double
 L = 2 m
 L+L = 4 m
 L-L = 0 m
@@ -34,7 +34,7 @@
 (3/2)vL = 1.5874 m^(2/3)
 //]
 
-//[unit_example_3_output_complex
+//[quantity_output_complex
 L = (3,4) m
 L+L = (6,8) m
 L-L = (0,0) m
@@ -74,7 +74,7 @@
     std::stringstream sstream1, sstream2;
     
     {
- //[unit_example_3_snippet_1
+ //[quantity_snippet_1
     quantity<length> L = 2.0*meters; // quantity of length
     quantity<energy> E = kilograms*pow<2>(L/seconds); // quantity of energy
     //]
@@ -95,7 +95,7 @@
     }
     
     {
- //[unit_example_3_snippet_2
+ //[quantity_snippet_2
     quantity<length,std::complex<double> > L(std::complex<double>(3.0,4.0)*meters);
     quantity<energy,std::complex<double> > E(kilograms*pow<2>(L/seconds));
     //]

Copied: sandbox/units/libs/units/example/quaternion.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_8.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_8.cpp (original)
+++ sandbox/units/libs/units/example/quaternion.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_8.cpp
+\brief quaternion.cpp
 
 \detailed
 Demonstrate interoperability with Boost.Quaternion.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_8_output_1
+//[quaternion_output_1
 +L = (4,3,2,1) m
 -L = (-4,-3,-2,-1) m
 L+L = (8,6,4,2) m
@@ -29,7 +29,7 @@
 L^3 = (-104,102,68,34) m^3
 //]
 
-//[unit_example_8_output_2
+//[quaternion_output_2
 +L = (4 m,3 m,2 m,1 m)
 -L = (-4 m,-3 m,-2 m,-1 m)
 L+L = (8 m,6 m,4 m,2 m)
@@ -65,7 +65,7 @@
 
 namespace units {
 
-//[unit_example_8_class_snippet_1
+//[quaternion_class_snippet_1
 /// specialize power typeof helper
 template<class Y,long N,long D>
 struct power_dimof_helper<boost::math::quaternion<Y>,static_rational<N,D> >
@@ -97,7 +97,7 @@
 };
 //]
 
-//[unit_example_8_class_snippet_2
+//[quaternion_class_snippet_2
 /// specialize power typeof helper for quaternion<quantity<Unit,Y> >
 template<class Unit,long N,long D,class Y>
 struct power_dimof_helper<boost::math::quaternion<quantity<Unit,Y> >,static_rational<N,D> >
@@ -160,7 +160,7 @@
     std::stringstream sstream1, sstream2;
     
     {
- //[unit_example_8_snippet_1
+ //[quaternion_snippet_1
     typedef quantity<length,quaternion<double> > length_dimension;
         
     length_dimension L(quaternion<double>(4.0,3.0,2.0,1.0)*meters);
@@ -180,7 +180,7 @@
     }
     
     {
- //[unit_example_8_snippet_2
+ //[quaternion_snippet_2
     typedef quaternion<quantity<length> > length_dimension;
         
     length_dimension L(4.0*meters,3.0*meters,2.0*meters,1.0*meters);

Copied: sandbox/units/libs/units/example/radar_beam_height.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_16.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_16.cpp (original)
+++ sandbox/units/libs/units/example/radar_beam_height.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_16.cpp
+\brief radar_beam_height.cpp
 
 \detailed
 Demonstrate library usage for user test cases suggested by Michael Fawcett.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_16_output
+//[radar_beam_height_output
 radar range : 300 nmi
 earth radius : 6.37101e+06 m
 beam height 1 : 18169.7 m
@@ -46,7 +46,7 @@
 
 namespace units {
 
-//[unit_example_16_class_snippet_1
+//[radar_beam_height_class_snippet_1
 namespace nautical {
 
 struct length_base_unit : base_unit<length_base_unit, length_dimension, 1>
@@ -78,7 +78,7 @@
 
 //]
 
-//[unit_example_16_class_snippet_2
+//[radar_beam_height_class_snippet_2
 namespace imperial {
 
 struct length_base_unit : base_unit<length_base_unit, length_dimension, 2>
@@ -109,7 +109,7 @@
 //]
 
 // radar beam height functions
-//[unit_example_16_function_snippet_1
+//[radar_beam_height_function_snippet_1
 template<class System,typename T>
 quantity<unit<length_dimension,System>,T>
 radar_beam_height(const quantity<unit<length_dimension,System>,T>& radar_range,
@@ -120,7 +120,7 @@
 }
 //]
 
-//[unit_example_16_function_snippet_2
+//[radar_beam_height_function_snippet_2
 template<class return_type,class System1,class System2,typename T>
 return_type
 radar_beam_height(const quantity<unit<length_dimension,System1>,T>& radar_range,
@@ -135,7 +135,7 @@
 }
 //]
 
-//[unit_example_16_function_snippet_3
+//[radar_beam_height_function_snippet_3
 quantity<imperial::length> radar_beam_height(const quantity<nautical::length>& range)
 {
     return quantity<imperial::length>(pow<2>(range/(1.23*nautical::miles/root<2>(imperial::feet))));
@@ -154,7 +154,7 @@
 
     std::stringstream sstream1, sstream2;
     
- //[unit_example_16_snippet_1
+ //[radar_beam_height_snippet_1
     const quantity<nautical::length> radar_range(300.0*miles);
     const quantity<SI::length> earth_radius(6371.0087714*kilo*meters);
     

Added: sandbox/units/libs/units/example/runtime_conversion_factor.cpp
==============================================================================
--- (empty file)
+++ sandbox/units/libs/units/example/runtime_conversion_factor.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -0,0 +1,65 @@
+// 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 <boost/units/base_dimension.hpp>
+#include <boost/units/base_unit.hpp>
+#include <boost/units/unit.hpp>
+#include <boost/units/quantity.hpp>
+
+//[runtime_conversion_factor_snippet_1
+
+static const long currency_base = 1;
+
+struct currency_base_dimension : boost::units::base_dimension<currency_base_dimension, 1> {};
+
+typedef currency_base_dimension::type currency_type;
+
+template<long N>
+struct currency_base_unit : boost::units::base_unit<currency_base_unit<N>, currency_type, currency_base + N> {};
+
+typedef currency_base_unit<0> us_dollar_base_unit;
+typedef currency_base_unit<1> euro_base_unit;
+
+typedef us_dollar_base_unit::unit_type us_dollar;
+typedef euro_base_unit::unit_type euro;
+
+// an array of all possible conversions
+double conversion_factors[2][2] = {
+ {1.0, 1.0},
+ {1.0, 1.0}
+};
+
+double get_conversion_factor(long from, long to) {
+ return(conversion_factors[from][to]);
+}
+
+void set_conversion_factor(long from, long to, double value) {
+ conversion_factors[from][to] = value;
+ conversion_factors[to][from] = 1.0 / value;
+}
+
+BOOST_UNITS_DEFINE_BASE_CONVERSION_TEMPLATE((long N1)(long N2), currency_base_unit<N1>, currency_base_unit<N2>, double, get_conversion_factor(N1, N2));
+
+//]
+
+int main() {
+ boost::units::quantity<us_dollar> dollars = 2.00 * us_dollar();
+ boost::units::quantity<euro> euros(dollars);
+ set_conversion_factor(0, 1, 2.0);
+ dollars = static_cast<boost::units::quantity<us_dollar> >(euros);
+ set_conversion_factor(0, 1, .5);
+ euros = static_cast<boost::units::quantity<euro> >(dollars);
+ double value = euros.value(); // = .5
+ if(value != .5) {
+ return(1);
+ } else {
+ return(0);
+ }
+}

Added: sandbox/units/libs/units/example/runtime_unit.cpp
==============================================================================
--- (empty file)
+++ sandbox/units/libs/units/example/runtime_unit.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -0,0 +1,60 @@
+// 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 <map>
+#include <iostream>
+#include <boost/lexical_cast.hpp>
+#include <boost/units/quantity.hpp>
+#include <boost/units/systems/si/length.hpp>
+#include <boost/units/systems/base_units.hpp>
+
+namespace {
+
+std::map<std::string, double> known_units;
+
+}
+
+int main() {
+ known_units["meter"] = 1.0;
+ known_units["centimeter"] = .01;
+ known_units["foot"] = conversion_factor(boost::units::foot_base_unit::unit_type(), boost::units::SI::meter);
+ std::string output_type("meter");
+ std::string input;
+ while(std::cin >> input) {
+ if(input == "exit") break;
+ else if(input == "help") {
+ std::cout << "type \"exit\" to exit\n"
+ "type \"return 'unit'\" to set the return units\n"
+ "type \"'number' 'unit'\" to convert a quantity to the return units" << std::endl;
+ } else if(input == "return") {
+ if(std::cin >> input) {
+ if(known_units.find(input) != known_units.end()) {
+ output_type = input;
+ std::cout << "Done." << std::endl;
+ } else {
+ std::cout << "Unknown unit \"" << input << "\"" << std::endl;
+ }
+ } else break;
+ } else {
+ try {
+ double value = boost::lexical_cast<double>(input);
+ if(std::cin >> input) {
+ if(known_units.find(input) != known_units.end()) {
+ std::cout << (value * known_units[input] / known_units[output_type]) << ' ' << output_type << std::endl;
+ } else {
+ std::cout << "Unknown unit \"" << input << "\"" << std::endl;
+ }
+ } else break;
+ } catch(...) {
+ std::cout << "Input error" << std::endl;
+ }
+ }
+ }
+}

Deleted: sandbox/units/libs/units/example/scaled_value.hpp
==============================================================================
--- sandbox/units/libs/units/example/scaled_value.hpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,404 +0,0 @@
-// mcs::units - A C++ library for zero-overhead dimensional analysis and
-// unit/quantity manipulation and conversion
-//
-// Copyright (C) 2003-2007 Matthias Christian Schabel
-//
-// 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 MCS_SCALED_VALUE_HPP
-#define MCS_SCALED_VALUE_HPP
-
-#include <cmath>
-#include <iostream>
-
-#include <boost/units/static_constant.hpp>
-#include <boost/units/static_rational.hpp>
-#include <boost/units/operators.hpp>
-
-namespace boost {
-
-namespace units {
-
-//template<long Base = 10,long Exp = 0>
-//struct scale
-//{
-// typedef long base_type;
-// typedef long exponent_type;
-//
-// static base_type base() { return Base; }
-// static exponent_type exponent() { return Exp; }
-//
-// scale() { }
-// ~scale() { }
-//};
-
-/// scaled_value
-template<class Y = double,class Z = scale<10,static_rational<0> > > class scaled_value;
-
-template<class Y,long Base,long Exp>
-class scaled_value< Y,scale<Base,static_rational<Exp> > >
-{
- public:
- typedef scaled_value< Y,scale<Base,static_rational<Exp> > > this_type;
- typedef Y value_type;
- typedef scale<Base,static_rational<Exp> > scale_type;
- //typedef typename scale_type::base_type base_type;
- //typedef typename scale_type::exponent_type exponent_type;
-
- scaled_value(const value_type& val = value_type()) :
- value_(val)
- { }
-
- scaled_value(const this_type& source) :
- value_(source.value_)
- { }
-
- ~scaled_value()
- { }
-
- this_type& operator=(const this_type& source)
- {
- if (this == &source) return *this;
-
- value_ = source.value_;
-
- return *this;
- }
-
- //base_type base() const { return scale_type::base(); }
- //exponent_type exponent() const { return scale_type::exponent(); }
- const value_type& value() const { return value_; }
-
- this_type& operator*=(value_type val)
- {
- value_ *= val;
- return *this;
- }
-
- this_type& operator/=(value_type val)
- {
- value_ /= val;
- return *this;
- }
-
- this_type& operator+=(const this_type& source) { value_ += source.value_; return *this; }
- this_type& operator-=(const this_type& source) { value_ -= source.value_; return *this; }
-
- private:
- value_type value_;
-};
-
-//// non-member operators
-//inline std::string getLongPrefix(const scale<10,-24>&) { return "yocto"; }
-//inline std::string getLongPrefix(const scale<10,-21>&) { return "zepto"; }
-//inline std::string getLongPrefix(const scale<10,-18>&) { return "atto"; }
-//inline std::string getLongPrefix(const scale<10,-15>&) { return "femto"; }
-//inline std::string getLongPrefix(const scale<10,-12>&) { return "pico"; }
-//inline std::string getLongPrefix(const scale<10,-9>&) { return "nano"; }
-//inline std::string getLongPrefix(const scale<10,-6>&) { return "micro"; }
-//inline std::string getLongPrefix(const scale<10,-3>&) { return "milli"; }
-//inline std::string getLongPrefix(const scale<10,-2>&) { return "centi"; }
-//inline std::string getLongPrefix(const scale<10,-1>&) { return "deci"; }
-//inline std::string getLongPrefix(const scale<10,0>&) { return ""; }
-//inline std::string getLongPrefix(const scale<10,1>&) { return "deka"; }
-//inline std::string getLongPrefix(const scale<10,2>&) { return "hecto"; }
-//inline std::string getLongPrefix(const scale<10,3>&) { return "kilo"; }
-//inline std::string getLongPrefix(const scale<10,6>&) { return "mega"; }
-//inline std::string getLongPrefix(const scale<10,9>&) { return "giga"; }
-//inline std::string getLongPrefix(const scale<10,12>&) { return "tera"; }
-//inline std::string getLongPrefix(const scale<10,15>&) { return "peta"; }
-//inline std::string getLongPrefix(const scale<10,18>&) { return "exa"; }
-//inline std::string getLongPrefix(const scale<10,21>&) { return "zetta"; }
-//inline std::string getLongPrefix(const scale<10,24>&) { return "yotta"; }
-//
-//inline std::string getShortPrefix(const scale<10,-24>&) { return "y"; }
-//inline std::string getShortPrefix(const scale<10,-21>&) { return "z"; }
-//inline std::string getShortPrefix(const scale<10,-18>&) { return "a"; }
-//inline std::string getShortPrefix(const scale<10,-15>&) { return "f"; }
-//inline std::string getShortPrefix(const scale<10,-12>&) { return "p"; }
-//inline std::string getShortPrefix(const scale<10,-9>&) { return "n"; }
-//inline std::string getShortPrefix(const scale<10,-6>&) { return "u"; }
-//inline std::string getShortPrefix(const scale<10,-3>&) { return "m"; }
-//inline std::string getShortPrefix(const scale<10,-2>&) { return "c"; }
-//inline std::string getShortPrefix(const scale<10,-1>&) { return "d"; }
-//inline std::string getShortPrefix(const scale<10,0>&) { return ""; }
-//inline std::string getShortPrefix(const scale<10,1>&) { return "da"; }
-//inline std::string getShortPrefix(const scale<10,2>&) { return "h"; }
-//inline std::string getShortPrefix(const scale<10,3>&) { return "k"; }
-//inline std::string getShortPrefix(const scale<10,6>&) { return "M"; }
-//inline std::string getShortPrefix(const scale<10,9>&) { return "G"; }
-//inline std::string getShortPrefix(const scale<10,12>&) { return "T"; }
-//inline std::string getShortPrefix(const scale<10,15>&) { return "P"; }
-//inline std::string getShortPrefix(const scale<10,18>&) { return "E"; }
-//inline std::string getShortPrefix(const scale<10,21>&) { return "Z"; }
-//inline std::string getShortPrefix(const scale<10,24>&) { return "Y"; }
-//
-//inline std::string getLongPrefix(const scale<2,10>&) { return "kibi"; }
-//inline std::string getLongPrefix(const scale<2,20>&) { return "mebi"; }
-//inline std::string getLongPrefix(const scale<2,30>&) { return "gibi"; }
-//inline std::string getLongPrefix(const scale<2,40>&) { return "tebi"; }
-//inline std::string getLongPrefix(const scale<2,50>&) { return "pebi"; }
-//inline std::string getLongPrefix(const scale<2,60>&) { return "exbi"; }
-//
-//inline std::string getShortPrefix(const scale<2,10>&) { return "Ki"; }
-//inline std::string getShortPrefix(const scale<2,20>&) { return "Mi"; }
-//inline std::string getShortPrefix(const scale<2,30>&) { return "Gi"; }
-//inline std::string getShortPrefix(const scale<2,40>&) { return "Ti"; }
-//inline std::string getShortPrefix(const scale<2,50>&) { return "Pi"; }
-//inline std::string getShortPrefix(const scale<2,60>&) { return "Ei"; }
-
-template<class Scale>
-std::string getLongPrefix(const Scale&) { return(Scale::name_prefix()); }
-template<class Scale>
-std::string getShortPrefix(const Scale&) { return(Scale::symbol_prefix()); }
-
-template<class Scale> struct reduced_scale;
-
-template<long Exp> struct reduced_scale<scale<2,static_rational<Exp> > > { typedef scale<2,static_rational<10*(Exp/10)> > type; };
-template<long Exp> struct reduced_scale<scale<10,static_rational<Exp> > > { typedef scale<10,static_rational<3*(Exp/3)> > type; };
-
-template<class Y,class Scale>
-std::ostream& operator<<(std::ostream& os,const scaled_value< Y,Scale>& val)
-{
- typedef typename reduced_scale<Scale>::type reduced_scale;
-
- //static const long reduced_exponent = reduced_scale::exponent(),
- // remainder_exponent = Exp-reduced_exponent;
- typedef typename mpl::minus<typename Scale::exponent, typename reduced_scale::exponent>::type remainder_exponent;
-
- if (boost::is_same<typename reduced_scale::exponent, static_rational<0> >())
- {
- os << val.value()*Scale::value();
- }
- else
- {
-// os << val.value() << " x " << val.base() << "^" << Exp;
- os << val.value()*scale<(Scale::base), remainder_exponent>::value() << " x " << reduced_scale::base << "^" << typename reduced_scale::exponent();
-// os << val.value()*std::pow(Y(val.base()),Y(remainder_exponent)) << " " << getShortPrefix(reduced_scale());
- }
-
- return os;
-}
-
-// value_type op scale
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,Exp> >
-operator*(const Y& lhs,const scale<Base,Exp>&)
-{
- return scaled_value< Y,scale<Base,Exp> >(lhs);
-}
-
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,typename mpl::negate<Exp>::type> >
-operator/(const Y& lhs,const scale<Base,Exp>&)
-{
- return scaled_value< Y,scale<Base,typename mpl::negate<Exp>::type> >(lhs);
-}
-
-//msvc can't find the template operator/ ???
-scaled_value< double,scale<10,static_rational<-4> > >
-inline operator/(const double& lhs,const scale<10,static_rational<4> >&)
-{
- return scaled_value< double,scale<10,static_rational<-4> > >(lhs);
-}
-
-// scale op value_type
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,Exp> >
-operator*(const scale<Base,Exp>&,const Y& rhs)
-{
- return scaled_value< Y,scale<Base,Exp> >(rhs);
-}
-
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,Exp> >
-operator/(const scale<Base,Exp>&,const Y& rhs)
-{
- return scaled_value< Y,scale<Base,Exp> >(Y(1)/rhs);
-}
-
-// value_type op scaled_value
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,Exp> >
-operator*(const Y& lhs,const scaled_value< Y,scale<Base,Exp> >& rhs)
-{
- return scaled_value< Y,scale<Base,Exp> >(lhs*rhs.value());
-}
-
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,typename mpl::negate<Exp>::type> >
-operator/(const Y& lhs,const scaled_value< Y,scale<Base,Exp> >& rhs)
-{
- return scaled_value< Y,scale<Base,typename mpl::negate<Exp>::type> >(lhs/rhs.value());
-}
-
-// scaled_value op value_type
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,Exp> >
-operator*(const scaled_value< Y,scale<Base,Exp> >& lhs,const Y& rhs)
-{
- return scaled_value< Y,scale<Base,Exp> >(lhs.value()*rhs);
-}
-
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,Exp> >
-operator/(const scaled_value< Y,scale<Base,Exp> >& lhs,const Y& rhs)
-{
- return scaled_value< Y,scale<Base,Exp> >(lhs.value()/rhs);
-}
-
-// scaled_value op scaled_value
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,Exp> >
-operator+(const scaled_value< Y,scale<Base,Exp> >& lhs,
- const scaled_value< Y,scale<Base,Exp> >& rhs)
-{
- return scaled_value< Y,scale<Base,Exp> >(lhs.value()+rhs.value());
-}
-
-template<class Y,long Base,class Exp>
-scaled_value< Y,scale<Base,Exp> >
-operator-(const scaled_value< Y,scale<Base,Exp> >& lhs,
- const scaled_value< Y,scale<Base,Exp> >& rhs)
-{
- return scaled_value< Y,scale<Base,Exp> >(lhs.value()-rhs.value());
-}
-
-template<class Y,long Base,class Exp1,class Exp2>
-scaled_value< Y,scale<Base,typename mpl::plus<Exp1,Exp2>::type> >
-operator*(const scaled_value< Y,scale<Base,Exp1> >& lhs,
- const scaled_value< Y,scale<Base,Exp2> >& rhs)
-{
- return scaled_value< Y,scale<Base,typename mpl::plus<Exp1,Exp2>::type> >(lhs.value()*rhs.value());
-}
-
-template<class Y,long Base,class Exp1,class Exp2>
-scaled_value< Y,scale<Base,typename mpl::minus<Exp1,Exp2>::type> >
-operator/(const scaled_value< Y,scale<Base,Exp1> >& lhs,
- const scaled_value< Y,scale<Base,Exp2> >& rhs)
-{
- return scaled_value< Y,scale<Base,typename mpl::minus<Exp1,Exp2>::type> >(lhs.value()/rhs.value());
-}
-
-/// specialize power typeof helper
-template<class Y,long Base,class Exp,long N,long 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;
-
- static type value(const scaled_value<Y,scale<Base,Exp> >& x)
- {
- const static_rational<N,D> rat;
-
- return type(std::pow(x.value(),Y(1)/Y(rat.denominator())));
- }
-};
-
-/// specialize root typeof helper
-template<class Y,long Base,class Exp,long N,long D>
-struct root_typeof_helper<scaled_value<Y,scale<Base,Exp> >,static_rational<N,D> >
-{
- typedef scaled_value<Y,scale<Base,typename mpl::times<Exp,static_rational<D> >::type> > type;
-
- static type value(const scaled_value<Y,scale<Base,Exp> >& x)
- {
- const static_rational<N,D> rat;
-
- return type(std::pow(x.value(),Y(1)/Y(rat.numerator())));
- }
-};
-
-namespace IEEE_1541 {
-
-namespace _ {
-
-typedef scale<2,static_rational<10> > scale_2_10;
-typedef scale<2,static_rational<20> > scale_2_20;
-typedef scale<2,static_rational<30> > scale_2_30;
-typedef scale<2,static_rational<40> > scale_2_40;
-typedef scale<2,static_rational<50> > scale_2_50;
-typedef scale<2,static_rational<60> > scale_2_60;
-
-} // namespace _
-
-BOOST_UNITS_STATIC_CONSTANT(kibi,_::scale_2_10) = {};
-BOOST_UNITS_STATIC_CONSTANT(mebi,_::scale_2_20) = {};
-BOOST_UNITS_STATIC_CONSTANT(gibi,_::scale_2_30) = {};
-BOOST_UNITS_STATIC_CONSTANT(tebi,_::scale_2_40) = {};
-BOOST_UNITS_STATIC_CONSTANT(pebi,_::scale_2_50) = {};
-BOOST_UNITS_STATIC_CONSTANT(exbi,_::scale_2_60) = {};
-
-BOOST_UNITS_STATIC_CONSTANT(Ki,_::scale_2_10) = {};
-BOOST_UNITS_STATIC_CONSTANT(Mi,_::scale_2_20) = {};
-BOOST_UNITS_STATIC_CONSTANT(Gi,_::scale_2_30) = {};
-BOOST_UNITS_STATIC_CONSTANT(Ti,_::scale_2_40) = {};
-BOOST_UNITS_STATIC_CONSTANT(Pi,_::scale_2_50) = {};
-BOOST_UNITS_STATIC_CONSTANT(Ei,_::scale_2_60) = {};
-
-} // namespace IEEE_1541
-
-namespace metric {
-
-namespace _ {
-
-typedef scale<10,static_rational<-24> > scale_10_m24;
-typedef scale<10,static_rational<-21> > scale_10_m21;
-typedef scale<10,static_rational<-18> > scale_10_m18;
-typedef scale<10,static_rational<-15> > scale_10_m15;
-typedef scale<10,static_rational<-12> > scale_10_m12;
-typedef scale<10,static_rational<-9> > scale_10_m9;
-typedef scale<10,static_rational<-6> > scale_10_m6;
-typedef scale<10,static_rational<-3> > scale_10_m3;
-typedef scale<10,static_rational<-2> > scale_10_m2;
-typedef scale<10,static_rational<-1> > scale_10_m1;
-typedef scale<10,static_rational<1> > scale_10_1;
-typedef scale<10,static_rational<2> > scale_10_2;
-typedef scale<10,static_rational<3> > scale_10_3;
-typedef scale<10,static_rational<6> > scale_10_6;
-typedef scale<10,static_rational<9> > scale_10_9;
-typedef scale<10,static_rational<12> > scale_10_12;
-typedef scale<10,static_rational<15> > scale_10_15;
-typedef scale<10,static_rational<18> > scale_10_18;
-typedef scale<10,static_rational<21> > scale_10_21;
-typedef scale<10,static_rational<24> > scale_10_24;
-
-} // namespace _
-
-BOOST_UNITS_STATIC_CONSTANT(yocto,_::scale_10_m24) = {};
-BOOST_UNITS_STATIC_CONSTANT(zepto,_::scale_10_m21) = {};
-BOOST_UNITS_STATIC_CONSTANT(atto,_::scale_10_m18) = {};
-BOOST_UNITS_STATIC_CONSTANT(femto,_::scale_10_m15) = {};
-BOOST_UNITS_STATIC_CONSTANT(pico,_::scale_10_m12) = {};
-BOOST_UNITS_STATIC_CONSTANT(nano,_::scale_10_m9) = {};
-BOOST_UNITS_STATIC_CONSTANT(micro,_::scale_10_m6) = {};
-BOOST_UNITS_STATIC_CONSTANT(milli,_::scale_10_m3) = {};
-BOOST_UNITS_STATIC_CONSTANT(centi,_::scale_10_m2) = {};
-BOOST_UNITS_STATIC_CONSTANT(deci,_::scale_10_m1) = {};
-BOOST_UNITS_STATIC_CONSTANT(deka,_::scale_10_1) = {};
-BOOST_UNITS_STATIC_CONSTANT(hecto,_::scale_10_2) = {};
-BOOST_UNITS_STATIC_CONSTANT(kilo,_::scale_10_3) = {};
-BOOST_UNITS_STATIC_CONSTANT(mega,_::scale_10_6) = {};
-BOOST_UNITS_STATIC_CONSTANT(giga,_::scale_10_9) = {};
-BOOST_UNITS_STATIC_CONSTANT(tera,_::scale_10_12) = {};
-BOOST_UNITS_STATIC_CONSTANT(peta,_::scale_10_15) = {};
-BOOST_UNITS_STATIC_CONSTANT(exa,_::scale_10_18) = {};
-BOOST_UNITS_STATIC_CONSTANT(zetta,_::scale_10_21) = {};
-BOOST_UNITS_STATIC_CONSTANT(yotta,_::scale_10_24) = {};
-
-} // namespace metric
-
-} // namespace units
-
-} // namespace boost
-
-#if BOOST_UNITS_HAS_BOOST_TYPEOF
-
-#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::scaled_value, 2)
-
-#endif
-
-#endif // MCS_SCALED_VALUE_HPP

Copied: sandbox/units/libs/units/example/temperature.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_20.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_20.cpp (original)
+++ sandbox/units/libs/units/example/temperature.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_20.cpp
+\brief temperature.cpp
 
 \detailed
 Conversions between Fahrenheit and Kelvin for absolute temperatures and
@@ -54,7 +54,7 @@
 
 namespace fahrenheit {
 
-//[unit_example_20_snippet_1
+//[temperature_snippet_1
 typedef make_system<fahrenheit_base_unit>::type system;
 
 typedef unit<temperature_dimension,system> temperature;
@@ -65,7 +65,7 @@
 
 } // fahrenheit
 
-//[unit_example_20_snippet_2
+//[temperature_snippet_2
 template<>
 struct is_implicitly_convertible< unit<temperature_dimension,fahrenheit::system>,
                                   unit<temperature_dimension,SI::system> > :
@@ -87,7 +87,7 @@
 {
     std::stringstream sstream1, sstream2;
     
- //[unit_example_20_snippet_3
+ //[temperature_snippet_3
     quantity<absolute<fahrenheit::temperature> > T1p(32.0*absolute<fahrenheit::temperature>());
     quantity<fahrenheit::temperature> T1v(32.0*fahrenheit::degrees);
     

Copied: sandbox/units/libs/units/example/unit.cpp (from r38663, /sandbox/units/libs/units/example/unit_example_2.cpp)
==============================================================================
--- /sandbox/units/libs/units/example/unit_example_2.cpp (original)
+++ sandbox/units/libs/units/example/unit.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
@@ -11,7 +11,7 @@
 /**
 \file
     
-\brief unit_example_2.cpp
+\brief unit.cpp
 
 \detailed
 Test unit algebra.
@@ -19,7 +19,7 @@
 Output:
 @verbatim
 
-//[unit_example_2_output
+//[unit_output
 L = m
 L+L = m
 L-L = m
@@ -47,7 +47,7 @@
     using namespace boost::units;
     using namespace boost::units::test;
 
- //[unit_example_2_snippet_1
+ //[unit_snippet_1
     const length L;
     const mass M;
     // needs to be namespace-qualified because of global time definition

Deleted: sandbox/units/libs/units/example/unit_example_1.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_1.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,102 +0,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)
-
-/**
-\file
-
-\brief unit_example_1.cpp
-
-\detailed
-Test dimension list manipulation.
-
-Output:
-_at_verbatim
-
-//[unit_example_1_output
-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_dimension = 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> >
-//]
-
-_at_endverbatim
-**/
-
-// undefine this if you don't want to demangle symbols
-// need to link with libboost_regex to get demangling functionality
-#define MCS_USE_DEMANGLING
-//#define MCS_USE_BOOST_REGEX_DEMANGLING
-
-#include <boost/type_traits/is_same.hpp>
-
-#include <boost/mpl/assert.hpp>
-
-#include <boost/units/detail/utility.hpp>
-
-#include "test_system.hpp"
-
-namespace mpl = boost::mpl;
-
-int main(void)
-{
- using namespace boost::units;
-
- 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_dimension,
- mpl::push_front<
- mpl::push_front<
- mpl::push_front<
- dimensionless_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_dimension = " << simplify_typename(length_dimension()) << std::endl
- << "mass_dimension = " << simplify_typename(mass_dimension()) << std::endl
- << "time_dimension = " << simplify_typename(time_dimension()) << std::endl
- << "energy_dimension = " << simplify_typename(energy_dimension()) << std::endl;
-
- //[unit_example_1_snippet_1
- 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_dimension,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_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_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_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
- << "V_type = " << simplify_typename(V_type()) << std::endl;
-
- return 0;
-}

Deleted: sandbox/units/libs/units/example/unit_example_10.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_10.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,211 +0,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)
-
-/**
-\file
-
-\brief unit_example_10.cpp
-
-\detailed
-Demonstrate angle unit systems, trigonometric functions, and
-
-Output:
-_at_verbatim
-
-//[unit_example_10_output
-thetad = 30 deg
-thetag = 33.3333 grad
-thetar = 0.523599 rad
-cos(thetad) = 0.866025 dimensionless
-cos(thetag) = 0.866025 dimensionless
-cos(thetar) = 0.866025 dimensionless
-acos(cos(thetad)) = 30 deg
-acos(cos(thetag)) = 33.3333 grad
-acos(cos(thetar)) = 0.523599 rad
-std::acos(cos(thetar)) = 0.523599
-
-thetad = 30 deg
-thetag = 33.3333 grad
-thetar = 0.523599 rad
-sin(thetad) = 0.5 dimensionless
-sin(thetag) = 0.5 dimensionless
-sin(thetar) = 0.5 dimensionless
-asin(sin(thetad)) = 30 deg
-asin(sin(thetag)) = 33.3333 grad
-asin(sin(thetar)) = 0.523599 rad
-std::asin(sin(thetar)) = 0.523599
-
-thetad = 30 deg
-thetag = 33.3333 grad
-thetar = 0.523599 rad
-tan(thetad) = 0.57735 dimensionless
-tan(thetag) = 0.57735 dimensionless
-tan(thetar) = 0.57735 dimensionless
-atan(tan(thetad)) = 30 deg
-atan(tan(thetag)) = 33.3333 grad
-atan(tan(thetar)) = 0.523599 rad
-std::atan(tan(thetar)) = 0.523599
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/units/io.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/conversion.hpp>
-#include <boost/units/systems/si.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/base_units.hpp>
-
-//#include <boost/units/systems/conversions/convert_degrees_to_radians.hpp>
-//#include <boost/units/systems/conversions/convert_gradians_to_radians.hpp>
-
-int main(void)
-{
- using namespace boost::units;
-
- std::stringstream sstream1, sstream2;
-
- //[unit_example_10_snippet_1
- 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<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
- << "thetar = " << thetar << std::endl
- << "cos(thetad) = " << cos_thetad << std::endl
- << "cos(thetag) = " << cos_thetag << std::endl
- << "cos(thetar) = " << cos_thetar << std::endl
- << "acos(cos(thetad)) = " << acos(cos_thetad) << std::endl
- << "acos(cos(thetag)) = " << acos(cos_thetag) << std::endl
- << "acos(cos(thetar)) = " << acos(cos_thetar) << std::endl
- << "std::acos(cos(thetar)) = " << std::acos(cos_thetar) << std::endl
- << std::endl;
- }
-
- /// test sin
- {
- 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
- << "thetar = " << thetar << std::endl
- << "sin(thetad) = " << sin_thetad << std::endl
- << "sin(thetag) = " << sin_thetag << std::endl
- << "sin(thetar) = " << sin_thetar << std::endl
- << "asin(sin(thetad)) = " << asin(sin_thetad) << std::endl
- << "asin(sin(thetag)) = " << asin(sin_thetag) << std::endl
- << "asin(sin(thetar)) = " << asin(sin_thetar) << std::endl
- << "std::asin(sin(thetar)) = " << std::asin(sin_thetar) << std::endl
- << std::endl;
- }
-
- /// test tan
- {
- 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
- << "thetar = " << thetar << std::endl
- << "tan(thetad) = " << tan_thetad << std::endl
- << "tan(thetag) = " << tan_thetag << std::endl
- << "tan(thetar) = " << tan_thetar << std::endl
- << "atan(tan(thetad)) = " << atan(tan_thetad) << std::endl
- << "atan(tan(thetag)) = " << atan(tan_thetag) << std::endl
- << "atan(tan(thetar)) = " << atan(tan_thetar) << std::endl
- << "std::atan(tan(thetar)) = " << std::atan(tan_thetar) << std::endl
- << std::endl;
- }
-
- sstream2 << "thetad = 30 deg" << std::endl;
- sstream2 << "thetag = 33.3333 grad" << std::endl;
- sstream2 << "thetar = 0.523599 rad" << std::endl;
- sstream2 << "cos(thetad) = 0.866025 dimensionless" << std::endl;
- sstream2 << "cos(thetag) = 0.866025 dimensionless" << std::endl;
- sstream2 << "cos(thetar) = 0.866025 dimensionless" << std::endl;
- sstream2 << "acos(cos(thetad)) = 30 deg" << std::endl;
- sstream2 << "acos(cos(thetag)) = 33.3333 grad" << std::endl;
- sstream2 << "acos(cos(thetar)) = 0.523599 rad" << std::endl;
- sstream2 << "std::acos(cos(thetar)) = 0.523599" << std::endl;
- sstream2 << std::endl;
- sstream2 << "thetad = 30 deg" << std::endl;
- sstream2 << "thetag = 33.3333 grad" << std::endl;
- sstream2 << "thetar = 0.523599 rad" << std::endl;
- sstream2 << "sin(thetad) = 0.5 dimensionless" << std::endl;
- sstream2 << "sin(thetag) = 0.5 dimensionless" << std::endl;
- sstream2 << "sin(thetar) = 0.5 dimensionless" << std::endl;
- sstream2 << "asin(sin(thetad)) = 30 deg" << std::endl;
- sstream2 << "asin(sin(thetag)) = 33.3333 grad" << std::endl;
- sstream2 << "asin(sin(thetar)) = 0.523599 rad" << std::endl;
- sstream2 << "std::asin(sin(thetar)) = 0.523599" << std::endl;
- sstream2 << std::endl;
- sstream2 << "thetad = 30 deg" << std::endl;
- sstream2 << "thetag = 33.3333 grad" << std::endl;
- sstream2 << "thetar = 0.523599 rad" << std::endl;
- sstream2 << "tan(thetad) = 0.57735 dimensionless" << std::endl;
- sstream2 << "tan(thetag) = 0.57735 dimensionless" << std::endl;
- sstream2 << "tan(thetar) = 0.57735 dimensionless" << std::endl;
- sstream2 << "atan(tan(thetad)) = 30 deg" << std::endl;
- sstream2 << "atan(tan(thetag)) = 33.3333 grad" << std::endl;
- sstream2 << "atan(tan(thetar)) = 0.523599 rad" << std::endl;
- sstream2 << "std::atan(tan(thetar)) = 0.523599" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_11.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_11.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,186 +0,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)
-
-/**
-\file
-
-\brief unit_example_11.cpp
-
-\detailed
-Test @c <cmath> functions.
-
-Output:
-_at_verbatim
-
-//[unit_example_11_output
-q0 = inf m
-q1 = 1.5 m
-q2 = -2.5 m
-q3 = 20 m^2
-
-isfinite(q0) : false
-isinf(q0) : true
-isnan(q0) : false
-isnormal(q0) : false
-isgreater(q1,q2) : true
-isgreaterequal(q1,q2) : true
-isless(q1,q2) : false
-islessequal(q1,q2) : false
-islessgreater(q1,q2) : true
-isunordered(q1,q2) : false
-abs(q1) : 1.5 m
-ceil(q1) : 2 m
-copysign(q1,q2) : -1.5 m
-fabs(q1) : 1.5 m
-floor(q1) : 1 m
-fdim(q1,q2) : 4 m
-fmax(q1,q2) : 1.5 m
-fmin(q1,q2) : -2.5 m
-fma(q1,q2,q3) : 16.25 m^2
-fpclassify(q1) : 4
-hypot(q1,q2) : 2.91548 m
-nearbyint(q1) : 2 m
-nextafter(q1,q2) : 1.5 m
-nexttoward(q1,q2) : 1.5 m
-rint(q1) : 2 m
-round(q1) : 2 m
-signbit(q1) : false
-trunc(q1) : 1 m
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-#include <limits>
-
-#include <boost/units/cmath.hpp>
-#include <boost/units/io.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/systems/si.hpp>
-
-int main(void)
-{
- using namespace boost::units;
-
- std::stringstream sstream1, sstream2;
-
- double inf = std::numeric_limits<double>::infinity();
-
- const quantity<SI::length> q0(inf*SI::meter),
- q1(1.5*SI::meters),
- q2(-2.5*SI::meters);
- const quantity<SI::area> q3(20.0*SI::square_meters);
-
- sstream1 << "q0 = " << q0 << std::endl
- << "q1 = " << q1 << std::endl
- << "q2 = " << q2 << std::endl
- << "q3 = " << q3 << std::endl
- << std::endl;
-
- // BOOST_PREVENT_MACRO_SUBSTITUTION is needed on certain compilers that define some <cmath> functions as macros
- sstream1 << "isfinite(q0) : " << std::boolalpha << isfinite BOOST_PREVENT_MACRO_SUBSTITUTION (q0) << std::endl
- << "isinf(q0) : " << std::boolalpha << isinf BOOST_PREVENT_MACRO_SUBSTITUTION (q0) << std::endl
- << "isnan(q0) : " << std::boolalpha << isnan BOOST_PREVENT_MACRO_SUBSTITUTION (q0) << std::endl
- << "isnormal(q0) : " << std::boolalpha << isnormal BOOST_PREVENT_MACRO_SUBSTITUTION (q0) << std::endl
- << "isgreater(q1,q2) : " << std::boolalpha << isgreater BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "isgreaterequal(q1,q2) : " << std::boolalpha << isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "isless(q1,q2) : " << std::boolalpha << isless BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "islessequal(q1,q2) : " << std::boolalpha << islessequal BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "islessgreater(q1,q2) : " << std::boolalpha << islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "isunordered(q1,q2) : " << std::boolalpha << isunordered BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "abs(q1) : " << abs BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << "ceil(q1) : " << ceil BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << "copysign(q1,q2) : " << copysign BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "fabs(q1) : " << fabs BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << "floor(q1) : " << floor BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << "fdim(q1,q2) : " << fdim BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "fmax(q1,q2) : " << fmax BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "fmin(q1,q2) : " << fmin BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "fma(q1,q2,q3) : " << fma BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2,q3) << std::endl
- << "fpclassify(q1) : " << fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << "hypot(q1,q2) : " << hypot BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "nearbyint(q1) : " << nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << "nextafter(q1,q2) : " << nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "nexttoward(q1,q2) : " << nexttoward BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl
- << "rint(q1) : " << rint BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << "round(q1) : " << round BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << "signbit(q1) : " << signbit BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << "trunc(q1) : " << trunc BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl
- << std::endl;
-
- sstream2 << "q0 = " << inf << " m" << std::endl;
- sstream2 << "q1 = 1.5 m" << std::endl;
- sstream2 << "q2 = -2.5 m" << std::endl;
- sstream2 << "q3 = 20 m^2" << std::endl;
- sstream2 << std::endl;
- sstream2 << "isfinite(q0) : false" << std::endl;
- sstream2 << "isinf(q0) : true" << std::endl;
- sstream2 << "isnan(q0) : false" << std::endl;
- sstream2 << "isnormal(q0) : false" << std::endl;
- sstream2 << "isgreater(q1,q2) : true" << std::endl;
- sstream2 << "isgreaterequal(q1,q2) : true" << std::endl;
- sstream2 << "isless(q1,q2) : false" << std::endl;
- sstream2 << "islessequal(q1,q2) : false" << std::endl;
- sstream2 << "islessgreater(q1,q2) : true" << std::endl;
- sstream2 << "isunordered(q1,q2) : false" << std::endl;
- sstream2 << "abs(q1) : 1.5 m" << std::endl;
- sstream2 << "ceil(q1) : 2 m" << std::endl;
- sstream2 << "copysign(q1,q2) : -1.5 m" << std::endl;
- sstream2 << "fabs(q1) : 1.5 m" << std::endl;
- sstream2 << "floor(q1) : 1 m" << std::endl;
- sstream2 << "fdim(q1,q2) : 4 m" << std::endl;
- sstream2 << "fmax(q1,q2) : 1.5 m" << std::endl;
- sstream2 << "fmin(q1,q2) : -2.5 m" << std::endl;
- sstream2 << "fma(q1,q2,q3) : 16.25 m^2" << std::endl;
- sstream2 << "fpclassify(q1) : "<< fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl;
- sstream2 << "hypot(q1,q2) : 2.91548 m" << std::endl;
- sstream2 << "nearbyint(q1) : 2 m" << std::endl;
- sstream2 << "nextafter(q1,q2) : 1.5 m" << std::endl;
- sstream2 << "nexttoward(q1,q2) : 1.5 m" << std::endl;
- sstream2 << "rint(q1) : 2 m" << std::endl;
- sstream2 << "round(q1) : 2 m" << std::endl;
- sstream2 << "signbit(q1) : false" << std::endl;
- sstream2 << "trunc(q1) : 1 m" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_12.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_12.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,158 +0,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)
-
-/**
-\file
-
-\brief unit_example_12.cpp
-
-\detailed
-Test interoperability with Boost.Interval.
-
-Output:
-_at_verbatim
-
-i0 = [ 1.1 , 1.2 ]
-i1 = [ 2.5 , 2.75 ]
-
-i0+i1 : [ 3.6 , 3.95 ]
-i0-i1 : [ -1.65 , -1.3 ]
-
-//[unit_example_12_output_1
-i0 = [ 1.1 , 1.2 ] m
-i1 = [ 2.5 , 2.75 ] m
-
-i0+i1 : [ 3.6 , 3.95 ] m
-i0-i1 : [ -1.65 , -1.3 ] m
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/numeric/interval.hpp>
-
-#include <boost/units/io.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/systems/si.hpp>
-
-#if BOOST_UNITS_HAS_BOOST_TYPEOF
-
-#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::numeric::interval, 1)
-
-#endif
-
-namespace boost {
-
-namespace numeric {
-
-template<class Y,class Z>
-std::ostream& operator<<(std::ostream& os,const interval<Y,Z>& val)
-{
- os << "[ " << val.lower() << " , " << val.upper() << " ]";
-
- return os;
-}
-
-} // namespace numeric
-
-} // namespace boost
-
-int main(void)
-{
- using namespace boost::numeric;
- using namespace boost::units;
-
- std::stringstream sstream1, sstream2;
-
- {
- const double q0 = 1.1,
- q1 = 1.2,
- q2 = 2.5,
- q3 = 2.75;
-
- const interval<double> i0(q0,q1),
- i1(q2,q3);
-
- sstream1 << "i0 = " << i0 << std::endl
- << "i1 = " << i1 << std::endl
- << std::endl;
-
- sstream1 << "i0+i1 : " << i0+i1 << std::endl
- << "i0-i1 : " << i0-i1 << std::endl
- << std::endl;
- }
-
- {
- //[unit_example_12_snippet_1
- typedef interval<double> interval_type;
-
- const quantity<SI::length,interval_type> i0(interval_type(1.1,1.2)*SI::meters),
- i1(interval_type(2.5,2.75)*SI::meters);
- //]
-
- sstream1 << "i0 = " << i0 << std::endl
- << "i1 = " << i1 << std::endl
- << std::endl;
-
- sstream1 << "i0+i1 : " << i0+i1 << std::endl
- << "i0-i1 : " << i0-i1 << std::endl
- << std::endl;
- }
-
- sstream2 << "i0 = [ 1.1 , 1.2 ]" << std::endl;
- sstream2 << "i1 = [ 2.5 , 2.75 ]" << std::endl;
- sstream2 << std::endl;
- sstream2 << "i0+i1 : [ 3.6 , 3.95 ]" << std::endl;
- sstream2 << "i0-i1 : [ -1.65 , -1.3 ]" << std::endl;
- sstream2 << std::endl;
- sstream2 << "i0 = [ 1.1 , 1.2 ] m" << std::endl;
- sstream2 << "i1 = [ 2.5 , 2.75 ] m" << std::endl;
- sstream2 << std::endl;
- sstream2 << "i0+i1 : [ 3.6 , 3.95 ] m" << std::endl;
- sstream2 << "i0-i1 : [ -1.65 , -1.3 ] m" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_13.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_13.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,95 +0,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)
-
-/**
-\file
-
-\brief unit_example_13.cpp
-
-\detailed
-Test interoperability with Boost.Serialization.
-
-Output:
-_at_verbatim
-
-//[unit_example_13_output
-volume (cm^3) = 1.35 cm^3
-
-22 serialization::archive 4 0 0 1.3500000000000001
-//]
-
-_at_endverbatim
-**/
-
-#include <fstream>
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/archive/text_iarchive.hpp>
-#include <boost/archive/text_oarchive.hpp>
-
-#include <boost/units/io.hpp>
-#include <boost/units/systems/cgs.hpp>
-
-using namespace boost::units;
-
-int main()
-{
-// std::ofstream ofs("boost_units_serialize_test.txt");
-
- std::stringstream sstream1, sstream2;
-
- //[unit_example_13_snippet_1
- const quantity<CGS::volume> vc(1.35*pow<3>(CGS::centimeter));
-
- sstream1 << "volume (cm^3) = " << vc << std::endl
- << std::endl;
-
- boost::archive::text_oarchive oa(sstream1);
-
- oa << vc;
- //]
-
- sstream2 << "volume (cm^3) = 1.35 cm^3" << std::endl;
- sstream2 << std::endl;
- sstream2 << "22 serialization::archive 4 0 0 1.3500000000000001";
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_14.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_14.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,458 +0,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)
-
-/**
-\file
-
-\brief unit_example_14.cpp
-
-\detailed
-Test runtime performance.
-
-Output:
-_at_verbatim
-
-f(x,y,z) took 0.26 seconds to run 5e+07 iterations with double = 7.69231e+08 flops
-f(x,y,z) took 0.24 seconds to run 5e+07 iterations with quantity<double> = 8.33333e+08 flops
-g(x,y,z) took 0.26 seconds to run 5e+07 iterations with double = 7.69231e+08 flops
-g(x,y,z) took 0.25 seconds to run 5e+07 iterations with quantity<double> = 8e+08 flops
-
-_at_endverbatim
-**/
-/*
-#include <iostream>
-#include <cstdlib>
-
-#include <boost/timer.hpp>
-
-#include <boost/units/quantity.hpp>
-#include <boost/units/io.hpp>
-#include <boost/units/systems/si.hpp>
-#include <boost/units/systems/si/constants.hpp>
-
-using namespace boost::units;
-using namespace boost::units::SI;
-
-// faster if TEST_LIMIT is large and REPETITIONS is smalle
-// because there are more function calls in the outer loop?
-static const int TEST_LIMIT = 1000000,
- REPETITIONS = 1000;
-
-inline
-double f(double x,double y,double z)
-{
- double V = 0,
- C = 0;
-
- for (int i = 0; i < TEST_LIMIT; ++i)
- {
- if (i % 100000 == 0)
- C = double(std::rand())/RAND_MAX;
-
- V = V + ((x + y) * z * C);
- }
-
- return V;
-}
-
-inline
-double g(double x,double y,double z)
-{
- double V = 0,
- C = 0;
-
- for (int i = 0; i < TEST_LIMIT; ++i)
- {
- if (i % 100000 == 0)
- C = double(std::rand())/RAND_MAX;
-
- V += ((x + y) * z * C);
- }
-
- return V;
-}
-
-inline
-quantity<volume> f_mcs(const quantity<length>& x,const quantity<length>& y,const quantity<length>& z)
-{
- quantity<volume> V = 0 * cubic_meters;
- quantity<length> C = 0 * meters;
-
- for (int i = 0; i < TEST_LIMIT; ++i)
- {
- if (i % 100000 == 0)
- C = double(std::rand())/RAND_MAX * meters;
-
- V = V + ((x + y) * z * C);
- }
-
- return V;
-}
-
-inline
-quantity<volume> g_mcs(const quantity<length>& x,const quantity<length>& y,const quantity<length>& z)
-{
- quantity<volume> V = 0 * cubic_meters;
- quantity<length> C = 0 * meters;
-
- for (int i = 0; i < TEST_LIMIT; ++i)
- {
- if (i % 100000 == 0)
- C = double(std::rand())/RAND_MAX * meters;
-
- V += ((x + y) * z * C);
- }
-
- return V;
-}
-
-int main()
-{
- boost::timer bench;
-
- {
- bench.restart();
-
- for (int i=0;i<REPETITIONS;++i)
- f(1.0,2.0,3.0);
-
- const double elapsed = bench.elapsed(),
- iterations = REPETITIONS*double(TEST_LIMIT),
- flops = iterations*4/elapsed;
-
- std::cout << "f(x,y,z) took " << elapsed
- << " seconds to run " << iterations
- << " iterations with double"
- << " = " << flops << " flops"
- << std::endl;
- }
-
- {
- bench.restart();
-
- for (int i=0;i<REPETITIONS;++i)
- f_mcs(1.0*meters,2.0*meters,3.0*meters);
-
- const double elapsed = bench.elapsed(),
- iterations = REPETITIONS*double(TEST_LIMIT),
- flops = iterations*4/elapsed;
-
- std::cout << "f(x,y,z) took " << elapsed
- << " seconds to run " << iterations
- << " iterations with quantity<double>"
- << " = " << flops << " flops"
- << std::endl;
- }
-
- {
- bench.restart();
-
- for (int i=0;i<REPETITIONS;++i)
- g(1.0,2.0,3.0);
-
- const double elapsed = bench.elapsed(),
- iterations = REPETITIONS*double(TEST_LIMIT),
- flops = iterations*4/elapsed;
-
- std::cout << "g(x,y,z) took " << elapsed
- << " seconds to run " << iterations
- << " iterations with double"
- << " = " << flops << " flops"
- << std::endl;
- }
-
- {
- bench.restart();
-
- for (int i=0;i<REPETITIONS;++i)
- g_mcs(1.0*meters,2.0*meters,3.0*meters);
-
- const double elapsed = bench.elapsed(),
- iterations = REPETITIONS*double(TEST_LIMIT),
- flops = iterations*4/elapsed;
-
- std::cout << "g(x,y,z) took " << elapsed
- << " seconds to run " << iterations
- << " iterations with quantity<double>"
- << " = " << flops << " flops"
- << std::endl;
- }
-
- 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)
-
-/**
-\file
-
-\brief unit_example_14.cpp
-
-\detailed
-Test runtime performance.
-
-Output:
-_at_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
-
-_at_endverbatim
-**/
-#include <cstdlib>
-#include <ctime>
-#include <algorithm>
-#include <iostream>
-#include <iomanip>
-
-#include <boost/timer.hpp>
-#include <boost/utility/result_of.hpp>
-#include <boost/numeric/ublas/matrix.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/systems/si.hpp>
-#include <boost/units/cmath.hpp>
-
-enum {
- tile_block_size = 24
-};
-
-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};
-
-template<class F, class T, class N, class R>
-R solve_differential_equation(F f, T lower, T upper, N steps, R start) {
- T h = (upper - lower) / steps;
- for(N i = N(); i < steps; ++i) {
- R y = start;
- T x = lower + h * i;
- typename F::template result<T, R>::type k1 = f(x, y);
- typename F::template result<T, R>::type k2 = f(x + h/2, y + h * k1 / 2);
- typename F::template result<T, R>::type k3 = f(x + h/2, y + h * k2 / 2);
- typename F::template result<T, R>::type k4 = f(x + h, y + h * k3);
- start = y + h * (k1 + 2 * k2 + 2 * k3 + k4) / 6;
- }
- return(start);
-}
-
-using namespace boost::units;
-
-//y' = 1 - x + 4 * y
-struct f {
- template<class Arg1, class Arg2> struct result;
-
- double operator()(const double& x, const double& y) const {
- return(1 - x + 4 * y);
- }
-
- boost::units::quantity<boost::units::SI::velocity>
- operator()(const quantity<SI::time>& x, const quantity<SI::length>& y) const {
- using namespace boost::units;
- using namespace SI;
- return(1 * meters / second - x * meters / pow<2>(seconds) + 4 * y / seconds );
- }
-};
-
-template<>
-struct f::result<double,double> {
- typedef double type;
-};
-
-template<>
-struct f::result<quantity<SI::time>, quantity<SI::length> > {
- typedef quantity<SI::velocity> type;
-};
-
-
-
-//y' = 1 - x + 4 * y
-//y' - 4 * y = 1 - x
-//e^(-4 * x) * (dy - 4 * y * dx) = e^(-4 * x) * (1 - x) * dx
-//d/dx(y * e ^ (-4 * x)) = e ^ (-4 * x) (1 - x) * dx
-
-//d/dx(y * e ^ (-4 * x)) = e ^ (-4 * x) * dx - x * e ^ (-4 * x) * dx
-//d/dx(y * e ^ (-4 * x)) = d/dx((-3/16 + 1/4 * x) * e ^ (-4 * x))
-//y * e ^ (-4 * x) = (-3/16 + 1/4 * x) * e ^ (-4 * x) + C
-//y = (-3/16 + 1/4 * x) + C/e ^ (-4 * x)
-//y = 1/4 * x - 3/16 + C * e ^ (4 * x)
-
-//y(0) = 1
-//1 = - 3/16 + C
-//C = 19/16
-//y(x) = 1/4 * x - 3/16 + 19/16 * e ^ (4 * x)
-
-
-
-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();
- }
- }
- std::cout << "multiplying ublas::matrix<double>(" << max_value << ", " << max_value << ") : ";
- 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();
- }
- }
- std::cout << "multiplying ublas::matrix<quantity>(" << max_value << ", " << max_value << ") : ";
- 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::cout << "tiled_matrix_multiply<double>(" << max_value << ", " << max_value << ") : ";
- boost::timer timer;
- tiled_multiply_carray_outer(&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;
- }
- std::cout << "tiled_matrix_multiply<quantity>(" << max_value << ", " << max_value << ") : ";
- 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]) > ublas_result(i,j) /1e14) {
- std::cout << std::setprecision(15) << "Uh Oh. ublas_result(" << i << "," << j << ") = " << ublas_result(i,j) << std::endl
- << "cresult[" << i << " * " << max_value << " + " << j << "] = " << cresult[i * max_value + j] << std::endl;
- return(EXIT_FAILURE);
- }
- }
- }
- {
- std::vector<double> values(1000);
- std::cout << "solving y' = 1 - x + 4 * y with double: ";
- boost::timer timer;
- for(int i = 0; i < 1000; ++i) {
- double x = .1 * i;
- values[i] = solve_differential_equation(f(), 0.0, x, i * 100, 1.0);
- }
- std::cout << timer.elapsed() << " seconds" << std::endl;
- for(int i = 0; i < 1000; ++i) {
- double x = .1 * i;
- double value = 1.0/4.0 * x - 3.0/16.0 + 19.0/16.0 * std::exp(4 * x);
- if(std::abs(values[i] - value) > value / 1e9) {
- std::cout << std::setprecision(15) << "i = : " << i << ", value = " << value << " approx = " << values[i] << std::endl;
- return(EXIT_FAILURE);
- }
- }
- }
- {
- using namespace boost::units;
- using namespace SI;
- std::vector<quantity<length> > values(1000);
- std::cout << "solving y' = 1 - x + 4 * y with quantity: ";
- boost::timer timer;
- for(int i = 0; i < 1000; ++i) {
- quantity<SI::time> x = .1 * i * seconds;
- values[i] = solve_differential_equation(f(), 0.0 * seconds, x, i * 100, 1.0 * meters);
- }
- std::cout << timer.elapsed() << " seconds" << std::endl;
- for(int i = 0; i < 1000; ++i) {
- double x = .1 * i;
- quantity<SI::length> value = (1.0/4.0 * x - 3.0/16.0 + 19.0/16.0 * std::exp(4 * x)) * meters;
- if(abs(values[i] - value) > value / 1e9) {
- std::cout << std::setprecision(15) << "i = : " << i << ", value = " << value << " approx = " << values[i] << std::endl;
- return(EXIT_FAILURE);
- }
- }
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_15.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_15.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,167 +0,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)
-
-/**
-\file
-
-\brief unit_example_15.cpp
-
-\detailed
-Demonstrate very simple unit systems for coordinate transformations
-
-Output:
-_at_verbatim
-
-
-_at_endverbatim
-**/
-
-#include <iostream>
-
-#include <boost/array.hpp>
-
-#include <boost/units/base_dimension.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/systems/si/length.hpp>
-
-namespace boost {
-
-namespace units {
-
-// fails due to redefinition of tag
-//struct erroneous_tag : base_dimension<erroneous_tag,-1> {};
-struct world_space_tag : base_dimension<world_space_tag,101> {};
-struct object_space_tag : base_dimension<object_space_tag, 102> {};
-
-namespace wo {
-
-typedef world_space_tag::type world_space_type;
-typedef object_space_tag::type object_space_type;
-
-/// placeholder class defining test unit system
-//struct system { };
-
-struct world_space_base_unit : base_unit<world_space_base_unit, world_space_type, 103> {};
-struct object_space_base_unit : base_unit<object_space_base_unit, object_space_type, 104> {};
-
-typedef make_system<world_space_base_unit, object_space_base_unit>::type system;
-
-/// unit typedefs
-typedef unit<dimensionless_type,system> dimensionless;
-
-typedef unit<world_space_type,system> world_space_unit;
-typedef unit<object_space_type,system> object_space_unit;
-
-static const world_space_unit world_space;
-static const object_space_unit object_space;
-
-} // namespace wo
-
-} // namespace units
-
-} // namespace boost
-
-template<class T>
-void suppress_unused_variable_warning(T&) {}
-
-int main(void)
-{
- using namespace boost::units;
- using namespace boost::units::wo;
-
- {
- typedef boost::array<double,3> vector;
-
- const vector vec1 = { 0, 0, 0 },
- vec2 = { 1, 1, 1 };
-
- quantity<world_space_unit,vector> wsv1(vec1*world_space),
- wsv2(vec2*world_space);
- quantity<object_space_unit,vector> osv1(vec1*object_space),
- osv2(vec2*object_space);
-
- quantity<world_space_unit,vector> wsv3(wsv1);
- quantity<object_space_unit,vector> osv3(osv1);
-
- suppress_unused_variable_warning(wsv2);
- suppress_unused_variable_warning(osv2);
-
- suppress_unused_variable_warning(wsv3);
- suppress_unused_variable_warning(osv3);
-
-#if defined(BOOST_UNITS_EXAMPLE_15_FAIL) && BOOST_UNITS_EXAMPLE_15_FAIL == 1
- // compile-time error if either of these is uncommented
- quantity<world_space_unit,vector> wsv4(osv1);
- quantity<object_space_unit,vector> osv4(wsv1);
-
-#endif
- }
-
- {
- typedef quantity<world_space_unit> world_space_quantity;
- typedef quantity<object_space_unit> object_space_quantity;
-
- typedef boost::array<world_space_quantity,3> world_space_vector;
- typedef boost::array<object_space_quantity,3> object_space_vector;
-
- world_space_vector wsv1 = { 0*world_space, 0*world_space, 0*world_space },
- wsv2 = { 1*world_space, 1*world_space, 1*world_space };
- object_space_vector osv1 = { 0*object_space, 0*object_space, 0*object_space },
- osv2 = { 1*object_space, 1*object_space, 1*object_space };
-
- world_space_vector wsv3(wsv1);
- object_space_vector osv3(osv1);
-
- suppress_unused_variable_warning(wsv2);
- suppress_unused_variable_warning(osv2);
-
- suppress_unused_variable_warning(wsv3);
- suppress_unused_variable_warning(osv3);
-
-#if defined(BOOST_UNITS_EXAMPLE_15_FAIL) && BOOST_UNITS_EXAMPLE_15_FAIL == 2
- // compile-time error if either of these is uncommented
- world_space_vector wsv4(osv1);
- object_space_vector osv4(wsv1);
-#endif
- }
-
- {
- // two-tier quantity for providing reference frame and underlying unit safety
- typedef boost::array<quantity<SI::length>,3> vector_type;
-
- typedef quantity<world_space_unit,vector_type> world_space_vector_type;
- typedef quantity<object_space_unit,vector_type> object_space_vector_type;
-
- vector_type vec1 = { 0*SI::meter, 0*SI::meter, 0*SI::meter },
- vec2 = { 1*SI::meter, 1*SI::meter, 1*SI::meter };
-
- world_space_vector_type wsv1 = vec1*world_space,
- wsv2 = vec2*world_space;
- object_space_vector_type osv1 = vec1*object_space,
- osv2 = vec2*object_space;
-
- world_space_vector_type wsv3(wsv1);
- object_space_vector_type osv3(osv1);
-
- suppress_unused_variable_warning(wsv2);
- suppress_unused_variable_warning(osv2);
-
- suppress_unused_variable_warning(wsv3);
- suppress_unused_variable_warning(osv3);
-
-#if defined(BOOST_UNITS_EXAMPLE_15_FAIL) && BOOST_UNITS_EXAMPLE_15_FAIL == 3
- // compile-time error if either of these is uncommented because conversion is not defined
- world_space_vector_type wsv4(osv2);
- object_space_vector_type osv4(wsv2);
-#endif
- }
-
- return 0;
-}

Deleted: sandbox/units/libs/units/example/unit_example_16.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_16.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,217 +0,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)
-
-/**
-\file
-
-\brief unit_example_16.cpp
-
-\detailed
-Demonstrate library usage for user test cases suggested by Michael Fawcett.
-
-Output:
-_at_verbatim
-
-//[unit_example_16_output
-radar range : 300 nmi
-earth radius : 6.37101e+06 m
-beam height 1 : 18169.7 m
-beam height 2 : 9.81085 nmi
-beam height 3 : 18169.7 m
-beam height 4 : 9.81085 nmi
-beam height approx : 59488.4 ft
-beam height approx : 18132.1 m
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/units/conversion.hpp>
-#include <boost/units/io.hpp>
-#include <boost/units/systems/si.hpp>
-#include <boost/units/systems/si/prefixes.hpp>
-
-namespace boost {
-
-namespace units {
-
-//[unit_example_16_class_snippet_1
-namespace nautical {
-
-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"; }
-};
-
-typedef make_system<length_base_unit>::type system;
-
-/// unit typedefs
-typedef unit<length_dimension,system> length;
-
-static const length mile,miles;
-
-} // namespace nautical
-
-// helper for conversions between nautical length and SI length
-
-} // namespace units
-
-} // namespace boost
-
-BOOST_UNITS_DEFINE_CONVERSION(boost::units::nautical::length_base_unit, boost::units::meter_base_unit::unit_type, double, 1.852e3);
-
-namespace boost {
-
-namespace units {
-
-//]
-
-//[unit_example_16_class_snippet_2
-namespace imperial {
-
-struct length_base_unit : base_unit<length_base_unit, length_dimension, 2>
-{
- static std::string name() { return "foot"; }
- static std::string symbol() { return "ft"; }
-};
-
-typedef make_system<length_base_unit>::type system;
-
-/// unit typedefs
-typedef unit<length_dimension,system> length;
-
-static const length foot,feet;
-
-} // imperial
-
-} // namespace units
-
-} // namespace boost
-
-BOOST_UNITS_DEFINE_CONVERSION(boost::units::imperial::length_base_unit, boost::units::meter_base_unit::unit_type, double, 1.0/3.28083989501312);
-
-namespace boost {
-
-namespace units {
-
-//]
-
-// radar beam height functions
-//[unit_example_16_function_snippet_1
-template<class System,typename T>
-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_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_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
- const return_type rr(radar_range),
- er(earth_radius);
-
- return return_type(pow<2>(rr)/(2.0*k*er));
-}
-//]
-
-//[unit_example_16_function_snippet_3
-quantity<imperial::length> radar_beam_height(const quantity<nautical::length>& range)
-{
- return quantity<imperial::length>(pow<2>(range/(1.23*nautical::miles/root<2>(imperial::feet))));
-}
-//]
-
-} // namespace units
-
-} // namespace boost
-
-int main(void)
-{
- using namespace boost::units;
- using namespace boost::units::SI;
- using namespace boost::units::nautical;
-
- std::stringstream sstream1, sstream2;
-
- //[unit_example_16_snippet_1
- const quantity<nautical::length> radar_range(300.0*miles);
- const quantity<SI::length> earth_radius(6371.0087714*kilo*meters);
-
- const quantity<SI::length> beam_height_1(radar_beam_height(quantity<SI::length>(radar_range),earth_radius));
- const quantity<nautical::length> beam_height_2(radar_beam_height(radar_range,quantity<nautical::length>(earth_radius)));
- const quantity<SI::length> beam_height_3(radar_beam_height< quantity<SI::length> >(radar_range,earth_radius));
- const quantity<nautical::length> beam_height_4(radar_beam_height< quantity<nautical::length> >(radar_range,earth_radius));
- //]
-
- sstream1 << "radar range : " << radar_range << std::endl
- << "earth radius : " << earth_radius << std::endl
- << "beam height 1 : " << beam_height_1 << std::endl
- << "beam height 2 : " << beam_height_2 << std::endl
- << "beam height 3 : " << beam_height_3 << std::endl
- << "beam height 4 : " << beam_height_4 << std::endl
- << "beam height approx : " << radar_beam_height(radar_range) << std::endl
- << "beam height approx : " << quantity<SI::length>(radar_beam_height(radar_range)) << std::endl
- << std::endl;
-
- sstream2 << "radar range : 300 nmi" << std::endl;
- sstream2 << "earth radius : " << 6.37101e6 << " m" << std::endl;
- sstream2 << "beam height 1 : 18169.7 m" << std::endl;
- sstream2 << "beam height 2 : 9.81085 nmi" << std::endl;
- sstream2 << "beam height 3 : 18169.7 m" << std::endl;
- sstream2 << "beam height 4 : 9.81085 nmi" << std::endl;
- sstream2 << "beam height approx : 59488.4 ft" << std::endl;
- sstream2 << "beam height approx : 18132.1 m" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_17.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_17.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,110 +0,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)
-
-/**
-\file
-
-\brief unit_example_17.cpp
-
-\detailed
-Test use of abstract unit system to perform pure dimensional analysis
-
-Output:
-_at_verbatim
-
-//[unit_example_17_output
-L = [L]
-L+L = [L]
-L-L = [L]
-L/L = dimensionless
-M*(L/T)*(L/T) = [L]^2 [M] [T]^-2
-M*(L/T)^2 = [L]^2 [M] [T]^-2
-L^3 = [L]^3
-L^(3/2) = [L]^(3/2)
-2vM = [M]^(1/2)
-(3/2)vM = [M]^(2/3)
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/units/io.hpp>
-#include <boost/units/detail/utility.hpp>
-#include <boost/units/systems/abstract.hpp>
-
-int main(void)
-{
- using namespace boost::units;
-
- std::stringstream sstream1, sstream2;
-
- //[unit_example_17_snippet_1
- const abstract::length L;
- const abstract::mass M;
- const abstract::time T;
- //]
-
- sstream1 << "L = " << L << std::endl
- << "L+L = " << L+L << std::endl
- << "L-L = " << L-L << std::endl
- << "L/L = " << L/L << std::endl
- << "M*(L/T)*(L/T) = " << M*(L/T)*(L/T) << std::endl
- << "M*(L/T)^2 = " << M*pow<2>(L/T) << std::endl
- << "L^3 = " << pow<3>(L) << std::endl
- << "L^(3/2) = " << pow<static_rational<3,2> >(L) << std::endl
- << "2vM = " << root<2>(M) << std::endl
- << "(3/2)vM = " << root<static_rational<3,2> >(M) << std::endl;
-
- sstream2 << "L = [L]" << std::endl;
- sstream2 << "L+L = [L]" << std::endl;
- sstream2 << "L-L = [L]" << std::endl;
- sstream2 << "L/L = dimensionless" << std::endl;
- sstream2 << "M*(L/T)*(L/T) = [L]^2 [M] [T]^-2" << std::endl;
- sstream2 << "M*(L/T)^2 = [L]^2 [M] [T]^-2" << std::endl;
- sstream2 << "L^3 = [L]^3" << std::endl;
- sstream2 << "L^(3/2) = [L]^(3/2)" << std::endl;
- sstream2 << "2vM = [M]^(1/2)" << std::endl;
- sstream2 << "(3/2)vM = [M]^(2/3)" << std::endl;\
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_18.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_18.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,130 +0,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)
-
-/**
-\file
-
-\brief unit_example_18.cpp
-
-\detailed
-Test heterogeneous units and quantities.
-
-Output:
-_at_verbatim
-
-//[unit_example_18_output_1
-1.5 m
-1 g
-1.5 m g
-1.5 m g^-1
-
-1 m kg s^-2
-1 kg s^-2
-
-1 cm kg s^-2
-1 cm m^-1 kg s^-2
-//]
-
-//[unit_example_18_output_2
-0.015 m^2
-//]
-
-_at_endverbatim
-**/
-
-#define MCS_USE_DEMANGLING
-//#define MCS_USE_BOOST_REGEX_DEMANGLING
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/units/io.hpp>
-#include <boost/units/detail/utility.hpp>
-#include <boost/units/systems/cgs.hpp>
-#include <boost/units/systems/si.hpp>
-
-using namespace boost::units;
-
-int main()
-{
- std::stringstream sstream1, sstream2;
-
- //[unit_example_18_snippet_1
- quantity<SI::length> L(1.5*SI::meter);
- quantity<CGS::mass> M(1.0*CGS::gram);
-
- sstream1 << L << std::endl
- << M << std::endl
- << L*M << std::endl
- << L/M << std::endl
- << std::endl;
-
- sstream1 << 1.0*SI::meter*SI::kilogram/pow<2>(SI::second) << std::endl
- << 1.0*SI::meter*SI::kilogram/pow<2>(SI::second)/SI::meter << std::endl
- << std::endl;
-
- sstream1 << 1.0*CGS::centimeter*SI::kilogram/pow<2>(SI::second) << std::endl
- << 1.0*CGS::centimeter*SI::kilogram/pow<2>(SI::second)/SI::meter << std::endl
- << std::endl;
- //]
-
- //unit_example_18_snippet_2
- quantity<SI::area> A(1.5*SI::meter*CGS::centimeter);
-
- sstream1 << A << std::endl
- << std::endl;
- //]
-
- sstream2 << "1.5 m" << std::endl
- << "1 g" << std::endl
- << "1.5 m g" << std::endl
- << "1.5 m g^-1" << std::endl
- << std::endl
- << "1 m kg s^-2" << std::endl
- << "1 kg s^-2" << std::endl
- << std::endl
- << "1 cm kg s^-2" << std::endl
- << "1 cm m^-1 kg s^-2" << std::endl
- << std::endl
- << "0.015 m^2" << std::endl
- << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_19.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_19.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,364 +0,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)
-
-/**
-\file
-
-\brief unit_example_19.cpp
-
-\detailed
-CODATA physical constants.
-
-Output:
-_at_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:
-
-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.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:
-
-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.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.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
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-
-#include <boost/units/io.hpp>
-#include <boost/units/systems/si/codata_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
- << "sigma_SB :\t" << sigma_SB << std::endl
- << "c_1 :\t" << c_1 << std::endl
- << "c_1L :\t" << c_1L << std::endl
- << "c_2 :\t" << c_2 << std::endl
- << "b :\t" << b << std::endl
- << "b' :\t" << b_prime << 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
- << "mu_mu/mu_B :\t" << mu_mu_over_mu_B << std::endl
- << "mu_mu/mu_N :\t" << mu_mu_over_mu_N << 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
- << "lambda_C_p :\t" << lambda_C_p << std::endl
- << "R_p :\t" << R_p << std::endl
- << "mu_p :\t" << mu_p << std::endl
- << "mu_p/mu_B :\t" << mu_p_over_mu_B << std::endl
- << "mu_p/mu_N :\t" << mu_p_over_mu_N << 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
- << "mu_p'/mu_B :\t" << mu_p_prime_over_mu_B << std::endl
- << "mu_p'/mu_N :\t" << mu_p_prime_over_mu_N << std::endl
- << "sigma_p' :\t" << sigma_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
- << "M_n :\t" << M_n << std::endl
- << "lambda_C_n :\t" << lambda_C_n << std::endl
- << "mu_n :\t" << mu_n << std::endl
- << "g_n :\t" << g_n << std::endl
- << "mu_n/mu_e :\t" << mu_n_over_mu_e << 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_B :\t" << mu_d_over_mu_B << std::endl
- << "mu_d/mu_N :\t" << mu_d_over_mu_N << std::endl
- << "g_d :\t" << g_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 << " triton: " << std::endl << std::endl
- << "m_t :\t" << m_t << std::endl
- << "m_t/m_e :\t" << m_t_over_m_e << std::endl
- << "m_t/m_p :\t" << m_t_over_m_p << std::endl
- << "M_t :\t" << M_t << std::endl
- << "mu_t :\t" << mu_t << std::endl
- << "mu_t/mu_B :\t" << mu_t_over_mu_B << std::endl
- << "mu_t/mu_N :\t" << mu_t_over_mu_N << std::endl
- << "g_t :\t" << g_t << std::endl
- << "mu_t/mu_e :\t" << mu_t_over_mu_e << std::endl
- << "mu_t/mu_p :\t" << mu_t_over_mu_p << std::endl
- << "mu_t/mu_n :\t" << mu_t_over_mu_n << std::endl
- << std::endl << " helion: " << std::endl << std::endl
- << "m_h :\t" << m_h << std::endl
- << "m_h/m_e :\t" << m_h_over_m_e << std::endl
- << "m_h/m_p :\t" << m_h_over_m_p << std::endl
- << "M_h :\t" << M_h << std::endl
- << "mu_h' :\t" << mu_h_prime << std::endl
- << "mu_h'/mu_B :\t" << mu_h_prime_over_mu_B << std::endl
- << "mu_h'/mu_N :\t" << mu_h_prime_over_mu_N << std::endl
- << "mu_h'/mu_p :\t" << mu_h_prime_over_mu_p << std::endl
- << "mu_h'/mu_p' :\t" << mu_h_prime_over_mu_p_prime << std::endl
- << "gamma_h' :\t" << gamma_h_prime << std::endl
- << std::endl << " alpha particle: " << std::endl << std::endl
- << "m_alpha :\t" << m_alpha << std::endl
- << "m_alpha/m_e :\t" << m_alpha_over_m_e << std::endl
- << "m_alpha/m_p :\t" << m_alpha_over_m_p << 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

Deleted: sandbox/units/libs/units/example/unit_example_2.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_2.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,114 +0,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)
-
-/**
-\file
-
-\brief unit_example_2.cpp
-
-\detailed
-Test unit algebra.
-
-Output:
-_at_verbatim
-
-//[unit_example_2_output
-L = m
-L+L = m
-L-L = m
-L/L = dimensionless
-meter*meter = m^2
-M*(L/T)*(L/T) = m^2 kg s^-2
-M*(L/T)^2 = m^2 kg s^-2
-L^3 = m^3
-L^(3/2) = m^(3/2)
-2vM = kg^(1/2)
-(3/2)vM = kg^(2/3)
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include "test_system.hpp"
-
-int main()
-{
- using namespace boost::units;
- using namespace boost::units::test;
-
- //[unit_example_2_snippet_1
- const length L;
- const mass M;
- // needs to be namespace-qualified because of global time definition
- const boost::units::test::time T;
- const energy E;
- //]
-
- std::stringstream sstream1, sstream2;
-
- sstream1 << "L = " << L << std::endl
- << "L+L = " << L+L << std::endl
- << "L-L = " << L-L << std::endl
- << "L/L = " << L/L << std::endl
- << "meter*meter = " << meter*meter << std::endl
- << "M*(L/T)*(L/T) = " << M*(L/T)*(L/T) << std::endl
- << "M*(L/T)^2 = " << M*pow<2>(L/T) << std::endl
- << "L^3 = " << pow<3>(L) << std::endl
- << "L^(3/2) = " << pow<static_rational<3,2> >(L) << std::endl
- << "2vM = " << root<2>(M) << std::endl
- << "(3/2)vM = " << root<static_rational<3,2> >(M) << std::endl;
-
- sstream2 << "L = m" << std::endl
- << "L+L = m" << std::endl
- << "L-L = m" << std::endl
- << "L/L = dimensionless" << std::endl
- << "meter*meter = m^2" << std::endl
- << "M*(L/T)*(L/T) = m^2 kg s^-2" << std::endl
- << "M*(L/T)^2 = m^2 kg s^-2" << std::endl
- << "L^3 = m^3" << std::endl
- << "L^(3/2) = m^(3/2)" << std::endl
- << "2vM = kg^(1/2)" << std::endl
- << "(3/2)vM = kg^(2/3)" << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_20.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_20.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,155 +0,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)
-
-/**
-\file
-
-\brief unit_example_20.cpp
-
-\detailed
-Conversions between Fahrenheit and Kelvin for absolute temperatures and
-temperature differences.
-
-Output:
-_at_verbatim
-
-{ 32 } F
-{ 273.15 } K
-{ 273.15 } K
-{ 273.15 } K
-[ 32 ] F
-[ 17.7778 ] K
-[ 17.7778 ] K
-[ 17.7778 ] K
-
-_at_endverbatim
-**/
-
-#include <algorithm>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-
-#include <boost/units/absolute.hpp>
-#include <boost/units/io.hpp>
-#include <boost/units/unit.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/systems/si/temperature.hpp>
-#include <boost/units/detail/utility.hpp>
-
-#include <boost/units/systems/base_units.hpp>
-
-using namespace boost::units;
-
-namespace boost {
-
-namespace units {
-
-namespace fahrenheit {
-
-//[unit_example_20_snippet_1
-typedef make_system<fahrenheit_base_unit>::type system;
-
-typedef unit<temperature_dimension,system> temperature;
-
-BOOST_UNITS_STATIC_CONSTANT(degree,temperature);
-BOOST_UNITS_STATIC_CONSTANT(degrees,temperature);
-//]
-
-} // fahrenheit
-
-//[unit_example_20_snippet_2
-template<>
-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_dimension,fahrenheit::system> >,
- absolute< unit<temperature_dimension,SI::system> > > :
- public mpl::true_
-{ };
-//]
-
-} // namespace units
-
-} // namespace boost
-
-int main()
-{
- std::stringstream sstream1, sstream2;
-
- //[unit_example_20_snippet_3
- quantity<absolute<fahrenheit::temperature> > T1p(32.0*absolute<fahrenheit::temperature>());
- quantity<fahrenheit::temperature> T1v(32.0*fahrenheit::degrees);
-
- quantity<absolute<SI::temperature> > T2p(T1p);
- quantity<absolute<SI::temperature> > T3p = T1p;
- quantity<SI::temperature> T2v(T1v);
- quantity<SI::temperature> T3v = T1v;
- //]
-
- typedef conversion_helper<quantity<absolute<fahrenheit::temperature> >,
- quantity<absolute<SI::temperature> > > absolute_conv_type;
- typedef conversion_helper<quantity<fahrenheit::temperature,double>,
- quantity<SI::temperature,double> > relative_conv_type;
-
- sstream1 << T1p << std::endl
- << absolute_conv_type::convert(T1p) << std::endl
- << T2p << std::endl
- << T3p << std::endl
- << T1v << std::endl
- << relative_conv_type::convert(T1v) << std::endl
- << T2v << std::endl
- << T3v << std::endl
- << std::endl;
-
- sstream2 << "32 absolute F" << std::endl
- << "273.15 absolute K" << std::endl
- << "273.15 absolute K" << std::endl
- << "273.15 absolute K" << std::endl
- << "32 F" << std::endl
- << "17.7778 K" << std::endl
- << "17.7778 K" << std::endl
- << "17.7778 K" << std::endl
- << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_21.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_21.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,86 +0,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)
-
-/**
-\file
-
-\brief unit_example_21.cpp
-
-\detailed
-Another example of user-defined units with conversions.
-
-Output:
-_at_verbatim
-
-//[unit_example_21_output
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-
-#include <boost/units/io.hpp>
-#include <boost/units/conversion.hpp>
-#include <boost/units/unit.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/systems/physical_units.hpp>
-#include <boost/units/base_unit.hpp>
-#include <boost/units/make_system.hpp>
-
-namespace boost {
-
-namespace units {
-
-struct imperial_gallon_tag : base_unit<imperial_gallon_tag, volume_dimension, 1> { };
-
-typedef make_system<imperial_gallon_tag>::type imperial;
-
-typedef unit<volume_dimension,imperial> imperial_gallon;
-
-struct us_gallon_tag : base_unit<us_gallon_tag, volume_dimension, 2> { };
-
-typedef make_system<us_gallon_tag>::type us;
-
-typedef unit<volume_dimension,us> us_gallon;
-
-template<>
-struct is_implicitly_convertible<unit<volume_dimension,imperial>,
- unit<volume_dimension,us> > :
- public mpl::true_
-{ };
-
-template<>
-struct is_implicitly_convertible<unit<volume_dimension,us>,
- unit<volume_dimension,imperial> > :
- public mpl::true_
-{ };
-
-} // namespace units
-
-} // namespace boost
-
-BOOST_UNITS_DEFINE_CONVERSION(boost::units::imperial_gallon_tag, boost::units::us_gallon_tag::unit_type, double, 1.2009499255);
-
-using namespace boost::units;
-
-int main(void)
-{
- quantity<imperial_gallon> ig1(1.0*imperial_gallon());
- quantity<us_gallon> ug1(1.0*us_gallon());
-
- quantity<imperial_gallon> ig2;
- quantity<us_gallon> ug2;
-
- ig2 = ug1;
- ug2 = ig1;
-
- return 0;
-}

Deleted: sandbox/units/libs/units/example/unit_example_22.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_22.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,76 +0,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)
-
-/**
-\file
-
-\brief unit_example_22.cpp
-
-\detailed Another example of defining units.
-
-Output:
-_at_verbatim
-
-//[unit_example_22_output
-kg s^(-3) K^(-1)
-kg s^(-3) K^(-1)
-1 kg s^(-3) K^(-1)
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-
-#include <boost/units/cmath.hpp>
-#include <boost/units/io.hpp>
-#include <boost/units/quantity.hpp>
-#include <boost/units/systems/cgs/acceleration.hpp>
-#include <boost/units/systems/si/acceleration.hpp>
-#include <boost/units/systems/si/force.hpp>
-#include <boost/units/systems/cgs/force.hpp>
-#include <boost/units/systems/si/mass.hpp>
-#include <boost/units/systems/cgs/mass.hpp>
-#include <boost/units/systems/si/momentum.hpp>
-#include <boost/units/systems/cgs/momentum.hpp>
-
-#include <boost/units/systems/other/non_si_units.hpp>
-
-struct blah { };
-struct blahblah { };
-
-blahblah operator+(const blah&) { return blahblah(); }
-
-template<typename I,I N,I D>
-class static_rational
-{ };
-
-int main()
-{
- using namespace boost;
- using namespace boost::units;
-
- std::cout << quantity<SI::dimensionless>(1.0*CGS::dyne/SI::newton) << std::endl;
-// std::cout << exp(1.0*(SI::newtons*CGS::dynes)/(SI::newtons*CGS::dynes)) << std::endl;
- std::cout << exp(quantity<SI::dimensionless>(1.0*(SI::newtons*CGS::dynes)/(SI::newtons*CGS::dynes))) << std::endl;
- std::cout << conversion_factor<double>(CGS::dyne,SI::newton) << std::endl;
- std::cout << conversion_factor<double>(SI::newton/SI::kilogram,CGS::dyne/CGS::gram) << std::endl;
- std::cout << conversion_factor<double>(CGS::momentum(),SI::momentum()) << std::endl;
- std::cout << conversion_factor<double>(SI::momentum()/SI::mass(),CGS::momentum()/CGS::mass()) << std::endl;
- std::cout << conversion_factor<double>(CGS::gal,SI::meter_per_second_squared) << std::endl;
-
- blah b;
-
- std::cout << typeid(+b).name() << std::cout;
-
- return 0;
-}
-
-

Deleted: sandbox/units/libs/units/example/unit_example_3.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_3.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,175 +0,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)
-
-/**
-\file
-
-\brief unit_example_3.cpp
-
-\detailed
-Test quantity algebra.
-
-Output:
-_at_verbatim
-
-//[unit_example_3_output_double
-L = 2 m
-L+L = 4 m
-L-L = 0 m
-L*L = 4 m^2
-L/L = 1 dimensionless
-L*meter = 2 m^2
-kilograms*(L/seconds)*(L/seconds) = 4 m^2 kg s^-2
-kilograms*(L/seconds)^2 = 4 m^2 kg s^-2
-L^3 = 8 m^3
-L^(3/2) = 2.82843 m^(3/2)
-2vL = 1.41421 m^(1/2)
-(3/2)vL = 1.5874 m^(2/3)
-//]
-
-//[unit_example_3_output_complex
-L = (3,4) m
-L+L = (6,8) m
-L-L = (0,0) m
-L*L = (-7,24) m^2
-L/L = (1,0) dimensionless
-L*meter = (3,4) m^2
-kilograms*(L/seconds)*(L/seconds) = (-7,24) m^2 kg s^-2
-kilograms*(L/seconds)^2 = (-7,24) m^2 kg s^-2
-L^3 = (-117,44) m^3
-L^(3/2) = (2,11) m^(3/2)
-2vL = (2,1) m^(1/2)
-(3/2)vL = (2.38285,1.69466) m^(2/3)
-//]
-
-_at_endverbatim
-**/
-
-#include <complex>
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/mpl/list.hpp>
-
-#include <boost/typeof/std/complex.hpp>
-
-#include <boost/units/quantity.hpp>
-#include <boost/units/io.hpp>
-
-#include "test_system.hpp"
-
-int main(void)
-{
- using namespace boost::units;
- using namespace boost::units::test;
-
- std::stringstream sstream1, sstream2;
-
- {
- //[unit_example_3_snippet_1
- quantity<length> L = 2.0*meters; // quantity of length
- quantity<energy> E = kilograms*pow<2>(L/seconds); // quantity of energy
- //]
-
- sstream1 << "L = " << L << std::endl
- << "L+L = " << L+L << std::endl
- << "L-L = " << L-L << std::endl
- << "L*L = " << L*L << std::endl
- << "L/L = " << L/L << std::endl
- << "L*meter = " << L*meter << std::endl
- << "kilograms*(L/seconds)*(L/seconds) = " << kilograms*(L/seconds)*(L/seconds) << std::endl
- << "kilograms*(L/seconds)^2 = " << kilograms*pow<2>(L/seconds) << std::endl
- << "L^3 = " << pow<3>(L) << std::endl
- << "L^(3/2) = " << pow<static_rational<3,2> >(L) << std::endl
- << "2vL = " << root<2>(L) << std::endl
- << "(3/2)vL = " << root<static_rational<3,2> >(L) << std::endl
- << std::endl;
- }
-
- {
- //[unit_example_3_snippet_2
- quantity<length,std::complex<double> > L(std::complex<double>(3.0,4.0)*meters);
- quantity<energy,std::complex<double> > E(kilograms*pow<2>(L/seconds));
- //]
-
- sstream1 << "L = " << L << std::endl
- << "L+L = " << L+L << std::endl
- << "L-L = " << L-L << std::endl
- << "L*L = " << L*L << std::endl
- << "L/L = " << L/L << std::endl
- << "L*meter = " << L*meter << std::endl
- << "kilograms*(L/seconds)*(L/seconds) = " << kilograms*(L/seconds)*(L/seconds) << std::endl
- << "kilograms*(L/seconds)^2 = " << kilograms*pow<2>(L/seconds) << std::endl
- << "L^3 = " << pow<3>(L) << std::endl
- << "L^(3/2) = " << pow<static_rational<3,2> >(L) << std::endl
- << "2vL = " << root<2>(L) << std::endl
- << "(3/2)vL = " << root<static_rational<3,2> >(L) << std::endl
- << std::endl;
- }
-
- sstream2 << "L = 2 m" << std::endl
- << "L+L = 4 m" << std::endl
- << "L-L = 0 m" << std::endl
- << "L*L = 4 m^2" << std::endl
- << "L/L = 1 dimensionless" << std::endl
- << "L*meter = 2 m^2" << std::endl
- << "kilograms*(L/seconds)*(L/seconds) = 4 m^2 kg s^-2" << std::endl
- << "kilograms*(L/seconds)^2 = 4 m^2 kg s^-2" << std::endl
- << "L^3 = 8 m^3" << std::endl
- << "L^(3/2) = 2.82843 m^(3/2)" << std::endl
- << "2vL = 1.41421 m^(1/2)" << std::endl
- << "(3/2)vL = 1.5874 m^(2/3)" << std::endl
- << std::endl
- << "L = (3,4) m" << std::endl
- << "L+L = (6,8) m" << std::endl
- << "L-L = (0,0) m" << std::endl
- << "L*L = (-7,24) m^2" << std::endl
- << "L/L = (1,0) dimensionless" << std::endl
- << "L*meter = (3,4) m^2" << std::endl
- << "kilograms*(L/seconds)*(L/seconds) = (-7,24) m^2 kg s^-2" << std::endl
- << "kilograms*(L/seconds)^2 = (-7,24) m^2 kg s^-2" << std::endl
- << "L^3 = (-117,44) m^3" << std::endl
- << "L^(3/2) = (2,11) m^(3/2)" << std::endl
- << "2vL = (2,1) m^(1/2)" << std::endl
- << "(3/2)vL = (2.38285,1.69466) m^(2/3)" << std::endl
- << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_4.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_4.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,552 +0,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)
-
-/**
-\file
-
-\brief unit_example_4.cpp
-
-\detailed
-More extensive quantity tests.
-
-Output:
-_at_verbatim
-
-//[unit_example_4_output_1
-S1 : 2
-X1 : 2
-X2 : (4/3)
-U1 : m kg s^-2
-U2 : m^2 kg s^-2
-Q1 : 1 m kg s^-2
-Q2 : 2 m^2 kg s^-2
-//]
-
-//[unit_example_4_output_2
-U1*S1 : 2 m kg s^-2
-S1*U1 : 2 m kg s^-2
-U1/S1 : 0.5 m kg s^-2
-S1/U1 : 2 m^-1 kg^-1 s^2
-//]
-
-//[unit_example_4_output_3
-U1+U1 : m kg s^-2
-U1-U1 : m kg s^-2
-U1*U1 : m^2 kg^2 s^-4
-U1/U1 : dimensionless
-U1*U2 : m^3 kg^2 s^-4
-U1/U2 : m^(-1)
-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)
-//]
-
-//[unit_example_4_output_4
-Q1*S1 : 2 m kg s^-2
-S1*Q1 : 2 m kg s^-2
-Q1/S1 : 0.5 m kg s^-2
-S1/Q1 : 2 m^-1 kg^-1 s^2
-//]
-
-//[unit_example_4_output_5
-U1*Q1 : 1 m^2 kg^2 s^-4
-Q1*U1 : 1 m^2 kg^2 s^-4
-U1/Q1 : 1 dimensionless
-Q1/U1 : 1 dimensionless
-//]
-
-//[unit_example_4_output_6
-+Q1 : 1 m kg s^-2
--Q1 : -1 m kg s^-2
-Q1+Q1 : 2 m kg s^-2
-Q1-Q1 : 0 m kg s^-2
-Q1*Q1 : 1 m^2 kg^2 s^-4
-Q1/Q1 : 1 dimensionless
-Q1*Q2 : 2 m^3 kg^2 s^-4
-Q1/Q2 : 0.5 m^-1
-Q1^X1 : 1 m^2 kg^2 s^-4
-X1vQ1 : 1 m^(1/2) kg^(1/2) s^-1
-Q1^X2 : 1 m^(4/3) kg^(4/3) s^(-8/3)
-X2vQ1 : 1 m^(3/4) kg^(3/4) s^(-3/2)
-//]
-
-//[unit_example_4_output_7
-l1 == l2 false
-l1 != l2 true
-l1 <= l2 true
-l1 < l2 true
-l1 >= l2 false
-l1 > l2 false
-//]
-
-dimless = 1
-
-//[unit_example_4_output_8
-v1 = 2 m s^-1
-//]
-
-//[unit_example_4_output_9
-F = 1 m kg s^-2
-dx = 1 m
-E = 1 m^2 kg s^-2
-//]
-
-//[unit_example_4_output_10
-r = 5e-07 m
-P = 101325 m^-1 kg s^-2
-V = 5.23599e-19 m^3
-T = 310 K
-n = 2.05835e-17 mol
-R = 8.31447 m^2 kg s^-2 K^-1 mol^-1
-//]
-
-//[unit_example_4_output_11
-theta = 0.375 rd
-sin(theta) = 0.366273 dimensionless
-asin(sin(theta)) = 0.375 rd
-//]
-
-//[unit_example_4_output_12
-V = (12.5,0) m^2 kg s^-3 A^-1
-I = (3,4) A
-Z = (1.5,-2) m^2 kg s^-3 A^-2
-I*Z = (12.5,0) m^2 kg s^-3 A^-1
-//]
-
-//[unit_example_4_output_13
-x+y-w = 0.48(+/-0.632772) m
-w*x = 9.04(+/-0.904885) m^2
-x/y = 0.666667(+/-0.149071) dimensionless
-//]
-
-//[unit_example_4_output_14
-w*y^2/(u*x)^2 = 10.17(+/-3.52328) m^-1
-w/(u*x)^(1/2) = 3.19612(+/-0.160431) dimensionless
-//]
-
-_at_endverbatim
-**/
-
-#include <cmath>
-#include <complex>
-#include <iostream>
-#include <algorithm>
-#include <sstream>
-
-#include <boost/typeof/std/complex.hpp>
-
-#include <boost/units/io.hpp>
-#include <boost/units/systems/si.hpp>
-#include <boost/units/systems/trig.hpp>
-#include <boost/units/systems/si/codata/physico-chemical_constants.hpp>
-
-#include "measurement.hpp"
-
-namespace boost {
-
-namespace units {
-
-/*
-//[unit_example_4_function_snippet_1
-/// 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_dimension,System>,Y>& theta)
-{
- return quantity<unit<dimensionless_type,System>,Y>(std::sin(theta.value()));
-}
-//]
-
-//[unit_example_4_function_snippet_2
-/// asin takes a dimensionless quantity and returns a quantity
-template<class System,class Y>
-quantity<unit<plane_angle_dimension,System>,Y>
-asin(const quantity<unit<dimensionless_type,System>,Y>& val)
-{
- typedef quantity<unit<plane_angle_dimension,System>,Y> quantity_type;
-
- return quantity_type::from_value(std::asin(val.value()));
-}
-//]
-*/
-
-//[unit_example_4_function_snippet_3
-/// the physical definition of work - computed for an arbitrary unit system
-template<class System,class Y>
-quantity<unit<energy_dimension,System>,Y>
-work(quantity<unit<force_dimension,System>,Y> F,
- quantity<unit<length_dimension,System>,Y> dx)
-{
- return F*dx;
-}
-//]
-
-//[unit_example_4_function_snippet_4
-/// the ideal gas law in SI units
-template<class Y>
-quantity<SI::amount,Y>
-idealGasLaw(const quantity<SI::pressure,Y>& P,
- const quantity<SI::volume,Y>& V,
- const quantity<SI::temperature,Y>& T)
-{
- using namespace boost::units::SI;
-
- #if BOOST_UNITS_HAS_TYPEOF
- return (P*V/(constants::CODATA::R*T));
- #else
- return P*V/(8.314472*(joules/(kelvin*mole))*T);
- #endif // BOOST_UNITS_HAS_TYPEOF
-}
-//]
-
-} // namespace units
-
-} // namespace boost
-
-int main()
-{
- using namespace boost::units;
- using namespace boost::units::SI;
-
- std::stringstream sstream1, sstream2;
-
- {
- //[unit_example_4_snippet_1
- /// scalar
- const double s1 = 2;
-
- const long x1 = 2;
- const static_rational<4,3> x2;
-
- /// define some units
- force u1 = newton;
- energy u2 = joule;
-
- /// define some quantities
- quantity<force> q1(1.0*u1);
- quantity<energy> q2(2.0*u2);
- //]
-
- /// check scalar, unit, and quantity io
- sstream1 << "S1 : " << s1 << std::endl
- << "X1 : " << x1 << std::endl
- << "X2 : " << x2 << std::endl
- << "U1 : " << u1 << std::endl
- << "U2 : " << u2 << std::endl
- << "Q1 : " << q1 << std::endl
- << "Q2 : " << q2 << std::endl
- << std::endl;
-
- /// check scalar-unit algebra
- sstream1 //<< "U1+S1 : " << u1+s1 << std::endl // illegal
- //<< "S1+U1 : " << s1+u1 << std::endl // illegal
- //<< "U1-S1 : " << u1-s1 << std::endl // illegal
- //<< "S1-U1 : " << s1-u1 << std::endl // illegal
- << "U1*S1 : " << u1*s1 << std::endl
- << "S1*U1 : " << s1*u1 << std::endl
- << "U1/S1 : " << u1/s1 << std::endl
- << "S1/U1 : " << s1/u1 << std::endl
- << std::endl;
-
- /// check unit-unit algebra
- sstream1 << "U1+U1 : " << u1+u1 << std::endl
- << "U1-U1 : " << u1-u1 << std::endl
- << "U1*U1 : " << u1*u1 << std::endl
- << "U1/U1 : " << u1/u1 << std::endl
- //<< "U1+U2 : " << u1+u2 << std::endl // illegal
- //<< "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
- << "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
- << std::endl;
-
- /// check scalar-quantity algebra
- sstream1 //<< "Q1+S1 : " << q1+s1 << std::endl // illegal
- //<< "S1+Q1 : " << s1+q1 << std::endl // illegal
- //<< "Q1-S1 : " << q1-s1 << std::endl // illegal
- //<< "S1-Q1 : " << s1-q1 << std::endl // illegal
- << "Q1*S1 : " << q1*s1 << std::endl
- << "S1*Q1 : " << s1*q1 << std::endl
- << "Q1/S1 : " << q1/s1 << std::endl
- << "S1/Q1 : " << s1/q1 << std::endl
- << std::endl;
-
- /// check unit-quantity algebra
- sstream1 //<< "U1+Q1 : " << u1+q1 << std::endl // illegal
- //<< "Q1+U1 : " << q1+u1 << std::endl // illegal
- //<< "U1-Q1 : " << u1-q1 << std::endl // illegal
- //<< "Q1-U1 : " << q1-u1 << std::endl // illegal
- << "U1*Q1 : " << u1*q1 << std::endl
- << "Q1*U1 : " << q1*u1 << std::endl
- << "U1/Q1 : " << u1/q1 << std::endl
- << "Q1/U1 : " << q1/u1 << std::endl
- << std::endl;
-
- /// check quantity-quantity algebra
- sstream1 << "+Q1 : " << +q1 << std::endl
- << "-Q1 : " << -q1 << std::endl
- << "Q1+Q1 : " << q1+q1 << std::endl
- << "Q1-Q1 : " << q1-q1 << std::endl
- << "Q1*Q1 : " << q1*q1 << std::endl
- << "Q1/Q1 : " << q1/q1 << std::endl
- //<< "Q1+Q2 : " << q1+q2 << std::endl // illegal
- //<< "Q1-Q2 : " << q1-q2 << std::endl // illegal
- << "Q1*Q2 : " << q1*q2 << std::endl
- << "Q1/Q2 : " << q1/q2 << std::endl
- << "Q1^X1 : " << pow<2>(q1) << std::endl
- << "X1vQ1 : " << root<2>(q1) << std::endl
- << "Q1^X2 : " << pow<static_rational<4,3> >(q1) << std::endl
- << "X2vQ1 : " << root<static_rational<4,3> >(q1) << std::endl
- << std::endl;
-
- //[unit_example_4_snippet_2
- /// check comparison tests
- quantity<length> l1(1.0*meter),
- l2(2.0*meters);
- //]
-
- sstream1 << std::boolalpha
- << "l1 == l2" << "\t" << (l1 == l2) << std::endl
- << "l1 != l2" << "\t" << (l1 != l2) << std::endl
- << "l1 <= l2" << "\t" << (l1 <= l2) << std::endl
- << "l1 < l2 " << "\t" << (l1 < l2) << std::endl
- << "l1 >= l2" << "\t" << (l1 >= l2) << std::endl
- << "l1 > l2 " << "\t" << (l1 > l2) << std::endl
- << std::endl;
-
- //[unit_example_4_snippet_3
- /// check implicit unit conversion from dimensionless to value_type
- const double dimless = (q1/q1);
- //]
-
- sstream1 << "dimless = " << dimless << std::endl
- << std::endl;
-
- quantity<velocity> v1 = 2.0*meters/second;
-
- sstream1 << "v1 = " << v1 << std::endl
- << std::endl;
-
- //[unit_example_4_snippet_4
- /// test calcuation of work
- quantity<force> F(1.0*newton);
- quantity<length> dx(1.0*meter);
- quantity<energy> E(work(F,dx));
- //]
-
- sstream1 << "F = " << F << std::endl
- << "dx = " << dx << std::endl
- << "E = " << E << std::endl
- << std::endl;
-
- {
- //[unit_example_4_snippet_5
- /// test ideal gas law
- quantity<temperature> T = (273.+37.)*kelvin;
- quantity<pressure> P = 1.01325e5*pascals;
- quantity<length> r = 0.5e-6*meters;
- quantity<volume> V = (4.0/3.0)*3.141592*pow<3>(r);
- quantity<amount> n(idealGasLaw(P,V,T));
- //]
-
- sstream1 << "r = " << r << std::endl
- << "P = " << P << std::endl
- << "V = " << V << std::endl
- << "T = " << T << std::endl
- << "n = " << n << std::endl
- #if BOOST_UNITS_HAS_TYPEOF
- << "R = " << constants::CODATA::R << std::endl
- #else
- << "no typeof" << std::endl
- #endif // BOOST_UNITS_HAS_TYPEOF
- << std::endl;
- }
-
- //[unit_example_4_snippet_6
- /// test trig stuff
- 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
- << "sin(theta) = " << sin_theta << std::endl
- << "asin(sin(theta)) = " << thetap << std::endl
- << std::endl;
-
- /// test implicit conversion of dimensionless to value
- double tmp = sin_theta;
-
- tmp = sin_theta;
-
- /// test implicit conversion from value to dimensionless
- quantity<dimensionless> tmpp = tmp;
-
- tmpp = tmp;
-
- /// check complex quantities
- typedef std::complex<double> complex_type;
-
- //[unit_example_4_snippet_7
- quantity<electric_potential,complex_type> v = complex_type(12.5,0.0)*volts;
- quantity<current,complex_type> i = complex_type(3.0,4.0)*amperes;
- quantity<resistance,complex_type> z = complex_type(1.5,-2.0)*ohms;
- //]
-
- sstream1 << "V = " << v << std::endl
- << "I = " << i << std::endl
- << "Z = " << z << std::endl
- << "I*Z = " << i*z << std::endl
- << std::endl;
-
- /// check quantities using user-defined type encapsulating error propagation
-
- //[unit_example_4_snippet_8
- quantity<length,measurement<double> > u(measurement<double>(1.0,0.0)*meters),
- w(measurement<double>(4.52,0.02)*meters),
- x(measurement<double>(2.0,0.2)*meters),
- y(measurement<double>(3.0,0.6)*meters);
- //]
-
- sstream1 << "x+y-w = " << x+y-w << std::endl
- << "w*x = " << w*x << std::endl
- << "x/y = " << x/y << std::endl
- << "w*y^2/(u*x)^2 = " << w*y*y/pow<2>(u*x) << std::endl
- << "w/(u*x)^(1/2) = " << w/pow< static_rational<1,2> >(u*x) << std::endl
- << std::endl;
- }
-
- sstream2 << "S1 : 2" << std::endl;
- sstream2 << "X1 : 2" << std::endl;
- sstream2 << "X2 : (4/3)" << std::endl;
- sstream2 << "U1 : m kg s^-2" << std::endl;
- sstream2 << "U2 : m^2 kg s^-2" << std::endl;
- sstream2 << "Q1 : 1 m kg s^-2" << std::endl;
- sstream2 << "Q2 : 2 m^2 kg s^-2" << std::endl;
- sstream2 << std::endl;
- sstream2 << "U1*S1 : 2 m kg s^-2" << std::endl;
- sstream2 << "S1*U1 : 2 m kg s^-2" << std::endl;
- sstream2 << "U1/S1 : 0.5 m kg s^-2" << std::endl;
- sstream2 << "S1/U1 : 2 m^-1 kg^-1 s^2" << std::endl;
- sstream2 << std::endl;
- sstream2 << "U1+U1 : m kg s^-2" << std::endl;
- sstream2 << "U1-U1 : m kg s^-2" << std::endl;
- sstream2 << "U1*U1 : m^2 kg^2 s^-4" << std::endl;
- 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 << "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;
- sstream2 << std::endl;
- sstream2 << "Q1*S1 : 2 m kg s^-2" << std::endl;
- sstream2 << "S1*Q1 : 2 m kg s^-2" << std::endl;
- sstream2 << "Q1/S1 : 0.5 m kg s^-2" << std::endl;
- sstream2 << "S1/Q1 : 2 m^-1 kg^-1 s^2" << std::endl;
- sstream2 << std::endl;
- sstream2 << "U1*Q1 : 1 m^2 kg^2 s^-4" << std::endl;
- sstream2 << "Q1*U1 : 1 m^2 kg^2 s^-4" << std::endl;
- sstream2 << "U1/Q1 : 1 dimensionless" << std::endl;
- sstream2 << "Q1/U1 : 1 dimensionless" << std::endl;
- sstream2 << std::endl;
- sstream2 << "+Q1 : 1 m kg s^-2" << std::endl;
- sstream2 << "-Q1 : -1 m kg s^-2" << std::endl;
- sstream2 << "Q1+Q1 : 2 m kg s^-2" << std::endl;
- sstream2 << "Q1-Q1 : 0 m kg s^-2" << std::endl;
- sstream2 << "Q1*Q1 : 1 m^2 kg^2 s^-4" << std::endl;
- sstream2 << "Q1/Q1 : 1 dimensionless" << std::endl;
- sstream2 << "Q1*Q2 : 2 m^3 kg^2 s^-4" << std::endl;
- sstream2 << "Q1/Q2 : 0.5 m^-1" << std::endl;
- sstream2 << "Q1^X1 : 1 m^2 kg^2 s^-4" << std::endl;
- sstream2 << "X1vQ1 : 1 m^(1/2) kg^(1/2) s^-1" << std::endl;
- sstream2 << "Q1^X2 : 1 m^(4/3) kg^(4/3) s^(-8/3)" << std::endl;
- sstream2 << "X2vQ1 : 1 m^(3/4) kg^(3/4) s^(-3/2)" << std::endl;
- sstream2 << std::endl;
- sstream2 << "l1 == l2\tfalse" << std::endl;
- sstream2 << "l1 != l2\ttrue" << std::endl;
- sstream2 << "l1 <= l2\ttrue" << std::endl;
- sstream2 << "l1 < l2 \ttrue" << std::endl;
- sstream2 << "l1 >= l2\tfalse" << std::endl;
- sstream2 << "l1 > l2 \tfalse" << std::endl;
- sstream2 << std::endl;
- sstream2 << "dimless = 1" << std::endl;
- sstream2 << std::endl;
- sstream2 << "v1 = 2 m s^-1" << std::endl;
- sstream2 << std::endl;
- sstream2 << "F = 1 m kg s^-2" << std::endl;
- sstream2 << "dx = 1 m" << std::endl;
- sstream2 << "E = 1 m^2 kg s^-2" << std::endl;
- sstream2 << std::endl;
- sstream2 << "r = " << 5e-7 << " m" << std::endl;
- sstream2 << "P = 101325 m^-1 kg s^-2" << std::endl;
- sstream2 << "V = " << 5.23599e-19 << " m^3" << std::endl;
- sstream2 << "T = 310 K" << std::endl;
- sstream2 << "n = " << 2.05835e-17 << " mol" << std::endl;
- #if BOOST_UNITS_HAS_TYPEOF
- sstream2 << "R = 8.314472 m^2 kg s^-2 K^-1 mol^-1 (rel. unc. = " << 1.8e-6 << ")" << std::endl;
- #else
- sstream2 << "no typeof" << std::endl;
- #endif // BOOST_UNITS_HAS_TYPEOF
- sstream2 << std::endl;
- sstream2 << "theta = " << 0.375 << " rad" << std::endl;
- sstream2 << "sin(theta) = " << 0.366273 << " dimensionless" << std::endl;
- sstream2 << "asin(sin(theta)) = " << 0.375 << " rad" << std::endl;
- sstream2 << std::endl;
- sstream2 << "V = (12.5,0) m^2 kg s^-3 A^-1" << std::endl;
- sstream2 << "I = (3,4) A" << std::endl;
- sstream2 << "Z = (1.5,-2) m^2 kg s^-3 A^-2" << std::endl;
- sstream2 << "I*Z = (12.5,0) m^2 kg s^-3 A^-1" << std::endl;
- sstream2 << std::endl;
- sstream2 << std::scientific << std::setprecision(1);
-
- sstream2 << "x+y-w = 0.48(+/-0.632772) m" << std::endl;
- sstream2 << "w*x = 9.04(+/-0.904885) m^2" << std::endl;
- sstream2 << "x/y = 0.666667(+/-0.149071) dimensionless" << std::endl;
- sstream2 << "w*y^2/(u*x)^2 = 10.17(+/-3.52328) m^-1" << std::endl;
- sstream2 << "w/(u*x)^(1/2) = 3.19612(+/-0.160431) dimensionless" << std::endl;
-
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_5.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_5.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,236 +0,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)
-
-/**
-\file
-
-\brief unit_example_5.cpp
-
-\detailed
-Test explicit and implicit unit conversion.
-
-Output:
-_at_verbatim
-
-//[unit_example_5_output_1
-L1 = 2 m
-L2 = 2 m
-L3 = 2 m
-L4 = 200 cm
-L5 = 5 m
-L6 = 4 m
-L7 = 200 cm
-//]
-
-//[unit_example_5_output_2
-volume (m^3) = 1 m^3
-volume (cm^3) = 1e+06 cm^3
-volume (m^3) = 1 m^3
-
-energy (joules) = 1 m^2 kg s^-2
-energy (ergs) = 1e+07 cm^2 g s^-2
-energy (joules) = 1 m^2 kg s^-2
-
-velocity (2 m/s) = 2 m s^-1
-velocity (2 cm/s) = 0.02 m s^-1
-//]
-
-//[unit_example_5_output_3
-implicit conversions enabled
-volume (m^3) = 1 m^3
-volume (cm^3) = 1e+06 cm^3
-
-energy (joules) = 1 m^2 kg s^-2
-energy (ergs) = 1e+07 cm^2 g s^-2
-
-velocity (2 m/s) = 2 m s^-1
-velocity (2 cm/s) = 0.02 m s^-1
-//]
-
-_at_endverbatim
-**/
-
-#define BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/units/io.hpp>
-#include <boost/units/systems/cgs.hpp>
-#include <boost/units/systems/si.hpp>
-
-using namespace boost::units;
-
-int main()
-{
-
- std::stringstream sstream1, sstream2;
-
- // test quantity_cast
- {
- // implicit value_type conversions
- //[unit_example_5_snippet_1
- quantity<SI::length> L1 = quantity<SI::length,int>(int(2.5)*SI::meters);
- quantity<SI::length,int> L2(quantity<SI::length,double>(2.5*SI::meters));
- //]
-
- //[unit_example_5_snippet_3
- quantity<SI::length,int> L3 = static_cast<quantity<SI::length,int> >(L1);
- //]
-
- //[unit_example_5_snippet_4
- quantity<CGS::length> L4 = static_cast<quantity<CGS::length> >(L1);
- //]
-
- quantity<SI::length,int> L5(4*SI::meters),
- L6(5*SI::meters);
- quantity<CGS::length> L7(L1);
-
- swap(L5,L6);
-
- sstream1 << "L1 = " << L1 << std::endl
- << "L2 = " << L2 << std::endl
- << "L3 = " << L3 << std::endl
- << "L4 = " << L4 << std::endl
- << "L5 = " << L5 << std::endl
- << "L6 = " << L6 << std::endl
- << "L7 = " << L7 << std::endl
- << std::endl;
- }
-
- // test explicit unit system conversion
- {
- //[unit_example_5_snippet_5
- quantity<SI::volume> vs(1.0*pow<3>(SI::meter));
- quantity<CGS::volume> vc(vs);
- quantity<SI::volume> vs2(vc);
-
- quantity<SI::energy> es(1.0*SI::joule);
- quantity<CGS::energy> ec(es);
- quantity<SI::energy> es2(ec);
-
- quantity<SI::velocity> v1 = 2.0*SI::meters/SI::second,
- v2(quantity<CGS::velocity>(2.0*CGS::centimeters/CGS::second));
- //]
-
- sstream1 << "volume (m^3) = " << vs << std::endl
- << "volume (cm^3) = " << vc << std::endl
- << "volume (m^3) = " << vs2 << std::endl
- << std::endl;
-
- sstream1 << "energy (joules) = " << es << std::endl
- << "energy (ergs) = " << ec << std::endl
- << "energy (joules) = " << es2 << std::endl
- << std::endl;
-
- sstream1 << "velocity (2 m/s) = " << v1 << std::endl
- << "velocity (2 cm/s) = " << v2 << std::endl
- << std::endl;
- }
-
- // test implicit unit system conversion
- {
- sstream1 << std::endl
- << "implicit conversions enabled"
- << std::endl;
-
- //[unit_example_5_snippet_6
- quantity<SI::volume> vs(1.0*pow<3>(SI::meter));
- quantity<CGS::volume> vc;
-
- vc = vs;
-
- quantity<SI::energy> es(1.0*SI::joule);
- quantity<CGS::energy> ec;
-
- ec = es;
-
- quantity<SI::velocity> v1 = 2.0*SI::meters/SI::second,
- v2 = 2.0*CGS::centimeters/CGS::second;
- //]
-
- sstream1 << "volume (m^3) = " << vs << std::endl
- << "volume (cm^3) = " << vc << std::endl
- << std::endl;
-
- sstream1 << "energy (joules) = " << es << std::endl
- << "energy (ergs) = " << ec << std::endl
- << std::endl;
-
- sstream1 << "velocity (2 m/s) = " << v1 << std::endl
- << "velocity (2 cm/s) = " << v2 << std::endl
- << std::endl;
- }
-
- sstream2 << "L1 = 2 m" << std::endl;
- sstream2 << "L2 = 2 m" << std::endl;
- sstream2 << "L3 = 2 m" << std::endl;
- sstream2 << "L4 = 200 cm" << std::endl;
- sstream2 << "L5 = 5 m" << std::endl;
- sstream2 << "L6 = 4 m" << std::endl;
- sstream2 << "L7 = 200 cm" << std::endl;
- sstream2 << std::endl;
- sstream2 << "volume (m^3) = 1 m^3" << std::endl;
- sstream2 << "volume (cm^3) = " << 1e6 << " cm^3" << std::endl;
- sstream2 << "volume (m^3) = 1 m^3" << std::endl;
- sstream2 << std::endl;
- sstream2 << "energy (joules) = 1 m^2 kg s^-2" << std::endl;
- sstream2 << "energy (ergs) = " << 1e7 << " cm^2 g s^-2" << std::endl;
- sstream2 << "energy (joules) = 1 m^2 kg s^-2" << std::endl;
- sstream2 << std::endl;
- sstream2 << "velocity (2 m/s) = 2 m s^-1" << std::endl;
- sstream2 << "velocity (2 cm/s) = 0.02 m s^-1" << std::endl;
- sstream2 << std::endl;
-#ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION
- sstream2 << std::endl;
- sstream2 << "implicit conversions enabled" << std::endl;
- sstream2 << "volume (m^3) = 1 m^3" << std::endl;
- sstream2 << "volume (cm^3) = " << 1e6 << " cm^3" << std::endl;
- sstream2 << std::endl;
- sstream2 << "energy (joules) = 1 m^2 kg s^-2" << std::endl;
- sstream2 << "energy (ergs) = " << 1e7 << " cm^2 g s^-2" << std::endl;
- sstream2 << std::endl;
- sstream2 << "velocity (2 m/s) = 2 m s^-1" << std::endl;
- sstream2 << "velocity (2 cm/s) = 0.02 m s^-1" << std::endl;
- sstream2 << std::endl;
-#endif
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_6.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_6.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,254 +0,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)
-
-/**
-\file
-
-\brief unit_example_6.cpp
-
-\detailed
-Demonstrate interoperability with UDT for scientific notation with heterogeneous algebra.
-
-Output:
-_at_verbatim
-
-//[unit_example_6_output_1
-L = 4 x 10^3 m
-T = 0.1 s
-L+L = 8 x 10^3 m
-T+T = 0.2 s
-L*T = 400 m s
-L/T = 40 x 10^3 m s^-1
-L*seconds = 4 x 10^3 m s
-kilograms*(L/T)*(L/T) = 1.6 x 10^9 m^2 kg s^-2
-kilograms*(L/T)^2 = 4 x 10^9 m^2 kg s^-2
-(L/T)^3 = 0.4 x 10^15 m^3 s^-3
-(L/T)^(3/2) = 0.632456 x 10^15 m^(3/2) s^(-3/2)
-2v(L/T) = 63.2456 x 10^3 m^(1/2) s^(-1/2)
-(3/2)v(L/T) = 7.36806 x 10^9 m^(2/3) s^(-2/3)
-//]
-
-20 x 10^3
-20 x 10^3
-0.2 x 10^-3
-5 x 10^3
-
-1 x 2^10 (kibi)
-1 x 2^20 (mebi)
-1 x 2^30 (gibi)
-1 x 2^40 (tebi)
-1 x 2^50 (pebi)
-1 x 2^60 (exbi)
-1 x 10^-24 (yocto)
-1 x 10^-21 (zepto)
-1 x 10^-18 (atto)
-1 x 10^-15 (femto)
-1 x 10^-12 (pico)
-1 x 10^-9 (nano)
-1 x 10^-6 (micro)
-1 x 10^-3 (milli)
-0.01 (centi)
-0.1 (deci)
-10 (deka)
-100 (hecto)
-1 x 10^3 (kilo)
-1 x 10^6 (mega)
-1 x 10^9 (giga)
-1 x 10^12 (tera)
-1 x 10^15 (peta)
-1 x 10^18 (exa)
-1 x 10^21 (zetta)
-1 x 10^24 (yotta)
-
-_at_endverbatim
-**/
-
-#include <cmath>
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/mpl/list.hpp>
-
-#include <boost/units/quantity.hpp>
-#include <boost/units/io.hpp>
-
-#include "scaled_value.hpp"
-#include "test_system.hpp"
-
-#if BOOST_UNITS_HAS_TYPEOF
-
-int main(void)
-{
- using namespace boost::units;
- using namespace boost::units::test;
-
- std::stringstream sstream1, sstream2;
-
- // don't know why this is necessary...
- typedef boost::units::test::time time_unit;
-
- //[unit_example_6_snippet_1
- typedef scaled_value<double,scale<10,static_rational<3> > > type1;
- typedef scaled_value<double,scale<10,static_rational<-2> > > type2;
-
- quantity<length,type1> L(type1(4.0)*meters);
- quantity<time_unit,type2> T(type2(10.0)*seconds);
- //]
-
- sstream1 << "L = " << L << std::endl
- << "T = " << T << std::endl
- << "L+L = " << L+L << std::endl
- << "T+T = " << T+T << std::endl
- << "L*T = " << L*T << std::endl
- << "L/T = " << L/T << std::endl
- << "L*seconds = " << L*seconds << std::endl
- << "kilograms*(L/T)*(L/T) = " << kilograms*(L/T)*(L/T) << std::endl
- << "kilograms*(L/T)^2 = " << kilograms*pow<2>(L/T) << std::endl
- << "(L/T)^3 = " << pow<3>(L/T) << std::endl
- << "(L/T)^(3/2) = " << pow<static_rational<3,2> >(L/T) << std::endl
- << "2v(L/T) = " << root<2>(L/T) << std::endl
- << "(3/2)v(L/T) = " << root<static_rational<3,2> >(L/T) << std::endl
- << std::endl;
-
- sstream1 << 2.0*scale<10,static_rational<4> >() << std::endl
- << scale<10,static_rational<4> >()*2.0 << std::endl
- << 2.0/scale<10,static_rational<4> >() << std::endl
- << scale<10,static_rational<4> >()/2.0 << std::endl
- << std::endl;
-
- {
- using namespace boost::units::IEEE_1541;
-
- sstream1 << 1.0*kibi << " (kibi)" << std::endl
- << 1.0*mebi << " (mebi)" << std::endl
- << 1.0*gibi << " (gibi)" << std::endl
- << 1.0*tebi << " (tebi)" << std::endl
- << 1.0*pebi << " (pebi)" << std::endl
- << 1.0*exbi << " (exbi)" << std::endl
- << std::endl;
- }
-
- {
- using namespace boost::units::metric;
-
- sstream1 << 1.0*yocto << " (yocto) " << std::endl
- << 1.0*zepto << " (zepto) " << std::endl
- << 1.0*atto << " (atto) " << std::endl
- << 1.0*femto << " (femto) " << std::endl
- << 1.0*pico << " (pico) " << std::endl
- << 1.0*nano << " (nano) " << std::endl
- << 1.0*micro << " (micro) " << std::endl
- << 1.0*milli << " (milli) " << std::endl
- << 1.0*centi << " (centi) " << std::endl
- << 1.0*deci << " (deci) " << std::endl
- << 1.0*deka << " (deka) " << std::endl
- << 1.0*hecto << " (hecto) " << std::endl
- << 1.0*kilo << " (kilo) " << std::endl
- << 1.0*mega << " (mega) " << std::endl
- << 1.0*giga << " (giga) " << std::endl
- << 1.0*tera << " (tera) " << std::endl
- << 1.0*peta << " (peta) " << std::endl
- << 1.0*exa << " (exa) " << std::endl
- << 1.0*zetta << " (zetta) " << std::endl
- << 1.0*yotta << " (yotta) " << std::endl
- << std::endl;
- }
-
- sstream2 << "L = 4 x 10^3 m" << std::endl;
- sstream2 << "T = 0.1 s" << std::endl;
- sstream2 << "L+L = 8 x 10^3 m" << std::endl;
- sstream2 << "T+T = 0.2 s" << std::endl;
- sstream2 << "L*T = 400 m s" << std::endl;
- sstream2 << "L/T = 40 x 10^3 m s^-1" << std::endl;
- sstream2 << "L*seconds = 4 x 10^3 m s" << std::endl;
- sstream2 << "kilograms*(L/T)*(L/T) = 1.6 x 10^9 m^2 kg s^-2" << std::endl;
- sstream2 << "kilograms*(L/T)^2 = 4 x 10^9 m^2 kg s^-2" << std::endl;
- sstream2 << "(L/T)^3 = 0.4 x 10^15 m^3 s^-3" << std::endl;
- sstream2 << "(L/T)^(3/2) = 0.632456 x 10^15 m^(3/2) s^(-3/2)" << std::endl;
- sstream2 << "2v(L/T) = 63.2456 x 10^3 m^(1/2) s^(-1/2)" << std::endl;
- sstream2 << "(3/2)v(L/T) = 7.36806 x 10^9 m^(2/3) s^(-2/3)" << std::endl;
- sstream2 << std::endl;
- sstream2 << "20 x 10^3" << std::endl;
- sstream2 << "20 x 10^3" << std::endl;
- sstream2 << "0.2 x 10^-3" << std::endl;
- sstream2 << "5 x 10^3" << std::endl;
- sstream2 << std::endl;
- sstream2 << "1 x 2^10 (kibi)" << std::endl;
- sstream2 << "1 x 2^20 (mebi)" << std::endl;
- sstream2 << "1 x 2^30 (gibi)" << std::endl;
- sstream2 << "1 x 2^40 (tebi)" << std::endl;
- sstream2 << "1 x 2^50 (pebi)" << std::endl;
- sstream2 << "1 x 2^60 (exbi)" << std::endl;
- sstream2 << std::endl;
- sstream2 << "1 x 10^-24 (yocto) " << std::endl;
- sstream2 << "1 x 10^-21 (zepto) " << std::endl;
- sstream2 << "1 x 10^-18 (atto) " << std::endl;
- sstream2 << "1 x 10^-15 (femto) " << std::endl;
- sstream2 << "1 x 10^-12 (pico) " << std::endl;
- sstream2 << "1 x 10^-9 (nano) " << std::endl;
- sstream2 << "1 x 10^-6 (micro) " << std::endl;
- sstream2 << "1 x 10^-3 (milli) " << std::endl;
- sstream2 << "0.01 (centi) " << std::endl;
- sstream2 << "0.1 (deci) " << std::endl;
- sstream2 << "10 (deka) " << std::endl;
- sstream2 << "100 (hecto) " << std::endl;
- sstream2 << "1 x 10^3 (kilo) " << std::endl;
- sstream2 << "1 x 10^6 (mega) " << std::endl;
- sstream2 << "1 x 10^9 (giga) " << std::endl;
- sstream2 << "1 x 10^12 (tera) " << std::endl;
- sstream2 << "1 x 10^15 (peta) " << std::endl;
- sstream2 << "1 x 10^18 (exa) " << std::endl;
- sstream2 << "1 x 10^21 (zetta) " << std::endl;
- sstream2 << "1 x 10^24 (yotta) " << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}
-
-#else
-
-int main(void)
-{
- std::cout << "No typeof enabled" << std::endl;
-
- return 0;
-}
-
-#endif // BOOST_UNITS_HAS_TYPEOF

Deleted: sandbox/units/libs/units/example/unit_example_7.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_7.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,570 +0,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)
-
-/**
-\file
-
-\brief unit_example_7.cpp
-
-\detailed
-Demonstrate interoperability with array class and built-in arrays.
-
-Output:
-_at_verbatim
-
-//[unit_example_7_output_1
-Using mcs::array...
-
-data1 :
-
- 0 m 1 m 2 m
- 10 m 11 m 12 m
- 20 m 21 m 22 m
-
-data2 :
-
- 0 m 0.1 m 0.2 m
- 1 m 1.1 m 1.2 m
- 2 m 2.1 m 2.2 m
-
-data3 :
-
- 0 m 1.1 m 2.2 m
- 11 m 12.1 m 13.2 m
- 22 m 23.1 m 24.2 m
-
-data4 :
-
- 0 m 0.9 m 1.8 m
- 9 m 9.9 m 10.8 m
- 18 m 18.9 m 19.8 m
-
-data5 :
-
- 0 m^2 0.1 m^2 0.4 m^2
- 10 m^2 12.1 m^2 14.4 m^2
- 40 m^2 44.1 m^2 48.4 m^2
-
-data6 :
-
- nan dimensionless 10 dimensionless 10 dimensionless
- 10 dimensionless 10 dimensionless 10 dimensionless
- 10 dimensionless 10 dimensionless 10 dimensionless
-//]
-
-_at_endverbatim
-
-...or...
-
-_at_verbatim
-
-//[unit_example_7_output_2
-Using C++ array...
-
-data1 :
-
- 0 m 1 m 2 m
- 10 m 11 m 12 m
- 20 m 21 m 22 m
-
-data2 :
-
- 0 m 0.1 m 0.2 m
- 1 m 1.1 m 1.2 m
- 2 m 2.1 m 2.2 m
-
-data3 :
-
- 0 m 1.1 m 2.2 m
- 11 m 12.1 m 13.2 m
- 22 m 23.1 m 24.2 m
-
-data4 :
-
- 0 m 0.9 m 1.8 m
- 9 m 9.9 m 10.8 m
- 18 m 18.9 m 19.8 m
-
-data5 :
-
- 0 m^2 0.1 m^2 0.4 m^2
- 10 m^2 12.1 m^2 14.4 m^2
- 40 m^2 44.1 m^2 48.4 m^2
-
-data6 :
-
- nan dimensionless 10 dimensionless 10 dimensionless
- 10 dimensionless 10 dimensionless 10 dimensionless
- 10 dimensionless 10 dimensionless 10 dimensionless
-//]
-
-_at_endverbatim
-**/
-
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-#include <limits>
-
-#include <boost/mpl/list.hpp>
-
-#include <boost/units/unit.hpp>
-#include <boost/units/io.hpp>
-
-#include "test_system.hpp"
-
-#if (BOOST_UNITS_HAS_TYPEOF && MCS_HAS_ARRAY)
-
-#include <mcs/array/array.hpp>
-
-int main(void)
-{
- using namespace boost::units;
- using namespace boost::units::test;
- using namespace mcs;
-
- std::stringstream sstream1, sstream2;
-
- double zero = 0.0,
- nan = 0.0/zero;
-
- sstream1 << "Using mcs::array..." << std::endl << std::endl;
-
- //[unit_example_7_snippet_1
- typedef quantity<dimensionless> dimensionless_type;
- typedef quantity<length> length_type;
- typedef quantity<area> area_type;
-
- const std::size_t xdim = 3,
- ydim = 3;
-
- Array<length_type,2> data1(Index<2>(xdim,ydim)),
- data2(Index<2>(xdim,ydim));
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- data1(i,j) = length_type((10.0f*i+j)*meters);
- data2(i,j) = length_type((i+0.10f*j)*meters);
- }
- }
- //]
-
- sstream1 << "data1 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- sstream1 << std::setw(5) << data1(i,j);
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream1 << "data2 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- sstream1 << std::setw(5) << data2(i,j);
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- //[unit_example_7_snippet_2
- mcs::Array<length_type,2> data3(data1+data2),
- data4(data1-data2);
- mcs::Array<area_type,2> data5(data1*data2);
- mcs::Array<dimensionless_type,2> data6(data1/data2);
- //]
-
- sstream1 << "data3 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- sstream1 << std::setw(5) << data3(i,j);
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream1 << "data4 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- sstream1 << std::setw(5) << data4(i,j);
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream1 << "data5 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- sstream1 << std::setw(5) << data5(i,j);
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream1 << "data6 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- sstream1 << std::setw(5) << data6(i,j);
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream2 << "Using mcs::array..." << std::endl;
- sstream2 << std::endl;
- sstream2 << "data1 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m 1 m 2 m" << std::endl;
- sstream2 << " 10 m 11 m 12 m" << std::endl;
- sstream2 << " 20 m 21 m 22 m" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data2 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m 0.1 m 0.2 m" << std::endl;
- sstream2 << " 1 m 1.1 m 1.2 m" << std::endl;
- sstream2 << " 2 m 2.1 m 2.2 m" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data3 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m 1.1 m 2.2 m" << std::endl;
- sstream2 << " 11 m 12.1 m 13.2 m" << std::endl;
- sstream2 << " 22 m 23.1 m 24.2 m" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data4 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m 0.9 m 1.8 m" << std::endl;
- sstream2 << " 9 m 9.9 m 10.8 m" << std::endl;
- sstream2 << " 18 m 18.9 m 19.8 m" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data5 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m^2 0.1 m^2 0.4 m^2" << std::endl;
- sstream2 << " 10 m^2 12.1 m^2 14.4 m^2" << std::endl;
- sstream2 << " 40 m^2 44.1 m^2 48.4 m^2" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data6 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << std::setw(5) << nan << " dimensionless";
- sstream2 << " 10 dimensionless 10 dimensionless" << std::endl;
- sstream2 << " 10 dimensionless 10 dimensionless 10 dimensionless" << std::endl;
- sstream2 << " 10 dimensionless 10 dimensionless 10 dimensionless" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}
-
-/* Output:
-
-Using mcs::array...
-
-data1 :
-
- 0 m 1 m 2 m
- 10 m 11 m 12 m
- 20 m 21 m 22 m
-
-data2 :
-
- 0 m 0.1 m 0.2 m
- 1 m 1.1 m 1.2 m
- 2 m 2.1 m 2.2 m
-
-data3 :
-
- 0 m 1.1 m 2.2 m
- 11 m 12.1 m 13.2 m
- 22 m 23.1 m 24.2 m
-
-data4 :
-
- 0 m 0.9 m 1.8 m
- 9 m 9.9 m 10.8 m
- 18 m 18.9 m 19.8 m
-
-data5 :
-
- 0 m^2 0.1 m^2 0.4 m^2
- 10 m^2 12.1 m^2 14.4 m^2
- 40 m^2 44.1 m^2 48.4 m^2
-
-data6 :
-
- nan dimensionless 10 dimensionless 10 dimensionless
- 10 dimensionless 10 dimensionless 10 dimensionless
- 10 dimensionless 10 dimensionless 10 dimensionless
-
-*/
-
-#else // MCS_HAS_ARRAY
-
-int main(void)
-{
- using namespace boost::units;
- using namespace boost::units::test;
-
- std::stringstream sstream1, sstream2;
-
- double zero = 0.0,
- nan = 0.0/zero;
-
- sstream1 << "Using C++ array..." << std::endl << std::endl;
-
- typedef quantity<dimensionless> dimensionless_type;
- typedef quantity<length> length_type;
- typedef quantity<area> area_type;
-
- static const std::size_t xdim = 3,
- ydim = 3;
-
- length_type data1[xdim][ydim],
- data2[xdim][ydim];
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- data1[i][j] = length_type((10.0f*i+j)*meters);
- data2[i][j] = length_type((i+0.10f*j)*meters);
- }
- }
-
- sstream1 << "data1 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- sstream1 << std::setw(5) << data1[i][j];
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream1 << "data2 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- sstream1 << std::setw(5) << data2[i][j];
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- length_type data3[xdim][ydim],
- data4[xdim][ydim];
- area_type data5[xdim][ydim];
- dimensionless_type data6[xdim][ydim];
-
- sstream1 << "data3 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- data3[i][j] = data1[i][j]+data2[i][j];
-
- sstream1 << std::setw(5) << data3[i][j];
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream1 << "data4 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- data4[i][j] = data1[i][j]-data2[i][j];
-
- sstream1 << std::setw(5) << data4[i][j];
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream1 << "data5 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- data5[i][j] = data1[i][j]*data2[i][j];
-
- sstream1 << std::setw(5) << data5[i][j];
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream1 << "data6 : " << std::endl << std::endl;
-
- for (std::size_t i=0;i<xdim;++i)
- {
- for (std::size_t j=0;j<ydim;++j)
- {
- data6[i][j] = data1[i][j]/data2[i][j];
-
- sstream1 << std::setw(5) << data6[i][j];
- }
-
- sstream1 << std::endl;
- }
-
- sstream1 << std::endl;
-
- sstream2 << "Using C++ array..." << std::endl;
- sstream2 << std::endl;
- sstream2 << "data1 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m 1 m 2 m" << std::endl;
- sstream2 << " 10 m 11 m 12 m" << std::endl;
- sstream2 << " 20 m 21 m 22 m" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data2 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m 0.1 m 0.2 m" << std::endl;
- sstream2 << " 1 m 1.1 m 1.2 m" << std::endl;
- sstream2 << " 2 m 2.1 m 2.2 m" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data3 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m 1.1 m 2.2 m" << std::endl;
- sstream2 << " 11 m 12.1 m 13.2 m" << std::endl;
- sstream2 << " 22 m 23.1 m 24.2 m" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data4 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m 0.9 m 1.8 m" << std::endl;
- sstream2 << " 9 m 9.9 m 10.8 m" << std::endl;
- sstream2 << " 18 m 18.9 m 19.8 m" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data5 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << " 0 m^2 0.1 m^2 0.4 m^2" << std::endl;
- sstream2 << " 10 m^2 12.1 m^2 14.4 m^2" << std::endl;
- sstream2 << " 40 m^2 44.1 m^2 48.4 m^2" << std::endl;
- sstream2 << std::endl;
- sstream2 << "data6 : " << std::endl;
- sstream2 << std::endl;
- sstream2 << std::setw(5) << nan << " dimensionless";
- sstream2 << " 10 dimensionless 10 dimensionless" << std::endl;
- sstream2 << " 10 dimensionless 10 dimensionless 10 dimensionless" << std::endl;
- sstream2 << " 10 dimensionless 10 dimensionless 10 dimensionless" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}
-
-#endif // MCS_HAS_ARRAY
-

Deleted: sandbox/units/libs/units/example/unit_example_8.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_8.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,247 +0,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)
-
-/**
-\file
-
-\brief unit_example_8.cpp
-
-\detailed
-Demonstrate interoperability with Boost.Quaternion.
-
-Output:
-_at_verbatim
-
-//[unit_example_8_output_1
-+L = (4,3,2,1) m
--L = (-4,-3,-2,-1) m
-L+L = (8,6,4,2) m
-L-L = (0,0,0,0) m
-L*L = (2,24,16,8) m^2
-L/L = (1,0,0,0) dimensionless
-L^3 = (-104,102,68,34) m^3
-//]
-
-//[unit_example_8_output_2
-+L = (4 m,3 m,2 m,1 m)
--L = (-4 m,-3 m,-2 m,-1 m)
-L+L = (8 m,6 m,4 m,2 m)
-L-L = (0 m,0 m,0 m,0 m)
-L^3 = (-104 m^3,102 m^3,68 m^3,34 m^3)
-//]
-
-_at_endverbatim
-**/
-
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/math/quaternion.hpp>
-#include <boost/mpl/list.hpp>
-
-#include <boost/units/quantity.hpp>
-#include <boost/units/io.hpp>
-
-#include "test_system.hpp"
-
-
-#if BOOST_UNITS_HAS_BOOST_TYPEOF
-
-#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::math::quaternion, 1)
-
-#endif
-
-namespace boost {
-
-namespace units {
-
-//[unit_example_8_class_snippet_1
-/// specialize power typeof helper
-template<class Y,long N,long 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_dimof_helper<Y,static_rational<N,D> >::type> type;
-
- static type value(const boost::math::quaternion<Y>& x)
- {
- return boost::math::pow(x,static_cast<int>(N));
- }
-};
-
-/// specialize root typeof helper
-template<class Y,long N,long D>
-struct root_typeof_helper<boost::math::quaternion<Y>,static_rational<N,D> >
-{
- // boost::math::quaternion only supports integer powers
- BOOST_STATIC_ASSERT(N==1);
-
- typedef boost::math::quaternion<typename root_typeof_helper<Y,static_rational<N,D> >::type> type;
-
- static type value(const boost::math::quaternion<Y>& x)
- {
- return boost::math::pow(x,static_cast<int>(D));
- }
-};
-//]
-
-//[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_dimof_helper<boost::math::quaternion<quantity<Unit,Y> >,static_rational<N,D> >
-{
- 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;
-
- static type value(const boost::math::quaternion<quantity<Unit,Y> >& x)
- {
- const boost::math::quaternion<value_type> tmp =
- pow<static_rational<N,D> >(boost::math::quaternion<Y>(x.R_component_1().value(),
- x.R_component_2().value(),
- x.R_component_3().value(),
- x.R_component_4().value()));
-
- return type(quantity_type::from_value(tmp.R_component_1()),
- quantity_type::from_value(tmp.R_component_2()),
- quantity_type::from_value(tmp.R_component_3()),
- quantity_type::from_value(tmp.R_component_4()));
- }
-};
-
-/// specialize root typeof helper for quaternion<quantity<Unit,Y> >
-template<class Unit,long N,long D,class Y>
-struct root_typeof_helper<boost::math::quaternion<quantity<Unit,Y> >,static_rational<N,D> >
-{
- typedef typename root_typeof_helper<Y,static_rational<N,D> >::type value_type;
- typedef typename root_typeof_helper<Unit,static_rational<N,D> >::type unit_type;
- typedef quantity<unit_type,value_type> quantity_type;
- typedef boost::math::quaternion<quantity_type> type;
-
- static type value(const boost::math::quaternion<quantity<Unit,Y> >& x)
- {
- const boost::math::quaternion<value_type> tmp =
- root<static_rational<N,D> >(boost::math::quaternion<Y>(x.R_component_1().value(),
- x.R_component_2().value(),
- x.R_component_3().value(),
- x.R_component_4().value()));
-
- return type(quantity_type::from_value(tmp.R_component_1()),
- quantity_type::from_value(tmp.R_component_2()),
- quantity_type::from_value(tmp.R_component_3()),
- quantity_type::from_value(tmp.R_component_4()));
- }
-};
-//]
-
-} // namespace units
-
-} // namespace boost
-
-int main(void)
-{
- using namespace boost::math;
- using namespace boost::units;
- using namespace boost::units::test;
-
- std::stringstream sstream1, sstream2;
-
- {
- //[unit_example_8_snippet_1
- typedef quantity<length,quaternion<double> > length_dimension;
-
- length_dimension L(quaternion<double>(4.0,3.0,2.0,1.0)*meters);
- //]
-
- sstream1 << "+L = " << +L << std::endl
- << "-L = " << -L << std::endl
- << "L+L = " << L+L << std::endl
- << "L-L = " << L-L << std::endl
- << "L*L = " << L*L << std::endl
- << "L/L = " << L/L << std::endl
- << "L^3 = " << pow<3>(L) << std::endl
-// << "L^(3/2) = " << pow< static_rational<3,2> >(L) << std::endl
-// << "3vL = " << root<3>(L) << std::endl
-// << "(3/2)vL = " << root< static_rational<3,2> >(L) << std::endl
- << std::endl;
- }
-
- {
- //[unit_example_8_snippet_2
- typedef quaternion<quantity<length> > length_dimension;
-
- length_dimension L(4.0*meters,3.0*meters,2.0*meters,1.0*meters);
- //]
-
- sstream1 << "+L = " << +L << std::endl
- << "-L = " << -L << std::endl
- << "L+L = " << L+L << std::endl
- << "L-L = " << L-L << std::endl
-// << "L*L = " << L*L << std::endl
-// << "L/L = " << L/L << std::endl
- << "L^3 = " << pow<3>(L) << std::endl
-// << "L^(3/2) = " << pow< static_rational<3,2> >(L) << std::endl
-// << "3vL = " << root<3>(L) << std::endl
-// << "(3/2)vL = " << root< static_rational<3,2> >(L) << std::endl
- << std::endl;
- }
-
- sstream2 << "+L = (4,3,2,1) m" << std::endl;
- sstream2 << "-L = (-4,-3,-2,-1) m" << std::endl;
- sstream2 << "L+L = (8,6,4,2) m" << std::endl;
- sstream2 << "L-L = (0,0,0,0) m" << std::endl;
- sstream2 << "L*L = (2,24,16,8) m^2" << std::endl;
- sstream2 << "L/L = (1,0,0,0) dimensionless" << std::endl;
- sstream2 << "L^3 = (-104,102,68,34) m^3" << std::endl;
- sstream2 << std::endl;
- sstream2 << "+L = (4 m,3 m,2 m,1 m)" << std::endl;
- sstream2 << "-L = (-4 m,-3 m,-2 m,-1 m)" << std::endl;
- sstream2 << "L+L = (8 m,6 m,4 m,2 m)" << std::endl;
- sstream2 << "L-L = (0 m,0 m,0 m,0 m)" << std::endl;
- sstream2 << "L^3 = (-104 m^3,102 m^3,68 m^3,34 m^3)" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}

Deleted: sandbox/units/libs/units/example/unit_example_9.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_9.cpp 2007-08-15 20:54:21 EDT (Wed, 15 Aug 2007)
+++ (empty file)
@@ -1,371 +0,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)
-
-/**
-\file
-
-\brief unit_example_9.cpp
-
-\detailed
-Demonstrate a complex number class that functions correctly with quantities.
-
-Output:
-_at_verbatim
-
-//[unit_example_9_output_1
-+L = 2 + 1 i m
--L = -2 + -1 i m
-L+L = 4 + 2 i m
-L-L = 0 + 0 i m
-L*L = 3 + 4 i m^2
-L/L = 1 + 0 i dimensionless
-L^3 = 2 + 11 i m^3
-L^(3/2) = 2.56713 + 2.14247 i m^(3/2)
-3vL = 1.29207 + 0.201294 i m^(1/3)
-(3/2)vL = 1.62894 + 0.520175 i m^(2/3)
-//]
-
-//[unit_example_9_output_2
-+L = 2 m + 1 m i
--L = -2 m + -1 m i
-L+L = 4 m + 2 m i
-L-L = 0 m + 0 m i
-L*L = 3 m^2 + 4 m^2 i
-L/L = 1 dimensionless + 0 dimensionless i
-L^3 = 2 m^3 + 11 m^3 i
-L^(3/2) = 2.56713 m^(3/2) + 2.14247 m^(3/2) i
-3vL = 1.29207 m^(1/3) + 0.201294 m^(1/3) i
-(3/2)vL = 1.62894 m^(2/3) + 0.520175 m^(2/3) i
-//]
-
-_at_endverbatim
-**/
-
-#include <cmath>
-#include <complex>
-#include <iostream>
-#include <sstream>
-#include <algorithm>
-
-#include <boost/mpl/list.hpp>
-
-#include <boost/units/io.hpp>
-#include <boost/units/quantity.hpp>
-
-#include "test_system.hpp"
-
-//[unit_example_9_class_snippet_1
-namespace boost {
-
-namespace units {
-
-/// replacement complex class
-template<class T>
-class complex
-{
- public:
- typedef complex<T> this_type;
-
- complex(const T& r = 0,const T& i = 0) : r_(r),i_(i) { }
- complex(const this_type& source) : r_(source.r_),i_(source.i_) { }
-
- this_type& operator=(const this_type& source)
- {
- if (this == &source) return *this;
-
- r_ = source.r_;
- i_ = source.i_;
-
- return *this;
- }
-
- T& real() { return r_; }
- T& imag() { return i_; }
-
- const T& real() const { return r_; }
- const T& imag() const { return i_; }
-
- this_type& operator+=(const T& val) { r_ += val; return *this; }
- this_type& operator-=(const T& val) { r_ -= val; return *this; }
- this_type& operator*=(const T& val) { r_ *= val; i_ *= val; return *this; }
- this_type& operator/=(const T& val) { r_ /= val; i_ /= val; return *this; }
-
- this_type& operator+=(const this_type& source) { r_ += source.r_; i_ += source.i_; return *this; }
- this_type& operator-=(const this_type& source) { r_ -= source.r_; i_ -= source.i_; return *this; }
- this_type& operator*=(const this_type& source) { *this = *this*source; return *this; }
- this_type& operator/=(const this_type& source) { *this = *this/source; return *this; }
-
- private:
- T r_,i_;
-};
-
-}
-
-}
-
-#if BOOST_UNITS_HAS_BOOST_TYPEOF
-
-#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-
-BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::complex, 1)
-
-#endif
-
-namespace boost {
-
-namespace units {
-
-template<class X>
-complex<typename unary_plus_typeof_helper<X>::type>
-operator+(const complex<X>& x)
-{
- typedef typename unary_plus_typeof_helper<X>::type type;
-
- return complex<type>(x.real(),x.imag());
-}
-
-template<class X>
-complex<typename unary_minus_typeof_helper<X>::type>
-operator-(const complex<X>& x)
-{
- typedef typename unary_minus_typeof_helper<X>::type type;
-
- return complex<type>(-x.real(),-x.imag());
-}
-
-template<class X,class Y>
-complex<typename add_typeof_helper<X,Y>::type>
-operator+(const complex<X>& x,const complex<Y>& y)
-{
- typedef typename boost::units::add_typeof_helper<X,Y>::type type;
-
- return complex<type>(x.real()+y.real(),x.imag()+y.imag());
-}
-
-template<class X,class Y>
-complex<typename boost::units::subtract_typeof_helper<X,Y>::type>
-operator-(const complex<X>& x,const complex<Y>& y)
-{
- typedef typename boost::units::subtract_typeof_helper<X,Y>::type type;
-
- return complex<type>(x.real()-y.real(),x.imag()-y.imag());
-}
-
-template<class X,class Y>
-complex<typename boost::units::multiply_typeof_helper<X,Y>::type>
-operator*(const complex<X>& x,const complex<Y>& y)
-{
- typedef typename boost::units::multiply_typeof_helper<X,Y>::type type;
-
- return complex<type>(x.real()*y.real()-x.imag()*y.imag(),x.real()*y.imag()+x.imag()*y.real());
-}
-
-template<class X,class Y>
-complex<typename boost::units::divide_typeof_helper<X,Y>::type>
-operator/(const complex<X>& x,const complex<Y>& y)
-{
- typedef typename boost::units::divide_typeof_helper<X,Y>::type type;
-
- return complex<type>((x.real()*y.real()+x.imag()*y.imag())/(y.real()*y.real()+y.imag()*y.imag()),
- (x.imag()*y.real()-x.real()*y.imag())/(y.real()*y.real()+y.imag()*y.imag()));
-}
-
-template<class Y>
-complex<Y>
-pow(const complex<Y>& x,const Y& y)
-{
- std::complex<Y> tmp(x.real(),x.imag());
-
- tmp = std::pow(tmp,y);
-
- return complex<Y>(tmp.real(),tmp.imag());
-}
-
-template<class Y>
-std::ostream& operator<<(std::ostream& os,const complex<Y>& val)
-{
- os << val.real() << " + " << val.imag() << " i";
-
- return os;
-}
-
-/// specialize power typeof helper
-template<class Y,long N,long D>
-struct power_dimof_helper<complex<Y>,static_rational<N,D> >
-{
- typedef complex<typename power_dimof_helper<Y,static_rational<N,D> >::type> type;
-
- static type value(const complex<Y>& x)
- {
- const static_rational<N,D> rat;
-
- const Y m = Y(rat.numerator())/Y(rat.denominator());
-
- return boost::units::pow(x,m);
- }
-};
-
-/// specialize root typeof helper
-template<class Y,long N,long D>
-struct root_typeof_helper<complex<Y>,static_rational<N,D> >
-{
- typedef complex<typename root_typeof_helper<Y,static_rational<N,D> >::type> type;
-
- static type value(const complex<Y>& x)
- {
- const static_rational<N,D> rat;
-
- const Y m = Y(rat.denominator())/Y(rat.numerator());
-
- return boost::units::pow(x,m);
- }
-};
-
-/// specialize power typeof helper for complex<quantity<Unit,Y> >
-template<class Y,class Unit,long N,long D>
-struct power_dimof_helper<complex<quantity<Unit,Y> >,static_rational<N,D> >
-{
- 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;
-
- static type value(const complex<quantity<Unit,Y> >& x)
- {
- const complex<value_type> tmp = pow<static_rational<N,D> >(complex<Y>(x.real().value(),x.imag().value()));
-
- return type(quantity_type::from_value(tmp.real()),quantity_type::from_value(tmp.imag()));
- }
-};
-
-/// specialize root typeof helper for complex<quantity<Unit,Y> >
-template<class Y,class Unit,long N,long D>
-struct root_typeof_helper<complex<quantity<Unit,Y> >,static_rational<N,D> >
-{
- typedef typename root_typeof_helper<Y,static_rational<N,D> >::type value_type;
- typedef typename root_typeof_helper<Unit,static_rational<N,D> >::type unit_type;
- typedef quantity<unit_type,value_type> quantity_type;
- typedef complex<quantity_type> type;
-
- static type value(const complex<quantity<Unit,Y> >& x)
- {
- const complex<value_type> tmp = root<static_rational<N,D> >(complex<Y>(x.real().value(),x.imag().value()));
-
- return type(quantity_type::from_value(tmp.real()),quantity_type::from_value(tmp.imag()));
- }
-};
-
-} // namespace units
-
-} // namespace boost
-//]
-
-int main(void)
-{
- using namespace boost::math;
- using namespace boost::units;
- using namespace boost::units::test;
-
- std::stringstream sstream1, sstream2;
-
- {
- //[unit_example_9_snippet_1
- typedef quantity<length,complex<double> > length_dimension;
-
- length_dimension L(complex<double>(2.0,1.0)*meters);
- //]
-
- sstream1 << "+L = " << +L << std::endl
- << "-L = " << -L << std::endl
- << "L+L = " << L+L << std::endl
- << "L-L = " << L-L << std::endl
- << "L*L = " << L*L << std::endl
- << "L/L = " << L/L << std::endl
- << "L^3 = " << pow<3>(L) << std::endl
- << "L^(3/2) = " << pow< static_rational<3,2> >(L) << std::endl
- << "3vL = " << root<3>(L) << std::endl
- << "(3/2)vL = " << root< static_rational<3,2> >(L) << std::endl
- << std::endl;
- }
-
- {
- //[unit_example_9_snippet_2
- typedef complex<quantity<length> > length_dimension;
-
- length_dimension L(2.0*meters,1.0*meters);
- //]
-
- sstream1 << "+L = " << +L << std::endl
- << "-L = " << -L << std::endl
- << "L+L = " << L+L << std::endl
- << "L-L = " << L-L << std::endl
- << "L*L = " << L*L << std::endl
- << "L/L = " << L/L << std::endl
- << "L^3 = " << pow<3>(L) << std::endl
- << "L^(3/2) = " << pow< static_rational<3,2> >(L) << std::endl
- << "3vL = " << root<3>(L) << std::endl
- << "(3/2)vL = " << root< static_rational<3,2> >(L) << std::endl
- << std::endl;
- }
-
- sstream2 << "+L = 2 + 1 i m" << std::endl;
- sstream2 << "-L = -2 + -1 i m" << std::endl;
- sstream2 << "L+L = 4 + 2 i m" << std::endl;
- sstream2 << "L-L = 0 + 0 i m" << std::endl;
- sstream2 << "L*L = 3 + 4 i m^2" << std::endl;
- sstream2 << "L/L = 1 + 0 i dimensionless" << std::endl;
- sstream2 << "L^3 = 2 + 11 i m^3" << std::endl;
- sstream2 << "L^(3/2) = 2.56713 + 2.14247 i m^(3/2)" << std::endl;
- sstream2 << "3vL = 1.29207 + 0.201294 i m^(1/3)" << std::endl;
- sstream2 << "(3/2)vL = 1.62894 + 0.520175 i m^(2/3)" << std::endl;
- sstream2 << std::endl;
- sstream2 << "+L = 2 m + 1 m i" << std::endl;
- sstream2 << "-L = -2 m + -1 m i" << std::endl;
- sstream2 << "L+L = 4 m + 2 m i" << std::endl;
- sstream2 << "L-L = 0 m + 0 m i" << std::endl;
- sstream2 << "L*L = 3 m^2 + 4 m^2 i" << std::endl;
- sstream2 << "L/L = 1 dimensionless + 0 dimensionless i" << std::endl;
- sstream2 << "L^3 = 2 m^3 + 11 m^3 i" << std::endl;
- sstream2 << "L^(3/2) = 2.56713 m^(3/2) + 2.14247 m^(3/2) i" << std::endl;
- sstream2 << "3vL = 1.29207 m^(1/3) + 0.201294 m^(1/3) i" << std::endl;
- sstream2 << "(3/2)vL = 1.62894 m^(2/3) + 0.520175 m^(2/3) i" << std::endl;
- sstream2 << std::endl;
-
- std::string str1(sstream1.str());
- std::string str2(sstream2.str());
-
- std::cout << str1;
-
- if(str1 == str2)
- {
- return(0);
- }
- else
- {
- std::cout << std::endl << str2 << std::endl;
-
- if(str1.size() < str2.size())
- {
- std::string::iterator iter = std::mismatch(str1.begin(), str1.end(), str2.begin()).first;
-
- std::cout << iter - str1.begin() << std::endl;
- std::cout << std::count(str1.begin(), iter, '\n') << std::endl;
- }
- else
- {
- std::string::iterator iter = std::mismatch(str2.begin(), str2.end(), str1.begin()).first;
-
- std::cout << iter - str2.begin() << std::endl;
- std::cout << std::count(str2.begin(), iter, '\n') << std::endl;
- }
-
- return(-1);
- }
-}


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