forked from mpusz/mp-units
Merge branch 'master' into chiphogg/switch-to-mag
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
project(mp-units VERSION 0.8.0 LANGUAGES CXX)
|
||||
|
||||
set(projectPrefix UNITS_)
|
||||
|
||||
@@ -20,14 +20,43 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
function(validate_unparsed module prefix)
|
||||
if(${prefix}_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Invalid arguments '${${prefix}_UNPARSED_ARGUMENTS}' " "for module '${module}'")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(validate_argument_exists module prefix arg)
|
||||
if(NOT ${prefix}_${arg})
|
||||
message(FATAL_ERROR "'${arg}' not provided for module '${module}'")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(validate_arguments_exists module prefix)
|
||||
foreach(arg ${ARGN})
|
||||
validate_argument_exists(${module} ${prefix} ${arg})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# add_units_module(ModuleName <depependencies>...)
|
||||
# add_units_module(ModuleName
|
||||
# DEPENDENCIES <depependency>...
|
||||
# HEADERS <header_file>...)
|
||||
#
|
||||
function(add_units_module name)
|
||||
add_library(mp-units-${name} INTERFACE)
|
||||
target_link_libraries(mp-units-${name} INTERFACE ${ARGN})
|
||||
# parse arguments
|
||||
set(multiValues DEPENDENCIES HEADERS)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 ARG "" "" "${multiValues}")
|
||||
|
||||
# validate and process arguments
|
||||
validate_unparsed(${name} ARG)
|
||||
validate_arguments_exists(${name} ARG DEPENDENCIES HEADERS)
|
||||
|
||||
# define the target for a module
|
||||
add_library(mp-units-${name} INTERFACE ${ARG_HEADERS})
|
||||
target_link_libraries(mp-units-${name} INTERFACE ${ARG_DEPENDENCIES})
|
||||
target_include_directories(
|
||||
mp-units-${name} ${unitsAsSystem} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
option(${projectPrefix}USE_LIBFMT "Enables usage of libfmt instead of the one from 'std'" ON)
|
||||
message(STATUS "${projectPrefix}USE_LIBFMT: ${${projectPrefix}USE_LIBFMT}")
|
||||
|
||||
add_units_module(core-fmt mp-units::core)
|
||||
add_units_module(core-fmt DEPENDENCIES mp-units::core HEADERS include/units/format.h)
|
||||
target_compile_definitions(mp-units-core-fmt INTERFACE ${projectPrefix}USE_LIBFMT=$<BOOL:${${projectPrefix}USE_LIBFMT}>)
|
||||
|
||||
if(${projectPrefix}USE_LIBFMT)
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(core-io mp-units::core)
|
||||
add_units_module(core-io DEPENDENCIES mp-units::core HEADERS include/units/quantity_io.h)
|
||||
|
||||
+28
-2
@@ -20,7 +20,7 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
# core library options
|
||||
set(${projectPrefix}DOWNCAST_MODE ON CACHE STRING "Select downcasting mode")
|
||||
@@ -34,7 +34,33 @@ include(CheckLibcxxInUse)
|
||||
check_libcxx_in_use(${projectPrefix}LIBCXX)
|
||||
|
||||
# core library definition
|
||||
add_library(mp-units-core INTERFACE)
|
||||
add_library(
|
||||
mp-units-core
|
||||
INTERFACE
|
||||
include/units/base_dimension.h
|
||||
include/units/chrono.h
|
||||
include/units/concepts.h
|
||||
include/units/customization_points.h
|
||||
include/units/derived_dimension.h
|
||||
include/units/exponent.h
|
||||
include/units/generic/angle.h
|
||||
include/units/generic/dimensionless.h
|
||||
include/units/kind.h
|
||||
include/units/magnitude.h
|
||||
include/units/math.h
|
||||
include/units/point_origin.h
|
||||
include/units/prefix.h
|
||||
include/units/quantity.h
|
||||
include/units/quantity_cast.h
|
||||
include/units/quantity_kind.h
|
||||
include/units/quantity_point.h
|
||||
include/units/quantity_point_kind.h
|
||||
include/units/random.h
|
||||
include/units/ratio.h
|
||||
include/units/reference.h
|
||||
include/units/symbol_text.h
|
||||
include/units/unit.h
|
||||
)
|
||||
target_compile_features(mp-units-core INTERFACE cxx_std_20)
|
||||
target_link_libraries(mp-units-core INTERFACE gsl::gsl-lite)
|
||||
target_include_directories(
|
||||
|
||||
@@ -50,8 +50,7 @@ namespace units {
|
||||
* @tparam Symbol an unique identifier of the base dimension used to provide dimensional analysis support
|
||||
* @tparam U a base unit to be used for this base dimension
|
||||
*/
|
||||
template<basic_fixed_string Symbol, Unit U>
|
||||
requires U::is_named
|
||||
template<basic_fixed_string Symbol, NamedUnit U>
|
||||
struct base_dimension {
|
||||
static constexpr auto symbol = Symbol; ///< Unique base dimension identifier
|
||||
using base_unit = U; ///< Base unit adopted for this dimension
|
||||
|
||||
@@ -37,25 +37,14 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
// PrefixFamily
|
||||
struct prefix_family;
|
||||
|
||||
/**
|
||||
* @brief A concept matching a prefix family
|
||||
*
|
||||
* Satisfied by all types derived from `prefix_family`
|
||||
*/
|
||||
template<typename T>
|
||||
concept PrefixFamily = std::derived_from<T, prefix_family>;
|
||||
|
||||
// Prefix
|
||||
namespace detail {
|
||||
|
||||
template<PrefixFamily PF, ratio R>
|
||||
template<ratio R>
|
||||
struct prefix_base;
|
||||
|
||||
template<PrefixFamily PF, ratio R>
|
||||
void to_prefix_base(const volatile prefix_base<PF, R>*);
|
||||
template<ratio R>
|
||||
void to_prefix_base(const volatile prefix_base<R>*);
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -87,9 +76,18 @@ void to_base_scaled_unit(const volatile scaled_unit<M, U>*);
|
||||
template<typename T>
|
||||
concept Unit = requires(T* t) { detail::to_base_scaled_unit(t); };
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename>
|
||||
inline constexpr bool is_named = false;
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
concept NamedUnit = Unit<T> && detail::is_named<T>;
|
||||
|
||||
// BaseDimension
|
||||
template<basic_fixed_string Symbol, Unit U>
|
||||
requires U::is_named
|
||||
template<basic_fixed_string Symbol, NamedUnit U>
|
||||
struct base_dimension;
|
||||
|
||||
namespace detail {
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ inline constexpr bool same_scaled_units = false;
|
||||
template<typename... Es, Unit... Us>
|
||||
inline constexpr bool same_scaled_units<exponent_list<Es...>, Us...> = (UnitOf<Us, typename Es::dimension> && ...);
|
||||
|
||||
// derived_unit
|
||||
// derived_scaled_unit
|
||||
|
||||
template<Unit... Us, typename... Es>
|
||||
constexpr Magnitude auto derived_mag(exponent_list<Es...>)
|
||||
@@ -44,6 +44,6 @@ constexpr Magnitude auto derived_mag(exponent_list<Es...>)
|
||||
}
|
||||
|
||||
template<DerivedDimension D, Unit... Us>
|
||||
using derived_unit = scaled_unit<derived_mag<Us...>(typename D::recipe()), typename D::coherent_unit::reference>;
|
||||
using derived_scaled_unit = scaled_unit<derived_mag<Us...>(typename D::recipe()), typename D::coherent_unit::reference>;
|
||||
|
||||
} // namespace units::detail
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <units/bits/external/text_tools.h>
|
||||
#include <units/derived_dimension.h>
|
||||
#include <units/prefix.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::detail {
|
||||
|
||||
@@ -57,28 +58,19 @@ constexpr auto ratio_text()
|
||||
}
|
||||
}
|
||||
|
||||
template<ratio R, typename PrefixFamily, std::size_t SymbolLen>
|
||||
template<Unit U, ratio R, std::size_t SymbolLen>
|
||||
constexpr auto prefix_or_ratio_text()
|
||||
{
|
||||
if constexpr (R.num == 1 && R.den == 1 && R.exp == 0) {
|
||||
// no ratio/prefix
|
||||
return basic_fixed_string("");
|
||||
} else {
|
||||
if constexpr (!is_same_v<PrefixFamily, no_prefix>) {
|
||||
// try to form a prefix
|
||||
using prefix = downcast<detail::prefix_base<PrefixFamily, R>>;
|
||||
// try to form a prefix
|
||||
using prefix = downcast<detail::prefix_base<R>>;
|
||||
|
||||
if constexpr (!is_same_v<prefix, prefix_base<PrefixFamily, R>>) {
|
||||
// print as a prefixed unit
|
||||
return prefix::symbol;
|
||||
} else {
|
||||
// print as a ratio of the coherent unit
|
||||
constexpr auto txt = ratio_text<R>();
|
||||
if constexpr (SymbolLen > 0 && txt.standard().size() > 0)
|
||||
return txt + basic_fixed_string(" ");
|
||||
else
|
||||
return txt;
|
||||
}
|
||||
if constexpr (can_be_prefixed<U> && !is_same_v<prefix, prefix_base<R>>) {
|
||||
// print as a prefixed unit
|
||||
return prefix::symbol;
|
||||
} else {
|
||||
// print as a ratio of the coherent unit
|
||||
constexpr auto txt = ratio_text<R>();
|
||||
@@ -110,7 +102,7 @@ template<Exponent Exp>
|
||||
constexpr auto exponent_list_with_named_units(Exp)
|
||||
{
|
||||
using dim = TYPENAME Exp::dimension;
|
||||
if constexpr (dimension_unit<dim>::is_named) {
|
||||
if constexpr (NamedUnit<dimension_unit<dim>>) {
|
||||
return exponent_list<Exp>();
|
||||
} else {
|
||||
using recipe = TYPENAME dim::recipe;
|
||||
@@ -147,21 +139,16 @@ constexpr auto unit_text()
|
||||
// print as a prefix or ratio of a coherent unit
|
||||
using coherent_unit = dimension_unit<Dim>;
|
||||
|
||||
if constexpr (has_symbol<coherent_unit>) {
|
||||
// use predefined coherent unit symbol
|
||||
constexpr auto symbol_text = coherent_unit::symbol;
|
||||
constexpr auto prefix_txt =
|
||||
prefix_or_ratio_text<as_ratio(U::mag / coherent_unit::mag), typename U::reference::prefix_family,
|
||||
symbol_text.standard().size()>();
|
||||
return prefix_txt + symbol_text;
|
||||
} else {
|
||||
// use derived dimension ingredients to create a unit symbol
|
||||
constexpr auto symbol_text = derived_dimension_unit_text<Dim>();
|
||||
constexpr auto prefix_txt =
|
||||
prefix_or_ratio_text<as_ratio(U::mag / coherent_unit::mag), typename U::reference::prefix_family,
|
||||
symbol_text.standard().size()>();
|
||||
return prefix_txt + symbol_text;
|
||||
}
|
||||
constexpr auto symbol_text = []() {
|
||||
if constexpr (has_symbol<coherent_unit>)
|
||||
return coherent_unit::symbol;
|
||||
else
|
||||
return derived_dimension_unit_text<Dim>();
|
||||
}();
|
||||
|
||||
constexpr auto prefix_txt =
|
||||
prefix_or_ratio_text<U, as_ratio(U::mag / coherent_unit::mag), symbol_text.standard().size()>();
|
||||
return prefix_txt + symbol_text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
struct radian : named_unit<radian, "rad", isq::si::prefix> {};
|
||||
struct radian : named_unit<radian, "rad"> {};
|
||||
|
||||
template<Unit U = radian>
|
||||
struct dim_angle : base_dimension<"A", U> {};
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
struct one : named_unit<one, "", no_prefix> {};
|
||||
struct percent : named_scaled_unit<percent, "%", no_prefix, as_magnitude<ratio(1, 100)>(), one> {};
|
||||
struct one : derived_unit<one> {};
|
||||
struct percent : named_scaled_unit<percent, "%", as_magnitude<ratio(1, 100)>(), one> {};
|
||||
|
||||
/**
|
||||
* @brief Dimension one
|
||||
|
||||
@@ -32,26 +32,10 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
/**
|
||||
* @brief The base for all prefix families
|
||||
*
|
||||
* Every prefix family should inherit from this type to satisfy PrefixFamily concept.
|
||||
*/
|
||||
struct prefix_family {};
|
||||
|
||||
/**
|
||||
* @brief No prefix possible for the unit
|
||||
*
|
||||
* This is a special prefix type tag specifying that the unit can not be scaled with any kind
|
||||
* of the prefix.
|
||||
*/
|
||||
struct no_prefix : prefix_family {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<PrefixFamily PF, ratio R>
|
||||
struct prefix_base : downcast_base<prefix_base<PF, R>> {
|
||||
using prefix_family = PF;
|
||||
template<ratio R>
|
||||
struct prefix_base : downcast_base<prefix_base<R>> {
|
||||
static constexpr Magnitude auto mag = as_magnitude<R>();
|
||||
};
|
||||
|
||||
@@ -64,17 +48,14 @@ struct prefix_base : downcast_base<prefix_base<PF, R>> {
|
||||
* - when defining a prefixed_unit its ratio is used to scale the reference unit and its
|
||||
* symbol is used to prepend to the symbol of referenced unit
|
||||
* - when printing the symbol of a scaled unit that was not predefined by the user but its
|
||||
* factor matches ratio of a prefix from the specified prefix family, its symbol will be
|
||||
* prepended to the symbol of the unit
|
||||
* factor matches ratio of a prefix, its symbol will be prepended to the symbol of the unit
|
||||
*
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
* @tparam PF a type of prefix family
|
||||
* @tparam Symbol a text representation of the prefix
|
||||
* @tparam R factor to be used to scale a unit
|
||||
*/
|
||||
template<typename Child, PrefixFamily PF, basic_symbol_text Symbol, ratio R>
|
||||
requires(!std::same_as<PF, no_prefix>)
|
||||
struct prefix : downcast_dispatch<Child, detail::prefix_base<PF, R>, downcast_mode::on> {
|
||||
template<typename Child, basic_symbol_text Symbol, ratio R>
|
||||
struct prefix : downcast_dispatch<Child, detail::prefix_base<R>, downcast_mode::on> {
|
||||
static constexpr auto symbol = Symbol;
|
||||
};
|
||||
|
||||
|
||||
@@ -45,6 +45,12 @@ inline constexpr auto make_quantity = [](auto&& v) {
|
||||
return quantity<typename decltype(R)::dimension, typename decltype(R)::unit, Rep>(std::forward<decltype(v)>(v));
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concept quantity_one =
|
||||
Quantity<T> &&
|
||||
(std::same_as<typename T::dimension, dim_one> || std::same_as<typename T::dimension, unknown_dimension<>>) &&
|
||||
detail::equivalent_unit<typename T::unit, typename T::dimension, ::units::one, typename T::dimension>::value;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<typename T>
|
||||
@@ -133,8 +139,7 @@ public:
|
||||
|
||||
template<typename Value>
|
||||
requires(safe_convertible_to_<std::remove_cvref_t<Value>, rep>)
|
||||
constexpr explicit(!(std::same_as<dimension, dim_one> && std::same_as<unit, ::units::one>)) quantity(Value&& v) :
|
||||
number_(std::forward<Value>(v))
|
||||
constexpr explicit(!detail::quantity_one<quantity>) quantity(Value&& v) : number_(std::forward<Value>(v))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -252,9 +257,9 @@ public:
|
||||
number_ *= rhs;
|
||||
return *this;
|
||||
}
|
||||
template<typename Rep2>
|
||||
constexpr quantity& operator*=(const dimensionless<units::one, Rep2>& rhs)
|
||||
requires requires(rep a, const Rep2 b) {
|
||||
template<detail::quantity_one Q>
|
||||
constexpr quantity& operator*=(const Q& rhs)
|
||||
requires requires(rep a, const typename Q::rep b) {
|
||||
{
|
||||
a *= b
|
||||
} -> std::same_as<rep&>;
|
||||
@@ -276,15 +281,15 @@ public:
|
||||
number_ /= rhs;
|
||||
return *this;
|
||||
}
|
||||
template<typename Rep2>
|
||||
constexpr quantity& operator/=(const dimensionless<units::one, Rep2>& rhs)
|
||||
requires requires(rep a, const Rep2 b) {
|
||||
template<detail::quantity_one Q>
|
||||
constexpr quantity& operator/=(const Q& rhs)
|
||||
requires requires(rep a, const typename Q::rep b) {
|
||||
{
|
||||
a /= b
|
||||
} -> std::same_as<rep&>;
|
||||
}
|
||||
{
|
||||
gsl_ExpectsAudit(rhs.number() != quantity_values<Rep2>::zero());
|
||||
gsl_ExpectsAudit(rhs.number() != quantity_values<typename Q::rep>::zero());
|
||||
number_ /= rhs.number();
|
||||
return *this;
|
||||
}
|
||||
@@ -302,15 +307,15 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Rep2>
|
||||
constexpr quantity& operator%=(const dimensionless<units::one, Rep2>& rhs)
|
||||
requires(!floating_point_<rep>) && (!floating_point_<Rep2>) && requires(rep a, const Rep2 b) {
|
||||
{
|
||||
a %= b
|
||||
} -> std::same_as<rep&>;
|
||||
}
|
||||
template<detail::quantity_one Q>
|
||||
constexpr quantity& operator%=(const Q& rhs)
|
||||
requires(!floating_point_<rep>) && (!floating_point_<typename Q::rep>) && requires(rep a, const typename Q::rep b) {
|
||||
{
|
||||
a %= b
|
||||
} -> std::same_as<rep&>;
|
||||
}
|
||||
{
|
||||
gsl_ExpectsAudit(rhs.number() != quantity_values<Rep2>::zero());
|
||||
gsl_ExpectsAudit(rhs.number() != quantity_values<typename Q::rep>::zero());
|
||||
number_ %= rhs.number();
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,10 @@ inline constexpr auto downcasted_kind_fn = [](auto q) {
|
||||
template<QuantityKind QK>
|
||||
inline constexpr auto& downcasted_kind = downcasted_kind_fn<typename QK::kind_type::base_kind>;
|
||||
|
||||
template<typename T, typename K>
|
||||
concept quantity_kind_one = QuantityKind<T> && equivalent<typename T::kind_type, downcast_kind<K, dim_one>> &&
|
||||
detail::quantity_one<typename T::quantity_type>;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
@@ -198,8 +202,8 @@ public:
|
||||
q_ *= rhs;
|
||||
return *this;
|
||||
}
|
||||
template<typename Rep2>
|
||||
constexpr quantity_kind& operator*=(const quantity_kind<downcast_kind<K, dim_one>, units::one, Rep2>& rhs)
|
||||
template<detail::quantity_kind_one<K> QK>
|
||||
constexpr quantity_kind& operator*=(const QK& rhs)
|
||||
requires requires(quantity_type q) { q *= rhs.common(); }
|
||||
{
|
||||
q_ *= rhs.common();
|
||||
@@ -214,8 +218,8 @@ public:
|
||||
q_ /= rhs;
|
||||
return *this;
|
||||
}
|
||||
template<typename Rep2>
|
||||
constexpr quantity_kind& operator/=(const quantity_kind<downcast_kind<K, dim_one>, units::one, Rep2>& rhs)
|
||||
template<detail::quantity_kind_one<K> QK>
|
||||
constexpr quantity_kind& operator/=(const QK& rhs)
|
||||
requires requires(quantity_type q) { q /= rhs.common(); }
|
||||
{
|
||||
q_ /= rhs.common();
|
||||
@@ -233,8 +237,7 @@ public:
|
||||
|
||||
template<QuantityKind QK>
|
||||
constexpr quantity_kind& operator%=(const QK& rhs)
|
||||
requires(QuantityKindEquivalentTo<QK, quantity_kind> ||
|
||||
std::same_as<typename QK::kind_type, downcast_kind<K, dim_one>>) &&
|
||||
requires(QuantityKindEquivalentTo<QK, quantity_kind> || detail::quantity_kind_one<QK, K>) &&
|
||||
requires(quantity_type q) { q %= rhs.common(); }
|
||||
{
|
||||
gsl_ExpectsAudit(rhs.common().number() != quantity_values<typename QK::rep>::zero());
|
||||
|
||||
@@ -78,16 +78,16 @@ struct basic_symbol_text {
|
||||
{
|
||||
detail::validate_ascii_string<N>(std.data_);
|
||||
}
|
||||
constexpr basic_symbol_text(const StandardCharT (&std)[N + 1], const char (&a)[M + 1]) noexcept :
|
||||
standard_(std), ascii_(a)
|
||||
constexpr basic_symbol_text(const StandardCharT (&std)[N + 1], const char (&ascii)[M + 1]) noexcept :
|
||||
standard_(std), ascii_(ascii)
|
||||
{
|
||||
detail::validate_ascii_string<M>(a);
|
||||
detail::validate_ascii_string<M>(ascii);
|
||||
}
|
||||
constexpr basic_symbol_text(const basic_fixed_string<StandardCharT, N>& std,
|
||||
const basic_fixed_string<char, M>& a) noexcept :
|
||||
standard_(std), ascii_(a)
|
||||
const basic_fixed_string<char, M>& ascii) noexcept :
|
||||
standard_(std), ascii_(ascii)
|
||||
{
|
||||
detail::validate_ascii_string<M>(a.data_);
|
||||
detail::validate_ascii_string<M>(ascii.data_);
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr auto& standard() { return standard_; }
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <units/bits/external/downcasting.h>
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/bits/derived_unit.h>
|
||||
#include <units/bits/derived_scaled_unit.h>
|
||||
#include <units/bits/external/fixed_string.h>
|
||||
#include <units/magnitude.h>
|
||||
#include <units/prefix.h>
|
||||
@@ -36,6 +36,13 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename>
|
||||
inline constexpr bool can_be_prefixed = false;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* @brief A common point for a hierarchy of units
|
||||
*
|
||||
@@ -63,58 +70,34 @@ using downcast_unit = downcast<scaled_unit<M, typename dimension_unit<D>::refere
|
||||
template<Unit U1, Unit U2>
|
||||
struct same_unit_reference : is_same<typename U1::reference, typename U2::reference> {};
|
||||
|
||||
/**
|
||||
* @brief An unnamed unit
|
||||
*
|
||||
* Defines a new unnamed (in most cases coherent) derived unit of a specific derived dimension
|
||||
* and it should be passed in this dimension's definition.
|
||||
*
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
*/
|
||||
template<typename Child>
|
||||
struct unit : downcast_dispatch<Child, scaled_unit<as_magnitude<1>(), Child>> {
|
||||
static constexpr bool is_named = false;
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A named unit
|
||||
*
|
||||
* Defines a named (in most cases coherent) unit that is then passed to a dimension definition.
|
||||
* A named unit may be used by other units defined with the prefix of the same type, unless
|
||||
* no_prefix is provided for PF template parameter (in such a case it is impossible to define
|
||||
* a prefix unit based on this one).
|
||||
* A named unit may be composed with a prefix to create a prefixed_unit.
|
||||
*
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
* @tparam Symbol a short text representation of the unit
|
||||
* @tparam PF no_prefix or a type of prefix family
|
||||
*/
|
||||
template<typename Child, basic_symbol_text Symbol, PrefixFamily PF>
|
||||
template<typename Child, basic_symbol_text Symbol>
|
||||
struct named_unit : downcast_dispatch<Child, scaled_unit<as_magnitude<1>(), Child>> {
|
||||
static constexpr bool is_named = true;
|
||||
static constexpr auto symbol = Symbol;
|
||||
using prefix_family = PF;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A scaled unit
|
||||
* @brief A named scaled unit
|
||||
*
|
||||
* Defines a new named unit that is a scaled version of another unit. Such unit can be used by
|
||||
* other units defined with the prefix of the same type, unless no_prefix is provided for PF
|
||||
* template parameter (in such a case it is impossible to define a prefix unit based on this
|
||||
* one).
|
||||
* Defines a new named unit that is a scaled version of another unit.
|
||||
* A named unit may be composed with a prefix to create a prefixed_unit.
|
||||
*
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
* @tparam Symbol a short text representation of the unit
|
||||
* @tparam PF no_prefix or a type of prefix family
|
||||
* @tparam M the Magnitude by which to scale U
|
||||
* @tparam U a reference unit to scale
|
||||
*/
|
||||
template<typename Child, basic_symbol_text Symbol, PrefixFamily PF, Magnitude auto M, Unit U>
|
||||
template<typename Child, basic_symbol_text Symbol, Magnitude auto M, Unit U>
|
||||
struct named_scaled_unit : downcast_dispatch<Child, scaled_unit<M * U::mag, typename U::reference>> {
|
||||
static constexpr bool is_named = true;
|
||||
static constexpr auto symbol = Symbol;
|
||||
using prefix_family = PF;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -128,14 +111,23 @@ struct named_scaled_unit : downcast_dispatch<Child, scaled_unit<M * U::mag, type
|
||||
* @tparam P prefix to be appied to the reference unit
|
||||
* @tparam U reference unit
|
||||
*/
|
||||
template<typename Child, Prefix P, Unit U>
|
||||
requires U::is_named && std::same_as<typename P::prefix_family, typename U::prefix_family>
|
||||
template<typename Child, Prefix P, NamedUnit U>
|
||||
requires detail::can_be_prefixed<U>
|
||||
struct prefixed_unit : downcast_dispatch<Child, scaled_unit<P::mag * U::mag, typename U::reference>> {
|
||||
static constexpr bool is_named = true;
|
||||
static constexpr auto symbol = P::symbol + U::symbol;
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A coherent unit of a derived quantity
|
||||
*
|
||||
* Defines a new coherent unit of a derived quantity. It should be passed as a coherent unit
|
||||
* in the dimension's definition for such a quantity.
|
||||
*
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
*/
|
||||
template<typename Child>
|
||||
struct derived_unit : downcast_dispatch<Child, scaled_unit<ratio(1), Child>> {};
|
||||
|
||||
/**
|
||||
* @brief A unit with a deduced ratio and symbol
|
||||
*
|
||||
@@ -149,36 +141,10 @@ struct prefixed_unit : downcast_dispatch<Child, scaled_unit<P::mag * U::mag, typ
|
||||
* @tparam U the unit of the first composite dimension from provided derived dimension's recipe
|
||||
* @tparam URest the units for the rest of dimensions from the recipe
|
||||
*/
|
||||
template<typename Child, DerivedDimension Dim, Unit U, Unit... URest>
|
||||
requires detail::same_scaled_units<typename Dim::recipe, U, URest...> &&
|
||||
(U::is_named && (URest::is_named && ... && true))
|
||||
struct derived_unit : downcast_dispatch<Child, detail::derived_unit<Dim, U, URest...>> {
|
||||
static constexpr bool is_named = false;
|
||||
static constexpr auto symbol = detail::derived_symbol_text<Dim, U, URest...>();
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A named unit with a deduced ratio
|
||||
*
|
||||
* Defines a new unit with a deduced ratio and the given symbol based on the recipe from the provided
|
||||
* derived dimension. The number and order of provided units should match the recipe of the
|
||||
* derived dimension. All of the units provided should also be a named ones so it is possible
|
||||
* to create a deduced symbol text.
|
||||
*
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
* @tparam Dim a derived dimension recipe to use for deduction
|
||||
* @tparam Symbol a short text representation of the unit
|
||||
* @tparam PF no_prefix or a type of prefix family
|
||||
* @tparam U the unit of the first composite dimension from provided derived dimension's recipe
|
||||
* @tparam URest the units for the rest of dimensions from the recipe
|
||||
*/
|
||||
template<typename Child, DerivedDimension Dim, basic_symbol_text Symbol, PrefixFamily PF, Unit U, Unit... URest>
|
||||
template<typename Child, DerivedDimension Dim, NamedUnit U, NamedUnit... URest>
|
||||
requires detail::same_scaled_units<typename Dim::recipe, U, URest...>
|
||||
struct named_derived_unit : downcast_dispatch<Child, detail::derived_unit<Dim, U, URest...>> {
|
||||
static constexpr bool is_named = true;
|
||||
static constexpr auto symbol = Symbol;
|
||||
using prefix_family = PF;
|
||||
struct derived_scaled_unit : downcast_dispatch<Child, detail::derived_scaled_unit<Dim, U, URest...>> {
|
||||
static constexpr auto symbol = detail::derived_symbol_text<Dim, U, URest...>();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -186,19 +152,14 @@ struct named_derived_unit : downcast_dispatch<Child, detail::derived_unit<Dim, U
|
||||
*
|
||||
* Defines a named alias for another unit. It is useful to assign alternative names and symbols
|
||||
* to the already predefined units (i.e. "tonne" for "megagram").
|
||||
* An alias unit may be used by other units defined with the prefix of the same type, unless
|
||||
* no_prefix is provided for PF template parameter (in such a case it is impossible to define
|
||||
* a prefix unit based on this one).
|
||||
* A alias unit may be composed with a prefix to create a prefixed_alias_unit.
|
||||
*
|
||||
* @tparam U Unit for which an alias is defined
|
||||
* @tparam Symbol a short text representation of the unit
|
||||
* @tparam PF no_prefix or a type of prefix family
|
||||
*/
|
||||
template<Unit U, basic_symbol_text Symbol, PrefixFamily PF>
|
||||
template<Unit U, basic_symbol_text Symbol>
|
||||
struct alias_unit : U {
|
||||
static constexpr bool is_named = true;
|
||||
static constexpr auto symbol = Symbol;
|
||||
using prefix_family = PF;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -215,20 +176,55 @@ struct alias_unit : U {
|
||||
// TODO gcc bug: 95015
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95015
|
||||
// template<Unit U, Prefix P, AliasUnit AU>
|
||||
// requires (!AliasUnit<U>) && std::same_as<typename P::prefix_family, typename AU::prefix_family>
|
||||
template<Unit U, Prefix P, Unit AU>
|
||||
requires AU::is_named && std::same_as<typename P::prefix_family, typename AU::prefix_family>
|
||||
// requires (!AliasUnit<U>)
|
||||
template<Unit U, Prefix P, NamedUnit AU>
|
||||
requires detail::can_be_prefixed<AU>
|
||||
struct prefixed_alias_unit : U {
|
||||
static constexpr bool is_named = true;
|
||||
static constexpr auto symbol = P::symbol + AU::symbol;
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Unknown unit
|
||||
* @brief Unknown coherent unit
|
||||
*
|
||||
* Used as a coherent unit of an unknown dimension.
|
||||
*/
|
||||
struct unknown_coherent_unit : unit<unknown_coherent_unit> {};
|
||||
struct unknown_coherent_unit : derived_unit<unknown_coherent_unit> {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename Child, basic_symbol_text Symbol>
|
||||
void is_named_impl(const volatile named_unit<Child, Symbol>*);
|
||||
|
||||
template<typename Child, basic_symbol_text Symbol, ratio R, typename U>
|
||||
void is_named_impl(const volatile named_scaled_unit<Child, Symbol, R, U>*);
|
||||
|
||||
template<typename Child, typename P, typename U>
|
||||
void is_named_impl(const volatile prefixed_unit<Child, P, U>*);
|
||||
|
||||
template<typename U, basic_symbol_text Symbol>
|
||||
void is_named_impl(const volatile alias_unit<U, Symbol>*);
|
||||
|
||||
template<typename U, typename P, typename AU>
|
||||
void is_named_impl(const volatile prefixed_alias_unit<U, P, AU>*);
|
||||
|
||||
template<Unit U>
|
||||
inline constexpr bool is_named<U> = requires(U * u) { is_named_impl(u); };
|
||||
|
||||
template<typename Child, basic_symbol_text Symbol>
|
||||
void can_be_prefixed_impl(const volatile named_unit<Child, Symbol>*);
|
||||
|
||||
template<typename Child, basic_symbol_text Symbol, ratio R, typename U>
|
||||
void can_be_prefixed_impl(const volatile named_scaled_unit<Child, Symbol, R, U>*);
|
||||
|
||||
template<typename U, basic_symbol_text Symbol>
|
||||
void can_be_prefixed_impl(const volatile alias_unit<U, Symbol>*);
|
||||
|
||||
template<Unit U>
|
||||
inline constexpr bool can_be_prefixed<U> = requires(U * u) { can_be_prefixed_impl(u); };
|
||||
|
||||
template<ratio R, typename U>
|
||||
inline constexpr bool can_be_prefixed<scaled_unit<R, U>> = can_be_prefixed<typename U::reference>;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
# systems
|
||||
add_subdirectory(isq)
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(isq-iec80000 mp-units::si)
|
||||
add_units_module(
|
||||
isq-iec80000
|
||||
DEPENDENCIES mp-units::si
|
||||
HEADERS include/units/isq/iec80000/binary_prefixes.h include/units/isq/iec80000/iec80000.h
|
||||
include/units/isq/iec80000/modulation_rate.h include/units/isq/iec80000/storage_capacity.h
|
||||
include/units/isq/iec80000/traffic_intensity.h include/units/isq/iec80000/transfer_rate.h
|
||||
)
|
||||
|
||||
@@ -26,13 +26,11 @@
|
||||
|
||||
namespace units::isq::iec80000 {
|
||||
|
||||
struct binary_prefix : prefix_family {};
|
||||
|
||||
struct kibi : units::prefix<kibi, binary_prefix, "Ki", ratio(1'024)> {};
|
||||
struct mebi : units::prefix<mebi, binary_prefix, "Mi", ratio(1'048'576)> {};
|
||||
struct gibi : units::prefix<gibi, binary_prefix, "Gi", ratio(1'073'741'824)> {};
|
||||
struct tebi : units::prefix<tebi, binary_prefix, "Ti", ratio(1'099'511'627'776)> {};
|
||||
struct pebi : units::prefix<pebi, binary_prefix, "Pi", ratio(1'125'899'906'842'624)> {};
|
||||
struct exbi : units::prefix<exbi, binary_prefix, "Ei", ratio(1'152'921'504'606'846'976)> {};
|
||||
struct kibi : units::prefix<kibi, "Ki", ratio(1'024)> {};
|
||||
struct mebi : units::prefix<mebi, "Mi", ratio(1'048'576)> {};
|
||||
struct gibi : units::prefix<gibi, "Gi", ratio(1'073'741'824)> {};
|
||||
struct tebi : units::prefix<tebi, "Ti", ratio(1'099'511'627'776)> {};
|
||||
struct pebi : units::prefix<pebi, "Pi", ratio(1'125'899'906'842'624)> {};
|
||||
struct exbi : units::prefix<exbi, "Ei", ratio(1'152'921'504'606'846'976)> {};
|
||||
|
||||
} // namespace units::isq::iec80000
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::iec80000 {
|
||||
|
||||
struct baud : alias_unit<si::hertz, "Bd", si::prefix> {};
|
||||
struct baud : alias_unit<si::hertz, "Bd"> {};
|
||||
struct kilobaud : prefixed_alias_unit<si::kilohertz, si::kilo, baud> {};
|
||||
struct megabaud : prefixed_alias_unit<si::megahertz, si::mega, baud> {};
|
||||
struct gigabaud : prefixed_alias_unit<si::gigahertz, si::giga, baud> {};
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
|
||||
namespace units::isq::iec80000 {
|
||||
|
||||
struct bit : named_unit<bit, "bit", si::prefix> {};
|
||||
struct bit : named_unit<bit, "bit"> {};
|
||||
|
||||
struct kilobit : prefixed_unit<kilobit, si::kilo, bit> {};
|
||||
struct megabit : prefixed_unit<megabit, si::mega, bit> {};
|
||||
struct gigabit : prefixed_unit<gigabit, si::giga, bit> {};
|
||||
@@ -45,15 +46,15 @@ struct exabit : prefixed_unit<exabit, si::exa, bit> {};
|
||||
struct zettabit : prefixed_unit<zettabit, si::zetta, bit> {};
|
||||
struct yottabit : prefixed_unit<yottabit, si::yotta, bit> {};
|
||||
|
||||
struct binary_prefix_bit : alias_unit<bit, "bit", binary_prefix> {};
|
||||
struct kibibit : prefixed_unit<kibibit, kibi, binary_prefix_bit> {};
|
||||
struct mebibit : prefixed_unit<mebibit, mebi, binary_prefix_bit> {};
|
||||
struct gibibit : prefixed_unit<gibibit, gibi, binary_prefix_bit> {};
|
||||
struct tebibit : prefixed_unit<tebibit, tebi, binary_prefix_bit> {};
|
||||
struct pebibit : prefixed_unit<pebibit, pebi, binary_prefix_bit> {};
|
||||
struct exbibit : prefixed_unit<exbibit, exbi, binary_prefix_bit> {};
|
||||
struct kibibit : prefixed_unit<kibibit, kibi, bit> {};
|
||||
struct mebibit : prefixed_unit<mebibit, mebi, bit> {};
|
||||
struct gibibit : prefixed_unit<gibibit, gibi, bit> {};
|
||||
struct tebibit : prefixed_unit<tebibit, tebi, bit> {};
|
||||
struct pebibit : prefixed_unit<pebibit, pebi, bit> {};
|
||||
struct exbibit : prefixed_unit<exbibit, exbi, bit> {};
|
||||
|
||||
struct byte : named_scaled_unit<byte, "B", as_magnitude<8>(), bit> {};
|
||||
|
||||
struct byte : named_scaled_unit<byte, "B", si::prefix, as_magnitude<8>(), bit> {};
|
||||
struct kilobyte : prefixed_unit<kilobyte, si::kilo, byte> {};
|
||||
struct megabyte : prefixed_unit<megabyte, si::mega, byte> {};
|
||||
struct gigabyte : prefixed_unit<gigabyte, si::giga, byte> {};
|
||||
@@ -63,13 +64,12 @@ struct exabyte : prefixed_unit<exabyte, si::exa, byte> {};
|
||||
struct zettabyte : prefixed_unit<zettabyte, si::zetta, byte> {};
|
||||
struct yottabyte : prefixed_unit<yottabyte, si::yotta, byte> {};
|
||||
|
||||
struct binary_prefix_byte : alias_unit<byte, "B", binary_prefix> {};
|
||||
struct kibibyte : prefixed_unit<kibibyte, kibi, binary_prefix_byte> {};
|
||||
struct mebibyte : prefixed_unit<mebibyte, mebi, binary_prefix_byte> {};
|
||||
struct gibibyte : prefixed_unit<gibibyte, gibi, binary_prefix_byte> {};
|
||||
struct tebibyte : prefixed_unit<tebibyte, tebi, binary_prefix_byte> {};
|
||||
struct pebibyte : prefixed_unit<pebibyte, pebi, binary_prefix_byte> {};
|
||||
// struct exbibyte : prefixed_unit<exbibyte, exbi, binary_prefix_byte> {};
|
||||
struct kibibyte : prefixed_unit<kibibyte, kibi, byte> {};
|
||||
struct mebibyte : prefixed_unit<mebibyte, mebi, byte> {};
|
||||
struct gibibyte : prefixed_unit<gibibyte, gibi, byte> {};
|
||||
struct tebibyte : prefixed_unit<tebibyte, tebi, byte> {};
|
||||
struct pebibyte : prefixed_unit<pebibyte, pebi, byte> {};
|
||||
// struct exbibyte : prefixed_unit<exbibyte, exbi, byte> {};
|
||||
|
||||
struct dim_storage_capacity : base_dimension<"M", byte> {};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
namespace units::isq::iec80000 {
|
||||
|
||||
struct erlang : named_unit<erlang, "E", no_prefix> {};
|
||||
struct erlang : named_unit<erlang, "E"> {};
|
||||
|
||||
struct dim_traffic_intensity : base_dimension<"A", erlang> {};
|
||||
|
||||
|
||||
@@ -34,19 +34,19 @@
|
||||
|
||||
namespace units::isq::iec80000 {
|
||||
|
||||
struct byte_per_second : unit<byte_per_second> {};
|
||||
struct byte_per_second : derived_unit<byte_per_second> {};
|
||||
struct dim_transfer_rate :
|
||||
derived_dimension<dim_transfer_rate, byte_per_second, exponent<dim_storage_capacity, 1>,
|
||||
exponent<si::dim_time, -1>> {};
|
||||
|
||||
struct kilobyte_per_second : derived_unit<kilobyte_per_second, dim_transfer_rate, kilobyte, si::second> {};
|
||||
struct megabyte_per_second : derived_unit<megabyte_per_second, dim_transfer_rate, megabyte, si::second> {};
|
||||
struct gigabyte_per_second : derived_unit<gigabyte_per_second, dim_transfer_rate, gigabyte, si::second> {};
|
||||
struct terabyte_per_second : derived_unit<terabyte_per_second, dim_transfer_rate, terabyte, si::second> {};
|
||||
struct petabyte_per_second : derived_unit<petabyte_per_second, dim_transfer_rate, petabyte, si::second> {};
|
||||
struct exabyte_per_second : derived_unit<exabyte_per_second, dim_transfer_rate, exabyte, si::second> {};
|
||||
struct zettabyte_per_second : derived_unit<zettabyte_per_second, dim_transfer_rate, zettabyte, si::second> {};
|
||||
struct yottabyte_per_second : derived_unit<yottabyte_per_second, dim_transfer_rate, yottabyte, si::second> {};
|
||||
struct kilobyte_per_second : derived_scaled_unit<kilobyte_per_second, dim_transfer_rate, kilobyte, si::second> {};
|
||||
struct megabyte_per_second : derived_scaled_unit<megabyte_per_second, dim_transfer_rate, megabyte, si::second> {};
|
||||
struct gigabyte_per_second : derived_scaled_unit<gigabyte_per_second, dim_transfer_rate, gigabyte, si::second> {};
|
||||
struct terabyte_per_second : derived_scaled_unit<terabyte_per_second, dim_transfer_rate, terabyte, si::second> {};
|
||||
struct petabyte_per_second : derived_scaled_unit<petabyte_per_second, dim_transfer_rate, petabyte, si::second> {};
|
||||
struct exabyte_per_second : derived_scaled_unit<exabyte_per_second, dim_transfer_rate, exabyte, si::second> {};
|
||||
struct zettabyte_per_second : derived_scaled_unit<zettabyte_per_second, dim_transfer_rate, zettabyte, si::second> {};
|
||||
struct yottabyte_per_second : derived_scaled_unit<yottabyte_per_second, dim_transfer_rate, yottabyte, si::second> {};
|
||||
|
||||
template<typename T>
|
||||
concept TransferRate = QuantityOf<T, dim_transfer_rate>;
|
||||
|
||||
@@ -20,6 +20,20 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(isq-natural mp-units::isq)
|
||||
add_units_module(
|
||||
isq-natural
|
||||
DEPENDENCIES mp-units::isq
|
||||
HEADERS include/units/isq/natural/acceleration.h
|
||||
include/units/isq/natural/constants.h
|
||||
include/units/isq/natural/energy.h
|
||||
include/units/isq/natural/force.h
|
||||
include/units/isq/natural/length.h
|
||||
include/units/isq/natural/mass.h
|
||||
include/units/isq/natural/momentum.h
|
||||
include/units/isq/natural/natural.h
|
||||
include/units/isq/natural/speed.h
|
||||
include/units/isq/natural/time.h
|
||||
include/units/isq/natural/units.h
|
||||
)
|
||||
|
||||
@@ -31,11 +31,10 @@
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct electronvolt : named_unit<electronvolt, "eV", si::prefix> {};
|
||||
struct electronvolt : named_unit<electronvolt, "eV"> {};
|
||||
struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, si::giga, electronvolt> {};
|
||||
struct inverted_gigaelectronvolt :
|
||||
named_unit<inverted_gigaelectronvolt, basic_symbol_text{"GeV⁻¹", "GeV^-1"}, no_prefix> {};
|
||||
struct square_gigaelectronvolt : named_unit<square_gigaelectronvolt, basic_symbol_text{"GeV²", "GeV^2"}, no_prefix> {};
|
||||
struct inverted_gigaelectronvolt : named_unit<inverted_gigaelectronvolt, basic_symbol_text{"GeV⁻¹", "GeV^-1"}> {};
|
||||
struct square_gigaelectronvolt : named_unit<square_gigaelectronvolt, basic_symbol_text{"GeV²", "GeV^2"}> {};
|
||||
|
||||
// NOTE: eV as a base unit with no relation to joule prevents us from going back
|
||||
// from natural units to SI. Do we need such a support or should we treat
|
||||
|
||||
@@ -20,6 +20,54 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(isq mp-units::core)
|
||||
add_units_module(
|
||||
isq
|
||||
DEPENDENCIES mp-units::core
|
||||
HEADERS include/units/isq/dimensions/absorbed_dose.h
|
||||
include/units/isq/dimensions/acceleration.h
|
||||
include/units/isq/dimensions/amount_of_substance.h
|
||||
include/units/isq/dimensions/angular_velocity.h
|
||||
include/units/isq/dimensions/area.h
|
||||
include/units/isq/dimensions/capacitance.h
|
||||
include/units/isq/dimensions/catalytic_activity.h
|
||||
include/units/isq/dimensions/charge_density.h
|
||||
include/units/isq/dimensions/concentration.h
|
||||
include/units/isq/dimensions/conductance.h
|
||||
include/units/isq/dimensions/current_density.h
|
||||
include/units/isq/dimensions/density.h
|
||||
include/units/isq/dimensions/dynamic_viscosity.h
|
||||
include/units/isq/dimensions/electric_charge.h
|
||||
include/units/isq/dimensions/electric_current.h
|
||||
include/units/isq/dimensions/electric_field_strength.h
|
||||
include/units/isq/dimensions/energy.h
|
||||
include/units/isq/dimensions/energy_density.h
|
||||
include/units/isq/dimensions/force.h
|
||||
include/units/isq/dimensions/frequency.h
|
||||
include/units/isq/dimensions/heat_capacity.h
|
||||
include/units/isq/dimensions/inductance.h
|
||||
include/units/isq/dimensions/length.h
|
||||
include/units/isq/dimensions/luminance.h
|
||||
include/units/isq/dimensions/luminous_intensity.h
|
||||
include/units/isq/dimensions/magnetic_flux.h
|
||||
include/units/isq/dimensions/magnetic_induction.h
|
||||
include/units/isq/dimensions/mass.h
|
||||
include/units/isq/dimensions/molar_energy.h
|
||||
include/units/isq/dimensions/momentum.h
|
||||
include/units/isq/dimensions/permeability.h
|
||||
include/units/isq/dimensions/permittivity.h
|
||||
include/units/isq/dimensions/power.h
|
||||
include/units/isq/dimensions/pressure.h
|
||||
include/units/isq/dimensions/radioactivity.h
|
||||
include/units/isq/dimensions/resistance.h
|
||||
include/units/isq/dimensions/speed.h
|
||||
include/units/isq/dimensions/surface_tension.h
|
||||
include/units/isq/dimensions/thermal_conductivity.h
|
||||
include/units/isq/dimensions/thermodynamic_temperature.h
|
||||
include/units/isq/dimensions/time.h
|
||||
include/units/isq/dimensions/torque.h
|
||||
include/units/isq/dimensions/voltage.h
|
||||
include/units/isq/dimensions/volume.h
|
||||
include/units/isq/dimensions.h
|
||||
)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/mass.h>
|
||||
#include <units/isq/dimensions/speed.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
@@ -20,6 +20,20 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(si-cgs mp-units::si)
|
||||
add_units_module(
|
||||
si-cgs
|
||||
DEPENDENCIES mp-units::si
|
||||
HEADERS include/units/isq/si/cgs/acceleration.h
|
||||
include/units/isq/si/cgs/area.h
|
||||
include/units/isq/si/cgs/cgs.h
|
||||
include/units/isq/si/cgs/energy.h
|
||||
include/units/isq/si/cgs/force.h
|
||||
include/units/isq/si/cgs/length.h
|
||||
include/units/isq/si/cgs/mass.h
|
||||
include/units/isq/si/cgs/power.h
|
||||
include/units/isq/si/cgs/pressure.h
|
||||
include/units/isq/si/cgs/speed.h
|
||||
include/units/isq/si/cgs/time.h
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct gal : named_unit<gal, "Gal", si::prefix> {};
|
||||
struct gal : named_unit<gal, "Gal"> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, gal, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct erg : named_unit<erg, "erg", si::prefix> {};
|
||||
struct erg : named_unit<erg, "erg"> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, erg, dim_force, dim_length> {};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct dyne : named_unit<dyne, "dyn", si::prefix> {};
|
||||
struct dyne : named_unit<dyne, "dyn"> {};
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, dyne, dim_mass, dim_acceleration> {};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct erg_per_second : unit<erg_per_second> {};
|
||||
struct erg_per_second : derived_unit<erg_per_second> {};
|
||||
|
||||
struct dim_power : isq::dim_power<dim_power, erg_per_second, dim_energy, dim_time> {};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct barye : named_unit<barye, "Ba", si::prefix> {};
|
||||
struct barye : named_unit<barye, "Ba"> {};
|
||||
|
||||
struct dim_pressure : isq::dim_pressure<dim_pressure, barye, dim_force, dim_area> {};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct centimetre_per_second : unit<centimetre_per_second> {};
|
||||
struct centimetre_per_second : derived_unit<centimetre_per_second> {};
|
||||
struct dim_speed : isq::dim_speed<dim_speed, centimetre_per_second, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_speed> U, Representation Rep = double>
|
||||
|
||||
@@ -20,6 +20,22 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(si-fps mp-units::si)
|
||||
add_units_module(
|
||||
si-fps
|
||||
DEPENDENCIES mp-units::si-international
|
||||
HEADERS include/units/isq/si/fps/acceleration.h
|
||||
include/units/isq/si/fps/area.h
|
||||
include/units/isq/si/fps/density.h
|
||||
include/units/isq/si/fps/energy.h
|
||||
include/units/isq/si/fps/force.h
|
||||
include/units/isq/si/fps/fps.h
|
||||
include/units/isq/si/fps/length.h
|
||||
include/units/isq/si/fps/mass.h
|
||||
include/units/isq/si/fps/power.h
|
||||
include/units/isq/si/fps/pressure.h
|
||||
include/units/isq/si/fps/speed.h
|
||||
include/units/isq/si/fps/time.h
|
||||
include/units/isq/si/fps/volume.h
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct foot_per_second_sq : unit<foot_per_second_sq> {};
|
||||
struct foot_per_second_sq : derived_unit<foot_per_second_sq> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, foot_per_second_sq, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct square_foot : unit<square_foot> {};
|
||||
struct square_foot : derived_unit<square_foot> {};
|
||||
struct dim_area : isq::dim_area<dim_area, square_foot, dim_length> {};
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct pound_per_foot_cub : unit<pound_per_foot_cub> {};
|
||||
struct pound_per_foot_cub : derived_unit<pound_per_foot_cub> {};
|
||||
|
||||
struct dim_density : isq::dim_density<dim_density, pound_per_foot_cub, dim_mass, dim_length> {};
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot-poundal
|
||||
struct foot_poundal : unit<foot_poundal> {};
|
||||
struct foot_poundal : derived_unit<foot_poundal> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, foot_poundal, dim_length, dim_force> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot-pound_(energy)
|
||||
struct foot_pound_force : derived_unit<foot_pound_force, dim_energy, foot, pound_force> {};
|
||||
struct foot_pound_force : derived_scaled_unit<foot_pound_force, dim_energy, foot, pound_force> {};
|
||||
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
@@ -37,16 +37,15 @@
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Poundal
|
||||
struct poundal : named_unit<poundal, "pdl", no_prefix> {};
|
||||
struct poundal : named_unit<poundal, "pdl"> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Pound_(force)
|
||||
struct pound_force :
|
||||
named_scaled_unit<pound_force, "lbf", si::prefix, as_magnitude<ratio(32'174'049, 1'000'000)>(), poundal> {};
|
||||
struct pound_force : named_scaled_unit<pound_force, "lbf", as_magnitude<ratio(32'174'049, 1'000'000)>(), poundal> {};
|
||||
|
||||
struct kilopound_force : prefixed_unit<kilopound_force, si::kilo, pound_force> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Kip_(unit),
|
||||
struct kip : alias_unit<kilopound_force, "klbf", no_prefix> {};
|
||||
struct kip : alias_unit<kilopound_force, "klbf"> {};
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, poundal, dim_mass, dim_acceleration> {};
|
||||
|
||||
|
||||
@@ -29,30 +29,27 @@
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, as_magnitude<ratio(3'048, 1'000, -1)>(), si::metre> {};
|
||||
|
||||
struct inch : named_scaled_unit<inch, "in", no_prefix, as_magnitude<ratio(1, 12)>(), foot> {};
|
||||
using si::international::fathom;
|
||||
using si::international::foot;
|
||||
using si::international::inch;
|
||||
using si::international::mil;
|
||||
using si::international::thou;
|
||||
using si::international::yard;
|
||||
|
||||
// thousandth of an inch
|
||||
struct thousandth : named_scaled_unit<thousandth, "thou", no_prefix, as_magnitude<ratio(1, 1'000)>(), inch> {};
|
||||
struct thou : alias_unit<thousandth, "thou", no_prefix> {};
|
||||
struct mil : alias_unit<thousandth, "mil", no_prefix> {};
|
||||
|
||||
struct yard : named_scaled_unit<yard, "yd", si::prefix, as_magnitude<3>(), foot> {};
|
||||
|
||||
struct fathom : named_scaled_unit<fathom, "ftm", no_prefix, as_magnitude<6>(), foot> {};
|
||||
struct thousandth : alias_unit<thou, "thou"> {};
|
||||
|
||||
struct kiloyard : prefixed_unit<kiloyard, si::kilo, yard> {};
|
||||
|
||||
struct mile : named_scaled_unit<mile, "mile", no_prefix, as_magnitude<5'280>(), foot> {};
|
||||
struct mile : named_scaled_unit<mile, "mile", as_magnitude<5'280>(), foot> {};
|
||||
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", no_prefix, as_magnitude<2'000>(), yard> {};
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "nmi", as_magnitude<2'000>(), yard> {};
|
||||
|
||||
struct dim_length : isq::dim_length<foot> {};
|
||||
|
||||
|
||||
@@ -35,29 +35,28 @@
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Pound_(mass)
|
||||
struct pound :
|
||||
named_scaled_unit<pound, "lb", no_prefix, as_magnitude<ratio(45'359'237, 100'000'000)>(), si::kilogram> {};
|
||||
struct pound : named_scaled_unit<pound, "lb", as_magnitude<ratio(45'359'237, 100'000'000)>(), si::kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<pound> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
struct grain : named_scaled_unit<grain, "gr", no_prefix, as_magnitude<ratio(1, 7000)>(), pound> {};
|
||||
struct grain : named_scaled_unit<grain, "gr", as_magnitude<ratio(1, 7000)>(), pound> {};
|
||||
|
||||
struct dram : named_scaled_unit<dram, "dr", no_prefix, as_magnitude<ratio(1, 256)>(), pound> {};
|
||||
struct dram : named_scaled_unit<dram, "dr", as_magnitude<ratio(1, 256)>(), pound> {};
|
||||
|
||||
struct ounce : named_scaled_unit<ounce, "oz", no_prefix, as_magnitude<ratio(1, 16)>(), pound> {};
|
||||
struct ounce : named_scaled_unit<ounce, "oz", as_magnitude<ratio(1, 16)>(), pound> {};
|
||||
|
||||
struct stone : named_scaled_unit<stone, "st", no_prefix, as_magnitude<14>(), pound> {};
|
||||
struct stone : named_scaled_unit<stone, "st", as_magnitude<14>(), pound> {};
|
||||
|
||||
struct quarter : named_scaled_unit<quarter, "qr", no_prefix, as_magnitude<28>(), pound> {};
|
||||
struct quarter : named_scaled_unit<quarter, "qr", as_magnitude<28>(), pound> {};
|
||||
|
||||
struct hundredweight : named_scaled_unit<hundredweight, "cwt", no_prefix, as_magnitude<112>(), pound> {};
|
||||
struct hundredweight : named_scaled_unit<hundredweight, "cwt", as_magnitude<112>(), pound> {};
|
||||
|
||||
struct short_ton : named_scaled_unit<short_ton, "ton (short)", no_prefix, as_magnitude<2'000>(), pound> {};
|
||||
struct short_ton : named_scaled_unit<short_ton, "ton (short)", as_magnitude<2'000>(), pound> {};
|
||||
|
||||
struct long_ton : named_scaled_unit<long_ton, "ton (long)", no_prefix, as_magnitude<2'240>(), pound> {};
|
||||
struct long_ton : named_scaled_unit<long_ton, "ton (long)", as_magnitude<2'240>(), pound> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
||||
@@ -35,14 +35,14 @@
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct foot_poundal_per_second : unit<foot_poundal_per_second> {};
|
||||
struct foot_poundal_per_second : derived_unit<foot_poundal_per_second> {};
|
||||
|
||||
struct dim_power : isq::dim_power<dim_power, foot_poundal_per_second, dim_length, dim_force, dim_time> {};
|
||||
|
||||
struct foot_pound_force_per_second : derived_unit<foot_pound_force_per_second, dim_power, foot, pound_force, second> {};
|
||||
struct foot_pound_force_per_second :
|
||||
derived_scaled_unit<foot_pound_force_per_second, dim_power, foot, pound_force, second> {};
|
||||
|
||||
struct horse_power :
|
||||
named_scaled_unit<horse_power, "hp", no_prefix, as_magnitude<550>(), foot_pound_force_per_second> {};
|
||||
struct horse_power : named_scaled_unit<horse_power, "hp", as_magnitude<550>(), foot_pound_force_per_second> {};
|
||||
|
||||
template<UnitOf<dim_power> U, Representation Rep = double>
|
||||
using power = quantity<dim_power, U, Rep>;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct poundal_per_foot_sq : unit<poundal_per_foot_sq> {};
|
||||
struct poundal_per_foot_sq : derived_unit<poundal_per_foot_sq> {};
|
||||
|
||||
struct dim_pressure : isq::dim_pressure<dim_pressure, poundal_per_foot_sq, dim_force, dim_area> {};
|
||||
|
||||
@@ -44,12 +44,11 @@ template<UnitOf<dim_pressure> U, Representation Rep = double>
|
||||
using pressure = quantity<dim_pressure, U, Rep>;
|
||||
|
||||
struct pound_force_per_foot_sq :
|
||||
named_scaled_unit<pound_force_per_foot_sq, "lbf ft2", si::prefix, as_magnitude<ratio(32'174'049, 1'000'000)>(),
|
||||
named_scaled_unit<pound_force_per_foot_sq, "lbf ft2", as_magnitude<ratio(32'174'049, 1'000'000)>(),
|
||||
poundal_per_foot_sq> {};
|
||||
|
||||
struct pound_force_per_inch_sq :
|
||||
named_scaled_unit<pound_force_per_inch_sq, "psi", si::prefix, as_magnitude<ratio(1, 144)>(),
|
||||
pound_force_per_foot_sq> {};
|
||||
named_scaled_unit<pound_force_per_inch_sq, "psi", as_magnitude<ratio(1, 144)>(), pound_force_per_foot_sq> {};
|
||||
|
||||
struct kilopound_force_per_inch_sq : prefixed_unit<kilopound_force_per_inch_sq, si::kilo, pound_force_per_inch_sq> {};
|
||||
|
||||
|
||||
@@ -35,15 +35,15 @@
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct foot_per_second : unit<foot_per_second> {};
|
||||
struct foot_per_second : derived_unit<foot_per_second> {};
|
||||
struct dim_speed : isq::dim_speed<dim_speed, foot_per_second, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_speed> U, Representation Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
struct mile_per_hour : derived_unit<mile_per_hour, dim_speed, mile, hour> {};
|
||||
struct nautical_mile_per_hour : derived_unit<nautical_mile_per_hour, dim_speed, nautical_mile, hour> {};
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "knot", no_prefix> {};
|
||||
struct mile_per_hour : derived_scaled_unit<mile_per_hour, dim_speed, mile, hour> {};
|
||||
struct nautical_mile_per_hour : derived_scaled_unit<nautical_mile_per_hour, dim_speed, nautical_mile, hour> {};
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "kn"> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
@@ -66,12 +66,12 @@ constexpr auto operator"" _q_mph(unsigned long long l)
|
||||
constexpr auto operator"" _q_mph(long double l) { return speed<mile_per_hour, long double>(l); }
|
||||
|
||||
// kn
|
||||
constexpr auto operator"" _q_knot(unsigned long long l)
|
||||
constexpr auto operator"" _q_kn(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return speed<knot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_knot(long double l) { return speed<knot, long double>(l); }
|
||||
constexpr auto operator"" _q_kn(long double l) { return speed<knot, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
@@ -82,7 +82,7 @@ constexpr auto operator"" _q_knot(long double l) { return speed<knot, long doubl
|
||||
namespace speed_references {
|
||||
|
||||
inline constexpr auto mph = reference<dim_speed, mile_per_hour>{};
|
||||
inline constexpr auto knot = reference<dim_speed, fps::knot>{};
|
||||
inline constexpr auto kn = reference<dim_speed, fps::knot>{};
|
||||
|
||||
} // namespace speed_references
|
||||
|
||||
@@ -105,7 +105,7 @@ using ft_per_s = units::isq::si::fps::speed<units::isq::si::fps::foot_per_second
|
||||
template<Representation Rep = double>
|
||||
using mph = units::isq::si::fps::speed<units::isq::si::fps::mile_per_hour, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using knot = units::isq::si::fps::speed<units::isq::si::fps::knot, Rep>;
|
||||
using kn = units::isq::si::fps::speed<units::isq::si::fps::knot, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline speed
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct cubic_foot : unit<cubic_foot> {};
|
||||
struct cubic_foot : derived_unit<cubic_foot> {};
|
||||
struct dim_volume : isq::dim_volume<dim_volume, cubic_foot, dim_length> {};
|
||||
|
||||
struct cubic_yard : derived_unit<cubic_yard, dim_volume, yard> {};
|
||||
struct cubic_yard : derived_scaled_unit<cubic_yard, dim_volume, yard> {};
|
||||
|
||||
template<UnitOf<dim_volume> U, Representation Rep = double>
|
||||
using volume = quantity<dim_volume, U, Rep>;
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(si-hep mp-units::si)
|
||||
add_units_module(
|
||||
si-hep DEPENDENCIES mp-units::si
|
||||
HEADERS include/units/isq/si/hep/area.h include/units/isq/si/hep/energy.h include/units/isq/si/hep/hep.h
|
||||
include/units/isq/si/hep/mass.h include/units/isq/si/hep/momentum.h
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/area.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
@@ -37,7 +37,7 @@ namespace units::isq::si::hep {
|
||||
// effective cross-sectional area according to EU council directive 80/181/EEC
|
||||
// https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:01980L0181-20090527#page=10
|
||||
// https://www.fedlex.admin.ch/eli/cc/1994/3109_3109_3109/de
|
||||
struct barn : named_scaled_unit<barn, "b", prefix, as_magnitude<ratio(1, 1, -28)>(), square_metre> {};
|
||||
struct barn : named_scaled_unit<barn, "b", as_magnitude<ratio(1, 1, -28)>(), square_metre> {};
|
||||
struct yocto_barn : prefixed_unit<yocto_barn, yocto, barn> {};
|
||||
struct zepto_barn : prefixed_unit<zepto_barn, zepto, barn> {};
|
||||
struct atto_barn : prefixed_unit<atto_barn, atto, barn> {};
|
||||
|
||||
@@ -43,7 +43,7 @@ inline constexpr std::optional<std::intmax_t> units::known_first_factor<225'653'
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
struct eV_per_c2 :
|
||||
named_scaled_unit<eV_per_c2, basic_symbol_text{"eV/c²", "eV/c^2"}, prefix,
|
||||
named_scaled_unit<eV_per_c2, basic_symbol_text{"eV/c²", "eV/c^2"},
|
||||
as_magnitude<ratio(17'826'619'216'279, 1'000'000'000'000, -35)>(), kilogram> {};
|
||||
struct feV_per_c2 : prefixed_unit<feV_per_c2, femto, eV_per_c2> {};
|
||||
struct peV_per_c2 : prefixed_unit<peV_per_c2, pico, eV_per_c2> {};
|
||||
@@ -60,14 +60,11 @@ struct PeV_per_c2 : prefixed_unit<PeV_per_c2, peta, eV_per_c2> {};
|
||||
struct EeV_per_c2 : prefixed_unit<EeV_per_c2, exa, eV_per_c2> {};
|
||||
struct YeV_per_c2 : prefixed_unit<YeV_per_c2, yotta, eV_per_c2> {};
|
||||
struct electron_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_e", prefix, as_magnitude<ratio(9'109'383'701'528, 1'000'000'000'000, -31)>(),
|
||||
kilogram> {};
|
||||
named_scaled_unit<eV_per_c2, "m_e", as_magnitude<ratio(9'109'383'701'528, 1'000'000'000'000, -31)>(), kilogram> {};
|
||||
struct proton_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_p", prefix, as_magnitude<ratio(1'672'621'923'695, 1'000'000'000'000, -27)>(),
|
||||
kilogram> {};
|
||||
named_scaled_unit<eV_per_c2, "m_p", as_magnitude<ratio(1'672'621'923'695, 1'000'000'000'000, -27)>(), kilogram> {};
|
||||
struct neutron_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_n", prefix, as_magnitude<ratio(1'674'927'498'049, 1'000'000'000'000, -27)>(),
|
||||
kilogram> {};
|
||||
named_scaled_unit<eV_per_c2, "m_n", as_magnitude<ratio(1'674'927'498'049, 1'000'000'000'000, -27)>(), kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<eV_per_c2> {};
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/momentum.h>
|
||||
#include <units/isq/si/momentum.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
@@ -35,9 +34,11 @@
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
struct kilogram_metre_per_second : derived_unit<kilogram_metre_per_second> {};
|
||||
|
||||
struct eV_per_c :
|
||||
named_scaled_unit<eV_per_c, "eV/c", prefix, as_magnitude<ratio(5'344'285'992'678, 1'000'000'000'000, -35)>(),
|
||||
::units::isq::si::kilogram_metre_per_second> {};
|
||||
named_scaled_unit<eV_per_c, "eV/c", as_magnitude<ratio(5'344'285'992'678, 1'000'000'000'000, -35)>(),
|
||||
kilogram_metre_per_second> {};
|
||||
struct feV_per_c : prefixed_unit<feV_per_c, femto, eV_per_c> {};
|
||||
struct peV_per_c : prefixed_unit<peV_per_c, pico, eV_per_c> {};
|
||||
struct neV_per_c : prefixed_unit<neV_per_c, nano, eV_per_c> {};
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(si-iau mp-units::si)
|
||||
add_units_module(
|
||||
si-iau DEPENDENCIES mp-units::si HEADERS include/units/isq/si/iau/iau.h include/units/isq/si/iau/length.h
|
||||
)
|
||||
|
||||
@@ -36,13 +36,13 @@
|
||||
namespace units::isq::si::iau {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Light-year
|
||||
struct light_year : named_scaled_unit<light_year, "ly", no_prefix, as_magnitude<9460730472580800>(), si::metre> {};
|
||||
struct light_year : named_scaled_unit<light_year, "ly", as_magnitude<9460730472580800>(), si::metre> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Parsec
|
||||
struct parsec : named_scaled_unit<parsec, "pc", si::prefix, as_magnitude<30'856'775'814'913'673>(), si::metre> {};
|
||||
struct parsec : named_scaled_unit<parsec, "pc", as_magnitude<30'856'775'814'913'673>(), si::metre> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Angstrom
|
||||
struct angstrom : named_scaled_unit<angstrom, "angstrom", no_prefix, as_magnitude<ratio(1, 1, -10)>(), si::metre> {};
|
||||
struct angstrom : named_scaled_unit<angstrom, "angstrom", as_magnitude<ratio(1, 1, -10)>(), si::metre> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(si-imperial mp-units::si)
|
||||
add_units_module(
|
||||
si-imperial DEPENDENCIES mp-units::si HEADERS include/units/isq/si/imperial/imperial.h
|
||||
include/units/isq/si/imperial/length.h
|
||||
)
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
namespace units::isq::si::imperial {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Chain_(unit)
|
||||
struct chain : named_scaled_unit<chain, "ch", no_prefix, as_magnitude<22>(), si::international::yard> {};
|
||||
struct chain : named_scaled_unit<chain, "ch", as_magnitude<22>(), si::international::yard> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Rod_(unit)
|
||||
struct rod : named_scaled_unit<rod, "rd", no_prefix, as_magnitude<ratio(1, 4)>(), chain> {};
|
||||
struct rod : named_scaled_unit<rod, "rd", as_magnitude<ratio(1, 4)>(), chain> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(si-international mp-units::si)
|
||||
add_units_module(
|
||||
si-international
|
||||
DEPENDENCIES mp-units::si
|
||||
HEADERS include/units/isq/si/international/area.h include/units/isq/si/international/international.h
|
||||
include/units/isq/si/international/length.h include/units/isq/si/international/speed.h
|
||||
include/units/isq/si/international/volume.h
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si::international {
|
||||
|
||||
struct square_foot : derived_unit<square_foot, si::dim_area, si::international::foot> {};
|
||||
struct square_foot : derived_scaled_unit<square_foot, si::dim_area, si::international::foot> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
||||
@@ -37,30 +37,30 @@ namespace units::isq::si::international {
|
||||
|
||||
// si::international yard
|
||||
// https://en.wikipedia.org/wiki/International_yard_and_pound
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, as_magnitude<ratio(9'144, 1'000, -1)>(), si::metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", as_magnitude<ratio(9'144, 1'000, -1)>(), si::metre> {};
|
||||
|
||||
// si::international foot
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)#International_foot
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, as_magnitude<ratio(1, 3)>(), yard> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", as_magnitude<ratio(1, 3)>(), yard> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Fathom#International_fathom
|
||||
struct fathom : named_scaled_unit<fathom, "fathom", no_prefix, as_magnitude<2>(), yard> {};
|
||||
struct fathom : named_scaled_unit<fathom, "fathom", as_magnitude<2>(), yard> {};
|
||||
|
||||
// si::international inch
|
||||
// https://en.wikipedia.org/wiki/Inch#Equivalences
|
||||
struct inch : named_scaled_unit<inch, "in", no_prefix, as_magnitude<ratio(1, 36)>(), yard> {};
|
||||
struct inch : named_scaled_unit<inch, "in", as_magnitude<ratio(1, 36)>(), yard> {};
|
||||
|
||||
// intrnational mile
|
||||
// https://en.wikipedia.org/wiki/Mile#International_mile
|
||||
struct mile : named_scaled_unit<mile, "mi", no_prefix, as_magnitude<ratio(25'146, 15'625)>(), si::kilometre> {};
|
||||
struct mile : named_scaled_unit<mile, "mi", as_magnitude<ratio(25'146, 15'625)>(), si::kilometre> {};
|
||||
|
||||
// si::international nautical mile
|
||||
// https://en.wikipedia.org/wiki/Nautical_mile
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", no_prefix, as_magnitude<1852>(), si::metre> {};
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", as_magnitude<1852>(), si::metre> {};
|
||||
|
||||
// thou
|
||||
// https://en.wikipedia.org/wiki/Thousandth_of_an_inch
|
||||
struct thou : named_scaled_unit<thou, "thou", no_prefix, as_magnitude<ratio(1, 1000)>(), inch> {};
|
||||
struct thou : named_scaled_unit<thou, "thou", as_magnitude<ratio(1, 1000)>(), inch> {};
|
||||
|
||||
// mil - different name for thou
|
||||
// https://en.wikipedia.org/wiki/Thousandth_of_an_inch
|
||||
|
||||
@@ -34,7 +34,10 @@
|
||||
|
||||
namespace units::isq::si::international {
|
||||
|
||||
struct mile_per_hour : derived_unit<mile_per_hour, si::dim_speed, si::international::mile, si::hour> {};
|
||||
struct mile_per_hour : derived_scaled_unit<mile_per_hour, si::dim_speed, si::international::mile, si::hour> {};
|
||||
struct nautical_mile_per_hour :
|
||||
derived_scaled_unit<nautical_mile_per_hour, si::dim_speed, si::international::nautical_mile, si::hour> {};
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "kn"> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
@@ -48,10 +51,42 @@ constexpr auto operator"" _q_mi_per_h(unsigned long long l)
|
||||
}
|
||||
constexpr auto operator"" _q_mi_per_h(long double l) { return si::speed<mile_per_hour, long double>(l); }
|
||||
|
||||
// nmi/h
|
||||
constexpr auto operator"" _q_nmi_per_h(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::speed<nautical_mile_per_hour, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nmi_per_h(long double l) { return si::speed<nautical_mile_per_hour, long double>(l); }
|
||||
|
||||
// kn
|
||||
constexpr auto operator"" _q_kn(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::speed<knot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kn(long double l) { return si::speed<knot, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace speed_references {
|
||||
|
||||
inline constexpr auto kn = reference<si::dim_speed, knot>{};
|
||||
|
||||
} // namespace speed_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace speed_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::international
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
@@ -61,6 +96,12 @@ namespace units::aliases::isq::si::international::inline speed {
|
||||
template<Representation Rep = double>
|
||||
using mi_per_h = units::isq::si::speed<units::isq::si::international::mile_per_hour, Rep>;
|
||||
|
||||
template<Representation Rep = double>
|
||||
using nmi_per_h = units::isq::si::speed<units::isq::si::international::nautical_mile_per_hour, Rep>;
|
||||
|
||||
template<Representation Rep = double>
|
||||
using kn = units::isq::si::speed<units::isq::si::international::knot, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::international::inline speed
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si::international {
|
||||
|
||||
struct cubic_foot : derived_unit<cubic_foot, si::dim_volume, si::international::foot> {};
|
||||
struct cubic_foot : derived_scaled_unit<cubic_foot, si::dim_volume, si::international::foot> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(si-typographic mp-units::si)
|
||||
add_units_module(
|
||||
si-typographic DEPENDENCIES mp-units::si HEADERS include/units/isq/si/typographic/length.h
|
||||
include/units/isq/si/typographic/typographic.h
|
||||
)
|
||||
|
||||
@@ -38,13 +38,11 @@ namespace units::isq::si::typographic {
|
||||
// TODO Conflicts with (https://en.wikipedia.org/wiki/Pica_(typography)), verify correctness of below conversion factors
|
||||
// and provide hyperlinks to definitions
|
||||
struct pica_comp :
|
||||
named_scaled_unit<pica_comp, "pica(comp)", no_prefix, as_magnitude<ratio(4233333, 1000000, -3)>(), si::metre> {};
|
||||
struct pica_prn :
|
||||
named_scaled_unit<pica_prn, "pica(prn)", no_prefix, as_magnitude<ratio(2108759, 500000, -3)>(), si::metre> {};
|
||||
named_scaled_unit<pica_comp, "pica(comp)", as_magnitude<ratio(4233333, 1000000, -3)>(), si::metre> {};
|
||||
struct pica_prn : named_scaled_unit<pica_prn, "pica(prn)", as_magnitude<ratio(2108759, 500000, -3)>(), si::metre> {};
|
||||
struct point_comp :
|
||||
named_scaled_unit<point_comp, "point(comp)", no_prefix, as_magnitude<ratio(1763889, 500000, -4)>(), si::metre> {};
|
||||
struct point_prn :
|
||||
named_scaled_unit<point_prn, "point(prn)", no_prefix, as_magnitude<ratio(1757299, 500000, -4)>(), si::metre> {};
|
||||
named_scaled_unit<point_comp, "point(comp)", as_magnitude<ratio(1763889, 500000, -4)>(), si::metre> {};
|
||||
struct point_prn : named_scaled_unit<point_prn, "point(prn)", as_magnitude<ratio(1757299, 500000, -4)>(), si::metre> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(si-uscs mp-units::si)
|
||||
add_units_module(
|
||||
si-uscs DEPENDENCIES mp-units::si HEADERS include/units/isq/si/uscs/length.h include/units/isq/si/uscs/uscs.h
|
||||
)
|
||||
|
||||
@@ -36,14 +36,14 @@ namespace units::isq::si::uscs {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)#US_survey_foot
|
||||
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
|
||||
struct foot : named_scaled_unit<foot, "ft(us)", no_prefix, as_magnitude<ratio(1'200, 3'937)>(), si::metre> {};
|
||||
struct foot : named_scaled_unit<foot, "ft(us)", as_magnitude<ratio(1'200, 3'937)>(), si::metre> {};
|
||||
|
||||
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
|
||||
struct fathom : named_scaled_unit<fathom, "fathom(us)", no_prefix, as_magnitude<6>(), foot> {};
|
||||
struct fathom : named_scaled_unit<fathom, "fathom(us)", as_magnitude<6>(), foot> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Mile#U.S._survey_mile
|
||||
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
|
||||
struct mile : named_scaled_unit<mile, "mi(us)", no_prefix, as_magnitude<5280>(), foot> {};
|
||||
struct mile : named_scaled_unit<mile, "mi(us)", as_magnitude<5280>(), foot> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
||||
@@ -20,6 +20,56 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(si mp-units::isq)
|
||||
add_units_module(
|
||||
si
|
||||
DEPENDENCIES mp-units::isq
|
||||
HEADERS include/units/isq/si/absorbed_dose.h
|
||||
include/units/isq/si/acceleration.h
|
||||
include/units/isq/si/amount_of_substance.h
|
||||
include/units/isq/si/angular_velocity.h
|
||||
include/units/isq/si/area.h
|
||||
include/units/isq/si/capacitance.h
|
||||
include/units/isq/si/catalytic_activity.h
|
||||
include/units/isq/si/charge_density.h
|
||||
include/units/isq/si/concentration.h
|
||||
include/units/isq/si/conductance.h
|
||||
include/units/isq/si/constants.h
|
||||
include/units/isq/si/current_density.h
|
||||
include/units/isq/si/density.h
|
||||
include/units/isq/si/dynamic_viscosity.h
|
||||
include/units/isq/si/electric_charge.h
|
||||
include/units/isq/si/electric_current.h
|
||||
include/units/isq/si/electric_field_strength.h
|
||||
include/units/isq/si/energy.h
|
||||
include/units/isq/si/energy_density.h
|
||||
include/units/isq/si/force.h
|
||||
include/units/isq/si/frequency.h
|
||||
include/units/isq/si/heat_capacity.h
|
||||
include/units/isq/si/inductance.h
|
||||
include/units/isq/si/length.h
|
||||
include/units/isq/si/luminance.h
|
||||
include/units/isq/si/luminous_intensity.h
|
||||
include/units/isq/si/magnetic_flux.h
|
||||
include/units/isq/si/magnetic_induction.h
|
||||
include/units/isq/si/mass.h
|
||||
include/units/isq/si/molar_energy.h
|
||||
include/units/isq/si/momentum.h
|
||||
include/units/isq/si/permeability.h
|
||||
include/units/isq/si/permittivity.h
|
||||
include/units/isq/si/power.h
|
||||
include/units/isq/si/prefixes.h
|
||||
include/units/isq/si/pressure.h
|
||||
include/units/isq/si/radioactivity.h
|
||||
include/units/isq/si/resistance.h
|
||||
include/units/isq/si/si.h
|
||||
include/units/isq/si/speed.h
|
||||
include/units/isq/si/surface_tension.h
|
||||
include/units/isq/si/thermal_conductivity.h
|
||||
include/units/isq/si/thermodynamic_temperature.h
|
||||
include/units/isq/si/time.h
|
||||
include/units/isq/si/torque.h
|
||||
include/units/isq/si/voltage.h
|
||||
include/units/isq/si/volume.h
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct gray : named_unit<gray, "Gy", prefix> {};
|
||||
struct gray : named_unit<gray, "Gy"> {};
|
||||
struct yoctogray : prefixed_unit<yoctogray, yocto, gray> {};
|
||||
struct zeptogray : prefixed_unit<zeptogray, zepto, gray> {};
|
||||
struct attogray : prefixed_unit<attogray, atto, gray> {};
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct metre_per_second_sq : unit<metre_per_second_sq> {};
|
||||
struct metre_per_second_sq : derived_unit<metre_per_second_sq> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, metre_per_second_sq, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct mole : named_unit<mole, "mol", prefix> {};
|
||||
struct mole : named_unit<mole, "mol"> {};
|
||||
|
||||
struct dim_amount_of_substance : isq::dim_amount_of_substance<mole> {};
|
||||
|
||||
|
||||
@@ -29,12 +29,13 @@
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/generic/angle.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct radian_per_second : named_unit<radian_per_second, basic_symbol_text{"ω", "w"}, no_prefix> {};
|
||||
struct radian_per_second : named_unit<radian_per_second, basic_symbol_text{"ω", "w"}> {};
|
||||
|
||||
struct dim_angular_velocity :
|
||||
isq::dim_angular_velocity<dim_angular_velocity, radian_per_second, dim_angle<>, dim_time> {};
|
||||
|
||||
@@ -34,31 +34,35 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct square_metre : unit<square_metre> {};
|
||||
struct square_metre : derived_unit<square_metre> {};
|
||||
struct dim_area : isq::dim_area<dim_area, square_metre, dim_length> {};
|
||||
|
||||
struct square_yoctometre : derived_unit<square_yoctometre, dim_area, yoctometre> {};
|
||||
struct square_zeptometre : derived_unit<square_zeptometre, dim_area, zeptometre> {};
|
||||
struct square_attometre : derived_unit<square_attometre, dim_area, attometre> {};
|
||||
struct square_femtometre : derived_unit<square_femtometre, dim_area, femtometre> {};
|
||||
struct square_picometre : derived_unit<square_picometre, dim_area, picometre> {};
|
||||
struct square_nanometre : derived_unit<square_nanometre, dim_area, nanometre> {};
|
||||
struct square_micrometre : derived_unit<square_micrometre, dim_area, micrometre> {};
|
||||
struct square_millimetre : derived_unit<square_millimetre, dim_area, millimetre> {};
|
||||
struct square_centimetre : derived_unit<square_centimetre, dim_area, centimetre> {};
|
||||
struct square_decimetre : derived_unit<square_decimetre, dim_area, decimetre> {};
|
||||
struct square_decametre : derived_unit<square_decametre, dim_area, decametre> {};
|
||||
struct square_hectometre : derived_unit<square_hectometre, dim_area, hectometre> {};
|
||||
struct square_kilometre : derived_unit<square_kilometre, dim_area, kilometre> {};
|
||||
struct square_megametre : derived_unit<square_megametre, dim_area, megametre> {};
|
||||
struct square_gigametre : derived_unit<square_gigametre, dim_area, gigametre> {};
|
||||
struct square_terametre : derived_unit<square_terametre, dim_area, terametre> {};
|
||||
struct square_petametre : derived_unit<square_petametre, dim_area, petametre> {};
|
||||
struct square_exametre : derived_unit<square_exametre, dim_area, exametre> {};
|
||||
struct square_zettametre : derived_unit<square_zettametre, dim_area, zettametre> {};
|
||||
struct square_yottametre : derived_unit<square_yottametre, dim_area, yottametre> {};
|
||||
struct square_yoctometre : derived_scaled_unit<square_yoctometre, dim_area, yoctometre> {};
|
||||
struct square_zeptometre : derived_scaled_unit<square_zeptometre, dim_area, zeptometre> {};
|
||||
struct square_attometre : derived_scaled_unit<square_attometre, dim_area, attometre> {};
|
||||
struct square_femtometre : derived_scaled_unit<square_femtometre, dim_area, femtometre> {};
|
||||
struct square_picometre : derived_scaled_unit<square_picometre, dim_area, picometre> {};
|
||||
struct square_nanometre : derived_scaled_unit<square_nanometre, dim_area, nanometre> {};
|
||||
struct square_micrometre : derived_scaled_unit<square_micrometre, dim_area, micrometre> {};
|
||||
struct square_millimetre : derived_scaled_unit<square_millimetre, dim_area, millimetre> {};
|
||||
struct square_centimetre : derived_scaled_unit<square_centimetre, dim_area, centimetre> {};
|
||||
struct square_decimetre : derived_scaled_unit<square_decimetre, dim_area, decimetre> {};
|
||||
struct square_decametre : derived_scaled_unit<square_decametre, dim_area, decametre> {};
|
||||
struct square_hectometre : derived_scaled_unit<square_hectometre, dim_area, hectometre> {};
|
||||
struct square_kilometre : derived_scaled_unit<square_kilometre, dim_area, kilometre> {};
|
||||
struct square_megametre : derived_scaled_unit<square_megametre, dim_area, megametre> {};
|
||||
struct square_gigametre : derived_scaled_unit<square_gigametre, dim_area, gigametre> {};
|
||||
struct square_terametre : derived_scaled_unit<square_terametre, dim_area, terametre> {};
|
||||
struct square_petametre : derived_scaled_unit<square_petametre, dim_area, petametre> {};
|
||||
struct square_exametre : derived_scaled_unit<square_exametre, dim_area, exametre> {};
|
||||
struct square_zettametre : derived_scaled_unit<square_zettametre, dim_area, zettametre> {};
|
||||
struct square_yottametre : derived_scaled_unit<square_yottametre, dim_area, yottametre> {};
|
||||
|
||||
struct hectare : alias_unit<square_hectometre, "ha", no_prefix> {};
|
||||
struct are : alias_unit<square_decametre, "a"> {};
|
||||
struct centiare : prefixed_alias_unit<square_metre, centi, are> {};
|
||||
struct deciare : prefixed_unit<deciare, deci, are> {};
|
||||
struct decare : prefixed_unit<decare, deca, are> {};
|
||||
struct hectare : prefixed_alias_unit<square_hectometre, hecto, are> {};
|
||||
|
||||
template<UnitOf<dim_area> U, Representation Rep = double>
|
||||
using area = quantity<dim_area, U, Rep>;
|
||||
@@ -235,6 +239,38 @@ constexpr auto operator"" _q_Ym2(unsigned long long l)
|
||||
}
|
||||
constexpr auto operator"" _q_Ym2(long double l) { return area<square_yottametre, long double>(l); }
|
||||
|
||||
// a
|
||||
constexpr auto operator"" _q_a(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<are, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_a(long double l) { return area<are, long double>(l); }
|
||||
|
||||
// ca
|
||||
constexpr auto operator"" _q_ca(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<centiare, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ca(long double l) { return area<centiare, long double>(l); }
|
||||
|
||||
// da
|
||||
constexpr auto operator"" _q_da(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<deciare, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_da(long double l) { return area<deciare, long double>(l); }
|
||||
|
||||
// daa
|
||||
constexpr auto operator"" _q_daa(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<decare, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_daa(long double l) { return area<decare, long double>(l); }
|
||||
|
||||
// ha
|
||||
constexpr auto operator"" _q_ha(unsigned long long l)
|
||||
{
|
||||
@@ -273,6 +309,10 @@ inline constexpr auto Em2 = reference<dim_area, square_exametre>{};
|
||||
inline constexpr auto Zm2 = reference<dim_area, square_zettametre>{};
|
||||
inline constexpr auto Ym2 = reference<dim_area, square_yottametre>{};
|
||||
|
||||
inline constexpr auto a = reference<dim_area, are>{};
|
||||
inline constexpr auto ca = reference<dim_area, centiare>{};
|
||||
inline constexpr auto da = reference<dim_area, deciare>{};
|
||||
inline constexpr auto daa = reference<dim_area, decare>{};
|
||||
inline constexpr auto ha = reference<dim_area, hectare>{};
|
||||
|
||||
} // namespace area_references
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct farad : named_unit<farad, "F", prefix> {};
|
||||
struct farad : named_unit<farad, "F"> {};
|
||||
struct yoctofarad : prefixed_unit<yoctofarad, yocto, farad> {};
|
||||
struct zeptofarad : prefixed_unit<zeptofarad, zepto, farad> {};
|
||||
struct attofarad : prefixed_unit<attofarad, atto, farad> {};
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct katal : named_unit<katal, "kat", prefix> {};
|
||||
struct katal : named_unit<katal, "kat"> {};
|
||||
struct yoctokatal : prefixed_unit<yoctokatal, yocto, katal> {};
|
||||
struct zeptokatal : prefixed_unit<zeptokatal, zepto, katal> {};
|
||||
struct attokatal : prefixed_unit<attokatal, atto, katal> {};
|
||||
@@ -58,7 +58,7 @@ struct exakatal : prefixed_unit<exakatal, exa, katal> {};
|
||||
struct zettakatal : prefixed_unit<zettakatal, zetta, katal> {};
|
||||
struct yottakatal : prefixed_unit<yottakatal, yotta, katal> {};
|
||||
|
||||
struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", prefix, as_magnitude<ratio(1, 60, -6)>(), katal> {};
|
||||
struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", as_magnitude<ratio(1, 60, -6)>(), katal> {};
|
||||
|
||||
struct dim_catalytic_activity :
|
||||
isq::dim_catalytic_activity<dim_catalytic_activity, katal, dim_time, dim_amount_of_substance> {};
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct coulomb_per_metre_cub : unit<coulomb_per_metre_cub> {};
|
||||
struct coulomb_per_metre_sq : unit<coulomb_per_metre_sq> {};
|
||||
struct coulomb_per_metre_cub : derived_unit<coulomb_per_metre_cub> {};
|
||||
struct coulomb_per_metre_sq : derived_unit<coulomb_per_metre_sq> {};
|
||||
|
||||
struct dim_charge_density :
|
||||
isq::dim_charge_density<dim_charge_density, coulomb_per_metre_cub, dim_electric_charge, dim_length> {};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct mol_per_metre_cub : unit<mol_per_metre_cub> {};
|
||||
struct mol_per_metre_cub : derived_unit<mol_per_metre_cub> {};
|
||||
struct dim_concentration :
|
||||
isq::dim_concentration<dim_concentration, mol_per_metre_cub, dim_amount_of_substance, dim_length> {};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct siemens : named_unit<siemens, "S", prefix> {};
|
||||
struct siemens : named_unit<siemens, "S"> {};
|
||||
struct yoctosiemens : prefixed_unit<yoctosiemens, yocto, siemens> {};
|
||||
struct zeptosiemens : prefixed_unit<zeptosiemens, zepto, siemens> {};
|
||||
struct attosiemens : prefixed_unit<attosiemens, atto, siemens> {};
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct ampere_per_metre_sq : unit<ampere_per_metre_sq> {};
|
||||
struct ampere_per_metre_sq : derived_unit<ampere_per_metre_sq> {};
|
||||
|
||||
struct dim_current_density :
|
||||
isq::dim_current_density<dim_current_density, ampere_per_metre_sq, dim_electric_current, dim_length> {};
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct kilogram_per_metre_cub : unit<kilogram_per_metre_cub> {};
|
||||
struct kilogram_per_metre_cub : derived_unit<kilogram_per_metre_cub> {};
|
||||
|
||||
struct dim_density : isq::dim_density<dim_density, kilogram_per_metre_cub, dim_mass, dim_length> {};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct pascal_second : unit<pascal_second> {};
|
||||
struct pascal_second : derived_unit<pascal_second> {};
|
||||
struct dim_dynamic_viscosity :
|
||||
isq::dim_dynamic_viscosity<dim_dynamic_viscosity, pascal_second, dim_pressure, dim_time> {};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct coulomb : named_unit<coulomb, "C", prefix> {};
|
||||
struct coulomb : named_unit<coulomb, "C"> {};
|
||||
|
||||
struct dim_electric_charge : isq::dim_electric_charge<dim_electric_charge, coulomb, dim_time, dim_electric_current> {};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct ampere : named_unit<ampere, "A", prefix> {};
|
||||
struct ampere : named_unit<ampere, "A"> {};
|
||||
struct yoctoampere : prefixed_unit<yoctoampere, yocto, ampere> {};
|
||||
struct zeptoampere : prefixed_unit<zeptoampere, zepto, ampere> {};
|
||||
struct attoampere : prefixed_unit<attoampere, atto, ampere> {};
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct volt_per_metre : unit<volt_per_metre> {};
|
||||
struct volt_per_metre : derived_unit<volt_per_metre> {};
|
||||
struct dim_electric_field_strength :
|
||||
isq::dim_electric_field_strength<dim_electric_field_strength, volt_per_metre, dim_voltage, dim_length> {};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct joule : named_unit<joule, "J", prefix> {};
|
||||
struct joule : named_unit<joule, "J"> {};
|
||||
struct yoctojoule : prefixed_unit<yoctojoule, yocto, joule> {};
|
||||
struct zeptojoule : prefixed_unit<zeptojoule, zepto, joule> {};
|
||||
struct attojoule : prefixed_unit<attojoule, atto, joule> {};
|
||||
@@ -56,7 +56,7 @@ struct yottajoule : prefixed_unit<yottajoule, yotta, joule> {};
|
||||
// N.B. electron charge (and eV) is an exact constant:
|
||||
// https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf#page=147
|
||||
struct electronvolt :
|
||||
named_scaled_unit<electronvolt, "eV", prefix, as_magnitude<ratio(1'602'176'634, 1'000'000'000, -19)>(), joule> {};
|
||||
named_scaled_unit<electronvolt, "eV", as_magnitude<ratio(1'602'176'634, 1'000'000'000, -19)>(), joule> {};
|
||||
struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, giga, electronvolt> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, joule, dim_force, dim_length> {};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct joule_per_metre_cub : unit<joule_per_metre_cub> {};
|
||||
struct joule_per_metre_cub : derived_unit<joule_per_metre_cub> {};
|
||||
struct dim_energy_density : isq::dim_energy_density<dim_energy_density, joule_per_metre_cub, dim_energy, dim_volume> {};
|
||||
|
||||
template<UnitOf<dim_energy_density> U, Representation Rep = double>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct newton : named_unit<newton, "N", prefix> {};
|
||||
struct newton : named_unit<newton, "N"> {};
|
||||
struct yoctonewton : prefixed_unit<yoctonewton, yocto, newton> {};
|
||||
struct zeptonewton : prefixed_unit<zeptonewton, zepto, newton> {};
|
||||
struct attonewton : prefixed_unit<attonewton, atto, newton> {};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct hertz : named_unit<hertz, "Hz", prefix> {};
|
||||
struct hertz : named_unit<hertz, "Hz"> {};
|
||||
struct yoctohertz : prefixed_unit<yoctohertz, yocto, hertz> {};
|
||||
struct zeptohertz : prefixed_unit<zeptohertz, zepto, hertz> {};
|
||||
struct attohertz : prefixed_unit<attohertz, atto, hertz> {};
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct joule_per_kelvin : unit<joule_per_kelvin> {};
|
||||
struct joule_per_kilogram_kelvin : unit<joule_per_kilogram_kelvin> {};
|
||||
struct joule_per_mole_kelvin : unit<joule_per_mole_kelvin> {};
|
||||
struct joule_per_kelvin : derived_unit<joule_per_kelvin> {};
|
||||
struct joule_per_kilogram_kelvin : derived_unit<joule_per_kilogram_kelvin> {};
|
||||
struct joule_per_mole_kelvin : derived_unit<joule_per_mole_kelvin> {};
|
||||
|
||||
struct dim_heat_capacity :
|
||||
isq::dim_heat_capacity<dim_heat_capacity, joule_per_kelvin, dim_energy, dim_thermodynamic_temperature> {};
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct henry : named_unit<henry, "H", prefix> {};
|
||||
struct henry : named_unit<henry, "H"> {};
|
||||
|
||||
struct yoctohenry : prefixed_unit<yoctohenry, yocto, henry> {};
|
||||
struct zeptohenry : prefixed_unit<zeptohenry, zepto, henry> {};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct metre : named_unit<metre, "m", prefix> {};
|
||||
struct metre : named_unit<metre, "m"> {};
|
||||
struct yoctometre : prefixed_unit<yoctometre, yocto, metre> {};
|
||||
struct zeptometre : prefixed_unit<zeptometre, zepto, metre> {};
|
||||
struct attometre : prefixed_unit<attometre, atto, metre> {};
|
||||
@@ -56,8 +56,7 @@ struct exametre : prefixed_unit<exametre, exa, metre> {};
|
||||
struct zettametre : prefixed_unit<zettametre, zetta, metre> {};
|
||||
struct yottametre : prefixed_unit<yottametre, yotta, metre> {};
|
||||
|
||||
struct astronomical_unit :
|
||||
named_scaled_unit<astronomical_unit, "au", no_prefix, as_magnitude<149'597'870'700>(), metre> {};
|
||||
struct astronomical_unit : named_scaled_unit<astronomical_unit, "au", as_magnitude<149'597'870'700>(), metre> {};
|
||||
|
||||
struct dim_length : isq::dim_length<metre> {};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct candela_per_metre_sq : unit<candela_per_metre_sq> {};
|
||||
struct candela_per_metre_sq : derived_unit<candela_per_metre_sq> {};
|
||||
struct dim_luminance : isq::dim_luminance<dim_luminance, candela_per_metre_sq, dim_luminous_intensity, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_luminance> U, Representation Rep = double>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct candela : named_unit<candela, "cd", prefix> {};
|
||||
struct candela : named_unit<candela, "cd"> {};
|
||||
struct yoctocandela : prefixed_unit<yoctocandela, yocto, candela> {};
|
||||
struct zeptocandela : prefixed_unit<zeptocandela, zepto, candela> {};
|
||||
struct attocandela : prefixed_unit<attocandela, atto, candela> {};
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct weber : named_unit<weber, "Wb", prefix> {};
|
||||
struct weber : named_unit<weber, "Wb"> {};
|
||||
|
||||
struct yoctoweber : prefixed_unit<yoctoweber, yocto, weber> {};
|
||||
struct zeptoweber : prefixed_unit<zeptoweber, zepto, weber> {};
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct tesla : named_unit<tesla, "T", prefix> {};
|
||||
struct tesla : named_unit<tesla, "T"> {};
|
||||
|
||||
struct yoctotesla : prefixed_unit<yoctotesla, yocto, tesla> {};
|
||||
struct zeptotesla : prefixed_unit<zeptotesla, zepto, tesla> {};
|
||||
@@ -56,7 +56,7 @@ struct exatesla : prefixed_unit<exatesla, exa, tesla> {};
|
||||
struct zettatesla : prefixed_unit<zettatesla, zetta, tesla> {};
|
||||
struct yottatesla : prefixed_unit<yottatesla, yotta, tesla> {};
|
||||
|
||||
struct gauss : named_scaled_unit<gauss, "G", prefix, as_magnitude<ratio(1, 10'000)>(), tesla> {};
|
||||
struct gauss : named_scaled_unit<gauss, "G", as_magnitude<ratio(1, 10'000)>(), tesla> {};
|
||||
|
||||
struct dim_magnetic_induction :
|
||||
isq::dim_magnetic_induction<dim_magnetic_induction, tesla, dim_voltage, dim_time, dim_length> {};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct gram : named_unit<gram, "g", prefix> {};
|
||||
struct gram : named_unit<gram, "g"> {};
|
||||
struct yoctogram : prefixed_unit<yoctogram, yocto, gram> {};
|
||||
struct zeptogram : prefixed_unit<zeptogram, zepto, gram> {};
|
||||
struct attogram : prefixed_unit<attogram, atto, gram> {};
|
||||
@@ -56,7 +56,7 @@ struct exagram : prefixed_unit<exagram, exa, gram> {};
|
||||
struct zettagram : prefixed_unit<zettagram, zetta, gram> {};
|
||||
struct yottagram : prefixed_unit<yottagram, yotta, gram> {};
|
||||
|
||||
struct tonne : alias_unit<megagram, "t", prefix> {};
|
||||
struct tonne : alias_unit<megagram, "t"> {};
|
||||
struct yoctotonne : prefixed_alias_unit<attogram, yocto, tonne> {};
|
||||
struct zeptotonne : prefixed_alias_unit<femtogram, zepto, tonne> {};
|
||||
struct attotonne : prefixed_alias_unit<picogram, atto, tonne> {};
|
||||
@@ -79,8 +79,7 @@ struct zettatonne : prefixed_unit<zettatonne, zetta, tonne> {};
|
||||
struct yottatonne : prefixed_unit<yottatonne, yotta, tonne> {};
|
||||
|
||||
struct dalton :
|
||||
named_scaled_unit<dalton, "Da", no_prefix, as_magnitude<ratio(16'605'390'666'050, 10'000'000'000'000, -27)>(),
|
||||
kilogram> {};
|
||||
named_scaled_unit<dalton, "Da", as_magnitude<ratio(16'605'390'666'050, 10'000'000'000'000, -27)>(), kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<kilogram> {};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct joule_per_mole : unit<joule_per_mole> {};
|
||||
struct joule_per_mole : derived_unit<joule_per_mole> {};
|
||||
|
||||
struct dim_molar_energy :
|
||||
isq::dim_molar_energy<dim_molar_energy, joule_per_mole, dim_energy, dim_amount_of_substance> {};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct kilogram_metre_per_second : unit<kilogram_metre_per_second> {};
|
||||
struct kilogram_metre_per_second : derived_unit<kilogram_metre_per_second> {};
|
||||
struct dim_momentum : isq::dim_momentum<dim_momentum, kilogram_metre_per_second, dim_mass, dim_speed> {};
|
||||
|
||||
template<UnitOf<dim_momentum> U, Representation Rep = double>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct henry_per_metre : unit<henry_per_metre> {};
|
||||
struct henry_per_metre : derived_unit<henry_per_metre> {};
|
||||
|
||||
struct dim_permeability : isq::dim_permeability<dim_permeability, henry_per_metre, dim_inductance, dim_length> {};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct farad_per_metre : unit<farad_per_metre> {};
|
||||
struct farad_per_metre : derived_unit<farad_per_metre> {};
|
||||
|
||||
struct dim_permittivity : isq::dim_permittivity<dim_permittivity, farad_per_metre, dim_capacitance, dim_length> {};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct watt : named_unit<watt, "W", prefix> {};
|
||||
struct watt : named_unit<watt, "W"> {};
|
||||
struct yoctowatt : prefixed_unit<yoctowatt, yocto, watt> {};
|
||||
struct zeptowatt : prefixed_unit<zeptowatt, zepto, watt> {};
|
||||
struct attowatt : prefixed_unit<attowatt, atto, watt> {};
|
||||
|
||||
@@ -26,29 +26,27 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct prefix : prefix_family {};
|
||||
|
||||
// clang-format off
|
||||
struct yocto : units::prefix<yocto, prefix, "y", ratio(1, 1, -24)> {};
|
||||
struct zepto : units::prefix<zepto, prefix, "z", ratio(1, 1, -21)> {};
|
||||
struct atto : units::prefix<atto, prefix, "a", ratio(1, 1, -18)> {};
|
||||
struct femto : units::prefix<femto, prefix, "f", ratio(1, 1, -15)> {};
|
||||
struct pico : units::prefix<pico, prefix, "p", ratio(1, 1, -12)> {};
|
||||
struct nano : units::prefix<nano, prefix, "n", ratio(1, 1, -9)> {};
|
||||
struct micro : units::prefix<micro, prefix, basic_symbol_text{"\u00b5", "u"}, ratio(1, 1, -6)> {};
|
||||
struct milli : units::prefix<milli, prefix, "m", ratio(1, 1, -3)> {};
|
||||
struct centi : units::prefix<centi, prefix, "c", ratio(1, 1, -2)> {};
|
||||
struct deci : units::prefix<deci, prefix, "d", ratio(1, 1, -1)> {};
|
||||
struct deca : units::prefix<deca, prefix, "da", ratio(1, 1, 1)> {};
|
||||
struct hecto : units::prefix<hecto, prefix, "h", ratio(1, 1, 2)> {};
|
||||
struct kilo : units::prefix<kilo, prefix, "k", ratio(1, 1, 3)> {};
|
||||
struct mega : units::prefix<mega, prefix, "M", ratio(1, 1, 6)> {};
|
||||
struct giga : units::prefix<giga, prefix, "G", ratio(1, 1, 9)> {};
|
||||
struct tera : units::prefix<tera, prefix, "T", ratio(1, 1, 12)> {};
|
||||
struct peta : units::prefix<peta, prefix, "P", ratio(1, 1, 15)> {};
|
||||
struct exa : units::prefix<exa, prefix, "E", ratio(1, 1, 18)> {};
|
||||
struct zetta : units::prefix<zetta, prefix, "Z", ratio(1, 1, 21)> {};
|
||||
struct yotta : units::prefix<yotta, prefix, "Y", ratio(1, 1, 24)> {};
|
||||
struct yocto : units::prefix<yocto, "y", ratio(1, 1, -24)> {};
|
||||
struct zepto : units::prefix<zepto, "z", ratio(1, 1, -21)> {};
|
||||
struct atto : units::prefix<atto, "a", ratio(1, 1, -18)> {};
|
||||
struct femto : units::prefix<femto, "f", ratio(1, 1, -15)> {};
|
||||
struct pico : units::prefix<pico, "p", ratio(1, 1, -12)> {};
|
||||
struct nano : units::prefix<nano, "n", ratio(1, 1, -9)> {};
|
||||
struct micro : units::prefix<micro, basic_symbol_text{"\u00b5", "u"}, ratio(1, 1, -6)> {};
|
||||
struct milli : units::prefix<milli, "m", ratio(1, 1, -3)> {};
|
||||
struct centi : units::prefix<centi, "c", ratio(1, 1, -2)> {};
|
||||
struct deci : units::prefix<deci, "d", ratio(1, 1, -1)> {};
|
||||
struct deca : units::prefix<deca, "da", ratio(1, 1, 1)> {};
|
||||
struct hecto : units::prefix<hecto, "h", ratio(1, 1, 2)> {};
|
||||
struct kilo : units::prefix<kilo, "k", ratio(1, 1, 3)> {};
|
||||
struct mega : units::prefix<mega, "M", ratio(1, 1, 6)> {};
|
||||
struct giga : units::prefix<giga, "G", ratio(1, 1, 9)> {};
|
||||
struct tera : units::prefix<tera, "T", ratio(1, 1, 12)> {};
|
||||
struct peta : units::prefix<peta, "P", ratio(1, 1, 15)> {};
|
||||
struct exa : units::prefix<exa, "E", ratio(1, 1, 18)> {};
|
||||
struct zetta : units::prefix<zetta, "Z", ratio(1, 1, 21)> {};
|
||||
struct yotta : units::prefix<yotta, "Y", ratio(1, 1, 24)> {};
|
||||
// clang-format on
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct pascal : named_unit<pascal, "Pa", prefix> {};
|
||||
struct pascal : named_unit<pascal, "Pa"> {};
|
||||
struct yoctopascal : prefixed_unit<yoctopascal, yocto, pascal> {};
|
||||
struct zeptopascal : prefixed_unit<zeptopascal, zepto, pascal> {};
|
||||
struct attopascal : prefixed_unit<attopascal, atto, pascal> {};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct becquerel : named_unit<becquerel, "Bq", prefix> {};
|
||||
struct becquerel : named_unit<becquerel, "Bq"> {};
|
||||
struct yoctobecquerel : prefixed_unit<yoctobecquerel, yocto, becquerel> {};
|
||||
struct zeptobecquerel : prefixed_unit<zeptobecquerel, zepto, becquerel> {};
|
||||
struct attobecquerel : prefixed_unit<attobecquerel, atto, becquerel> {};
|
||||
@@ -280,47 +280,47 @@ using namespace radioactivity_references;
|
||||
namespace units::aliases::isq::si::inline radioactivity {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using Bq = units::isq::radioactivity<units::isq::becquerel, Rep>;
|
||||
using Bq = units::isq::si::radioactivity<units::isq::si::becquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using yBq = units::isq::radioactivity<units::isq::yoctobecquerel, Rep>;
|
||||
using yBq = units::isq::si::radioactivity<units::isq::si::yoctobecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using zBq = units::isq::radioactivity<units::isq::zeptobecquerel, Rep>;
|
||||
using zBq = units::isq::si::radioactivity<units::isq::si::zeptobecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using aBq = units::isq::radioactivity<units::isq::attobecquerel, Rep>;
|
||||
using aBq = units::isq::si::radioactivity<units::isq::si::attobecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using fBq = units::isq::radioactivity<units::isq::femtobecquerel, Rep>;
|
||||
using fBq = units::isq::si::radioactivity<units::isq::si::femtobecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using pBq = units::isq::radioactivity<units::isq::picobecquerel, Rep>;
|
||||
using pBq = units::isq::si::radioactivity<units::isq::si::picobecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using nBq = units::isq::radioactivity<units::isq::nanobecquerel, Rep>;
|
||||
using nBq = units::isq::si::radioactivity<units::isq::si::nanobecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using uBq = units::isq::radioactivity<units::isq::microbecquerel, Rep>;
|
||||
using uBq = units::isq::si::radioactivity<units::isq::si::microbecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using mBq = units::isq::radioactivity<units::isq::millibecquerel, Rep>;
|
||||
using mBq = units::isq::si::radioactivity<units::isq::si::millibecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using cBq = units::isq::radioactivity<units::isq::centibecquerel, Rep>;
|
||||
using cBq = units::isq::si::radioactivity<units::isq::si::centibecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using dBq = units::isq::radioactivity<units::isq::decibecquerel, Rep>;
|
||||
using dBq = units::isq::si::radioactivity<units::isq::si::decibecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using daBq = units::isq::radioactivity<units::isq::decabecquerel, Rep>;
|
||||
using daBq = units::isq::si::radioactivity<units::isq::si::decabecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using hBq = units::isq::radioactivity<units::isq::hectobecquerel, Rep>;
|
||||
using hBq = units::isq::si::radioactivity<units::isq::si::hectobecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using kBq = units::isq::radioactivity<units::isq::kilobecquerel, Rep>;
|
||||
using kBq = units::isq::si::radioactivity<units::isq::si::kilobecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using MBq = units::isq::radioactivity<units::isq::megabecquerel, Rep>;
|
||||
using MBq = units::isq::si::radioactivity<units::isq::si::megabecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using GBq = units::isq::radioactivity<units::isq::gigabecquerel, Rep>;
|
||||
using GBq = units::isq::si::radioactivity<units::isq::si::gigabecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using TBq = units::isq::radioactivity<units::isq::terabecquerel, Rep>;
|
||||
using TBq = units::isq::si::radioactivity<units::isq::si::terabecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using PBq = units::isq::radioactivity<units::isq::petabecquerel, Rep>;
|
||||
using PBq = units::isq::si::radioactivity<units::isq::si::petabecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using EBq = units::isq::radioactivity<units::isq::exabecquerel, Rep>;
|
||||
using EBq = units::isq::si::radioactivity<units::isq::si::exabecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using ZBq = units::isq::radioactivity<units::isq::zettabecquerel, Rep>;
|
||||
using ZBq = units::isq::si::radioactivity<units::isq::si::zettabecquerel, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using YBq = units::isq::radioactivity<units::isq::yottabecquerel, Rep>;
|
||||
using YBq = units::isq::si::radioactivity<units::isq::si::yottabecquerel, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::inline radioactivity
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user