diff options
Diffstat (limited to 'boost/units')
-rw-r--r-- | boost/units/base_units/cgs/biot.hpp | 2 | ||||
-rw-r--r-- | boost/units/conversion.hpp | 2 | ||||
-rw-r--r-- | boost/units/io.hpp | 81 | ||||
-rw-r--r-- | boost/units/systems/si/codata/physico-chemical_constants.hpp | 24 |
4 files changed, 55 insertions, 54 deletions
diff --git a/boost/units/base_units/cgs/biot.hpp b/boost/units/base_units/cgs/biot.hpp index 51eb5fc7bf..1fa03f2e8f 100644 --- a/boost/units/base_units/cgs/biot.hpp +++ b/boost/units/base_units/cgs/biot.hpp @@ -20,7 +20,7 @@ namespace units { namespace cgs { -typedef scaled_base_unit<boost::units::si::ampere_base_unit, scale<10, static_rational<-1> > > biot_base_unit; +typedef scaled_base_unit<boost::units::si::ampere_base_unit, scale<10, static_rational<+1> > > biot_base_unit; } // namespace cgs diff --git a/boost/units/conversion.hpp b/boost/units/conversion.hpp index beb641516e..2e5d4db6d4 100644 --- a/boost/units/conversion.hpp +++ b/boost/units/conversion.hpp @@ -159,7 +159,7 @@ namespace namespace_ { \ struct name_ ## _base_unit \ : base_unit<name_ ## _base_unit, unit::dimension_type, id> { \ static const char* name() { return(name_string_); } \ - static const char* symbol() { return(symbol_string_); }; \ + static const char* symbol() { return(symbol_string_); } \ }; \ } \ } \ diff --git a/boost/units/io.hpp b/boost/units/io.hpp index 338a919ea6..eda835568d 100644 --- a/boost/units/io.hpp +++ b/boost/units/io.hpp @@ -1,4 +1,4 @@ -// Boost.Units - A C++ library for zero-overhead dimensional analysis and +// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel @@ -24,6 +24,7 @@ #include <ios> #include <sstream> +#include <boost/assert.hpp> #include <boost/serialization/nvp.hpp> #include <boost/units/units_fwd.hpp> @@ -50,7 +51,7 @@ inline void serialize(Archive& ar,boost::units::quantity<Unit,Y>& q,const unsign { ar & boost::serialization::make_nvp("value", units::quantity_cast<Y&>(q)); } - + } // namespace serialization namespace units { @@ -59,9 +60,9 @@ namespace units { template<class T> std::string to_string(const T& t) { std::stringstream sstr; - + sstr << t; - + return sstr.str(); } @@ -125,7 +126,7 @@ enum autoprefix_mode namespace detail { template<bool> -struct xalloc_key_holder +struct xalloc_key_holder { static int value; static bool initialized; @@ -137,11 +138,11 @@ int xalloc_key_holder<b>::value = 0; template<bool b> bool xalloc_key_holder<b>::initialized = 0; -struct xalloc_key_initializer_t +struct xalloc_key_initializer_t { - xalloc_key_initializer_t() + xalloc_key_initializer_t() { - if (!xalloc_key_holder<true>::initialized) + if (!xalloc_key_holder<true>::initialized) { xalloc_key_holder<true>::value = std::ios_base::xalloc(); xalloc_key_holder<true>::initialized = true; @@ -150,7 +151,7 @@ struct xalloc_key_initializer_t }; namespace /**/ { - + xalloc_key_initializer_t xalloc_key_initializer; } // namespace @@ -158,54 +159,54 @@ xalloc_key_initializer_t xalloc_key_initializer; } // namespace detail /// returns flags controlling output. -inline long get_flags(std::ios_base& ios, long mask) +inline long get_flags(std::ios_base& ios, long mask) { return(ios.iword(detail::xalloc_key_holder<true>::value) & mask); } /// Set new flags controlling output format. -inline void set_flags(std::ios_base& ios, long new_flags, long mask) +inline void set_flags(std::ios_base& ios, long new_flags, long mask) { - assert((~mask & new_flags) == 0); + BOOST_ASSERT((~mask & new_flags) == 0); long& flags = ios.iword(detail::xalloc_key_holder<true>::value); flags = (flags & ~mask) | new_flags; } /// returns flags controlling output format. -inline format_mode get_format(std::ios_base& ios) +inline format_mode get_format(std::ios_base& ios) { return(static_cast<format_mode>((get_flags)(ios, fmt_mask))); } /// Set new flags controlling output format. -inline void set_format(std::ios_base& ios, format_mode new_mode) +inline void set_format(std::ios_base& ios, format_mode new_mode) { (set_flags)(ios, new_mode, fmt_mask); } /// Set new flags for type_name output format. -inline std::ios_base& typename_format(std::ios_base& ios) +inline std::ios_base& typename_format(std::ios_base& ios) { (set_format)(ios, typename_fmt); return(ios); } /// set new flag for raw format output, for example "m". -inline std::ios_base& raw_format(std::ios_base& ios) +inline std::ios_base& raw_format(std::ios_base& ios) { (set_format)(ios, raw_fmt); return(ios); } /// set new format flag for symbol output, for example "m". -inline std::ios_base& symbol_format(std::ios_base& ios) +inline std::ios_base& symbol_format(std::ios_base& ios) { (set_format)(ios, symbol_fmt); return(ios); } /// set new format for name output, for example "meter". -inline std::ios_base& name_format(std::ios_base& ios) +inline std::ios_base& name_format(std::ios_base& ios) { (set_format)(ios, name_fmt); return(ios); @@ -266,7 +267,7 @@ inline std::string base_unit_symbol_string(const T&) return base_unit_info<typename T::tag_type>::symbol() + exponent_string(typename T::value_type()); } -template<class T> +template<class T> inline std::string base_unit_name_string(const T&) { return base_unit_info<typename T::tag_type>::name() + exponent_string(typename T::value_type()); @@ -297,7 +298,7 @@ struct symbol_string_impl<1> static void value(std::string& str) { str += base_unit_symbol_string(typename Begin::item()); - }; + } }; }; @@ -316,12 +317,12 @@ struct symbol_string_impl<0> }; template<int N> -struct scale_symbol_string_impl +struct scale_symbol_string_impl { template<class Begin> - struct apply + struct apply { - static void value(std::string& str) + static void value(std::string& str) { str += Begin::item::symbol(); scale_symbol_string_impl<N - 1>::template apply<typename Begin::next>::value(str); @@ -333,7 +334,7 @@ template<> struct scale_symbol_string_impl<0> { template<class Begin> - struct apply + struct apply { static void value(std::string&) { } }; @@ -364,7 +365,7 @@ struct name_string_impl<1> static void value(std::string& str) { str += base_unit_name_string(typename Begin::item()); - }; + } }; }; @@ -382,12 +383,12 @@ struct name_string_impl<0> }; template<int N> -struct scale_name_string_impl +struct scale_name_string_impl { template<class Begin> - struct apply + struct apply { - static void value(std::string& str) + static void value(std::string& str) { str += Begin::item::name(); scale_name_string_impl<N - 1>::template apply<typename Begin::next>::value(str); @@ -399,7 +400,7 @@ template<> struct scale_name_string_impl<0> { template<class Begin> - struct apply + struct apply { static void value(std::string&) { } }; @@ -463,14 +464,14 @@ to_string_impl(const unit<Dimension, heterogeneous_system<heterogeneous_system_i f.template append_scale_to<Scale>(str); std::string without_scale = f(unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, dimensionless_type> > >()); - + if (f.is_default_string(without_scale, unit<Dimension, heterogeneous_system<heterogeneous_system_impl<Units, Dimension, dimensionless_type> > >())) { str += "("; str += without_scale; str += ")"; - } - else + } + else { str += without_scale; } @@ -1010,27 +1011,27 @@ name_string(const unit<Dimension, System>&) template<class Char, class Traits, class Dimension, class System> inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, System>& u) { - if (units::get_format(os) == typename_fmt) + if (units::get_format(os) == typename_fmt) { detail::do_print(os, typename_string(u)); } - else if (units::get_format(os) == raw_fmt) + else if (units::get_format(os) == raw_fmt) { detail::do_print(os, detail::to_string_impl(u, detail::format_raw_symbol_impl())); } - else if (units::get_format(os) == symbol_fmt) + else if (units::get_format(os) == symbol_fmt) { detail::do_print(os, symbol_string(u)); } - else if (units::get_format(os) == name_fmt) + else if (units::get_format(os) == name_fmt) { detail::do_print(os, name_string(u)); } - else + else { - assert(!"The format mode must be one of: typename_format, raw_format, name_format, symbol_format"); + BOOST_ASSERT_MSG(false, "The format mode must be one of: typename_format, raw_format, name_format, symbol_format"); } - + return(os); } @@ -1057,7 +1058,7 @@ inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Tra } else { - assert(!"Autoprefixing must be one of: no_prefix, engineering_prefix, binary_prefix"); + BOOST_ASSERT_MSG(false, "Autoprefixing must be one of: no_prefix, engineering_prefix, binary_prefix"); } return(os); } diff --git a/boost/units/systems/si/codata/physico-chemical_constants.hpp b/boost/units/systems/si/codata/physico-chemical_constants.hpp index 38975bbfdc..e9ed035f9c 100644 --- a/boost/units/systems/si/codata/physico-chemical_constants.hpp +++ b/boost/units/systems/si/codata/physico-chemical_constants.hpp @@ -30,7 +30,7 @@ /// \file /// CODATA recommended values of fundamental physico-chemical constants -/// CODATA 2006 values as of 2007/03/30 +/// CODATA 2014 values as of 2016/04/26 namespace boost { @@ -44,27 +44,27 @@ namespace codata { // PHYSICO-CHEMICAL /// Avogadro constant -BOOST_UNITS_PHYSICAL_CONSTANT(N_A,quantity<inverse_amount>,6.02214179e23/mole,3.0e16/mole); +BOOST_UNITS_PHYSICAL_CONSTANT(N_A,quantity<inverse_amount>,6.022140857e23/mole,7.4e15/mole); /// atomic mass constant -BOOST_UNITS_PHYSICAL_CONSTANT(m_u,quantity<mass>,1.660538782e-27*kilograms,8.3e-35*kilograms); +BOOST_UNITS_PHYSICAL_CONSTANT(m_u,quantity<mass>,1.660539040e-27*kilograms,2.0e-35*kilograms); /// Faraday constant -BOOST_UNITS_PHYSICAL_CONSTANT(F,quantity<electric_charge_over_amount>,96485.3399*coulombs/mole,2.4e-3*coulombs/mole); +BOOST_UNITS_PHYSICAL_CONSTANT(F,quantity<electric_charge_over_amount>,96485.33289*coulombs/mole,5.9e-4*coulombs/mole); /// molar gas constant -BOOST_UNITS_PHYSICAL_CONSTANT(R,quantity<energy_over_temperature_amount>,8.314472*joules/kelvin/mole,1.5e-5*joules/kelvin/mole); +BOOST_UNITS_PHYSICAL_CONSTANT(R,quantity<energy_over_temperature_amount>,8.3144598*joules/kelvin/mole,4.8e-06*joules/kelvin/mole); /// Boltzmann constant -BOOST_UNITS_PHYSICAL_CONSTANT(k_B,quantity<energy_over_temperature>,1.3806504e-23*joules/kelvin,2.4e-29*joules/kelvin); +BOOST_UNITS_PHYSICAL_CONSTANT(k_B,quantity<energy_over_temperature>,1.38064852e-23*joules/kelvin,7.9e-30*joules/kelvin); /// Stefan-Boltzmann constant -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)); +BOOST_UNITS_PHYSICAL_CONSTANT(sigma_SB,quantity<power_over_area_temperature_4>,5.670367e-8*watts/square_meter/pow<4>(kelvin),1.3e-13*watts/square_meter/pow<4>(kelvin)); /// first radiation constant -BOOST_UNITS_PHYSICAL_CONSTANT(c_1,quantity<power_area>,3.74177118e-16*watt*square_meters,1.9e-23*watt*square_meters); +BOOST_UNITS_PHYSICAL_CONSTANT(c_1,quantity<power_area>,3.741771790e-16*watt*square_meters,4.6e-24*watt*square_meters); /// first radiation constant for spectral radiance -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); +BOOST_UNITS_PHYSICAL_CONSTANT(c_1L,quantity<power_area_over_solid_angle>,1.191042953e-16*watt*square_meters/steradian,1.5e-24*watt*square_meters/steradian); /// second radiation constant -BOOST_UNITS_PHYSICAL_CONSTANT(c_2,quantity<length_temperature>,1.4387752e-2*meter*kelvin,2.5e-8*meter*kelvin); +BOOST_UNITS_PHYSICAL_CONSTANT(c_2,quantity<length_temperature>,1.43877736e-2*meter*kelvin,8.3e-9*meter*kelvin); /// Wien displacement law constant : lambda_max T -BOOST_UNITS_PHYSICAL_CONSTANT(b,quantity<length_temperature>,2.8977685e-3*meter*kelvin,5.1e-9*meter*kelvin); +BOOST_UNITS_PHYSICAL_CONSTANT(b,quantity<length_temperature>,2.8977729e-3*meter*kelvin,1.7e-9*meter*kelvin); /// Wien displacement law constant : nu_max/T -BOOST_UNITS_PHYSICAL_CONSTANT(b_prime,quantity<frequency_over_temperature>,5.878933e10*hertz/kelvin,1.0e15*hertz/kelvin); +BOOST_UNITS_PHYSICAL_CONSTANT(b_prime,quantity<frequency_over_temperature>,5.8789238e10*hertz/kelvin,3.4e4*hertz/kelvin); } // namespace codata |