You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(89) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(208) |
Feb
(76) |
Mar
(55) |
Apr
(74) |
May
(43) |
Jun
(116) |
Jul
(109) |
Aug
(46) |
Sep
(36) |
Oct
(106) |
Nov
(159) |
Dec
(128) |
2007 |
Jan
(54) |
Feb
(225) |
Mar
(200) |
Apr
(229) |
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Douglas G. <dg...@us...> - 2007-05-03 13:34:00
|
Update of /cvsroot/boost-sandbox/CVSROOT In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20668 Modified Files: commitinfo Log Message: Enable CVS ACLs Index: commitinfo =================================================================== RCS file: /cvsroot/boost-sandbox/CVSROOT/commitinfo,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- commitinfo 14 May 2002 16:11:31 -0000 1.1 +++ commitinfo 3 May 2007 13:33:55 -0000 1.2 @@ -13,3 +13,5 @@ # # If the name "ALL" appears as a regular expression it is always used # in addition to the first matching regex or "DEFAULT". + +ALL /cvsroot/sitedocs/CVSROOT/cvstools/cvs_acls |
From: Douglas G. <dg...@us...> - 2007-05-03 13:33:30
|
Update of /cvsroot/boost-sandbox/CVSROOT In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20624 Modified Files: checkoutlist Added Files: avail Log Message: Restrict CVS write access for the Subversion switch Index: checkoutlist =================================================================== RCS file: /cvsroot/boost-sandbox/CVSROOT/checkoutlist,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- checkoutlist 14 May 2002 16:11:31 -0000 1.1 +++ checkoutlist 3 May 2007 13:33:26 -0000 1.2 @@ -11,3 +11,4 @@ # [<whitespace>]<filename><whitespace><error message><end-of-line> # # comment lines begin with '#' +avail --- NEW FILE: avail --- unavail avail|dgregor |
From: John M. <joh...@us...> - 2007-05-03 11:12:08
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/math/special_functions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29426/boost/math/special_functions Modified Files: Tag: math_toolkit log1p.hpp Log Message: Fix for VC7.1 Index: log1p.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/math/special_functions/Attic/log1p.hpp,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -u -d -r1.1.2.11 -r1.1.2.12 --- log1p.hpp 6 Feb 2007 13:32:59 -0000 1.1.2.11 +++ log1p.hpp 3 May 2007 11:12:03 -0000 1.1.2.12 @@ -172,7 +172,7 @@ BOOST_CURRENT_FUNCTION); return ::log1p(x); } -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && (BOOST_MSVC >= 1400) // // You should only enable this branch if you are absolutely sure // that your compilers optimizer won't mess this code up!! |
From: Daniel J. <dan...@us...> - 2007-05-02 23:59:17
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22727/doc Modified Files: comparison.qbk hash_equality.qbk Log Message: Remove use of quickbook 1.4 features from unordered container documentation, so it'll build with quickbook 1.3 (will put them back soon-ish). Index: hash_equality.qbk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/doc/hash_equality.qbk,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- hash_equality.qbk 18 Mar 2007 20:00:57 -0000 1.4 +++ hash_equality.qbk 2 May 2007 23:59:14 -0000 1.5 @@ -34,9 +34,37 @@ sure you use a hash function that matches it. For example, a case-insensitive dictionary: -[import src_code/insensitive.cpp] -[case_insensitive_functions] -[case_insensitive_dictionary] + struct iequal_to + : std::binary_function<std::string, std::string, bool> + { + bool operator()(std::string const& x, + std::string const& y) const + { + return boost::algorithm::iequals(x, y); + } + }; + + struct ihash + : std::unary_function<std::string, bool> + { + bool operator()(std::string const& x) const + { + std::size_t seed = 0; + + for(std::string::const_iterator it = x.begin(); + it != x.end(); ++it) + { + boost::hash_combine(seed, std::toupper(*it)); + } + + return seed; + } + }; + + struct word_info; + + boost::unordered_map<std::string, word_info, ihash, iequal_to> + idictionary; A more generic version of this example is available at: [@../../libs/unordered/examples/case_insensitive.hpp /libs/unordered/examples/case_insensitive.hpp] Index: comparison.qbk =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/doc/comparison.qbk,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- comparison.qbk 18 Mar 2007 20:00:57 -0000 1.7 +++ comparison.qbk 2 May 2007 23:59:14 -0000 1.8 @@ -14,10 +14,7 @@ ] [ [`Compare` exposed by member typedef `key_compare`, accessed by member function `key_comp()`] - [ - `Hash` exposed by member typedef `hasher`, accessed by member function `hash_function()`. - - `Pred` by member typedef `key_equal` and member function `key_eq()`.] + [`Hash` exposed by member typedef `hasher`, accessed by member function `hash_function()`.\n`Pred` by member typedef `key_equal` and member function `key_eq()`.] ] [ [Member typedef `value_compare` supplies an ordering comparison for member elements, accessed by member function `value_comp()`.] |
From: Daniel J. <dan...@us...> - 2007-05-02 23:57:12
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22330/doc Modified Files: ref.xml Log Message: Fix an odd encoding error in the unordered containers reference. Index: ref.xml =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/doc/ref.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ref.xml 18 Mar 2007 20:00:57 -0000 1.6 +++ ref.xml 2 May 2007 23:57:09 -0000 1.7 @@ -701,7 +701,7 @@ </para> </description> <throws> - <para>The function has no effect if an exception is thrown, unless it is thrown by the containerâs hash function or comparison function. + <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function. </para> </throws> </method> @@ -1418,7 +1418,7 @@ </para> </description> <throws> - <para>The function has no effect if an exception is thrown, unless it is thrown by the containerâs hash function or comparison function. + <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function. </para> </throws> </method> @@ -2183,7 +2183,7 @@ </para> </description> <throws> - <para>The function has no effect if an exception is thrown, unless it is thrown by the containerâs hash function or comparison function. + <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function. </para> </throws> </method> @@ -2914,7 +2914,7 @@ </para> </description> <throws> - <para>The function has no effect if an exception is thrown, unless it is thrown by the containerâs hash function or comparison function. + <para>The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function. </para> </throws> </method> |
From: Daniel J. <dan...@us...> - 2007-05-01 21:24:50
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/test/helpers In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7204/test/helpers Modified Files: generators.hpp Log Message: Stop using Boost.Random as it doesn't support all the platforms I do. The new code (using std::rand) needs work, but I want to get this in before the sandbox is converted to subversion. Index: generators.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/test/helpers/generators.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- generators.hpp 18 Mar 2007 20:00:58 -0000 1.8 +++ generators.hpp 1 May 2007 21:24:48 -0000 1.9 @@ -3,7 +3,12 @@ // 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) -// A crude wrapper round Boost.Random to make life easier. +// This uses std::rand to generate random values for tests. +// Which is not good as different platforms will be running different tests. +// It would be much better to use Boost.Random, but it doesn't +// support all the compilers that I want to test on. +// TODO: seed the random generator. +// TODO: check that this is actually working... #if !defined(BOOST_UNORDERED_TEST_HELPERS_GENERATORS_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_GENERATORS_HEADER @@ -11,19 +16,12 @@ #include <string> #include <utility> #include <stdexcept> -#include <boost/random/inversive_congruential.hpp> -#include <boost/random/uniform_int.hpp> -#include <boost/random/lagged_fibonacci.hpp> -#include <boost/random/uniform_real.hpp> -#include <boost/random/variate_generator.hpp> +#include <cstdlib> #include "./fwd.hpp" namespace test { - typedef boost::hellekalek1995 integer_generator_type; - typedef boost::lagged_fibonacci607 real_generator_type; - template <class T> struct generator; @@ -48,20 +46,14 @@ inline int generate(int const*) { - static integer_generator_type gen; - static boost::uniform_int<> dist(0, 1000); - static boost::variate_generator<integer_generator_type, boost::uniform_int<> > - vg(gen, dist); - return vg(); + using namespace std; + return rand(); } inline char generate(char const*) { - static integer_generator_type gen; - static boost::uniform_int<char> dist(32, 127); - static boost::variate_generator<integer_generator_type, boost::uniform_int<char> > - vg(gen, dist); - return vg(); + using namespace std; + return (rand() >> 1) % (128-32) + 32; } inline std::string generate(std::string const*) @@ -81,11 +73,7 @@ float generate(float const*) { - static real_generator_type gen; - static boost::uniform_real<float> dist; - static boost::variate_generator<real_generator_type, boost::uniform_real<float> > - vg(gen, dist); - return vg(); + return (float) rand() / (float) RAND_MAX; } } |
From: Daniel J. <dan...@us...> - 2007-05-01 21:22:02
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/test/objects In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6048/test/objects Modified Files: minimal.hpp Log Message: Rename some pointer classes to avoid shadowing them in the test allocator. Index: minimal.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/unordered/test/objects/minimal.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- minimal.hpp 18 Mar 2007 20:00:59 -0000 1.6 +++ minimal.hpp 1 May 2007 21:22:01 -0000 1.7 @@ -16,8 +16,8 @@ class assignable; template <class T> class hash; template <class T> class equal_to; - template <class T> class pointer; - template <class T> class const_pointer; + template <class T> class ptr; + template <class T> class const_ptr; template <class T> class allocator; class copy_constructible @@ -68,95 +68,95 @@ bool operator()(T const&, T const&) const { return true; } }; - template <class T> class pointer; - template <class T> class const_pointer; + template <class T> class ptr; + template <class T> class const_ptr; template <class T> - class pointer + class ptr { friend class allocator<T>; - friend class const_pointer<T>; + friend class const_ptr<T>; T* ptr_; - pointer(T* ptr) : ptr_(ptr) {} + ptr(T* ptr) : ptr_(ptr) {} public: - pointer() : ptr_(0) {} + ptr() : ptr_(0) {} - typedef void (pointer::*bool_type)() const; + typedef void (ptr::*bool_type)() const; void this_type_does_not_support_comparisons() const {} T& operator*() const { return *ptr_; } T* operator->() const { return ptr_; } - pointer& operator++() { ++ptr_; return *this; } - pointer operator++(int) { pointer tmp(*this); ++ptr_; return tmp; } - pointer operator+(int s) const { return pointer<T>(ptr_ + s); } + ptr& operator++() { ++ptr_; return *this; } + ptr operator++(int) { ptr tmp(*this); ++ptr_; return tmp; } + ptr operator+(int s) const { return ptr<T>(ptr_ + s); } T& operator[](int s) const { return ptr_[s]; } bool operator!() const { return !ptr_; } operator bool_type() const { return ptr_ ? - &pointer::this_type_does_not_support_comparisons + &ptr::this_type_does_not_support_comparisons : 0; } - bool operator==(pointer const& x) const { return ptr_ == x.ptr_; } - bool operator!=(pointer const& x) const { return ptr_ != x.ptr_; } - bool operator<(pointer const& x) const { return ptr_ < x.ptr_; } - bool operator>(pointer const& x) const { return ptr_ > x.ptr_; } - bool operator<=(pointer const& x) const { return ptr_ <= x.ptr_; } - bool operator>=(pointer const& x) const { return ptr_ >= x.ptr_; } + bool operator==(ptr const& x) const { return ptr_ == x.ptr_; } + bool operator!=(ptr const& x) const { return ptr_ != x.ptr_; } + bool operator<(ptr const& x) const { return ptr_ < x.ptr_; } + bool operator>(ptr const& x) const { return ptr_ > x.ptr_; } + bool operator<=(ptr const& x) const { return ptr_ <= x.ptr_; } + bool operator>=(ptr const& x) const { return ptr_ >= x.ptr_; } - bool operator==(const_pointer<T> const& x) const { return ptr_ == x.ptr_; } - bool operator!=(const_pointer<T> const& x) const { return ptr_ != x.ptr_; } - bool operator<(const_pointer<T> const& x) const { return ptr_ < x.ptr_; } - bool operator>(const_pointer<T> const& x) const { return ptr_ > x.ptr_; } - bool operator<=(const_pointer<T> const& x) const { return ptr_ <= x.ptr_; } - bool operator>=(const_pointer<T> const& x) const { return ptr_ >= x.ptr_; } + bool operator==(const_ptr<T> const& x) const { return ptr_ == x.ptr_; } + bool operator!=(const_ptr<T> const& x) const { return ptr_ != x.ptr_; } + bool operator<(const_ptr<T> const& x) const { return ptr_ < x.ptr_; } + bool operator>(const_ptr<T> const& x) const { return ptr_ > x.ptr_; } + bool operator<=(const_ptr<T> const& x) const { return ptr_ <= x.ptr_; } + bool operator>=(const_ptr<T> const& x) const { return ptr_ >= x.ptr_; } }; template <class T> - class const_pointer + class const_ptr { friend class allocator<T>; T* ptr_; - const_pointer(T* ptr) : ptr_(ptr) {} + const_ptr(T* ptr) : ptr_(ptr) {} public: - const_pointer() : ptr_(0) {} - const_pointer(pointer<T> const& x) : ptr_(x.ptr_) {} + const_ptr() : ptr_(0) {} + const_ptr(ptr<T> const& x) : ptr_(x.ptr_) {} - typedef void (const_pointer::*bool_type)() const; + typedef void (const_ptr::*bool_type)() const; void this_type_does_not_support_comparisons() const {} T& operator*() const { return *ptr_; } T* operator->() const { return ptr_; } - const_pointer& operator++() { ++ptr_; return *this; } - const_pointer operator++(int) { const_pointer tmp(*this); ++ptr_; return tmp; } - const_pointer operator+(int s) const { return const_pointer(ptr_ + s); } + const_ptr& operator++() { ++ptr_; return *this; } + const_ptr operator++(int) { const_ptr tmp(*this); ++ptr_; return tmp; } + const_ptr operator+(int s) const { return const_ptr(ptr_ + s); } T& operator[](int s) const { return ptr_[s]; } bool operator!() const { return !ptr_; } operator bool_type() const { return ptr_ ? - &const_pointer::this_type_does_not_support_comparisons + &const_ptr::this_type_does_not_support_comparisons : 0; } - bool operator==(pointer<T> const& x) const { return ptr_ == x.ptr_; } - bool operator!=(pointer<T> const& x) const { return ptr_ != x.ptr_; } - bool operator<(pointer<T> const& x) const { return ptr_ < x.ptr_; } - bool operator>(pointer<T> const& x) const { return ptr_ > x.ptr_; } - bool operator<=(pointer<T> const& x) const { return ptr_ <= x.ptr_; } - bool operator>=(pointer<T> const& x) const { return ptr_ >= x.ptr_; } + bool operator==(ptr<T> const& x) const { return ptr_ == x.ptr_; } + bool operator!=(ptr<T> const& x) const { return ptr_ != x.ptr_; } + bool operator<(ptr<T> const& x) const { return ptr_ < x.ptr_; } + bool operator>(ptr<T> const& x) const { return ptr_ > x.ptr_; } + bool operator<=(ptr<T> const& x) const { return ptr_ <= x.ptr_; } + bool operator>=(ptr<T> const& x) const { return ptr_ >= x.ptr_; } - bool operator==(const_pointer const& x) const { return ptr_ == x.ptr_; } - bool operator!=(const_pointer const& x) const { return ptr_ != x.ptr_; } - bool operator<(const_pointer const& x) const { return ptr_ < x.ptr_; } - bool operator>(const_pointer const& x) const { return ptr_ > x.ptr_; } - bool operator<=(const_pointer const& x) const { return ptr_ <= x.ptr_; } - bool operator>=(const_pointer const& x) const { return ptr_ >= x.ptr_; } + bool operator==(const_ptr const& x) const { return ptr_ == x.ptr_; } + bool operator!=(const_ptr const& x) const { return ptr_ != x.ptr_; } + bool operator<(const_ptr const& x) const { return ptr_ < x.ptr_; } + bool operator>(const_ptr const& x) const { return ptr_ > x.ptr_; } + bool operator<=(const_ptr const& x) const { return ptr_ <= x.ptr_; } + bool operator>=(const_ptr const& x) const { return ptr_ >= x.ptr_; } }; template <class T> @@ -165,8 +165,8 @@ public: typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; - typedef pointer<T> pointer; - typedef const_pointer<T> const_pointer; + typedef ptr<T> pointer; + typedef const_ptr<T> const_pointer; typedef T& reference; typedef T const& const_reference; typedef T value_type; |
From: Steven W. <ste...@us...> - 2007-04-30 23:19:26
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31739/boost-sandbox/boost/units/experimental Modified Files: linear_algebra.hpp Log Message: Use bubble sort instead of mpl::sort Index: linear_algebra.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental/linear_algebra.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- linear_algebra.hpp 29 Apr 2007 01:58:24 -0000 1.3 +++ linear_algebra.hpp 30 Apr 2007 23:19:19 -0000 1.4 @@ -446,14 +446,83 @@ }; }; +template<bool second_is_less> +struct bubble_sort_conditional_swap; + +template<> +struct bubble_sort_conditional_swap<true> { + template<class T0, class T1> + struct apply { + typedef T1 first; + typedef T0 second; + }; +}; + +template<> +struct bubble_sort_conditional_swap<false> { + template<class T0, class T1> + struct apply { + typedef T0 first; + typedef T1 second; + }; +}; + +template<int N> +struct bubble_sort_pass_impl { + template<class Begin, class Current> + struct apply { + typedef typename mpl::deref<Begin>::type val; + typedef typename bubble_sort_conditional_swap<mpl::less<val, Current>::value>::template apply<Current, val> pair; + typedef typename bubble_sort_pass_impl<N-1>::template apply<typename mpl::next<Begin>::type, typename pair::second> next; + typedef typename mpl::push_front<typename next::type, typename pair::first>::type type; + enum { value = next::value || mpl::less<val, Current>::value }; + }; +}; + +template<> +struct bubble_sort_pass_impl<0> { + template<class Begin, class Current> + struct apply { + typedef typename mpl::push_front<mpl::list0<>, Current>::type type; + enum { value = false }; + }; +}; + +template<bool> +struct bubble_sort_impl; + +template<> +struct bubble_sort_impl<true> { + template<class T> + struct apply { + typedef typename mpl::begin<T>::type begin; + typedef typename bubble_sort_pass_impl<mpl::size<T>::value - 1>::template apply< + typename mpl::next<begin>::type, + typename mpl::deref<begin>::type + > single_pass; + typedef typename bubble_sort_impl<(single_pass::value)>::template apply<typename single_pass::type>::type type; + }; +}; + +template<> +struct bubble_sort_impl<false> { + template<class T> + struct apply { + typedef T type; + }; +}; + +template<class T> +struct bubble_sort { + typedef typename bubble_sort_impl<((mpl::size<T>::value) > 1)>::template apply<T>::type type; +}; + template<class T> struct find_base_dimensions { - typedef typename mpl::sort< + typedef typename bubble_sort< typename find_base_dimensions_impl< mpl::size<T>::value - >::template apply<typename mpl::begin<T>::type>::type, - mpl::greater<>, - mpl::front_inserter<mpl::list0<> > + >::template apply<typename mpl::begin<T>::type>::type >::type type; }; |
From: Jan G. <jan...@us...> - 2007-04-30 21:05:33
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3738/libs/circular_buffer/doc Modified Files: circular_buffer.html circular_buffer_space_optimized.html Log Message: circular_buffer: updated srcdoc Index: circular_buffer.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer.html,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- circular_buffer.html 16 Apr 2007 23:19:07 -0000 1.66 +++ circular_buffer.html 30 Apr 2007 21:05:26 -0000 1.67 @@ -4488,7 +4488,8 @@ <b>Effect:</b> </dt> <dd> - <code>this</code> contains elements of <code>cb</code> and vice versa. + <code>this</code> contains elements of <code>cb</code> and vice versa; capacity of <code>this</code> + equals to capacity of <code>cb</code> and vice versa. </dd> </dl> <dl> Index: circular_buffer_space_optimized.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- circular_buffer_space_optimized.html 16 Apr 2007 23:19:07 -0000 1.40 +++ circular_buffer_space_optimized.html 30 Apr 2007 21:05:26 -0000 1.41 @@ -2209,9 +2209,76 @@ "classboost_1_1circular__buffer__space__optimized_14fd3b613f754d529ca250f2563b2f863"></a><code><b>void swap(circular_buffer_space_optimized<T,Alloc>& cb);</b></code><br> <br> - See the <a href="circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a> source - documentation.<br> - <br> + Swap the contents of two space optimized circular buffers. + <dl> + <dt> + <b>Effect:</b> + </dt> + <dd> + <code>this</code> contains elements of <code>cb</code> and vice versa; capacity of <code>this</code> + equals to capacity of <code>cb</code> and vice versa. + </dd> + </dl> + <dl> + <dt> + <b>Parameter(s):</b> + </dt> + <dd> + <dl compact> + <dt> + <code>cb</code> + </dt> + <dd> + The <code>circular_buffer_space_optimized</code> whose content will be swapped. + </dd> + </dl> + </dd> + </dl> + <dl> + <dt> + <b>Throws:</b> + </dt> + <dd> + Nothing. + </dd> + </dl> + <dl> + <dt> + <b>Exception Safety:</b> + </dt> + <dd> + No-throw. + </dd> + </dl> + <dl> + <dt> + <b>Iterator Invalidation:</b> + </dt> + <dd> + Invalidates all iterators of both <code>circular_buffer_space_optimized</code>s. (On the other hand the + iterators still point to the same elements but within another container. If you want to rely on this + feature you have to turn the <a href="circular_buffer.html#debug">Debug Support</a> off otherwise an + assertion will report an error if such invalidated iterator is used.) + </dd> + </dl> + <dl> + <dt> + <b>Complexity:</b> + </dt> + <dd> + Constant (in the size of the <code>circular_buffer_space_optimized</code>). + </dd> + </dl> + <dl> + <dt> + <b>See Also:</b> + </dt> + <dd> + <code><a href= + "circular_buffer.html#namespaceboost_14aa8f6a2c9640f3f22e266f0fca85777">swap(circular_buffer_space_optimized<T, + Alloc>&, circular_buffer_space_optimized<T, Alloc>&)</a></code> + </dd> + </dl> </td> </tr> <tr> |
From: Jan G. <jan...@us...> - 2007-04-30 21:05:33
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3738/boost/circular_buffer Modified Files: base.hpp space_optimized.hpp Log Message: circular_buffer: updated srcdoc Index: space_optimized.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/space_optimized.hpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- space_optimized.hpp 16 Apr 2007 23:19:06 -0000 1.28 +++ space_optimized.hpp 30 Apr 2007 21:05:25 -0000 1.29 @@ -685,7 +685,24 @@ check_high_capacity(); } - //! See the circular_buffer source documentation. + //! Swap the contents of two space optimized circular buffers. + /*! + \post <code>this</code> contains elements of <code>cb</code> and vice versa; capacity of <code>this</code> + equals to capacity of <code>cb</code> and vice versa. + \param cb The <code>circular_buffer_space_optimized</code> whose content will be swapped. + \throws Nothing. + \par Exception Safety + No-throw. + \par Iterator Invalidation + Invalidates all iterators of both <code>circular_buffer_space_optimized</code>s. (On the other hand the + iterators still point to the same elements but within another container. If you want to rely on this + feature you have to turn the <a href="circular_buffer.html#debug">Debug Support</a> off otherwise an + assertion will report an error if such invalidated iterator is used.) + \par Complexity + Constant (in the size of the <code>circular_buffer_space_optimized</code>). + \sa <code>\link swap(circular_buffer<T, Alloc>&, circular_buffer<T, Alloc>&) + swap(circular_buffer_space_optimized<T, Alloc>&, circular_buffer_space_optimized<T, Alloc>&)\endlink</code> + */ void swap(circular_buffer_space_optimized<T, Alloc>& cb) { std::swap(m_capacity_ctrl, cb.m_capacity_ctrl); circular_buffer<T, Alloc>::swap(cb); Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/base.hpp,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- base.hpp 16 Apr 2007 23:19:06 -0000 1.86 +++ base.hpp 30 Apr 2007 21:05:25 -0000 1.87 @@ -1236,7 +1236,8 @@ //! Swap the contents of two <code>circular_buffer</code>s. /*! - \post <code>this</code> contains elements of <code>cb</code> and vice versa. + \post <code>this</code> contains elements of <code>cb</code> and vice versa; capacity of <code>this</code> + equals to capacity of <code>cb</code> and vice versa. \param cb The <code>circular_buffer</code> whose content will be swapped. \throws Nothing. \par Exception Safety |
From: Steven W. <ste...@us...> - 2007-04-29 02:38:04
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12750/boost-sandbox/boost/units/detail Modified Files: prevent_ordinal_redefinition_impl.hpp Log Message: Minor name changes, made base_unit and base_dimension independent Index: prevent_ordinal_redefinition_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/prevent_ordinal_redefinition_impl.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- prevent_ordinal_redefinition_impl.hpp 18 Apr 2007 00:08:52 -0000 1.1 +++ prevent_ordinal_redefinition_impl.hpp 29 Apr 2007 02:36:22 -0000 1.2 @@ -33,16 +33,12 @@ } /// This must be in namespace boost::units so that ADL -/// will work with friend functions defined inline. -/// INTERNAL ONLY -template<long N> struct long_ { }; - -/// Again this needs to be in the same namespace as long_ -/// we need a mangled name because it must be found by ADL +/// will work. we need a mangled name because it must +/// be found by ADL /// INTERNAL ONLY template<class T> detail::no -prevent_ordinal_redefinition(const T&) +boost_units_is_registered(const T&) { return(detail::no()); } } // namespace units |
From: Steven W. <ste...@us...> - 2007-04-29 02:38:04
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12750/boost-sandbox/boost/units Modified Files: base_dimension.hpp Log Message: Minor name changes, made base_unit and base_dimension independent Index: base_dimension.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/base_dimension.hpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- base_dimension.hpp 29 Apr 2007 00:48:15 -0000 1.10 +++ base_dimension.hpp 29 Apr 2007 02:36:22 -0000 1.11 @@ -23,6 +23,11 @@ namespace units { +/// This must be in namespace boost::units so that ADL +/// will work with friend functions defined inline. +/// INTERNAL ONLY +template<long N> struct base_dimension_ordinal { }; + /// INTERNAL ONLY template<class T, long N> struct base_dimension_pair { }; @@ -34,8 +39,8 @@ template<class Derived, long N, class = typename detail::ordinal_has_already_been_defined< - sizeof(prevent_ordinal_redefinition(units::long_<N>())) == sizeof(detail::yes) && - sizeof(prevent_ordinal_redefinition(units::base_dimension_pair<Derived, N>())) != sizeof(detail::yes) + 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) >::type> class base_dimension : public mpl::long_<N> @@ -49,13 +54,13 @@ /// Register this ordinal /// INTERNAL ONLY friend detail::yes - prevent_ordinal_redefinition(const units::long_<N>&) + boost_units_is_registered(const units::base_dimension_ordinal<N>&) { return(detail::yes()); } /// But make sure we can identify the current instantiation! /// INTERNAL ONLY friend detail::yes - prevent_ordinal_redefinition(const units::base_dimension_pair<Derived, N>&) + boost_units_is_registered(const units::base_dimension_pair<Derived, N>&) { return(detail::yes()); } }; |
From: Steven W. <ste...@us...> - 2007-04-29 02:38:04
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12750/boost-sandbox/boost/units/experimental Modified Files: base_unit.hpp Log Message: Minor name changes, made base_unit and base_dimension independent Index: base_unit.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental/base_unit.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- base_unit.hpp 29 Apr 2007 00:48:15 -0000 1.2 +++ base_unit.hpp 29 Apr 2007 02:36:22 -0000 1.3 @@ -23,20 +23,26 @@ namespace units { +/// This must be in namespace boost::units so that ADL +/// will work with friend functions defined inline. +/// Base dimensions and base units are independent. +/// INTERNAL ONLY +template<long N> struct base_unit_ordinal { }; + /// INTERNAL ONLY template<class T, long N> struct base_unit_pair { }; -/// 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> {}; +/// 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_type, 1> {}; /// It is designed so that you will get an error message if you try /// to use the same value in multiple definitions. template<class Derived, class Dim, long N, class = typename detail::ordinal_has_already_been_defined< - sizeof(prevent_ordinal_redefinition(units::long_<N>())) == sizeof(detail::yes) && - sizeof(prevent_ordinal_redefinition(units::base_unit_pair<Derived, N>())) != sizeof(detail::yes) + sizeof(boost_units_is_registered(units::base_unit_ordinal<N>())) == sizeof(detail::yes) && + sizeof(boost_units_is_registered(units::base_unit_pair<Derived, N>())) != sizeof(detail::yes) >::type> class base_unit : public mpl::long_<N> @@ -50,13 +56,13 @@ /// Register this ordinal /// INTERNAL ONLY friend detail::yes - prevent_ordinal_redefinition(const units::long_<N>&) + boost_units_is_registered(const units::base_unit_ordinal<N>&) { return(detail::yes()); } /// But make sure we can identify the current instantiation! /// INTERNAL ONLY friend detail::yes - prevent_ordinal_redefinition(const units::base_unit_pair<Derived, N>&) + boost_units_is_registered(const units::base_unit_pair<Derived, N>&) { return(detail::yes()); } }; |
From: Steven W. <ste...@us...> - 2007-04-29 01:58:33
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30426/boost-sandbox/boost/units/experimental Modified Files: linear_algebra.hpp Log Message: Improved names/comments Index: linear_algebra.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental/linear_algebra.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- linear_algebra.hpp 28 Apr 2007 21:42:58 -0000 1.2 +++ linear_algebra.hpp 29 Apr 2007 01:58:24 -0000 1.3 @@ -66,7 +66,7 @@ struct check_extra_equations_impl; template<int N> -struct solve_linear_equations_impl; +struct normalize_units_impl; struct inconsistant {}; @@ -246,7 +246,7 @@ // rational substitute(equation e, list<rational> solutions) { // rational value = e.back(); // for_each(rational x : solutions, rational a : pop_front(pop_back(e))) { -// value -= x; +// value -= a * x; // } // return(e.front() / value); // } @@ -468,7 +468,7 @@ // increment the iterator and we set the // coefficient to zero. -template<bool> +template<bool has_dimension> struct calculate_base_dimension_coefficients_func; template<> @@ -542,8 +542,9 @@ // solve_for_base_dimension_impl computes the // coefficients of each unit for all the base_dimensions. // the inner lists are in reverse order. + template<int N> -struct solve_for_base_dimension_impl { +struct get_equations_for_base_dimension_impl { template<class Begin, class Units> struct apply { typedef typename calculate_base_dimension_coefficients_impl<mpl::size<Units>::value>::template apply< @@ -552,7 +553,7 @@ mpl::list0<> > x; typedef typename mpl::push_front< - typename solve_for_base_dimension_impl<N-1>::template apply< + typename get_equations_for_base_dimension_impl<N-1>::template apply< typename mpl::next<Begin>::type, typename x::next >::type, @@ -562,7 +563,7 @@ }; template<> -struct solve_for_base_dimension_impl<0> { +struct get_equations_for_base_dimension_impl<0> { template<class Begin, class Units> struct apply { typedef mpl::list0<> type; @@ -594,8 +595,8 @@ // prepare_equations takes the result of // solve_for_base_dimension_impl and an index. -// it sets the equation at the index to -// one and the others to zero. In the process +// it sets the equation at the index equal to +// one and all the others to zero. In the process // it reverses the inner lists thus yielding // a matrix that can be passed to solve. @@ -648,6 +649,14 @@ }; }; +// add_solutions takes a list of equations +// for the extra dummy units and a list +// of the values of all the regular units. +// It find the coefficients of all the dummy +// units and pushes them onto the begining +// of the list in reverse order (since the +// dummy equations are reversed). + template<int N> struct add_solutions_impl { template<class Begin, class T, class Solution> @@ -674,23 +683,64 @@ }; }; +// normalize_units finds the units corresponding +// to each base dimension. The form of the result is +// a two dimensional list. list<list<rational> >. +// each of the inner lists represents a single +// base dimension. There may be extra units added +// to the front of the inner list if there are +// more base dimensions than base units. The +// number such units is returned as a long called +// extra. For example list<pound, foot> will yield +// list<list<0, 0, 1>,list<1, 0, 0>,list<1/2,-1/2,1/2> > meaning +// +// length = 0 * mass + 0 * force + 1 * length +// mass = 1 * mass + 0 * force + 0 * length +// time = 1/2 * mass - 1/2 * force + 1/2 * length +// +// Why is there a dummy mass unit? It isn't +// possible to represent three base dimensions +// with only two base units. So we need some +// kind of dummy. Why mass? Well, a base +// unit of length doesn't help us since we +// already have one. Mass is before time +// so we use mass. + +// S is the solution for this particular base dimension. +// if the base dimension cannot be represented then +// solve will return inconsistant hence the two specializations. + template<class S> -struct solve_linear_equations_func { +struct normalize_units_func { template<class ReverseEquations, int M, class DimensionIterator, int N, int Extra, int I,class ExtraEquations> struct apply { + // first add zeroes for all the extra units that + // are not needed. typedef typename add_zeroes_impl<Extra-mpl::size<ExtraEquations>::value>::template apply<S>::type result1; + // then find the values for the extra units that /are/ needed. typedef typename add_solutions_impl<mpl::size<ExtraEquations>::value>::template apply< typename mpl::begin<ExtraEquations>::type, result1, S >::type result; + // recurse back to the primary loop putting + // push_front outside since we wish to maintain + // the original ordering of dimensions typedef typename mpl::push_front< - typename solve_linear_equations_impl<N-1>::template apply< + typename normalize_units_impl<N-1>::template apply< + // The coefficient are still the same + // and we don't need to remove any equations ReverseEquations, + // increment the number of equations that + // need to be skipped when we add another + // dummy unit. M+1, typename mpl::next<DimensionIterator>::type, Extra, + // increment the number of dimensions we've seen I+1, + // pass the equations for the dummy + // units on without modification. ExtraEquations >::type, result @@ -698,12 +748,21 @@ }; }; +// handles the case when this base dimension +// cannot be represented with the base units +// and the dummies allready added. template<> -struct solve_linear_equations_func<inconsistant> { +struct normalize_units_func<inconsistant> { template<class ReverseEquations, int M, class DimensionIterator, int N, int Extra, int I, class ExtraEquations> struct apply { + // Find the position that needs to be erased. (Since this + // equation can always be adjusted by adjusting the + // dummy unit we are adding now, independently of + // other units, we don't need it anymore.) typedef typename typename mpl::advance_c<typename mpl::begin<ReverseEquations>::type, M>::type pos; - typedef typename solve_linear_equations_impl<N-1>::template apply< + // Continue with the main loop. + typedef typename normalize_units_impl<N-1>::template apply< + // Remove current_equation typename mpl::erase< ReverseEquations, pos @@ -711,25 +770,33 @@ M, typename mpl::next<DimensionIterator>::type, Extra, + // Increment the number of dimensions we've seen I+1, + // Add "current_equation == 0" to the list of equations + // for the dummy units. (For all base dimensions + // except this the current dimension must sum to + // zero.) typename mpl::push_front< ExtraEquations, + // Remember it's backwards typename mpl::reverse< typename mpl::push_front<typename mpl::deref<pos>::type, static_rational<0> >::type >::type >::type > next; + // this dimension is (0, ..., 0, 1, 0, ..., 0) typedef typename mpl::push_front< typename add_zeroes_impl<N-1>::template apply<mpl::list0<> >::type, static_rational<1> >::type result1; typedef typename add_zeroes_impl<I>::template apply<result1>::type result; + // Push the result onto the list. typedef typename mpl::push_front<typename next::type, result>::type type; }; }; template<int N> -struct solve_linear_equations_impl { +struct normalize_units_impl { template<class ReverseEquations, int M, class DimensionIterator, int Extra, int I, class ExtraEquations> struct apply { typedef typename solve< @@ -740,7 +807,7 @@ M >::type >::type solution; - typedef typename solve_linear_equations_func<solution>::template apply< + typedef typename normalize_units_func<solution>::template apply< ReverseEquations, M, DimensionIterator, @@ -753,7 +820,7 @@ }; template<> -struct solve_linear_equations_impl<0> { +struct normalize_units_impl<0> { template<class ReverseEquations, int M, class DimensionIterator, int Extra, int I, class ExtraEquations> struct apply { typedef mpl::list0<> type; @@ -761,17 +828,17 @@ }; template<class T> -struct solve_linear_equations { +struct normalize_units { typedef typename find_base_dimensions<T>::type dimensions; typedef typename get_dimension_iterators_impl<mpl::size<T>::value>::template apply<typename mpl::begin<T>::type>::type iterators; - typedef typename solve_for_base_dimension_impl< + typedef typename get_equations_for_base_dimension_impl< mpl::size<dimensions>::value >::template apply< typename mpl::begin<dimensions>::type, iterators >::type reverse_equations; static const long extra = mpl::size<reverse_equations>::value - mpl::size<T>::value; - typedef typename solve_linear_equations_impl<mpl::size<reverse_equations>::value>::template apply< + typedef typename normalize_units_impl<mpl::size<reverse_equations>::value>::template apply< reverse_equations, 0, typename mpl::begin<dimensions>::type, @@ -783,6 +850,11 @@ // expand_dimensions finds the exponents of // a set of dimensions in a dimension_list. +// the second parameter is assumed to be +// a superset of the base_dimensions of +// the first parameter. +// +// list<rational> expand_dimensions(dimension_list, list<base_dimension>); template<int N> struct expand_dimensions { @@ -932,18 +1004,43 @@ // dimension. // // list<rational> calculate_base_unit_exponents(list<base_unit> units, dimension_list dimensions); +// +// What is the purpose of all this magic with +// base_dimensions? Can't we just solve the +// equations for the dimension directly? Yes, +// we can, but remember that solving a +// system of linear equations is O(N^3). +// By normalizing the system we incur a +// high one time cost O(N^4), but for all +// solutions after the first it is O(N^2) +// In addition, the constant factor is +// good because everything is already set up. +// Since we expect a few systems to be +// used many times, the cost of creating +// a system is probably not significant. template<class T, class Dimensions> struct calculate_base_unit_exponents { - typedef typename solve_linear_equations<T> base_solutions; + // find the units that correspond to each base dimension + typedef typename normalize_units<T> base_solutions; + // pad the dimension with zeroes so it can just be a + // list of numbers, making the multiplication easy + // e.g. if the arguments are list<pound, foot> and + // dimension_list<mass,time^-2> then this step will + // yield list<0,1,-2> typedef typename expand_dimensions<mpl::size<typename base_solutions::dimensions>::value>::template apply< typename mpl::begin<typename base_solutions::dimensions>::type, typename mpl::begin<Dimensions>::type >::type dimensions; + // take the unit corresponding to each base unit + // multiply each of its exponents by the exponent + // of the base_dimension in the result and sum. typedef typename multiply_add_units<mpl::size<dimensions>::value>::template apply< typename mpl::begin<dimensions>::type, typename mpl::begin<typename base_solutions::type>::type >::type units; + // Now, verify that the dummy units really + // cancel out and remove them. typedef typename strip_zeroes_impl<base_solutions::extra>::template apply<units>::type type; }; |
From: Steven W. <ste...@us...> - 2007-04-29 00:48:28
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3360/boost-sandbox/boost/units/detail Modified Files: dim_impl.hpp conversion_impl.hpp system_impl.hpp Log Message: Compare tags using mpl::less Index: conversion_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/conversion_impl.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- conversion_impl.hpp 15 Apr 2007 07:07:15 -0000 1.8 +++ conversion_impl.hpp 29 Apr 2007 00:48:15 -0000 1.9 @@ -379,7 +379,7 @@ template<class T1, class V1, class T2, class V2> struct less<heterogeneous_system_by_dimension_dim<T1, V1>, heterogeneous_system_by_dimension_dim<T2, V2> > - : mpl::less<typename T1::value, typename T2::value> + : mpl::less<T1, T2> { }; template<class Tag, class L> @@ -448,7 +448,7 @@ template<class T1, class V1, class T2, class V2> struct less<heterogeneous_system_by_dimension_value<T1, V1>, heterogeneous_system_by_dimension_value<T2, V2> > - : mpl::less<typename T1::value, typename T2::value> + : mpl::less<T1, T2> { }; template<class Tag, class L> Index: system_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/system_impl.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- system_impl.hpp 12 Apr 2007 00:39:12 -0000 1.2 +++ system_impl.hpp 29 Apr 2007 00:48:15 -0000 1.3 @@ -96,7 +96,7 @@ template<class T1,class V1,class T2,class V2> struct less< heterogeneous_system_element<T1,V1>,heterogeneous_system_element<T2,V2> > { - typedef typename boost::mpl::less<typename T1::value,typename T2::value>::type type; + typedef typename boost::mpl::less<T1,T2>::type type; static const bool value = boost::is_same<type,boost::mpl::true_>::value; }; Index: dim_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/dim_impl.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- dim_impl.hpp 13 Apr 2007 06:08:52 -0000 1.4 +++ dim_impl.hpp 29 Apr 2007 00:48:15 -0000 1.5 @@ -73,7 +73,7 @@ template<typename T1,typename V1,typename T2,typename V2> struct less< dim<T1,V1>,dim<T2,V2> > { - typedef typename boost::mpl::less<typename T1::value,typename T2::value>::type type; + typedef typename boost::mpl::less<T1,T2>::type type; static const bool value = boost::is_same<type,boost::mpl::true_>::value; }; |
From: Steven W. <ste...@us...> - 2007-04-29 00:48:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3360/boost-sandbox/boost/units Modified Files: base_dimension.hpp ordinal.hpp Log Message: Compare tags using mpl::less Index: ordinal.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/ordinal.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ordinal.hpp 14 Apr 2007 21:52:00 -0000 1.2 +++ ordinal.hpp 29 Apr 2007 00:48:15 -0000 1.3 @@ -20,7 +20,7 @@ namespace units { /// Class for defining a cardinal ordering of tags to faciliate compile-time sorting. -template<long N> struct ordinal { typedef typename boost::mpl::long_<N> value; }; +template<long N> struct ordinal : mpl::long_<N> {}; } // namespace units Index: base_dimension.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/base_dimension.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- base_dimension.hpp 18 Apr 2007 22:25:37 -0000 1.9 +++ base_dimension.hpp 29 Apr 2007 00:48:15 -0000 1.10 @@ -42,7 +42,7 @@ { public: typedef base_dimension this_type; - typedef mpl::long_<N> value; + //typedef mpl::long_<N> value; typedef dimension_list<dim<Derived,static_rational<1> >, dimensionless_type> type; private: |
From: Steven W. <ste...@us...> - 2007-04-29 00:48:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3360/boost-sandbox/boost/units/experimental Modified Files: base_unit.hpp Log Message: Compare tags using mpl::less Index: base_unit.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental/base_unit.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- base_unit.hpp 18 Apr 2007 00:12:58 -0000 1.1 +++ base_unit.hpp 29 Apr 2007 00:48:15 -0000 1.2 @@ -43,7 +43,7 @@ { public: typedef base_unit this_type; - typedef mpl::long_<N> value; + //typedef mpl::long_<N> value; typedef Dim dimension_type; private: |
From: Steven W. <ste...@us...> - 2007-04-28 21:43:12
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27536/boost-sandbox/boost/units/experimental Modified Files: linear_algebra.hpp Log Message: finished implementation Index: linear_algebra.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental/linear_algebra.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- linear_algebra.hpp 27 Apr 2007 00:31:30 -0000 1.1 +++ linear_algebra.hpp 28 Apr 2007 21:42:58 -0000 1.2 @@ -28,6 +28,7 @@ #include <boost/mpl/reverse.hpp> #include <boost/mpl/advance.hpp> #include <boost/mpl/erase.hpp> +#include <boost/mpl/front.hpp> namespace boost { @@ -35,6 +36,8 @@ namespace detail { +// typedef list<rational> equation; + template<int N> struct eliminate_from_pair_of_equations_impl; @@ -67,6 +70,15 @@ struct inconsistant {}; +// eliminate_from_pair_of_equations takes a pair of +// equations and eliminates the first variable. +// +// equation eliminate_from_pair_of_equations(equation l1, equation l2) { +// rational x1 = l1.front(); +// rational x2 = l2.front(); +// return(transform(pop_front(l1), pop_front(l2), _1 * x2 - _2 * x1)); +// } + template<int N> struct eliminate_from_pair_of_equations_impl { template<class Begin1, class Begin2, class X1, class X2> @@ -106,6 +118,32 @@ >::type type; }; +// Eliminates the first variable from a list of equations +// returns inconsistant if all its coefficients are 0. Otherwise +// recursively calls solve to find the remaining variables +// +// list<rational> eliminate(list<equation> system) { +// list<equation> result; +// equation eliminate_against = null; +// for_each(equation e : system) { +// if(eliminate_against == null) { +// if(e.front() == 0) { +// result = push_front(result, pop_front(e)); +// } else { +// eliminate_against = e; +// } +// } else { +// result = push_back(result, eliminate_from_pair_of_equations(e,eliminate_against)); +// } +// } +// if(eliminate_against == null) { +// return(inconsistant); +// } else { +// list<rational> solution = solve(result); +// return(push_front(solution, substitute(eliminate_against,solution))); +// } +// } + template<int N> struct elimination_impl { template<class Begin, class Prev, class L> @@ -202,6 +240,17 @@ }; }; +// finds the vaue of the first variable given the +// values of all the other variables. +// +// rational substitute(equation e, list<rational> solutions) { +// rational value = e.back(); +// for_each(rational x : solutions, rational a : pop_front(pop_back(e))) { +// value -= x; +// } +// return(e.front() / value); +// } + template<int N> struct substitute_impl { template<class Begin1, class Begin2> @@ -247,6 +296,10 @@ }; }; +// check_extra_equations verifies that the +// after all the variables have been eliminated +// the remaining equations are all 0=0. + template<class T> struct check_extra_equations_func { template<class Begin, int N> @@ -328,11 +381,30 @@ }; }; +// solve takes a list of equations and returns the solutions +// as a vector. Each equation is interpreted as a sequence +// of coefficients with the last item being the value e.g. +// list<1, 2, 3> is 1 * x0 + 2 * x1 = 3 + template<class T> struct solve { typedef typename solve_impl<mpl::size<T>::value == 0>::template apply<T>::type type; }; +// find_base_dimensions takes a list of +// base_units and returns a sorted list +// of all the base_dimensions they use. +// +// list<base_dimension> find_base_dimensions(list<base_unit> l) { +// set<base_dimension> dimensions; +// for_each(base_unit unit : l) { +// for_each(dim d : unit.dimension_type) { +// dimensions = insert(dimensions, d.tag_type); +// } +// } +// return(sort(dimensions, _1 > _2, front_inserter(list<base_dimension>()))); +// } + template<int N> struct find_base_dimensions_impl_impl { template<class Begin, class S> @@ -385,6 +457,17 @@ >::type type; }; +// calculate_base_dimension_coefficients finds +// the coefficients corresponding to the first +// base_dimension in each of the dimension_lists. +// It returns two values. The first result +// is a list of the coefficients. The second +// is a list with all the incremented iterators. +// When we encounter a base_dimension that is +// missing from a dimension_list, we do not +// increment the iterator and we set the +// coefficient to zero. + template<bool> struct calculate_base_dimension_coefficients_func; @@ -406,14 +489,33 @@ }; }; +// begins_with_dimension returns true iff its first +// parameter is a valid iterator which yields its +// second parameter when dereferenced. + +template<class Iterator> +struct begins_with_dimension { + template<class Dim> + struct apply : + boost::is_same< + Dim, + typename mpl::deref<Iterator>::type::tag_type + > {}; +}; + +template<> +struct begins_with_dimension<dimensionless_type> { + template<class Dim> + struct apply : mpl::false_ {}; +}; + template<int N> struct calculate_base_dimension_coefficients_impl { template<class BaseUnitDimensions,class Dim,class T> struct apply { typedef typename calculate_base_dimension_coefficients_func< - boost::is_same< - Dim, - typename mpl::deref<typename mpl::deref<BaseUnitDimensions>::type>::type::tag_type + begins_with_dimension<typename mpl::deref<BaseUnitDimensions>::type>::template apply< + Dim >::value >::template apply< typename mpl::deref<BaseUnitDimensions>::type @@ -437,7 +539,9 @@ }; }; -// returns the result in reverse order +// solve_for_base_dimension_impl computes the +// coefficients of each unit for all the base_dimensions. +// the inner lists are in reverse order. template<int N> struct solve_for_base_dimension_impl { template<class Begin, class Units> @@ -465,6 +569,10 @@ }; }; +// get_dimension_iterators_impl takes a list of base_units +// and returns a list of the begin iterators of their +// dimensions + template<int N> struct get_dimension_iterators_impl { template<class Begin> @@ -484,6 +592,13 @@ }; }; +// prepare_equations takes the result of +// solve_for_base_dimension_impl and an index. +// it sets the equation at the index to +// one and the others to zero. In the process +// it reverses the inner lists thus yielding +// a matrix that can be passed to solve. + template<int N> struct prepare_equations_impl { template<class Begin, int M> @@ -503,6 +618,17 @@ }; }; +// add_zeroes pushs N zeroes onto the +// front of a list. +// +// list<rational> add_zeroes(list<rational> l, int N) { +// if(N == 0) { +// return(l); +// } else { +// return(push_front(add_zeroes(l, N-1), 0)); +// } +// } + template<int N> struct add_zeroes_impl { template<class T> @@ -534,7 +660,8 @@ typename mpl::begin<typename mpl::deref<Begin>::type>::type, typename mpl::begin<Solution>::type >::type - >::type + >::type, + Solution >::type type; }; }; @@ -643,16 +770,183 @@ typename mpl::begin<dimensions>::type, iterators >::type reverse_equations; + static const long extra = mpl::size<reverse_equations>::value - mpl::size<T>::value; typedef typename solve_linear_equations_impl<mpl::size<reverse_equations>::value>::template apply< reverse_equations, 0, typename mpl::begin<dimensions>::type, - mpl::size<reverse_equations>::value - mpl::size<T>::value, + extra, 0, mpl::list0<> >::type type; }; +// expand_dimensions finds the exponents of +// a set of dimensions in a dimension_list. + +template<int N> +struct expand_dimensions { + template<class Begin, class DimensionIterator> + struct apply { + typedef typename calculate_base_dimension_coefficients_func< + begins_with_dimension<DimensionIterator>::template apply<typename mpl::deref<Begin>::type>::value + >::template apply<DimensionIterator> result; + typedef typename mpl::push_front< + typename expand_dimensions<N-1>::template apply<typename mpl::next<Begin>::type, typename result::next>::type, + typename result::type + >::type type; + }; +}; + +template<> +struct expand_dimensions<0> { + template<class Begin, class DimensionIterator> + struct apply { + typedef mpl::list0<> type; + }; +}; + +// multiply_add_units computes M x V +// where M is a matrix and V is a horizontal +// vector +// +// list<rational> multiply_add_units(list<list<rational> >, list<rational>); + +template<int N> +struct multiply_add_units_impl { + template<class Begin1, class Begin2 ,class X> + struct apply { + typedef typename mpl::push_front< + typename multiply_add_units_impl<N-1>::template apply< + typename mpl::next<Begin1>::type, + typename mpl::next<Begin2>::type, + X + >::type, + typename mpl::plus< + typename mpl::times< + typename mpl::deref<Begin2>::type, + X + >::type, + typename mpl::deref<Begin1>::type + >::type + >::type type; + }; +}; + +template<> +struct multiply_add_units_impl<0> { + template<class Begin1, class Begin2 ,class X> + struct apply { + typedef mpl::list0<> type; + }; +}; + +template<int N> +struct multiply_add_units { + template<class Begin1, class Begin2> + struct apply { + typedef typename multiply_add_units_impl< + mpl::size<typename mpl::deref<Begin2>::type>::value + >::template apply< + typename mpl::begin< + typename multiply_add_units<N-1>::template apply< + typename mpl::next<Begin1>::type, + typename mpl::next<Begin2>::type + >::type + >::type, + typename mpl::begin<typename mpl::deref<Begin2>::type>::type, + typename mpl::deref<Begin1>::type + >::type type; + }; +}; + +template<> +struct multiply_add_units<1> { + template<class Begin1, class Begin2> + struct apply { + typedef typename add_zeroes_impl< + mpl::size<typename mpl::deref<Begin2>::type>::value + >::template apply<mpl::list0<> >::type type1; + typedef typename multiply_add_units_impl< + mpl::size<typename mpl::deref<Begin2>::type>::value + >::template apply< + typename mpl::begin< + type1 + >::type, + typename mpl::begin<typename mpl::deref<Begin2>::type>::type, + typename mpl::deref<Begin1>::type + >::type type; + }; +}; + +// strip_zeroes erases the first N elements of a list if +// they are all zero, otherwise returns inconsistant +// +// list strip_zeroes(list l, int N) { +// if(N == 0) { +// return(l); +// } else if(l.front == 0) { +// return(strip_zeroes(pop_front(l), N-1)); +// } else { +// return(inconsistant); +// } +// } + +template<int N> +struct strip_zeroes_impl; + +template<class T> +struct strip_zeroes_func { + template<class L, int N> + struct apply { + typedef inconsistant type; + }; +}; + +template<> +struct strip_zeroes_func<static_rational<0> > { + template<class L, int N> + struct apply { + typedef typename strip_zeroes_impl<N-1>::template apply<typename mpl::pop_front<L>::type>::type type; + }; +}; + +template<int N> +struct strip_zeroes_impl { + template<class T> + struct apply { + typedef typename strip_zeroes_func<typename mpl::front<T>::type>::template apply<T, N>::type type; + }; +}; + +template<> +struct strip_zeroes_impl<0> { + template<class T> + struct apply { + typedef T type; + }; +}; + +// Given a list of base_units, computes the +// exponents of each base unit for a given +// dimension. +// +// list<rational> calculate_base_unit_exponents(list<base_unit> units, dimension_list dimensions); + +template<class T, class Dimensions> +struct calculate_base_unit_exponents { + typedef typename solve_linear_equations<T> base_solutions; + typedef typename expand_dimensions<mpl::size<typename base_solutions::dimensions>::value>::template apply< + typename mpl::begin<typename base_solutions::dimensions>::type, + typename mpl::begin<Dimensions>::type + >::type dimensions; + typedef typename multiply_add_units<mpl::size<dimensions>::value>::template apply< + typename mpl::begin<dimensions>::type, + typename mpl::begin<typename base_solutions::type>::type + >::type units; + typedef typename strip_zeroes_impl<base_solutions::extra>::template apply<units>::type type; +}; + } // namespace detail } // namespace units |
From: Steven W. <ste...@us...> - 2007-04-27 00:31:39
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1257/boost-sandbox/boost/units/experimental Added Files: linear_algebra.hpp Log Message: Scaffolding needed for generalized base units --- NEW FILE: linear_algebra.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_LINEAR_ALGEBRA_HPP #define BOOST_UNITS_LINEAR_ALGEBRA_HPP #include <boost/units/static_rational.hpp> #include <boost/mpl/list.hpp> #include <boost/mpl/push_front.hpp> #include <boost/mpl/pop_front.hpp> #include <boost/mpl/deref.hpp> #include <boost/mpl/begin.hpp> #include <boost/mpl/size.hpp> #include <boost/mpl/next.hpp> #include <boost/mpl/arithmetic.hpp> #include <boost/mpl/sort.hpp> #include <boost/mpl/front_inserter.hpp> #include <boost/mpl/set.hpp> #include <boost/mpl/insert.hpp> #include <boost/mpl/greater.hpp> #include <boost/mpl/reverse.hpp> #include <boost/mpl/advance.hpp> #include <boost/mpl/erase.hpp> namespace boost { namespace units { namespace detail { template<int N> struct eliminate_from_pair_of_equations_impl; template<class E1, class E2> struct eliminate_from_pair_of_equations; template<int N> struct elimination_impl; template<bool is_zero, bool element_is_last> struct elimination_skip_leading_zeros_impl; template<class Equation, class Vars> struct substitute; template<int N> struct substitute_impl; template<bool is_end> struct solve_impl; template<class T> struct solve; template<int N> struct check_extra_equations_impl; template<int N> struct solve_linear_equations_impl; struct inconsistant {}; template<int N> struct eliminate_from_pair_of_equations_impl { template<class Begin1, class Begin2, class X1, class X2> struct apply { typedef typename mpl::push_front< typename eliminate_from_pair_of_equations_impl<N - 1>::template apply< typename mpl::next<Begin1>::type, typename mpl::next<Begin2>::type, X1, X2 >::type, typename mpl::minus< typename mpl::times<typename mpl::deref<Begin1>::type, X2>::type, typename mpl::times<typename mpl::deref<Begin2>::type, X1>::type >::type >::type type; }; }; template<> struct eliminate_from_pair_of_equations_impl<0> { template<class Begin1, class Begin2, class X1, class X2> struct apply { typedef mpl::list0<> type; }; }; template<class E1, class E2> struct eliminate_from_pair_of_equations { typedef typename mpl::begin<E1>::type begin1; typedef typename mpl::begin<E2>::type begin2; typedef typename eliminate_from_pair_of_equations_impl<mpl::size<E1>::value - 1>::template apply< typename mpl::next<begin1>::type, typename mpl::next<begin2>::type, typename mpl::deref<begin1>::type, typename mpl::deref<begin2>::type >::type type; }; template<int N> struct elimination_impl { template<class Begin, class Prev, class L> struct apply { typedef typename mpl::push_front< typename elimination_impl<N-1>::template apply<typename mpl::next<Begin>::type, Prev, L>::type, typename eliminate_from_pair_of_equations<typename mpl::deref<Begin>::type,Prev>::type >::type type; }; }; template<> struct elimination_impl<0> { template<class Begin, class Prev, class L> struct apply { typedef L type; }; }; template<> struct elimination_skip_leading_zeros_impl<true, true> { template<class Begin, int N, class L> struct apply { typedef inconsistant type; }; }; template<> struct elimination_skip_leading_zeros_impl<true, false> { template<class Begin, int N, class L> struct apply { typedef typename mpl::next<Begin>::type next; typedef typename elimination_skip_leading_zeros_impl< boost::is_same< typename mpl::deref< typename mpl::begin<typename mpl::deref<next>::type>::type >::type, static_rational<0> >::value, N == 2 >::template apply< next, N-1, typename mpl::push_front< L, typename mpl::pop_front<typename mpl::deref<Begin>::type>::type >::type >::type type; }; }; template<class S> struct combine_solutions { template<class Iterator> struct apply { typedef typename substitute<typename mpl::deref<Iterator>::type, S>::type x; typedef typename mpl::push_front<S, x>::type type; }; }; template<> struct combine_solutions<inconsistant> { template<class Iterator> struct apply { typedef inconsistant type; }; }; template<> struct elimination_skip_leading_zeros_impl<false, true> { template<class Begin, int N, class L> struct apply { typedef typename elimination_impl<N - 1>::template apply< typename mpl::next<Begin>::type, typename mpl::deref<Begin>::type, L >::type list_type; typedef typename solve<list_type>::type next; typedef typename combine_solutions<next>::template apply<Begin>::type type; }; }; template<> struct elimination_skip_leading_zeros_impl<false, false> { template<class Begin, int N, class L> struct apply { typedef typename elimination_impl<N - 1>::template apply< typename mpl::next<Begin>::type, typename mpl::deref<Begin>::type, L >::type list_type; typedef typename solve<list_type>::type next; typedef typename combine_solutions<next>::template apply<Begin>::type type; }; }; template<int N> struct substitute_impl { template<class Begin1, class Begin2> struct apply { typedef typename mpl::minus< typename substitute_impl<N-1>::template apply< typename mpl::next<Begin1>::type, typename mpl::next<Begin2>::type >::type, typename mpl::times< typename mpl::deref<Begin1>::type, typename mpl::deref<Begin2>::type >::type >::type type; }; }; template<> struct substitute_impl<0> { template<class Begin1, class Begin2> struct apply { typedef typename mpl::deref<Begin1>::type type; }; }; template<class Equation, class Vars> struct substitute { typedef typename mpl::begin<Equation>::type begin; typedef typename mpl::divides< typename substitute_impl<mpl::size<Vars>::value>::template apply< typename mpl::next<begin>::type, typename mpl::begin<Vars>::type >::type, typename mpl::deref<begin>::type >::type type; }; template<> struct solve_impl<true> { template<class T> struct apply { typedef mpl::list0<> type; }; }; template<class T> struct check_extra_equations_func { template<class Begin, int N> struct apply { typedef inconsistant type; }; }; template<> struct check_extra_equations_func<static_rational<0> > { template<class Begin, int N> struct apply { typedef typename check_extra_equations_impl<N - 1>::template apply<typename mpl::next<Begin>::type>::type type; }; }; template<int N> struct check_extra_equations_impl { template<class Begin> struct apply { typedef typename check_extra_equations_func< typename mpl::deref<typename mpl::begin<typename mpl::deref<Begin>::type>::type>::type >::template apply<Begin, N>::type type; }; }; template<> struct check_extra_equations_impl<0> { template<class Begin> struct apply { typedef mpl::list0<> type; }; }; template<bool is_end> struct check_extra_equations; template<> struct check_extra_equations<true> { template<class T> struct apply { typedef typename check_extra_equations_impl<mpl::size<T>::value>::template apply< typename mpl::begin<T>::type >::type type; }; }; template<> struct check_extra_equations<false> { template<class T> struct apply { typedef typename mpl::begin<T>::type begin; typedef typename elimination_skip_leading_zeros_impl< boost::is_same< typename mpl::deref< typename mpl::begin<typename mpl::deref<begin>::type>::type >::type, static_rational<0> >::value, mpl::size<T>::value == 1 >::template apply< begin, mpl::size<T>::value, mpl::list0<> >::type type; }; }; template<> struct solve_impl<false> { template<class T> struct apply { typedef typename mpl::begin<T>::type begin; typedef typename check_extra_equations< mpl::size<typename mpl::deref<begin>::type>::value == 1 >::template apply< T >::type type; }; }; template<class T> struct solve { typedef typename solve_impl<mpl::size<T>::value == 0>::template apply<T>::type type; }; template<int N> struct find_base_dimensions_impl_impl { template<class Begin, class S> struct apply { typedef typename mpl::insert< typename find_base_dimensions_impl_impl<N-1>::template apply< typename mpl::next<Begin>::type, S >::type, typename mpl::deref<Begin>::type::tag_type >::type type; }; }; template<> struct find_base_dimensions_impl_impl<0> { template<class Begin, class S> struct apply { typedef S type; }; }; template<int N> struct find_base_dimensions_impl { template<class Begin> struct apply { typedef typename find_base_dimensions_impl_impl<mpl::size<typename mpl::deref<Begin>::type::dimension_type>::value>::template apply< typename mpl::begin<typename mpl::deref<Begin>::type::dimension_type>::type, typename find_base_dimensions_impl<N-1>::template apply<typename mpl::next<Begin>::type>::type >::type type; }; }; template<> struct find_base_dimensions_impl<0> { template<class Begin> struct apply { typedef mpl::set0<> type; }; }; template<class T> struct find_base_dimensions { typedef typename mpl::sort< typename find_base_dimensions_impl< mpl::size<T>::value >::template apply<typename mpl::begin<T>::type>::type, mpl::greater<>, mpl::front_inserter<mpl::list0<> > >::type type; }; template<bool> struct calculate_base_dimension_coefficients_func; template<> struct calculate_base_dimension_coefficients_func<true> { template<class T> struct apply { typedef typename mpl::deref<T>::type::value_type type; typedef typename mpl::next<T>::type next; }; }; template<> struct calculate_base_dimension_coefficients_func<false> { template<class T> struct apply { typedef static_rational<0> type; typedef typename T next; }; }; template<int N> struct calculate_base_dimension_coefficients_impl { template<class BaseUnitDimensions,class Dim,class T> struct apply { typedef typename calculate_base_dimension_coefficients_func< boost::is_same< Dim, typename mpl::deref<typename mpl::deref<BaseUnitDimensions>::type>::type::tag_type >::value >::template apply< typename mpl::deref<BaseUnitDimensions>::type > result; typedef typename calculate_base_dimension_coefficients_impl<N-1>::template apply< typename mpl::next<BaseUnitDimensions>::type, Dim, typename mpl::push_front<T, typename result::type>::type > next_; typedef typename next_::type type; typedef typename mpl::push_front<typename next_::next, typename result::next>::type next; }; }; template<> struct calculate_base_dimension_coefficients_impl<0> { template<class Begin, class BaseUnitDimensions, class T> struct apply { typedef T type; typedef mpl::list0<> next; }; }; // returns the result in reverse order template<int N> struct solve_for_base_dimension_impl { template<class Begin, class Units> struct apply { typedef typename calculate_base_dimension_coefficients_impl<mpl::size<Units>::value>::template apply< typename mpl::begin<Units>::type, typename mpl::deref<Begin>::type, mpl::list0<> > x; typedef typename mpl::push_front< typename solve_for_base_dimension_impl<N-1>::template apply< typename mpl::next<Begin>::type, typename x::next >::type, typename x::type >::type type; }; }; template<> struct solve_for_base_dimension_impl<0> { template<class Begin, class Units> struct apply { typedef mpl::list0<> type; }; }; template<int N> struct get_dimension_iterators_impl { template<class Begin> struct apply { typedef typename mpl::push_front< typename get_dimension_iterators_impl<N-1>::template apply<typename mpl::next<Begin>::type>::type, typename mpl::begin<typename mpl::deref<Begin>::type::dimension_type>::type >::type type; }; }; template<> struct get_dimension_iterators_impl<0> { template<class Begin> struct apply { typedef mpl::list0<> type; }; }; template<int N> struct prepare_equations_impl { template<class Begin, int M> struct apply { typedef typename mpl::push_front< typename prepare_equations_impl<N-1>::template apply<typename mpl::next<Begin>::type, M - 1>::type, typename mpl::reverse<typename mpl::push_front<typename mpl::deref<Begin>::type, static_rational<(M == 0 ? 1 : 0)> >::type>::type >::type type; }; }; template<> struct prepare_equations_impl<0> { template<class Begin, int M> struct apply { typedef mpl::list0<> type; }; }; template<int N> struct add_zeroes_impl { template<class T> struct apply { typedef typename mpl::push_front< typename add_zeroes_impl<N-1>::template apply<T>::type, static_rational<0> >::type type; }; }; template<> struct add_zeroes_impl<0> { template<class T> struct apply { typedef T type; }; }; template<int N> struct add_solutions_impl { template<class Begin, class T, class Solution> struct apply { typedef typename add_solutions_impl<N-1>::template apply< typename mpl::next<Begin>::type, typename mpl::push_front< T, typename substitute_impl<mpl::size<Solution>::value>::template apply< typename mpl::begin<typename mpl::deref<Begin>::type>::type, typename mpl::begin<Solution>::type >::type >::type >::type type; }; }; template<> struct add_solutions_impl<0> { template<class Begin, class T, class Solution> struct apply { typedef T type; }; }; template<class S> struct solve_linear_equations_func { template<class ReverseEquations, int M, class DimensionIterator, int N, int Extra, int I,class ExtraEquations> struct apply { typedef typename add_zeroes_impl<Extra-mpl::size<ExtraEquations>::value>::template apply<S>::type result1; typedef typename add_solutions_impl<mpl::size<ExtraEquations>::value>::template apply< typename mpl::begin<ExtraEquations>::type, result1, S >::type result; typedef typename mpl::push_front< typename solve_linear_equations_impl<N-1>::template apply< ReverseEquations, M+1, typename mpl::next<DimensionIterator>::type, Extra, I+1, ExtraEquations >::type, result >::type type; }; }; template<> struct solve_linear_equations_func<inconsistant> { template<class ReverseEquations, int M, class DimensionIterator, int N, int Extra, int I, class ExtraEquations> struct apply { typedef typename typename mpl::advance_c<typename mpl::begin<ReverseEquations>::type, M>::type pos; typedef typename solve_linear_equations_impl<N-1>::template apply< typename mpl::erase< ReverseEquations, pos >::type, M, typename mpl::next<DimensionIterator>::type, Extra, I+1, typename mpl::push_front< ExtraEquations, typename mpl::reverse< typename mpl::push_front<typename mpl::deref<pos>::type, static_rational<0> >::type >::type >::type > next; typedef typename mpl::push_front< typename add_zeroes_impl<N-1>::template apply<mpl::list0<> >::type, static_rational<1> >::type result1; typedef typename add_zeroes_impl<I>::template apply<result1>::type result; typedef typename mpl::push_front<typename next::type, result>::type type; }; }; template<int N> struct solve_linear_equations_impl { template<class ReverseEquations, int M, class DimensionIterator, int Extra, int I, class ExtraEquations> struct apply { typedef typename solve< typename prepare_equations_impl< mpl::size<ReverseEquations>::value >::template apply< typename mpl::begin<ReverseEquations>::type, M >::type >::type solution; typedef typename solve_linear_equations_func<solution>::template apply< ReverseEquations, M, DimensionIterator, N, Extra, I, ExtraEquations >::type type; }; }; template<> struct solve_linear_equations_impl<0> { template<class ReverseEquations, int M, class DimensionIterator, int Extra, int I, class ExtraEquations> struct apply { typedef mpl::list0<> type; }; }; template<class T> struct solve_linear_equations { typedef typename find_base_dimensions<T>::type dimensions; typedef typename get_dimension_iterators_impl<mpl::size<T>::value>::template apply<typename mpl::begin<T>::type>::type iterators; typedef typename solve_for_base_dimension_impl< mpl::size<dimensions>::value >::template apply< typename mpl::begin<dimensions>::type, iterators >::type reverse_equations; typedef typename solve_linear_equations_impl<mpl::size<reverse_equations>::value>::template apply< reverse_equations, 0, typename mpl::begin<dimensions>::type, mpl::size<reverse_equations>::value - mpl::size<T>::value, 0, mpl::list0<> >::type type; }; } // namespace detail } // namespace units } // namespace boost #endif |
From: Steven W. <ste...@us...> - 2007-04-21 18:50:56
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2497/boost-sandbox/libs/units/example Modified Files: unit_example_15.cpp Log Message: Use base_dimension Index: unit_example_15.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_15.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- unit_example_15.cpp 13 Apr 2007 01:15:39 -0000 1.6 +++ unit_example_15.cpp 21 Apr 2007 18:50:54 -0000 1.7 @@ -27,6 +27,7 @@ #include <boost/array.hpp> +#include <boost/units/base_dimension.hpp> #include <boost/units/quantity.hpp> #include <boost/units/systems/si/length.hpp> @@ -35,11 +36,9 @@ namespace units { // fails due to redefinition of tag -//BOOST_UNITS_REGISTER_BASE_DIMENSION(erroneous_tag,-1); -BOOST_UNITS_REGISTER_BASE_DIMENSION(world_space_tag,101); -BOOST_UNITS_REGISTER_BASE_DIMENSION(object_space_tag,102); -//typedef base_dimension<101> world_space_tag; -//typedef base_dimension<102> object_space_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 { |
From: Steven W. <ste...@us...> - 2007-04-21 18:49:16
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1949/boost-sandbox/libs/units/test Modified Files: Jamfile.v2 Added Files: test_negative_denominator.cpp Log Message: handle negative denominator correctly Index: Jamfile.v2 =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/Jamfile.v2,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Jamfile.v2 15 Apr 2007 01:53:58 -0000 1.3 +++ Jamfile.v2 21 Apr 2007 18:49:14 -0000 1.4 @@ -15,6 +15,7 @@ test-suite units : [ compile test_predicates.cpp : $(UNIT_REQUIREMENTS) : ] + [ compile test_negative_denominator.cpp : $(UNIT_REQUIREMENTS) : ] [ run test_dimensionless_quantity.cpp : : : $(UNIT_REQUIREMENTS) : ] [ run test_implicit_conversion.cpp : : : $(UNIT_REQUIREMENTS) : ] [ run test_quantity.cpp : : : $(UNIT_REQUIREMENTS) : ] --- NEW FILE: test_negative_denominator.cpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /** \file \brief test_negative_denominator.cpp \detailed Test negative denominator for static_rational class. Output: @verbatim @endverbatim **/ #include <boost/units/static_rational.hpp> #include <boost/mpl/assert.hpp> #include <boost/type_traits/is_same.hpp> BOOST_MPL_ASSERT((boost::is_same<boost::units::static_rational<-2,1>::type, boost::units::static_rational<2, -1>::type>)); int main() { } |
From: Steven W. <ste...@us...> - 2007-04-21 18:49:15
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1949/boost-sandbox/boost/units Modified Files: static_rational.hpp Log Message: handle negative denominator correctly Index: static_rational.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/static_rational.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- static_rational.hpp 13 Apr 2007 06:08:52 -0000 1.7 +++ static_rational.hpp 21 Apr 2007 18:49:14 -0000 1.8 @@ -71,7 +71,7 @@ /// greatest common divisor of N and D // need cast to signed because static_gcd returns unsigned long static const integer_type den = - static_cast<integer_type>(boost::math::static_gcd<nabs,dabs>::value); + static_cast<integer_type>(boost::math::static_gcd<nabs,dabs>::value) * ((D < 0) ? -1 : 1); public: // for mpl arithmetic support |
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10552/boost-sandbox/boost/units/systems/si/codata Modified Files: atomic_and_nuclear_constants.hpp electromagnetic_constants.hpp physico-chemical_constants.hpp universal_constants.hpp Added Files: typedefs.hpp Log Message: made constants safe to use before main Index: universal_constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata/universal_constants.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- universal_constants.hpp 5 Apr 2007 21:08:54 -0000 1.5 +++ universal_constants.hpp 20 Apr 2007 23:43:08 -0000 1.6 @@ -11,8 +11,6 @@ #ifndef BOOST_UNITS_CODATA_UNIVERSAL_CONSTANTS_HPP #define BOOST_UNITS_CODATA_UNIVERSAL_CONSTANTS_HPP -#if BOOST_UNITS_HAS_TYPEOF - #include <boost/units/static_constant.hpp> #include <boost/units/systems/si/constants.hpp> @@ -25,6 +23,7 @@ #include <boost/units/systems/si/resistance.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/si/time.hpp> +#include <boost/units/systems/si/velocity.hpp> #include <boost/units/systems/si/volume.hpp> /// \file @@ -45,27 +44,27 @@ // UNIVERSAL /// speed of light -BOOST_UNITS_AUTO_STATIC_CONSTANT(c,(value_and_uncertainty<double>(299792458.0,0.0)*meters/second)); +BOOST_UNITS_PHYSICAL_CONSTANT(c,quantity<velocity>,299792458.0*meters/second,0.0*meters/second); /// magnetic constant (exactly 4 pi x 10^(-7) - error is due to finite precision of pi) -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_0,(value_and_uncertainty<double>(12.56637061435917295385057353311801153679e-7,0.0)*newtons/ampere/ampere)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_0,quantity<force_over_current_squared>,12.56637061435917295385057353311801153679e-7*newtons/ampere/ampere,0.0*newtons/ampere/ampere); /// electric constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(epsilon_0,(value_and_uncertainty<double>(8.854187817620389850536563031710750260608e-12,0.0)*farad/meter)); +BOOST_UNITS_PHYSICAL_CONSTANT(epsilon_0,quantity<capacitance_over_length>,8.854187817620389850536563031710750260608e-12*farad/meter,0.0*farad/meter); /// characteristic impedance of vacuum -BOOST_UNITS_AUTO_STATIC_CONSTANT(Z_0,(value_and_uncertainty<double>(376.7303134617706554681984004203193082686,0.0)*ohm)); +BOOST_UNITS_PHYSICAL_CONSTANT(Z_0,quantity<resistance>,376.7303134617706554681984004203193082686*ohm,0.0*ohm); /// Newtonian constant of gravitation -BOOST_UNITS_AUTO_STATIC_CONSTANT(G,(value_and_uncertainty<double>(6.67428e-11,6.7e-15)*cubic_meters/kilogram/second/second)); +BOOST_UNITS_PHYSICAL_CONSTANT(G,quantity<volume_over_mass_time_squared>,6.67428e-11*cubic_meters/kilogram/second/second,6.7e-15*cubic_meters/kilogram/second/second); /// Planck constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(h,(value_and_uncertainty<double>(6.62606896e-34,3.3e-41)*joule*seconds)); +BOOST_UNITS_PHYSICAL_CONSTANT(h,quantity<energy_time>,6.62606896e-34*joule*seconds,3.3e-41*joule*seconds); /// Dirac constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(hbar,(value_and_uncertainty<double>(1.054571628e-34,5.3e-42)*joule*seconds)); +BOOST_UNITS_PHYSICAL_CONSTANT(hbar,quantity<energy_time>,1.054571628e-34*joule*seconds,5.3e-42*joule*seconds); /// Planck mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_P,(value_and_uncertainty<double>(2.17644e-8,1.1e-12)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_P,quantity<mass>,2.17644e-8*kilograms,1.1e-12*kilograms); /// Planck temperature -BOOST_UNITS_AUTO_STATIC_CONSTANT(T_P,(value_and_uncertainty<double>(1.416785e32,7.1e27)*kelvin)); +BOOST_UNITS_PHYSICAL_CONSTANT(T_P,quantity<temperature>,1.416785e32*kelvin,7.1e27*kelvin); /// Planck length -BOOST_UNITS_AUTO_STATIC_CONSTANT(l_P,(value_and_uncertainty<double>(1.616252e-35,8.1e-40)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(l_P,quantity<length>,1.616252e-35*meters,8.1e-40*meters); /// Planck time -BOOST_UNITS_AUTO_STATIC_CONSTANT(t_P,(value_and_uncertainty<double>(5.39124e-44,2.7e-48)*seconds)); +BOOST_UNITS_PHYSICAL_CONSTANT(t_P,quantity<time>,5.39124e-44*seconds,2.7e-48*seconds); } // namespace CODATA @@ -77,6 +76,4 @@ } // namespace boost -#endif // BOOST_UNITS_HAS_TYPEOF - #endif // BOOST_UNITS_CODATA_UNIVERSAL_CONSTANTS_HPP --- NEW FILE: typedefs.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_CODATA_TYPEDEFS_HPP #define BOOST_UNITS_CODATA_TYPEDEFS_HPP #include <boost/units/operators.hpp> #include <boost/units/systems/si/amount.hpp> #include <boost/units/systems/si/area.hpp> #include <boost/units/systems/si/capacitance.hpp> #include <boost/units/systems/si/electric_charge.hpp> #include <boost/units/systems/si/current.hpp> #include <boost/units/systems/si/electric_potential.hpp> #include <boost/units/systems/si/energy.hpp> #include <boost/units/systems/si/force.hpp> #include <boost/units/systems/si/frequency.hpp> #include <boost/units/systems/si/magnetic_flux_density.hpp> #include <boost/units/systems/si/mass.hpp> #include <boost/units/systems/si/power.hpp> #include <boost/units/systems/si/solid_angle.hpp> #include <boost/units/systems/si/temperature.hpp> #include <boost/units/systems/si/time.hpp> #include <boost/units/systems/si/volume.hpp> namespace boost { namespace units { namespace SI { namespace constants { namespace CODATA { typedef divide_typeof_helper<frequency,electric_potential>::type frequency_over_electric_potential; typedef divide_typeof_helper<electric_charge,mass>::type electric_charge_over_mass; typedef divide_typeof_helper<mass,amount>::type mass_over_amount; typedef divide_typeof_helper<energy,magnetic_flux_density>::type energy_over_magnetic_flux_density; typedef divide_typeof_helper<frequency,magnetic_flux_density>::type frequency_over_magnetic_flux_density; typedef divide_typeof_helper<current,energy>::type current_over_energy; typedef divide_typeof_helper<dimensionless,amount>::type inverse_amount; typedef divide_typeof_helper<energy,temperature>::type energy_over_temperature; typedef divide_typeof_helper<energy_over_temperature,amount>::type energy_over_temperature_amount; typedef divide_typeof_helper< divide_typeof_helper<power,area>::type, power_typeof_helper<temperature,static_rational<4> >::type >::type power_over_area_temperature_4; typedef multiply_typeof_helper<power,area>::type power_area; typedef divide_typeof_helper<power_area,solid_angle>::type power_area_over_solid_angle; typedef multiply_typeof_helper<length,temperature>::type length_temperature; typedef divide_typeof_helper<frequency,temperature>::type frequency_over_temperature; typedef divide_typeof_helper<divide_typeof_helper<force,current>::type,current>::type force_over_current_squared; typedef divide_typeof_helper<capacitance,length>::type capacitance_over_length; typedef divide_typeof_helper< divide_typeof_helper<divide_typeof_helper<volume,mass>::type,time>::type, time >::type volume_over_mass_time_squared; typedef multiply_typeof_helper<energy,time>::type energy_time; typedef divide_typeof_helper<electric_charge,amount>::type electric_charge_over_amount; } // namespace CODATA } // namespace constants } // namespace SI } // namespace units } // namespace boost #endif Index: physico-chemical_constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata/physico-chemical_constants.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- physico-chemical_constants.hpp 5 Apr 2007 21:08:54 -0000 1.6 +++ physico-chemical_constants.hpp 20 Apr 2007 23:43:08 -0000 1.7 @@ -11,8 +11,6 @@ #ifndef BOOST_UNITS_CODATA_PHYSICO_CHEMICAL_CONSTANTS_HPP #define BOOST_UNITS_CODATA_PHYSICO_CHEMICAL_CONSTANTS_HPP -#if BOOST_UNITS_HAS_TYPEOF - #include <boost/units/static_constant.hpp> #include <boost/units/systems/si/constants.hpp> @@ -26,6 +24,8 @@ #include <boost/units/systems/si/solid_angle.hpp> #include <boost/units/systems/si/temperature.hpp> +#include <boost/units/systems/si/codata/typedefs.hpp> + /// \file /// CODATA recommended values of fundamental physico-chemical constants /// CODATA 2006 values as of 2007/03/30 @@ -42,27 +42,27 @@ // PHYSICO-CHEMICAL /// Avogadro constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(N_A,(value_and_uncertainty<double>(6.02214179e23,3.0e16)/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(N_A,quantity<inverse_amount>,6.02214179e23/mole,3.0e16/mole); /// atomic mass constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_u,(value_and_uncertainty<double>(1.660538782e-27,8.3e-35)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_u,quantity<mass>,1.660538782e-27*kilograms,8.3e-35*kilograms); /// Faraday constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(F,(value_and_uncertainty<double>(96485.3399,2.4e-3)*coulombs/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(F,quantity<electric_charge_over_amount>,96485.3399*coulombs/mole,2.4e-3*coulombs/mole); /// molar gas constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(R,(value_and_uncertainty<double>(8.314472,1.5e-5)*joules/kelvin/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(R,quantity<energy_over_temperature_amount>,8.314472*joules/kelvin/mole,1.5e-5*joules/kelvin/mole); /// Boltzmann constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(k_B,(value_and_uncertainty<double>(1.3806504e-23,2.4e-29)*joules/kelvin)); +BOOST_UNITS_PHYSICAL_CONSTANT(k_B,quantity<energy_over_temperature>,1.3806504e-23*joules/kelvin,2.4e-29*joules/kelvin); /// Stefan-Boltzmann constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(sigma_SB,(value_and_uncertainty<double>(5.670400e-8,4.0e-13)*watts/square_meter/pow<4>(kelvin))); +BOOST_UNITS_PHYSICAL_CONSTANT(sigma_SB,quantity<power_over_area_temperature_4>,5.670400e-8*watts/square_meter/pow<4>(kelvin),4.0e-13*watts/square_meter/pow<4>(kelvin)); /// first radiation constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(c_1,(value_and_uncertainty<double>(3.74177118e-16,1.9e-23)*watt*square_meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(c_1,quantity<power_area>,3.74177118e-16*watt*square_meters,1.9e-23*watt*square_meters); /// first radiation constant for spectral radiance -BOOST_UNITS_AUTO_STATIC_CONSTANT(c_1L,(value_and_uncertainty<double>(1.191042759e-16,5.9e-24)*watt*square_meters/steradian)); +BOOST_UNITS_PHYSICAL_CONSTANT(c_1L,quantity<power_area_over_solid_angle>,1.191042759e-16*watt*square_meters/steradian,5.9e-24*watt*square_meters/steradian); /// second radiation constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(c_2,(value_and_uncertainty<double>(1.4387752e-2,2.5e-8)*meter*kelvin)); +BOOST_UNITS_PHYSICAL_CONSTANT(c_2,quantity<length_temperature>,1.4387752e-2*meter*kelvin,2.5e-8*meter*kelvin); /// Wien displacement law constant : lambda_max T -BOOST_UNITS_AUTO_STATIC_CONSTANT(b,(value_and_uncertainty<double>(2.8977685e-3,5.1e-9)*meter*kelvin)); +BOOST_UNITS_PHYSICAL_CONSTANT(b,quantity<length_temperature>,2.8977685e-3*meter*kelvin,5.1e-9*meter*kelvin); /// Wien displacement law constant : nu_max/T -BOOST_UNITS_AUTO_STATIC_CONSTANT(b_prime,(value_and_uncertainty<double>(5.878933e10,1.0e15)*hertz/kelvin)); +BOOST_UNITS_PHYSICAL_CONSTANT(b_prime,quantity<frequency_over_temperature>,5.878933e10*hertz/kelvin,1.0e15*hertz/kelvin); } // namespace CODATA @@ -74,6 +74,4 @@ } // namespace boost -#endif // BOOST_UNITS_HAS_TYPEOF - #endif // BOOST_UNITS_CODATA_PHYSICO_CHEMICAL_CONSTANTS_HPP Index: atomic_and_nuclear_constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata/atomic_and_nuclear_constants.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- atomic_and_nuclear_constants.hpp 5 Apr 2007 21:08:54 -0000 1.7 +++ atomic_and_nuclear_constants.hpp 20 Apr 2007 23:43:08 -0000 1.8 @@ -11,8 +11,6 @@ #ifndef BOOST_UNITS_CODATA_ATOMIC_AND_NUCLEAR_CONSTANTS_HPP #define BOOST_UNITS_CODATA_ATOMIC_AND_NUCLEAR_CONSTANTS_HPP -#if BOOST_UNITS_HAS_TYPEOF - #include <boost/units/static_constant.hpp> #include <boost/units/systems/si/constants.hpp> @@ -20,10 +18,14 @@ #include <boost/units/systems/si/area.hpp> #include <boost/units/systems/si/electric_charge.hpp> #include <boost/units/systems/si/energy.hpp> +#include <boost/units/systems/si/frequency.hpp> #include <boost/units/systems/si/length.hpp> #include <boost/units/systems/si/mass.hpp> #include <boost/units/systems/si/magnetic_flux_density.hpp> #include <boost/units/systems/si/time.hpp> +#include <boost/units/systems/si/wavenumber.hpp> + +#include <boost/units/systems/si/codata/typedefs.hpp> /// \file /// CODATA recommended values of fundamental atomic and nuclear constants @@ -43,250 +45,250 @@ // ATOMIC AND NUCLEAR /// fine structure constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(alpha,(value_and_uncertainty<double>(7.2973525376e-3,5.0e-12)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(alpha,quantity<dimensionless>,7.2973525376e-3*dimensionless(),5.0e-12*dimensionless()); /// Rydberg constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(R_infinity,(value_and_uncertainty<double>(10973731.568527,7.3e-5)/meter)); +BOOST_UNITS_PHYSICAL_CONSTANT(R_infinity,quantity<wavenumber>,10973731.568527/meter,7.3e-5/meter); /// Bohr radius -BOOST_UNITS_AUTO_STATIC_CONSTANT(a_0,(value_and_uncertainty<double>(0.52917720859e-10,3.6e-20)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(a_0,quantity<length>,0.52917720859e-10*meters,3.6e-20*meters); /// Hartree energy -BOOST_UNITS_AUTO_STATIC_CONSTANT(E_h,(value_and_uncertainty<double>(4.35974394e-18,2.2e-25)*joules)); +BOOST_UNITS_PHYSICAL_CONSTANT(E_h,quantity<energy>,4.35974394e-18*joules,2.2e-25*joules); /// electron mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e,(value_and_uncertainty<double>(9.10938215e-31,4.5e-38)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_e,quantity<mass>,9.10938215e-31*kilograms,4.5e-38*kilograms); /// electron-muon mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_mu,(value_and_uncertainty<double>(4.83633171e-3,1.2e-10)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_e_over_m_mu,quantity<dimensionless>,4.83633171e-3*dimensionless(),1.2e-10*dimensionless()); /// electron-tau mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_tau,(value_and_uncertainty<double>(2.87564e-4,4.7e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_e_over_m_tau,quantity<dimensionless>,2.87564e-4*dimensionless(),4.7e-8*dimensionless()); /// electron-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_p,(value_and_uncertainty<double>(5.4461702177e-4,2.4e-13)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_e_over_m_p,quantity<dimensionless>,5.4461702177e-4*dimensionless(),2.4e-13*dimensionless()); /// electron-neutron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_n,(value_and_uncertainty<double>(5.4386734459e-4,3.3e-13)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_e_over_m_n,quantity<dimensionless>,5.4386734459e-4*dimensionless(),3.3e-13*dimensionless()); /// electron-deuteron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_d,(value_and_uncertainty<double>(2.7244371093e-4,1.2e-13)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_e_over_m_d,quantity<dimensionless>,2.7244371093e-4*dimensionless(),1.2e-13*dimensionless()); /// electron-alpha particle mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_e_over_m_alpha,(value_and_uncertainty<double>(1.37093355570e-4,5.8e-14)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_e_over_m_alpha,quantity<dimensionless>,1.37093355570e-4*dimensionless(),5.8e-14*dimensionless()); /// electron charge to mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(e_over_m_e,(value_and_uncertainty<double>(1.758820150e11,4.4e3)*coulombs/kilogram)); +BOOST_UNITS_PHYSICAL_CONSTANT(e_over_m_e,quantity<electric_charge_over_mass>,1.758820150e11*coulombs/kilogram,4.4e3*coulombs/kilogram); /// electron molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_e,(value_and_uncertainty<double>(5.4857990943e-7,2.3e-16)*kilograms/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(M_e,quantity<mass_over_amount>,5.4857990943e-7*kilograms/mole,2.3e-16*kilograms/mole); /// Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C,(value_and_uncertainty<double>(2.4263102175e-12,3.3e-21)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(lambda_C,quantity<length>,2.4263102175e-12*meters,3.3e-21*meters); /// classical electron radius -BOOST_UNITS_AUTO_STATIC_CONSTANT(r_e,(value_and_uncertainty<double>(2.8179402894e-15,5.8e-24)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(r_e,quantity<length>,2.8179402894e-15*meters,5.8e-24*meters); /// Thompson cross section -BOOST_UNITS_AUTO_STATIC_CONSTANT(sigma_e,(value_and_uncertainty<double>(0.6652458558e-28,2.7e-37)*square_meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(sigma_e,quantity<area>,0.6652458558e-28*square_meters,2.7e-37*square_meters); /// electron magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e,(value_and_uncertainty<double>(-928.476377e-26,2.3e-31)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_e,quantity<energy_over_magnetic_flux_density>,-928.476377e-26*joules/tesla,2.3e-31*joules/tesla); /// electron-Bohr magenton moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_B,(value_and_uncertainty<double>(-1.00115965218111,7.4e-13)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_e_over_mu_B,quantity<dimensionless>,-1.00115965218111*dimensionless(),7.4e-13*dimensionless()); /// electron-nuclear magneton moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_N,(value_and_uncertainty<double>(-183.28197092,8.0e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_e_over_mu_N,quantity<dimensionless>,-183.28197092*dimensionless(),8.0e-7*dimensionless()); /// electron magnetic moment anomaly -BOOST_UNITS_AUTO_STATIC_CONSTANT(a_e,(value_and_uncertainty<double>(1.15965218111e-3,7.4e-13)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(a_e,quantity<dimensionless>,1.15965218111e-3*dimensionless(),7.4e-13*dimensionless()); /// electron g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_e,(value_and_uncertainty<double>(-2.0023193043622,1.5e-12)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(g_e,quantity<dimensionless>,-2.0023193043622*dimensionless(),1.5e-12*dimensionless()); /// electron-muon magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_mu,(value_and_uncertainty<double>(206.7669877,5.2e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_e_over_mu_mu,quantity<dimensionless>,206.7669877*dimensionless(),5.2e-6*dimensionless()); /// electron-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_p,(value_and_uncertainty<double>(-658.2106848,5.4e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_e_over_mu_p,quantity<dimensionless>,-658.2106848*dimensionless(),5.4e-6*dimensionless()); /// electron-shielded proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_p_prime,(value_and_uncertainty<double>(-658.2275971,7.2e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_e_over_mu_p_prime,quantity<dimensionless>,-658.2275971*dimensionless(),7.2e-6*dimensionless()); /// electron-neutron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_n,(value_and_uncertainty<double>(960.92050,2.3e-4)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_e_over_mu_n,quantity<dimensionless>,960.92050*dimensionless(),2.3e-4*dimensionless()); /// electron-deuteron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_d,(value_and_uncertainty<double>(-2143.923498,1.8e-5)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_e_over_mu_d,quantity<dimensionless>,-2143.923498*dimensionless(),1.8e-5*dimensionless()); /// electron-shielded helion magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_e_over_mu_h_prime,(value_and_uncertainty<double>(864.058257,1.0e-5)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_e_over_mu_h_prime,quantity<dimensionless>,864.058257*dimensionless(),1.0e-5*dimensionless()); /// electron gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_e,(value_and_uncertainty<double>(1.760859770e11,4.4e3)/second/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(gamma_e,quantity<frequency_over_magnetic_flux_density>,1.760859770e11/second/tesla,4.4e3/second/tesla); /// muon mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu,(value_and_uncertainty<double>(1.88353130e-28,1.1e-35)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_mu,quantity<mass>,1.88353130e-28*kilograms,1.1e-35*kilograms); /// muon-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_e,(value_and_uncertainty<double>(206.7682823,5.2e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_mu_over_m_e,quantity<dimensionless>,206.7682823*dimensionless(),5.2e-6*dimensionless()); /// muon-tau mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_tau,(value_and_uncertainty<double>(5.94592e-2,9.7e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_mu_over_m_tau,quantity<dimensionless>,5.94592e-2*dimensionless(),9.7e-6*dimensionless()); /// muon-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_p,(value_and_uncertainty<double>(0.1126095261,2.9e-9)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_mu_over_m_p,quantity<dimensionless>,0.1126095261*dimensionless(),2.9e-9*dimensionless()); /// muon-neutron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_mu_over_m_n,(value_and_uncertainty<double>(0.1124545167,2.9e-9)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_mu_over_m_n,quantity<dimensionless>,0.1124545167*dimensionless(),2.9e-9*dimensionless()); /// muon molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_mu,(value_and_uncertainty<double>(0.1134289256e-3,2.9e-12)*kilograms/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(M_mu,quantity<mass_over_amount>,0.1134289256e-3*kilograms/mole,2.9e-12*kilograms/mole); /// muon Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_mu,(value_and_uncertainty<double>(11.73444104e-15,3.0e-22)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(lambda_C_mu,quantity<length>,11.73444104e-15*meters,3.0e-22*meters); /// muon magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu,(value_and_uncertainty<double>(-4.49044786e-26,1.6e-33)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_mu,quantity<energy_over_magnetic_flux_density>,-4.49044786e-26*joules/tesla,1.6e-33*joules/tesla); /// muon-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu_over_mu_B,(value_and_uncertainty<double>(-4.84197049e-3,1.2e-10)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_mu_over_mu_B,quantity<dimensionless>,-4.84197049e-3*dimensionless(),1.2e-10*dimensionless()); /// muon-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu_over_mu_N,(value_and_uncertainty<double>(-8.89059705,2.3e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_mu_over_mu_N,quantity<dimensionless>,-8.89059705*dimensionless(),2.3e-7*dimensionless()); /// muon magnetic moment anomaly -BOOST_UNITS_AUTO_STATIC_CONSTANT(a_mu,(value_and_uncertainty<double>(1.16592069e-3,6.0e-10)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(a_mu,quantity<dimensionless>,1.16592069e-3*dimensionless(),6.0e-10*dimensionless()); /// muon g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_mu,(value_and_uncertainty<double>(-2.0023318414,1.2e-9)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(g_mu,quantity<dimensionless>,-2.0023318414*dimensionless(),1.2e-9*dimensionless()); /// muon-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_mu_over_mu_p,(value_and_uncertainty<double>(-3.183345137,8.5e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_mu_over_mu_p,quantity<dimensionless>,-3.183345137*dimensionless(),8.5e-8*dimensionless()); /// tau mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau,(value_and_uncertainty<double>(3.16777e-27,5.2e-31)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_tau,quantity<mass>,3.16777e-27*kilograms,5.2e-31*kilograms); /// tau-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_e,(value_and_uncertainty<double>(3477.48,5.7e-1)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_tau_over_m_e,quantity<dimensionless>,3477.48*dimensionless(),5.7e-1*dimensionless()); /// tau-muon mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_mu,(value_and_uncertainty<double>(16.8183,2.7e-3)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_tau_over_m_mu,quantity<dimensionless>,16.8183*dimensionless(),2.7e-3*dimensionless()); /// tau-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_p,(value_and_uncertainty<double>(1.89390,3.1e-4)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_tau_over_m_p,quantity<dimensionless>,1.89390*dimensionless(),3.1e-4*dimensionless()); /// tau-neutron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_tau_over_m_n,(value_and_uncertainty<double>(1.89129,3.1e-4)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_tau_over_m_n,quantity<dimensionless>,1.89129*dimensionless(),3.1e-4*dimensionless()); /// tau molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_tau,(value_and_uncertainty<double>(1.90768e-3,3.1e-7)*kilograms/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(M_tau,quantity<mass_over_amount>,1.90768e-3*kilograms/mole,3.1e-7*kilograms/mole); /// tau Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_tau,(value_and_uncertainty<double>(0.69772e-15,1.1e-19)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(lambda_C_tau,quantity<length>,0.69772e-15*meters,1.1e-19*meters); /// proton mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p,(value_and_uncertainty<double>(1.672621637e-27,8.3e-35)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_p,quantity<mass>,1.672621637e-27*kilograms,8.3e-35*kilograms); /// proton-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_e,(value_and_uncertainty<double>(1836.15267247,8.0e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_p_over_m_e,quantity<dimensionless>,1836.15267247*dimensionless(),8.0e-7*dimensionless()); /// proton-muon mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_mu,(value_and_uncertainty<double>(8.88024339,2.3e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_p_over_m_mu,quantity<dimensionless>,8.88024339*dimensionless(),2.3e-7*dimensionless()); /// proton-tau mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_tau,(value_and_uncertainty<double>(0.528012,8.6e-5)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_p_over_m_tau,quantity<dimensionless>,0.528012*dimensionless(),8.6e-5*dimensionless()); /// proton-neutron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_p_over_m_n,(value_and_uncertainty<double>(0.99862347824,4.6e-10)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_p_over_m_n,quantity<dimensionless>,0.99862347824*dimensionless(),4.6e-10*dimensionless()); /// proton charge to mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(e_over_m_p,(value_and_uncertainty<double>(9.57883392e7,2.4e0)*coulombs/kilogram)); +BOOST_UNITS_PHYSICAL_CONSTANT(e_over_m_p,quantity<electric_charge_over_mass>,9.57883392e7*coulombs/kilogram,2.4e0*coulombs/kilogram); /// proton molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_p,(value_and_uncertainty<double>(1.00727646677e-3,1.0e-13)*kilograms/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(M_p,quantity<mass_over_amount>,1.00727646677e-3*kilograms/mole,1.0e-13*kilograms/mole); /// proton Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_p,(value_and_uncertainty<double>(1.3214098446e-15,1.9e-24)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(lambda_C_p,quantity<length>,1.3214098446e-15*meters,1.9e-24*meters); /// proton rms charge radius -BOOST_UNITS_AUTO_STATIC_CONSTANT(R_p,(value_and_uncertainty<double>(0.8768e-15,6.9e-18)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(R_p,quantity<length>,0.8768e-15*meters,6.9e-18*meters); /// proton magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p,(value_and_uncertainty<double>(1.410606662e-26,3.7e-34)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_p,quantity<energy_over_magnetic_flux_density>,1.410606662e-26*joules/tesla,3.7e-34*joules/tesla); /// proton-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_over_mu_B,(value_and_uncertainty<double>(1.521032209e-3,1.2e-11)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_p_over_mu_B,quantity<dimensionless>,1.521032209e-3*dimensionless(),1.2e-11*dimensionless()); /// proton-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_over_mu_N,(value_and_uncertainty<double>(2.792847356,2.3e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_p_over_mu_N,quantity<dimensionless>,2.792847356*dimensionless(),2.3e-8*dimensionless()); /// proton g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_p,(value_and_uncertainty<double>(5.585694713,4.6e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(g_p,quantity<dimensionless>,5.585694713*dimensionless(),4.6e-8*dimensionless()); /// proton-neutron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_over_mu_n,(value_and_uncertainty<double>(-1.45989806,3.4e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_p_over_mu_n,quantity<dimensionless>,-1.45989806*dimensionless(),3.4e-7*dimensionless()); /// shielded proton magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_prime,(value_and_uncertainty<double>(1.410570419e-26,3.8e-34)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_p_prime,quantity<energy_over_magnetic_flux_density>,1.410570419e-26*joules/tesla,3.8e-34*joules/tesla); /// shielded proton-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_prime_over_mu_B,(value_and_uncertainty<double>(1.520993128e-3,1.7e-11)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_p_prime_over_mu_B,quantity<dimensionless>,1.520993128e-3*dimensionless(),1.7e-11*dimensionless()); /// shielded proton-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_p_prime_over_mu_N,(value_and_uncertainty<double>(2.792775598,3.0e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_p_prime_over_mu_N,quantity<dimensionless>,2.792775598*dimensionless(),3.0e-8*dimensionless()); /// proton magnetic shielding correction -BOOST_UNITS_AUTO_STATIC_CONSTANT(sigma_p_prime,(value_and_uncertainty<double>(25.694e-6,1.4e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(sigma_p_prime,quantity<dimensionless>,25.694e-6*dimensionless(),1.4e-8*dimensionless()); /// proton gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_p,(value_and_uncertainty<double>(2.675222099e8,7.0e0)/second/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(gamma_p,quantity<frequency_over_magnetic_flux_density>,2.675222099e8/second/tesla,7.0e0/second/tesla); /// shielded proton gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_p_prime,(value_and_uncertainty<double>(2.675153362e8,7.3e0)/second/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(gamma_p_prime,quantity<frequency_over_magnetic_flux_density>,2.675153362e8/second/tesla,7.3e0/second/tesla); /// neutron mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n,(value_and_uncertainty<double>(1.674927211e-27,8.4e-35)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_n,quantity<mass>,1.674927211e-27*kilograms,8.4e-35*kilograms); /// neutron-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_e,(value_and_uncertainty<double>(1838.6836605,1.1e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_n_over_m_e,quantity<dimensionless>,1838.6836605*dimensionless(),1.1e-6*dimensionless()); /// neutron-muon mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_mu,(value_and_uncertainty<double>(8.89248409,2.3e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_n_over_m_mu,quantity<dimensionless>,8.89248409*dimensionless(),2.3e-7*dimensionless()); /// neutron-tau mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_tau,(value_and_uncertainty<double>(0.528740,8.6e-5)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_n_over_m_tau,quantity<dimensionless>,0.528740*dimensionless(),8.6e-5*dimensionless()); /// neutron-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_n_over_m_p,(value_and_uncertainty<double>(1.00137841918,4.6e-10)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_n_over_m_p,quantity<dimensionless>,1.00137841918*dimensionless(),4.6e-10*dimensionless()); /// neutron molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_n,(value_and_uncertainty<double>(1.00866491597e-3,4.3e-13)*kilograms/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(M_n,quantity<mass_over_amount>,1.00866491597e-3*kilograms/mole,4.3e-13*kilograms/mole); /// neutron Compton wavelength -BOOST_UNITS_AUTO_STATIC_CONSTANT(lambda_C_n,(value_and_uncertainty<double>(1.3195908951e-15,2.0e-24)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(lambda_C_n,quantity<length>,1.3195908951e-15*meters,2.0e-24*meters); /// neutron magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n,(value_and_uncertainty<double>(-0.96623641e-26,2.3e-33)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_n,quantity<energy_over_magnetic_flux_density>,-0.96623641e-26*joules/tesla,2.3e-33*joules/tesla); /// neutron g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_n,(value_and_uncertainty<double>(-3.82608545,9.0e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(g_n,quantity<dimensionless>,-3.82608545*dimensionless(),9.0e-7*dimensionless()); /// neutron-electron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n_over_mu_e,(value_and_uncertainty<double>(1.04066882e-3,2.5e-10)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_n_over_mu_e,quantity<dimensionless>,1.04066882e-3*dimensionless(),2.5e-10*dimensionless()); /// neutron-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n_over_mu_p,(value_and_uncertainty<double>(-0.68497934,1.6e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_n_over_mu_p,quantity<dimensionless>,-0.68497934*dimensionless(),1.6e-7*dimensionless()); /// neutron-shielded proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_n_over_mu_p_prime,(value_and_uncertainty<double>(-0.68499694,1.6e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_n_over_mu_p_prime,quantity<dimensionless>,-0.68499694*dimensionless(),1.6e-7*dimensionless()); /// neutron gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_n,(value_and_uncertainty<double>(1.83247185e8,4.3e1)/second/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(gamma_n,quantity<frequency_over_magnetic_flux_density>,1.83247185e8/second/tesla,4.3e1/second/tesla); /// deuteron mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_d,(value_and_uncertainty<double>(3.34358320e-27,1.7e-34)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_d,quantity<mass>,3.34358320e-27*kilograms,1.7e-34*kilograms); /// deuteron-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_d_over_m_e,(value_and_uncertainty<double>(3670.4829654,1.6e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_d_over_m_e,quantity<dimensionless>,3670.4829654*dimensionless(),1.6e-6*dimensionless()); /// deuteron-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_d_over_m_p,(value_and_uncertainty<double>(1.99900750108,2.2e-10)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_d_over_m_p,quantity<dimensionless>,1.99900750108*dimensionless(),2.2e-10*dimensionless()); /// deuteron molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_d,(value_and_uncertainty<double>(2.013553212724e-3,7.8e-14)*kilograms/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(M_d,quantity<mass_over_amount>,2.013553212724e-3*kilograms/mole,7.8e-14*kilograms/mole); /// deuteron rms charge radius -BOOST_UNITS_AUTO_STATIC_CONSTANT(R_d,(value_and_uncertainty<double>(2.1402e-15,2.8e-18)*meters)); +BOOST_UNITS_PHYSICAL_CONSTANT(R_d,quantity<length>,2.1402e-15*meters,2.8e-18*meters); /// deuteron magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d,(value_and_uncertainty<double>(0.433073465e-26,1.1e-34)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_d,quantity<energy_over_magnetic_flux_density>,0.433073465e-26*joules/tesla,1.1e-34*joules/tesla); /// deuteron-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_B,(value_and_uncertainty<double>(0.4669754556e-3,3.9e-12)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_d_over_mu_B,quantity<dimensionless>,0.4669754556e-3*dimensionless(),3.9e-12*dimensionless()); /// deuteron-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_N,(value_and_uncertainty<double>(0.8574382308,7.2e-9)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_d_over_mu_N,quantity<dimensionless>,0.8574382308*dimensionless(),7.2e-9*dimensionless()); /// deuteron g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_d,(value_and_uncertainty<double>(0.8574382308,7.2e-9)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(g_d,quantity<dimensionless>,0.8574382308*dimensionless(),7.2e-9*dimensionless()); /// deuteron-electron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_e,(value_and_uncertainty<double>(-4.664345537e-4,3.9e-12)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_d_over_mu_e,quantity<dimensionless>,-4.664345537e-4*dimensionless(),3.9e-12*dimensionless()); /// deuteron-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_p,(value_and_uncertainty<double>(0.3070122070,2.4e-9)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_d_over_mu_p,quantity<dimensionless>,0.3070122070*dimensionless(),2.4e-9*dimensionless()); /// deuteron-neutron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_d_over_mu_n,(value_and_uncertainty<double>(-0.44820652,1.1e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_d_over_mu_n,quantity<dimensionless>,-0.44820652*dimensionless(),1.1e-7*dimensionless()); /// triton mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_t,(value_and_uncertainty<double>(5.00735588e-27,2.5e-34)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_t,quantity<mass>,5.00735588e-27*kilograms,2.5e-34*kilograms); /// triton-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_t_over_m_e,(value_and_uncertainty<double>(5496.9215269,5.1e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_t_over_m_e,quantity<dimensionless>,5496.9215269*dimensionless(),5.1e-6*dimensionless()); /// triton-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_t_over_m_p,(value_and_uncertainty<double>(2.9937170309,2.5e-9)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_t_over_m_p,quantity<dimensionless>,2.9937170309*dimensionless(),2.5e-9*dimensionless()); /// triton molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_t,(value_and_uncertainty<double>(3.0155007134e-3,2.5e-12)*kilograms/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(M_t,quantity<mass_over_amount>,3.0155007134e-3*kilograms/mole,2.5e-12*kilograms/mole); /// triton magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t,(value_and_uncertainty<double>(1.504609361e-26,4.2e-34)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_t,quantity<energy_over_magnetic_flux_density>,1.504609361e-26*joules/tesla,4.2e-34*joules/tesla); /// triton-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_B,(value_and_uncertainty<double>(1.622393657e-3,2.1e-11)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_t_over_mu_B,quantity<dimensionless>,1.622393657e-3*dimensionless(),2.1e-11*dimensionless()); /// triton-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_N,(value_and_uncertainty<double>(2.978962448,3.8e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_t_over_mu_N,quantity<dimensionless>,2.978962448*dimensionless(),3.8e-8*dimensionless()); /// triton g-factor -BOOST_UNITS_AUTO_STATIC_CONSTANT(g_t,(value_and_uncertainty<double>(5.957924896,7.6e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(g_t,quantity<dimensionless>,5.957924896*dimensionless(),7.6e-8*dimensionless()); /// triton-electron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_e,(value_and_uncertainty<double>(-1.620514423e-3,2.1e-11)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_t_over_mu_e,quantity<dimensionless>,-1.620514423e-3*dimensionless(),2.1e-11*dimensionless()); /// triton-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_p,(value_and_uncertainty<double>(1.066639908,1.0e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_t_over_mu_p,quantity<dimensionless>,1.066639908*dimensionless(),1.0e-8*dimensionless()); /// triton-neutron magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_t_over_mu_n,(value_and_uncertainty<double>(-1.55718553,3.7e-7)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_t_over_mu_n,quantity<dimensionless>,-1.55718553*dimensionless(),3.7e-7*dimensionless()); /// helion mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_h,(value_and_uncertainty<double>(5.00641192e-27,2.5e-34)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_h,quantity<mass>,5.00641192e-27*kilograms,2.5e-34*kilograms); /// helion-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_h_over_m_e,(value_and_uncertainty<double>(5495.8852765,5.2e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_h_over_m_e,quantity<dimensionless>,5495.8852765*dimensionless(),5.2e-6*dimensionless()); /// helion-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_h_over_m_p,(value_and_uncertainty<double>(2.9931526713,2.6e-9)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_h_over_m_p,quantity<dimensionless>,2.9931526713*dimensionless(),2.6e-9*dimensionless()); /// helion molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_h,(value_and_uncertainty<double>(3.0149322473e-3,2.6e-12)*kilograms/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(M_h,quantity<mass_over_amount>,3.0149322473e-3*kilograms/mole,2.6e-12*kilograms/mole); /// helion shielded magnetic moment -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime,(value_and_uncertainty<double>(-1.074552982e-26,3.0e-34)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_h_prime,quantity<energy_over_magnetic_flux_density>,-1.074552982e-26*joules/tesla,3.0e-34*joules/tesla); /// shielded helion-Bohr magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_B,(value_and_uncertainty<double>(-1.158671471e-3,1.4e-11)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_h_prime_over_mu_B,quantity<dimensionless>,-1.158671471e-3*dimensionless(),1.4e-11*dimensionless()); /// shielded helion-nuclear magneton ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_N,(value_and_uncertainty<double>(-2.127497718,2.5e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_h_prime_over_mu_N,quantity<dimensionless>,-2.127497718*dimensionless(),2.5e-8*dimensionless()); /// shielded helion-proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_p,(value_and_uncertainty<double>(-0.761766558,1.1e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_h_prime_over_mu_p,quantity<dimensionless>,-0.761766558*dimensionless(),1.1e-8*dimensionless()); /// shielded helion-shielded proton magnetic moment ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_h_prime_over_mu_p_prime,(value_and_uncertainty<double>(-0.7617861313,3.3e-8)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_h_prime_over_mu_p_prime,quantity<dimensionless>,-0.7617861313*dimensionless(),3.3e-8*dimensionless()); /// shielded helion gyromagnetic ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(gamma_h_prime,(value_and_uncertainty<double>(2.037894730e8,5.6e-0)/second/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(gamma_h_prime,quantity<frequency_over_magnetic_flux_density>,2.037894730e8/second/tesla,5.6e-0/second/tesla); /// alpha particle mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_alpha,(value_and_uncertainty<double>(6.64465620e-27,3.3e-34)*kilograms)); +BOOST_UNITS_PHYSICAL_CONSTANT(m_alpha,quantity<mass>,6.64465620e-27*kilograms,3.3e-34*kilograms); /// alpha-electron mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_alpha_over_m_e,(value_and_uncertainty<double>(7294.2995365,3.1e-6)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_alpha_over_m_e,quantity<dimensionless>,7294.2995365*dimensionless(),3.1e-6*dimensionless()); /// alpha-proton mass ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(m_alpha_over_m_p,(value_and_uncertainty<double>(3.97259968951,4.1e-10)*dimensionless())); +BOOST_UNITS_PHYSICAL_CONSTANT(m_alpha_over_m_p,quantity<dimensionless>,3.97259968951*dimensionless(),4.1e-10*dimensionless()); /// alpha molar mass -BOOST_UNITS_AUTO_STATIC_CONSTANT(M_alpha,(value_and_uncertainty<double>(4.001506179127e-3,6.2e-14)*kilograms/mole)); +BOOST_UNITS_PHYSICAL_CONSTANT(M_alpha,quantity<mass_over_amount>,4.001506179127e-3*kilograms/mole,6.2e-14*kilograms/mole); } // namespace CODATA @@ -298,6 +300,4 @@ } // namespace boost -#endif // BOOST_UNITS_HAS_TYPEOF - #endif // BOOST_UNITS_CODATA_ATOMIC_AND_NUCLEAR_CONSTANTS_HPP Index: electromagnetic_constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/codata/electromagnetic_constants.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- electromagnetic_constants.hpp 5 Apr 2007 21:08:54 -0000 1.5 +++ electromagnetic_constants.hpp 20 Apr 2007 23:43:08 -0000 1.6 @@ -11,8 +11,6 @@ #ifndef BOOST_UNITS_CODATA_ELECTROMAGNETIC_CONSTANTS_HPP #define BOOST_UNITS_CODATA_ELECTROMAGNETIC_CONSTANTS_HPP -#if BOOST_UNITS_HAS_TYPEOF - #include <boost/units/static_constant.hpp> #include <boost/units/systems/si/constants.hpp> @@ -26,6 +24,8 @@ #include <boost/units/systems/si/magnetic_flux_density.hpp> #include <boost/units/systems/si/resistance.hpp> +#include <boost/units/systems/si/codata/typedefs.hpp> + /// \file /// CODATA recommended values of fundamental electromagnetic constants /// CODATA 2006 values as of 2007/03/30 @@ -44,21 +44,21 @@ // ELECTROMAGNETIC /// elementary charge -BOOST_UNITS_AUTO_STATIC_CONSTANT(e,(value_and_uncertainty<double>(1.602176487e-19,4.0e-27)*coulombs)); +BOOST_UNITS_PHYSICAL_CONSTANT(e,quantity<electric_charge>,1.602176487e-19*coulombs,4.0e-27*coulombs); /// elementary charge to Planck constant ratio -BOOST_UNITS_AUTO_STATIC_CONSTANT(e_over_h,(value_and_uncertainty<double>(2.417989454e14,6.0e6)*amperes/joule)); +BOOST_UNITS_PHYSICAL_CONSTANT(e_over_h,quantity<current_over_energy>,2.417989454e14*amperes/joule,6.0e6*amperes/joule); /// magnetic flux quantum -BOOST_UNITS_AUTO_STATIC_CONSTANT(Phi_0,(value_and_uncertainty<double>(2.067833667e-15,5.2e-23)*webers)); +BOOST_UNITS_PHYSICAL_CONSTANT(Phi_0,quantity<magnetic_flux>,2.067833667e-15*webers,5.2e-23*webers); /// conductance quantum -BOOST_UNITS_AUTO_STATIC_CONSTANT(G_0,(value_and_uncertainty<double>(7.7480917004e-5,5.3e-14)*siemens)); +BOOST_UNITS_PHYSICAL_CONSTANT(G_0,quantity<conductance>,7.7480917004e-5*siemens,5.3e-14*siemens); /// Josephson constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(K_J,(value_and_uncertainty<double>(483597.891e9,1.2e7)*hertz/volt)); +BOOST_UNITS_PHYSICAL_CONSTANT(K_J,quantity<frequency_over_electric_potential>,483597.891e9*hertz/volt,1.2e7*hertz/volt); /// von Klitzing constant -BOOST_UNITS_AUTO_STATIC_CONSTANT(R_K,(value_and_uncertainty<double>(25812.807557,1.77e-5)*ohms)); +BOOST_UNITS_PHYSICAL_CONSTANT(R_K,quantity<resistance>,25812.807557*ohms,1.77e-5*ohms); /// Bohr magneton -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_B,(value_and_uncertainty<double>(927.400915e-26,2.3e-31)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_B,quantity<energy_over_magnetic_flux_density>,927.400915e-26*joules/tesla,2.3e-31*joules/tesla); /// nuclear magneton -BOOST_UNITS_AUTO_STATIC_CONSTANT(mu_N,(value_and_uncertainty<double>(5.05078324e-27,1.3e-34)*joules/tesla)); +BOOST_UNITS_PHYSICAL_CONSTANT(mu_N,quantity<energy_over_magnetic_flux_density>,5.05078324e-27*joules/tesla,1.3e-34*joules/tesla); } // namespace CODATA @@ -70,6 +70,4 @@ } // namespace boost -#endif // BOOST_UNITS_HAS_TYPEOF - #endif // BOOST_UNITS_CODATA_ELECTROMAGNETIC_CONSTANTS_HPP |
From: Steven W. <ste...@us...> - 2007-04-20 23:43:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10552/boost-sandbox/boost/units/systems/si Modified Files: constants.hpp Log Message: made constants safe to use before main Index: constants.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/si/constants.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- constants.hpp 13 Apr 2007 01:38:04 -0000 1.3 +++ constants.hpp 20 Apr 2007 23:43:08 -0000 1.4 @@ -17,64 +17,131 @@ #include <boost/io/ios_state.hpp> +#include <boost/units/static_constant.hpp> + namespace boost { namespace units { -template<class Y> -class value_and_uncertainty -{ - public: - typedef value_and_uncertainty<Y> this_type; - typedef Y value_type; - - value_and_uncertainty(const value_type& val = value_type(), - const value_type& err = value_type()) : - value_(val), - uncertainty_(std::abs(err)) - { } - - value_and_uncertainty(const this_type& source) : - value_(source.value_), - uncertainty_(source.uncertainty_) - { } - - //~value_and_uncertainty() { } - - this_type& operator=(const this_type& source) - { - value_ = source.value_; - uncertainty_ = source.uncertainty_; - - return *this; - } - - operator value_type() const { return value_; } - - value_type value() const { return value_; } - value_type uncertainty() const { return uncertainty_; } - value_type lower_bound() const { return value_-uncertainty_; } - value_type upper_bound() const { return value_+uncertainty_; } +template<class Base> +struct constant : Base {}; - private: - value_type value_, - uncertainty_; -}; +template<class Base> +struct physical_constant : Base {}; + +#define BOOST_UNITS_DEFINE_HELPER(name, symbol, template_name) \ + \ +template<class T, class Arg1, class Arg2> \ +struct name ## _typeof_helper<constant<T>, template_name<Arg1, Arg2> >\ +{ \ + typedef typename name ## _typeof_helper<typename T::value_type, template_name<Arg1, Arg2> >::type type;\ +}; \ + \ +template<class T, class Arg1, class Arg2> \ +struct name ## _typeof_helper<template_name<Arg1, Arg2>, constant<T> >\ +{ \ + typedef typename name ## _typeof_helper<template_name<Arg1, Arg2>, typename T::value_type>::type type;\ +}; \ + \ +template<class T, class Arg1, class Arg2> \ +typename name ## _typeof_helper<typename T::value_type, template_name<Arg1, Arg2> >::type \ +operator symbol(const constant<T>& t, const template_name<Arg1, Arg2>& u)\ +{ \ + return(t.value() symbol u); \ +} \ + \ +template<class T, class Arg1, class Arg2> \ +typename name ## _typeof_helper<typename T::value_type, template_name<Arg1, Arg2> >::type \ +operator symbol(const template_name<Arg1, Arg2>& u, const constant<T>& t)\ +{ \ + return(u symbol t.value()); \ +} + +BOOST_UNITS_DEFINE_HELPER(add, +, unit) +BOOST_UNITS_DEFINE_HELPER(add, +, quantity) +BOOST_UNITS_DEFINE_HELPER(subtract, -, unit) +BOOST_UNITS_DEFINE_HELPER(subtract, -, quantity) +BOOST_UNITS_DEFINE_HELPER(multiply, *, unit) +BOOST_UNITS_DEFINE_HELPER(multiply, *, quantity) +BOOST_UNITS_DEFINE_HELPER(divide, /, unit) +BOOST_UNITS_DEFINE_HELPER(divide, /, quantity) + +#undef BOOST_UNITS_DEFINE_HELPER + +#define BOOST_UNITS_DEFINE_HELPER(name, symbol) \ + \ +template<class T1, class T2> \ +struct name ## _typeof_helper<constant<T1>, constant<T2> > \ +{ \ + typedef typename name ## _typeof_helper<typename T1::value_type, typename T2::value_type>::type type;\ +}; \ + \ +template<class T1, class T2> \ +typename name ## _typeof_helper<typename T1::value_type, typename T2::value_type>::type \ +operator symbol(const constant<T1>& t, const constant<T2>& u) \ +{ \ + return(t.value() symbol u.value()); \ +} \ + \ +template<class T1, class T2> \ +struct name ## _typeof_helper<constant<T1>, T2> \ +{ \ + typedef typename name ## _typeof_helper<typename T1::value_type, T2>::type type;\ +}; \ + \ +template<class T1, class T2> \ +struct name ## _typeof_helper<T1, constant<T2> > \ +{ \ + typedef typename name ## _typeof_helper<T1, typename T2::value_type>::type type;\ +}; \ + \ +template<class T1, class T2> \ +typename name ## _typeof_helper<typename T1::value_type, T2>::type \ +operator symbol(const constant<T1>& t, const T2& u) \ +{ \ + return(t.value() symbol u); \ +} \ + \ +template<class T1, class T2> \ +typename name ## _typeof_helper<T1, typename T2::value_type>::type \ +operator symbol(const T1& t, const constant<T2>& u) \ +{ \ + return(t symbol u.value()); \ +} + +BOOST_UNITS_DEFINE_HELPER(add, +) +BOOST_UNITS_DEFINE_HELPER(subtract, -) +BOOST_UNITS_DEFINE_HELPER(multiply, *) +BOOST_UNITS_DEFINE_HELPER(divide, /) + +#undef BOOST_UNITS_DEFINE_HELPER + +#define BOOST_UNITS_PHYSICAL_CONSTANT(name, type, value_, uncertainty_) \ +struct name ## _t { \ + typedef type value_type; \ + operator value_type() const { return value_; } \ + value_type value() const { return value_; } \ + value_type uncertainty() const { return uncertainty_; } \ + value_type lower_bound() const { return value_-uncertainty_; } \ + value_type upper_bound() const { return value_+uncertainty_; } \ +}; \ +BOOST_UNITS_STATIC_CONSTANT(name, boost::units::constant<boost::units::physical_constant<name ## _t> >) // stream output template<class Y> inline -std::ostream& operator<<(std::ostream& os,const value_and_uncertainty<Y>& val) +std::ostream& operator<<(std::ostream& os,const physical_constant<Y>& val) { boost::io::ios_precision_saver precision_saver(os); //boost::io::ios_width_saver width_saver(os); boost::io::ios_flags_saver flags_saver(os); //os << std::setw(21); + typedef typename Y::value_type value_type; - if (val.uncertainty() > Y(0)) + if (val.uncertainty() > value_type()) { - const Y relative_uncertainty = std::abs(val.uncertainty()/val.value()); + const double relative_uncertainty = std::abs(val.uncertainty()/val.value()); const double exponent = std::log10(relative_uncertainty); const long digits_of_precision = static_cast<long>(std::ceil(std::abs(exponent)))+3; |
From: Steven W. <ste...@us...> - 2007-04-20 23:43:17
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10552/boost-sandbox/libs/units/example Modified Files: unit_example_4.cpp Log Message: made constants safe to use before main Index: unit_example_4.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_4.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- unit_example_4.cpp 15 Apr 2007 07:09:03 -0000 1.11 +++ unit_example_4.cpp 20 Apr 2007 23:43:08 -0000 1.12 @@ -23,57 +23,57 @@ 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) +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 +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 : 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^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^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 +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 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 : 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*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) //] @@ -90,22 +90,22 @@ dimless = 1 //[unit_example_4_output_8 -v1 = 2 m s^(-1) +v1 = 2 m s^-1 //] //[unit_example_4_output_9 -F = 1 m kg s^(-2) +F = 1 m kg s^-2 dx = 1 m -E = 1 m^2 kg s^(-2) +E = 1 m^2 kg s^-2 //] //[unit_example_4_output_10 r = 5e-07 m -P = 101325 m^(-1) kg s^(-2) +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) +R = 8.31447 m^2 kg s^-2 K^-1 mol^-1 //] //[unit_example_4_output_11 @@ -115,10 +115,10 @@ //] //[unit_example_4_output_12 -V = (12.5,0) m^2 kg s^(-3) A^(-1) +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) +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 @@ -128,7 +128,7 @@ //] //[unit_example_4_output_14 -w*y^2/(u*x)^2 = 10.17(+/-3.52328) m^(-1) +w*y^2/(u*x)^2 = 10.17(+/-3.52328) m^-1 w/(u*x)^(1/2) = 3.19612(+/-0.160431) dimensionless //] @@ -493,7 +493,7 @@ sstream2 << "T = 310 K" << std::endl; sstream2 << "n = " << 2.05835e-17 << " mol" << std::endl; #if BOOST_UNITS_HAS_TYPEOF - sstream2 << "R = 8.314472 (rel. unc. = " << 1.8e-6 << ") m^2 kg s^-2 K^-1 mol^-1" << std::endl; + 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 @@ -508,11 +508,13 @@ 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()); |