From f4747a4d7dde1c007b2e9eceac94070f579260a6 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Fri, 11 Sep 2020 21:16:26 +0200 Subject: [PATCH] refactor: :recycle: more file system related cleanup (mostly physical dimensions definitions) BREAKING_CHANGE: current, substance, temperature renamed to proper names --- .../reference/systems/physical/si/current.rst | 2 +- .../systems/physical/si/substance.rst | 2 +- .../systems/physical/si/temperature.rst | 2 +- example/experimental_angle.cpp | 3 +- src/include/units/base_dimension.h | 2 +- src/include/units/bits/basic_concepts.h | 289 ++++++++++++++ src/include/units/bits/equivalent.h | 2 +- src/include/units/bits/quantity_of.h | 60 +++ src/include/units/concepts.h | 267 +------------ src/include/units/generic/angle.h | 3 + .../units/physical/bits/absorbed_dose.h | 37 ++ .../units/physical/bits/acceleration.h | 37 ++ .../units/physical/bits/amount_of_substance.h | 35 ++ .../units/physical/bits/angular_velocity.h | 37 ++ src/include/units/physical/bits/area.h | 36 ++ src/include/units/physical/bits/capacitance.h | 37 ++ .../units/physical/bits/catalytic_activity.h | 37 ++ .../units/physical/bits/charge_density.h | 43 ++ .../units/physical/bits/concentration.h | 37 ++ src/include/units/physical/bits/conductance.h | 36 ++ .../units/physical/bits/current_density.h | 37 ++ src/include/units/physical/bits/density.h | 37 ++ src/include/units/physical/bits/dimensions.h | 73 ++++ .../units/physical/bits/dynamic_viscosity.h | 37 ++ .../units/physical/bits/electric_charge.h | 37 ++ .../units/physical/bits/electric_current.h | 35 ++ .../physical/bits/electric_field_strength.h | 37 ++ src/include/units/physical/bits/energy.h | 37 ++ .../units/physical/bits/energy_density.h | 38 ++ src/include/units/physical/bits/force.h | 37 ++ src/include/units/physical/bits/frequency.h | 36 ++ .../units/physical/bits/heat_capacity.h | 51 +++ src/include/units/physical/bits/inductance.h | 37 ++ src/include/units/physical/bits/length.h | 35 ++ src/include/units/physical/bits/luminance.h | 37 ++ .../units/physical/bits/luminous_intensity.h | 35 ++ .../units/physical/bits/magnetic_flux.h | 37 ++ .../units/physical/bits/magnetic_induction.h | 38 ++ src/include/units/physical/bits/mass.h | 35 ++ .../units/physical/bits/molar_energy.h | 37 ++ src/include/units/physical/bits/momentum.h | 36 ++ .../units/physical/bits/permeability.h | 37 ++ .../units/physical/bits/permittivity.h | 37 ++ src/include/units/physical/bits/power.h | 37 ++ src/include/units/physical/bits/pressure.h | 37 ++ .../units/physical/bits/radioactivity.h | 37 ++ src/include/units/physical/bits/resistance.h | 37 ++ src/include/units/physical/bits/speed.h | 37 ++ .../units/physical/bits/surface_tension.h | 37 ++ .../physical/bits/thermal_conductivity.h | 38 ++ .../physical/bits/thermodynamic_temperature.h | 35 ++ src/include/units/physical/bits/time.h | 35 ++ src/include/units/physical/bits/torque.h | 37 ++ src/include/units/physical/bits/voltage.h | 37 ++ src/include/units/physical/bits/volume.h | 36 ++ src/include/units/physical/dimensions.h | 367 +++--------------- .../{substance.h => amount_of_substance.h} | 8 +- src/include/units/physical/si/base/current.h | 146 ------- .../units/physical/si/base/electric_current.h | 146 +++++++ ...perature.h => thermodynamic_temperature.h} | 6 +- .../si/bits/derived/catalytic_activity.h | 4 +- .../physical/si/bits/derived/concentration.h | 4 +- .../si/bits/derived/current_density.h | 2 +- .../si/bits/derived/electric_charge.h | 2 +- .../physical/si/bits/derived/heat_capacity.h | 6 +- .../physical/si/bits/derived/inductance.h | 2 +- .../physical/si/bits/derived/molar_energy.h | 4 +- .../physical/si/bits/derived/resistance.h | 2 +- .../si/bits/derived/thermal_conductivity.h | 2 +- .../units/physical/si/bits/derived/voltage.h | 2 +- src/include/units/physical/si/si.h | 6 +- src/include/units/prefix.h | 2 +- src/include/units/quantity_cast.h | 4 - 73 files changed, 2283 insertions(+), 769 deletions(-) create mode 100644 src/include/units/bits/basic_concepts.h create mode 100644 src/include/units/bits/quantity_of.h create mode 100644 src/include/units/physical/bits/absorbed_dose.h create mode 100644 src/include/units/physical/bits/acceleration.h create mode 100644 src/include/units/physical/bits/amount_of_substance.h create mode 100644 src/include/units/physical/bits/angular_velocity.h create mode 100644 src/include/units/physical/bits/area.h create mode 100644 src/include/units/physical/bits/capacitance.h create mode 100644 src/include/units/physical/bits/catalytic_activity.h create mode 100644 src/include/units/physical/bits/charge_density.h create mode 100644 src/include/units/physical/bits/concentration.h create mode 100644 src/include/units/physical/bits/conductance.h create mode 100644 src/include/units/physical/bits/current_density.h create mode 100644 src/include/units/physical/bits/density.h create mode 100644 src/include/units/physical/bits/dimensions.h create mode 100644 src/include/units/physical/bits/dynamic_viscosity.h create mode 100644 src/include/units/physical/bits/electric_charge.h create mode 100644 src/include/units/physical/bits/electric_current.h create mode 100644 src/include/units/physical/bits/electric_field_strength.h create mode 100644 src/include/units/physical/bits/energy.h create mode 100644 src/include/units/physical/bits/energy_density.h create mode 100644 src/include/units/physical/bits/force.h create mode 100644 src/include/units/physical/bits/frequency.h create mode 100644 src/include/units/physical/bits/heat_capacity.h create mode 100644 src/include/units/physical/bits/inductance.h create mode 100644 src/include/units/physical/bits/length.h create mode 100644 src/include/units/physical/bits/luminance.h create mode 100644 src/include/units/physical/bits/luminous_intensity.h create mode 100644 src/include/units/physical/bits/magnetic_flux.h create mode 100644 src/include/units/physical/bits/magnetic_induction.h create mode 100644 src/include/units/physical/bits/mass.h create mode 100644 src/include/units/physical/bits/molar_energy.h create mode 100644 src/include/units/physical/bits/momentum.h create mode 100644 src/include/units/physical/bits/permeability.h create mode 100644 src/include/units/physical/bits/permittivity.h create mode 100644 src/include/units/physical/bits/power.h create mode 100644 src/include/units/physical/bits/pressure.h create mode 100644 src/include/units/physical/bits/radioactivity.h create mode 100644 src/include/units/physical/bits/resistance.h create mode 100644 src/include/units/physical/bits/speed.h create mode 100644 src/include/units/physical/bits/surface_tension.h create mode 100644 src/include/units/physical/bits/thermal_conductivity.h create mode 100644 src/include/units/physical/bits/thermodynamic_temperature.h create mode 100644 src/include/units/physical/bits/time.h create mode 100644 src/include/units/physical/bits/torque.h create mode 100644 src/include/units/physical/bits/voltage.h create mode 100644 src/include/units/physical/bits/volume.h rename src/include/units/physical/si/base/{substance.h => amount_of_substance.h} (84%) delete mode 100644 src/include/units/physical/si/base/current.h create mode 100644 src/include/units/physical/si/base/electric_current.h rename src/include/units/physical/si/base/{temperature.h => thermodynamic_temperature.h} (83%) diff --git a/docs_disabled/reference/systems/physical/si/current.rst b/docs_disabled/reference/systems/physical/si/current.rst index acfbdcfe..b2dc5744 100644 --- a/docs_disabled/reference/systems/physical/si/current.rst +++ b/docs_disabled/reference/systems/physical/si/current.rst @@ -1,4 +1,4 @@ Current ======= -.. doxygenfile:: si/base/current.h +.. doxygenfile:: si/base/electric_current.h diff --git a/docs_disabled/reference/systems/physical/si/substance.rst b/docs_disabled/reference/systems/physical/si/substance.rst index e2d51fcf..ec5b8912 100644 --- a/docs_disabled/reference/systems/physical/si/substance.rst +++ b/docs_disabled/reference/systems/physical/si/substance.rst @@ -1,4 +1,4 @@ Substance ========= -.. doxygenfile:: si/base/substance.h +.. doxygenfile:: si/base/amount_of_substance.h diff --git a/docs_disabled/reference/systems/physical/si/temperature.rst b/docs_disabled/reference/systems/physical/si/temperature.rst index 713e83a7..b0cf85ed 100644 --- a/docs_disabled/reference/systems/physical/si/temperature.rst +++ b/docs_disabled/reference/systems/physical/si/temperature.rst @@ -1,4 +1,4 @@ Temperature =========== -.. doxygenfile:: si/base/temperature.h +.. doxygenfile:: si/base/thermodynamic_temperature.h diff --git a/example/experimental_angle.cpp b/example/experimental_angle.cpp index 4fa9ca8c..4e46fba1 100644 --- a/example/experimental_angle.cpp +++ b/example/experimental_angle.cpp @@ -21,6 +21,7 @@ // SOFTWARE. #include +#include #include #include @@ -32,7 +33,7 @@ int main() auto torque = 20.0_q_Nm; auto energy = 20.0_q_J; - physical::Angle auto angle = torque / energy; + Angle auto angle = torque / energy; std::cout << angle << '\n'; } diff --git a/src/include/units/base_dimension.h b/src/include/units/base_dimension.h index 750c9deb..9653ec27 100644 --- a/src/include/units/base_dimension.h +++ b/src/include/units/base_dimension.h @@ -23,7 +23,7 @@ #pragma once #include -#include +#include #include namespace units { diff --git a/src/include/units/bits/basic_concepts.h b/src/include/units/bits/basic_concepts.h new file mode 100644 index 00000000..0cdb8bdb --- /dev/null +++ b/src/include/units/bits/basic_concepts.h @@ -0,0 +1,289 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace units { + +// PrefixFamily +struct prefix_family; + +/** + * @brief A concept matching a prefix family + * + * Satisfied by all types derived from `prefix_family` + */ +template +concept PrefixFamily = std::derived_from; + +// Prefix +namespace detail { + +template +struct prefix_base; + +template +void to_prefix_base(const volatile prefix_base*); + +} // namespace detail + +/** + * @brief A concept matching a symbol prefix + * + * Satisfied by all specializations of `prefix`. + */ +template +concept Prefix = requires(const volatile T* t) { detail::to_prefix_base(t); }; + +/** + * @brief A concept matching unit's ratio + * + * Satisfied by all ratio values for which `R.num > 0` and `R.den > 0`. + */ +template +concept UnitRatio = R.num > 0 && R.den > 0; + +// Unit +template + requires UnitRatio +struct scaled_unit; + +// TODO: Remove when P1985 accepted +namespace detail { + +template +void to_base_scaled_unit(const volatile scaled_unit*); + +} // namespace detail + +/** + * @brief A concept matching all unit types in the library + * + * Satisfied by all unit types derived from an specialization of :class:`scaled_unit`. + */ +template +concept Unit = requires { detail::to_base_scaled_unit(std::declval()); }; + +// BaseDimension +template + requires U::is_named +struct base_dimension; + +namespace detail { + +template +void to_base_base_dimension(const volatile base_dimension*); + +} // namespace detail + +/** + * @brief A concept matching all base dimensions in the library. + * + * Satisfied by all dimension types derived from an specialization of `base_dimension`. + */ +template +concept BaseDimension = requires { detail::to_base_base_dimension(std::declval()); }; + +// Exponent +namespace detail { + +template +inline constexpr bool is_exponent = false; + +} // namespace detail + +/** + * @brief A concept matching dimension's exponents. + * + * Satisfied by all specializations of :class:`exponent`. + */ +template +concept Exponent = detail::is_exponent; + +// DerivedDimension +namespace detail { + +template + requires (BaseDimension && ...) +struct derived_dimension_base; + +} // namespace detail + +/** + * @brief A concept matching all derived dimensions in the library. + * + * Satisfied by all dimension types derived from an specialization of `detail::derived_dimension_base`. + */ +template +concept DerivedDimension = is_derived_from_specialization_of; + +// Dimension +/** + * @brief A concept matching all dimensions in the library. + * + * Satisfied by all dimension types for which either `BaseDimension` or `DerivedDimension` is `true`. + */ +template +concept Dimension = BaseDimension || DerivedDimension; + +// UnitOf +namespace detail { + +template +auto default_unit() +{ + if constexpr (BaseDimension) + return typename D::base_unit{}; + else + return typename D::coherent_unit{}; +} + +} // namespace detail + +/** + * @brief Returns a 'default' unit of the dimension + * + * Depending on the dimension type it returns a base unit (for base dimensions) + * or a coherent unit (in case of derived dimensions). + * + * @tparam D Dimension type to get the unit from. + */ +template +using dimension_unit = decltype(detail::default_unit()); +// TODO: replace with the below code when VS catches up +// decltype([]{ +// if constexpr (BaseDimension) +// return TYPENAME D::base_unit{}; +// else +// return TYPENAME D::coherent_unit{}; +// }()); + +/** + * @brief A concept matching only units of a specified dimension. + * + * Satisfied by all unit types that satisfy `Unit`, `Dimension`, and for which + * `U::reference` and @c dimension_unit::reference denote the same unit type. + * + * @tparam U Type to verify. + * @tparam D Dimension type to use for verification. + */ +template +concept UnitOf = + Unit && + Dimension && + std::same_as::reference>; + +// Quantity, QuantityPoint +namespace detail { + +template +inline constexpr bool is_quantity = false; + +template +inline constexpr bool is_quantity_point = false; + +} // namespace detail + +/** + * @brief A concept matching all quantities in the library. + * + * Satisfied by all specializations of :class:`quantity`. + */ +template +concept Quantity = detail::is_quantity; + +/** + * @brief A concept matching all quantity points in the library. + * + * Satisfied by all specializations of :class:`quantity_point`. + */ +template +concept QuantityPoint = detail::is_quantity_point; + + +// WrappedQuantity +namespace detail { + +template +inline constexpr bool is_wrapped_quantity = false; + +template + requires requires { typename T::value_type; } +inline constexpr bool is_wrapped_quantity = Quantity || is_wrapped_quantity; + +} // namespace detail + +/** + * @brief A concept matching types that wrap quantity objects. + * + * Satisfied by all wrapper types that satisfy `Quantity` + * recursively (i.e. `std::optional>`). + */ +template +concept WrappedQuantity = detail::is_wrapped_quantity; + +// ScalableNumber + +namespace detail { + +template +concept constructible_from_integral = + // construction from an integral type + std::constructible_from && + // unit scaling + std::regular_invocable, T, T> && + std::regular_invocable, T, T>; + +template +concept not_constructible_from_integral = + // not construction from an integral type + (!std::constructible_from) && + + // scaling by the value from ratio + std::regular_invocable, T, std::int64_t> && + std::regular_invocable, std::int64_t, T>; // && + // std::regular_invocable, T, std::int64_t>; // TODO Uncomment when a bug in LA is fixed + +} // namespace detail + +/** + * @brief A concept matching non-Quantity types. + * + * Satisfied by types that satisfy `(!Quantity) && (!WrappedQuantity) && std::regular`. + */ +template +concept ScalableNumber = + (!Quantity) && + (!WrappedQuantity) && + std::regular && + (detail::constructible_from_integral || detail::not_constructible_from_integral); + +} // namespace units diff --git a/src/include/units/bits/equivalent.h b/src/include/units/bits/equivalent.h index 2164da9f..39d7784c 100644 --- a/src/include/units/bits/equivalent.h +++ b/src/include/units/bits/equivalent.h @@ -22,7 +22,7 @@ #pragma once -#include +#include #include namespace units { diff --git a/src/include/units/bits/quantity_of.h b/src/include/units/bits/quantity_of.h new file mode 100644 index 00000000..26996e27 --- /dev/null +++ b/src/include/units/bits/quantity_of.h @@ -0,0 +1,60 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include + +namespace units { + +// DimensionOfT +namespace detail { + +template typename DimTemplate> +inline constexpr bool same_exponents_of = false; + +template typename DimTemplate> +inline constexpr bool same_exponents_of, DimTemplate> = requires { typename DimTemplate, unknown_coherent_unit, typename Es::dimension...>; } && std::same_as, typename DimTemplate, unknown_coherent_unit, typename Es::dimension...>::recipe>; + +} // namespace detail + +template typename DimTemplate> +concept EquivalentUnknownDimensionOfT = Dimension && is_derived_from_specialization_of && detail::same_exponents_of; + +template typename DimTemplate> +concept DimensionOfT = Dimension && (is_derived_from_specialization_of +#if DOWNCAST_MODE == 0 + || EquivalentUnknownDimensionOfT +#endif +); + +// QuantityOfT +template typename DimTemplate> +concept QuantityOfT = Quantity && DimensionOfT; + +// QuantityOf +template +concept QuantityOf = Quantity && Dimension && equivalent; + + +} // namespace units diff --git a/src/include/units/concepts.h b/src/include/units/concepts.h index 0cdb8bdb..e8fbccd1 100644 --- a/src/include/units/concepts.h +++ b/src/include/units/concepts.h @@ -22,268 +22,5 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include - -namespace units { - -// PrefixFamily -struct prefix_family; - -/** - * @brief A concept matching a prefix family - * - * Satisfied by all types derived from `prefix_family` - */ -template -concept PrefixFamily = std::derived_from; - -// Prefix -namespace detail { - -template -struct prefix_base; - -template -void to_prefix_base(const volatile prefix_base*); - -} // namespace detail - -/** - * @brief A concept matching a symbol prefix - * - * Satisfied by all specializations of `prefix`. - */ -template -concept Prefix = requires(const volatile T* t) { detail::to_prefix_base(t); }; - -/** - * @brief A concept matching unit's ratio - * - * Satisfied by all ratio values for which `R.num > 0` and `R.den > 0`. - */ -template -concept UnitRatio = R.num > 0 && R.den > 0; - -// Unit -template - requires UnitRatio -struct scaled_unit; - -// TODO: Remove when P1985 accepted -namespace detail { - -template -void to_base_scaled_unit(const volatile scaled_unit*); - -} // namespace detail - -/** - * @brief A concept matching all unit types in the library - * - * Satisfied by all unit types derived from an specialization of :class:`scaled_unit`. - */ -template -concept Unit = requires { detail::to_base_scaled_unit(std::declval()); }; - -// BaseDimension -template - requires U::is_named -struct base_dimension; - -namespace detail { - -template -void to_base_base_dimension(const volatile base_dimension*); - -} // namespace detail - -/** - * @brief A concept matching all base dimensions in the library. - * - * Satisfied by all dimension types derived from an specialization of `base_dimension`. - */ -template -concept BaseDimension = requires { detail::to_base_base_dimension(std::declval()); }; - -// Exponent -namespace detail { - -template -inline constexpr bool is_exponent = false; - -} // namespace detail - -/** - * @brief A concept matching dimension's exponents. - * - * Satisfied by all specializations of :class:`exponent`. - */ -template -concept Exponent = detail::is_exponent; - -// DerivedDimension -namespace detail { - -template - requires (BaseDimension && ...) -struct derived_dimension_base; - -} // namespace detail - -/** - * @brief A concept matching all derived dimensions in the library. - * - * Satisfied by all dimension types derived from an specialization of `detail::derived_dimension_base`. - */ -template -concept DerivedDimension = is_derived_from_specialization_of; - -// Dimension -/** - * @brief A concept matching all dimensions in the library. - * - * Satisfied by all dimension types for which either `BaseDimension` or `DerivedDimension` is `true`. - */ -template -concept Dimension = BaseDimension || DerivedDimension; - -// UnitOf -namespace detail { - -template -auto default_unit() -{ - if constexpr (BaseDimension) - return typename D::base_unit{}; - else - return typename D::coherent_unit{}; -} - -} // namespace detail - -/** - * @brief Returns a 'default' unit of the dimension - * - * Depending on the dimension type it returns a base unit (for base dimensions) - * or a coherent unit (in case of derived dimensions). - * - * @tparam D Dimension type to get the unit from. - */ -template -using dimension_unit = decltype(detail::default_unit()); -// TODO: replace with the below code when VS catches up -// decltype([]{ -// if constexpr (BaseDimension) -// return TYPENAME D::base_unit{}; -// else -// return TYPENAME D::coherent_unit{}; -// }()); - -/** - * @brief A concept matching only units of a specified dimension. - * - * Satisfied by all unit types that satisfy `Unit`, `Dimension`, and for which - * `U::reference` and @c dimension_unit::reference denote the same unit type. - * - * @tparam U Type to verify. - * @tparam D Dimension type to use for verification. - */ -template -concept UnitOf = - Unit && - Dimension && - std::same_as::reference>; - -// Quantity, QuantityPoint -namespace detail { - -template -inline constexpr bool is_quantity = false; - -template -inline constexpr bool is_quantity_point = false; - -} // namespace detail - -/** - * @brief A concept matching all quantities in the library. - * - * Satisfied by all specializations of :class:`quantity`. - */ -template -concept Quantity = detail::is_quantity; - -/** - * @brief A concept matching all quantity points in the library. - * - * Satisfied by all specializations of :class:`quantity_point`. - */ -template -concept QuantityPoint = detail::is_quantity_point; - - -// WrappedQuantity -namespace detail { - -template -inline constexpr bool is_wrapped_quantity = false; - -template - requires requires { typename T::value_type; } -inline constexpr bool is_wrapped_quantity = Quantity || is_wrapped_quantity; - -} // namespace detail - -/** - * @brief A concept matching types that wrap quantity objects. - * - * Satisfied by all wrapper types that satisfy `Quantity` - * recursively (i.e. `std::optional>`). - */ -template -concept WrappedQuantity = detail::is_wrapped_quantity; - -// ScalableNumber - -namespace detail { - -template -concept constructible_from_integral = - // construction from an integral type - std::constructible_from && - // unit scaling - std::regular_invocable, T, T> && - std::regular_invocable, T, T>; - -template -concept not_constructible_from_integral = - // not construction from an integral type - (!std::constructible_from) && - - // scaling by the value from ratio - std::regular_invocable, T, std::int64_t> && - std::regular_invocable, std::int64_t, T>; // && - // std::regular_invocable, T, std::int64_t>; // TODO Uncomment when a bug in LA is fixed - -} // namespace detail - -/** - * @brief A concept matching non-Quantity types. - * - * Satisfied by types that satisfy `(!Quantity) && (!WrappedQuantity) && std::regular`. - */ -template -concept ScalableNumber = - (!Quantity) && - (!WrappedQuantity) && - std::regular && - (detail::constructible_from_integral || detail::not_constructible_from_integral); - -} // namespace units +#include +#include diff --git a/src/include/units/generic/angle.h b/src/include/units/generic/angle.h index 2f0a2661..f35798a4 100644 --- a/src/include/units/generic/angle.h +++ b/src/include/units/generic/angle.h @@ -32,6 +32,9 @@ struct radian : named_unit {}; template struct dim_angle : base_dimension<"A", U> {}; +template +concept Angle = QuantityOfT; + template using angle = quantity, U, Rep>; diff --git a/src/include/units/physical/bits/absorbed_dose.h b/src/include/units/physical/bits/absorbed_dose.h new file mode 100644 index 00000000..e85bd209 --- /dev/null +++ b/src/include/units/physical/bits/absorbed_dose.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template E, DimensionOfT M> +struct dim_absorbed_dose : derived_dimension, exponent> {}; + +template +concept AbsorbedDose = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/acceleration.h b/src/include/units/physical/bits/acceleration.h new file mode 100644 index 00000000..0e4a6ad3 --- /dev/null +++ b/src/include/units/physical/bits/acceleration.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template L, DimensionOfT T> +struct dim_acceleration : derived_dimension, exponent> {}; + +template +concept Acceleration = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/amount_of_substance.h b/src/include/units/physical/bits/amount_of_substance.h new file mode 100644 index 00000000..ffa42303 --- /dev/null +++ b/src/include/units/physical/bits/amount_of_substance.h @@ -0,0 +1,35 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::physical { + +template +struct dim_amount_of_substance : base_dimension<"N", U> {}; + +template +concept AmountOfSubstance = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/angular_velocity.h b/src/include/units/physical/bits/angular_velocity.h new file mode 100644 index 00000000..17692931 --- /dev/null +++ b/src/include/units/physical/bits/angular_velocity.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template A, DimensionOfT T> +struct dim_angular_velocity : derived_dimension, exponent> {}; + +template +concept AngularVelocity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/area.h b/src/include/units/physical/bits/area.h new file mode 100644 index 00000000..e6871deb --- /dev/null +++ b/src/include/units/physical/bits/area.h @@ -0,0 +1,36 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include + +namespace units::physical { + +template L> +struct dim_area : derived_dimension> {}; + +template +concept Area = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/capacitance.h b/src/include/units/physical/bits/capacitance.h new file mode 100644 index 00000000..55fa0a25 --- /dev/null +++ b/src/include/units/physical/bits/capacitance.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template C, DimensionOfT V> +struct dim_capacitance : derived_dimension, exponent> {}; + +template +concept Capacitance = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/catalytic_activity.h b/src/include/units/physical/bits/catalytic_activity.h new file mode 100644 index 00000000..a9114bbd --- /dev/null +++ b/src/include/units/physical/bits/catalytic_activity.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template T, DimensionOfT M> +struct dim_catalytic_activity : derived_dimension, exponent> {}; + +template +concept CatalyticActivity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/charge_density.h b/src/include/units/physical/bits/charge_density.h new file mode 100644 index 00000000..62d56f25 --- /dev/null +++ b/src/include/units/physical/bits/charge_density.h @@ -0,0 +1,43 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template Q, DimensionOfT L> +struct dim_charge_density : derived_dimension, exponent> {}; + +template Q, DimensionOfT L> +struct dim_surface_charge_density : derived_dimension, exponent> {}; + +template +concept ChargeDensity = QuantityOfT; + +template +concept SurfaceChargeDensity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/concentration.h b/src/include/units/physical/bits/concentration.h new file mode 100644 index 00000000..e978de19 --- /dev/null +++ b/src/include/units/physical/bits/concentration.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template M, DimensionOfT L> +struct dim_concentration : derived_dimension, exponent> {}; + +template +concept Concentration = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/conductance.h b/src/include/units/physical/bits/conductance.h new file mode 100644 index 00000000..eb8912d5 --- /dev/null +++ b/src/include/units/physical/bits/conductance.h @@ -0,0 +1,36 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include + +namespace units::physical { + +template R> +struct dim_conductance : derived_dimension> {}; + +template +concept Conductance = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/current_density.h b/src/include/units/physical/bits/current_density.h new file mode 100644 index 00000000..0bd9ec3c --- /dev/null +++ b/src/include/units/physical/bits/current_density.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template I, DimensionOfT L> +struct dim_current_density : derived_dimension, exponent> {}; + +template +concept CurrentDensity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/density.h b/src/include/units/physical/bits/density.h new file mode 100644 index 00000000..95bb0fc7 --- /dev/null +++ b/src/include/units/physical/bits/density.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template M, DimensionOfT L> +struct dim_density : derived_dimension, exponent> {}; + +template +concept Density = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/dimensions.h b/src/include/units/physical/bits/dimensions.h new file mode 100644 index 00000000..7d4bc6c8 --- /dev/null +++ b/src/include/units/physical/bits/dimensions.h @@ -0,0 +1,73 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// TODO Add when downcasting issue is solved +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// TODO Add when downcasting issue is solved +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/include/units/physical/bits/dynamic_viscosity.h b/src/include/units/physical/bits/dynamic_viscosity.h new file mode 100644 index 00000000..bc2533db --- /dev/null +++ b/src/include/units/physical/bits/dynamic_viscosity.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template P, DimensionOfT T> +struct dim_dynamic_viscosity : derived_dimension, exponent> {}; + +template +concept DynamicViscosity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/electric_charge.h b/src/include/units/physical/bits/electric_charge.h new file mode 100644 index 00000000..3289edbc --- /dev/null +++ b/src/include/units/physical/bits/electric_charge.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template T, DimensionOfT C> +struct dim_electric_charge : derived_dimension, exponent> {}; + +template +concept ElectricCharge = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/electric_current.h b/src/include/units/physical/bits/electric_current.h new file mode 100644 index 00000000..5540a4c5 --- /dev/null +++ b/src/include/units/physical/bits/electric_current.h @@ -0,0 +1,35 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::physical { + +template +struct dim_electric_current : base_dimension<"I", U> {}; + +template +concept ElectricCurrent = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/electric_field_strength.h b/src/include/units/physical/bits/electric_field_strength.h new file mode 100644 index 00000000..b1e213c0 --- /dev/null +++ b/src/include/units/physical/bits/electric_field_strength.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template V, DimensionOfT L> +struct dim_electric_field_strength : derived_dimension, exponent> {}; + +template +concept ElectricFieldStrength = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/energy.h b/src/include/units/physical/bits/energy.h new file mode 100644 index 00000000..ba1c722e --- /dev/null +++ b/src/include/units/physical/bits/energy.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template F, DimensionOfT L> +struct dim_energy : derived_dimension, exponent> {}; + +template +concept Energy = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/energy_density.h b/src/include/units/physical/bits/energy_density.h new file mode 100644 index 00000000..fe9c6808 --- /dev/null +++ b/src/include/units/physical/bits/energy_density.h @@ -0,0 +1,38 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +// TODO Add when downcasting issue is solved +// template E, DimensionOfT L> +// struct dim_energy_density : derived_dimension, exponent> {}; + +// template +// concept EnergyDensity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/force.h b/src/include/units/physical/bits/force.h new file mode 100644 index 00000000..8ad9b197 --- /dev/null +++ b/src/include/units/physical/bits/force.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template M, DimensionOfT A> +struct dim_force : derived_dimension, exponent> {}; + +template +concept Force = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/frequency.h b/src/include/units/physical/bits/frequency.h new file mode 100644 index 00000000..40f71561 --- /dev/null +++ b/src/include/units/physical/bits/frequency.h @@ -0,0 +1,36 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include + +namespace units::physical { + +template T> +struct dim_frequency : derived_dimension> {}; + +template +concept Frequency = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/heat_capacity.h b/src/include/units/physical/bits/heat_capacity.h new file mode 100644 index 00000000..41497dc3 --- /dev/null +++ b/src/include/units/physical/bits/heat_capacity.h @@ -0,0 +1,51 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include +#include +#include + +namespace units::physical { + +template E, DimensionOfT T> +struct dim_heat_capacity : derived_dimension, exponent> {}; + +template C, DimensionOfT M> +struct dim_specific_heat_capacity : derived_dimension, exponent> {}; + +template C, DimensionOfT M> +struct dim_molar_heat_capacity : derived_dimension, exponent> {}; + +template +concept HeatCapacity = QuantityOfT; + +template +concept SpecificHeatCapacity = QuantityOfT; + +template +concept MolarHeatCapacity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/inductance.h b/src/include/units/physical/bits/inductance.h new file mode 100644 index 00000000..3343b6ae --- /dev/null +++ b/src/include/units/physical/bits/inductance.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template F, DimensionOfT I> +struct dim_inductance : derived_dimension, exponent> {}; + +template +concept Inductance = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/length.h b/src/include/units/physical/bits/length.h new file mode 100644 index 00000000..4460195d --- /dev/null +++ b/src/include/units/physical/bits/length.h @@ -0,0 +1,35 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::physical { + +template +struct dim_length : base_dimension<"L", U> {}; + +template +concept Length = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/luminance.h b/src/include/units/physical/bits/luminance.h new file mode 100644 index 00000000..592897b9 --- /dev/null +++ b/src/include/units/physical/bits/luminance.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template I, DimensionOfT L> +struct dim_luminance : derived_dimension, exponent> {}; + +template +concept Luminance = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/luminous_intensity.h b/src/include/units/physical/bits/luminous_intensity.h new file mode 100644 index 00000000..c26b10a9 --- /dev/null +++ b/src/include/units/physical/bits/luminous_intensity.h @@ -0,0 +1,35 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::physical { + +template +struct dim_luminous_intensity : base_dimension<"J", U> {}; + +template +concept LuminousIntensity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/magnetic_flux.h b/src/include/units/physical/bits/magnetic_flux.h new file mode 100644 index 00000000..d413cb24 --- /dev/null +++ b/src/include/units/physical/bits/magnetic_flux.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template B, DimensionOfT A> +struct dim_magnetic_flux : derived_dimension, exponent> {}; + +template +concept MagneticFlux = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/magnetic_induction.h b/src/include/units/physical/bits/magnetic_induction.h new file mode 100644 index 00000000..c19a6042 --- /dev/null +++ b/src/include/units/physical/bits/magnetic_induction.h @@ -0,0 +1,38 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include +#include + +namespace units::physical { + +template V, DimensionOfT T, DimensionOfT L> +struct dim_magnetic_induction : derived_dimension, exponent, exponent> {}; + +template +concept MagneticInduction = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/mass.h b/src/include/units/physical/bits/mass.h new file mode 100644 index 00000000..d07c31eb --- /dev/null +++ b/src/include/units/physical/bits/mass.h @@ -0,0 +1,35 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::physical { + +template +struct dim_mass : base_dimension<"M", U> {}; + +template +concept Mass = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/molar_energy.h b/src/include/units/physical/bits/molar_energy.h new file mode 100644 index 00000000..7e1f48cc --- /dev/null +++ b/src/include/units/physical/bits/molar_energy.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template E, DimensionOfT M> +struct dim_molar_energy : derived_dimension, exponent> {}; + +template +concept MolarEnergy = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/momentum.h b/src/include/units/physical/bits/momentum.h new file mode 100644 index 00000000..319a741e --- /dev/null +++ b/src/include/units/physical/bits/momentum.h @@ -0,0 +1,36 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include + +namespace units::physical { + +template M, DimensionOfT V> +struct dim_momentum : derived_dimension, exponent> {}; + +template +concept Momentum = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/permeability.h b/src/include/units/physical/bits/permeability.h new file mode 100644 index 00000000..382e22c6 --- /dev/null +++ b/src/include/units/physical/bits/permeability.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template H, DimensionOfT L> +struct dim_permeability : derived_dimension, exponent> {}; + +template +concept Permeability = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/permittivity.h b/src/include/units/physical/bits/permittivity.h new file mode 100644 index 00000000..82f91b88 --- /dev/null +++ b/src/include/units/physical/bits/permittivity.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template C, DimensionOfT L> +struct dim_permittivity : derived_dimension, exponent> {}; + +template +concept Permittivity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/power.h b/src/include/units/physical/bits/power.h new file mode 100644 index 00000000..2c1a3aed --- /dev/null +++ b/src/include/units/physical/bits/power.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template E, DimensionOfT T> +struct dim_power : derived_dimension, exponent> {}; + +template +concept Power = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/pressure.h b/src/include/units/physical/bits/pressure.h new file mode 100644 index 00000000..6391c370 --- /dev/null +++ b/src/include/units/physical/bits/pressure.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template F, DimensionOfT A> +struct dim_pressure : derived_dimension, exponent> {}; + +template +concept Pressure = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/radioactivity.h b/src/include/units/physical/bits/radioactivity.h new file mode 100644 index 00000000..c21bc10e --- /dev/null +++ b/src/include/units/physical/bits/radioactivity.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include + +namespace units::physical { + +// TODO Add when downcasting issue is solved +// template T> +// struct dim_radioactivity : derived_dimension> {}; + +// template +// concept Radioactivity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/resistance.h b/src/include/units/physical/bits/resistance.h new file mode 100644 index 00000000..6fea2236 --- /dev/null +++ b/src/include/units/physical/bits/resistance.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template V, DimensionOfT C> +struct dim_resistance : derived_dimension, exponent> {}; + +template +concept Resistance = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/speed.h b/src/include/units/physical/bits/speed.h new file mode 100644 index 00000000..088d0c9d --- /dev/null +++ b/src/include/units/physical/bits/speed.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template L, DimensionOfT T> +struct dim_speed : derived_dimension, exponent> {}; + +template +concept Speed = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/surface_tension.h b/src/include/units/physical/bits/surface_tension.h new file mode 100644 index 00000000..8ad9c8d9 --- /dev/null +++ b/src/include/units/physical/bits/surface_tension.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template F, DimensionOfT L> +struct dim_surface_tension : derived_dimension, exponent> {}; + +template +concept SurfaceTension = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/thermal_conductivity.h b/src/include/units/physical/bits/thermal_conductivity.h new file mode 100644 index 00000000..4374c3c7 --- /dev/null +++ b/src/include/units/physical/bits/thermal_conductivity.h @@ -0,0 +1,38 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include +#include + +namespace units::physical { + +template P, DimensionOfT L, DimensionOfT T> +struct dim_thermal_conductivity : derived_dimension, exponent, exponent> {}; + +template +concept ThermalConductivity = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/thermodynamic_temperature.h b/src/include/units/physical/bits/thermodynamic_temperature.h new file mode 100644 index 00000000..b0037682 --- /dev/null +++ b/src/include/units/physical/bits/thermodynamic_temperature.h @@ -0,0 +1,35 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::physical { + +template +struct dim_thermodynamic_temperature : base_dimension<"Θ", U> {}; + +template +concept ThermodynamicTemperature = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/time.h b/src/include/units/physical/bits/time.h new file mode 100644 index 00000000..7f458983 --- /dev/null +++ b/src/include/units/physical/bits/time.h @@ -0,0 +1,35 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units::physical { + +template +struct dim_time : base_dimension<"T", U> {}; + +template +concept Time = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/torque.h b/src/include/units/physical/bits/torque.h new file mode 100644 index 00000000..b20a1660 --- /dev/null +++ b/src/include/units/physical/bits/torque.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template E, DimensionOfT A> +struct dim_torque : derived_dimension, exponent> {}; + +template +concept Torque = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/voltage.h b/src/include/units/physical/bits/voltage.h new file mode 100644 index 00000000..ed974892 --- /dev/null +++ b/src/include/units/physical/bits/voltage.h @@ -0,0 +1,37 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical { + +template P, DimensionOfT C> +struct dim_voltage : derived_dimension, exponent> {}; + +template +concept Voltage = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/bits/volume.h b/src/include/units/physical/bits/volume.h new file mode 100644 index 00000000..218fd3ba --- /dev/null +++ b/src/include/units/physical/bits/volume.h @@ -0,0 +1,36 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include + +namespace units::physical { + +template L> +struct dim_volume : derived_dimension> {}; + +template +concept Volume = QuantityOfT; + +} // namespace units::physical diff --git a/src/include/units/physical/dimensions.h b/src/include/units/physical/dimensions.h index 96415e42..239d19a0 100644 --- a/src/include/units/physical/dimensions.h +++ b/src/include/units/physical/dimensions.h @@ -22,327 +22,50 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace units::physical { - -namespace detail { - -template typename DimTemplate> -inline constexpr bool same_exponents_of = false; - -template typename DimTemplate> -inline constexpr bool same_exponents_of, DimTemplate> = requires { typename DimTemplate, unknown_coherent_unit, typename Es::dimension...>; } && std::same_as, typename DimTemplate, unknown_coherent_unit, typename Es::dimension...>::recipe>; - -} // namespace detail - -template typename DimTemplate> -concept EquivalentUnknownDimensionOf = Dimension && is_derived_from_specialization_of && detail::same_exponents_of; - -template typename DimTemplate> -concept DimensionOf = Dimension && (is_derived_from_specialization_of);// || - // EquivalentUnknownDimensionOf); - -template typename DimTemplate> -concept QuantityOf = Quantity && DimensionOf; - -// ------------------------ base dimensions ----------------------------- - -template -struct dim_length : base_dimension<"L", U> {}; - -template -struct dim_mass : base_dimension<"M", U> {}; - -template -struct dim_time : base_dimension<"T", U> {}; - -template -struct dim_electric_current : base_dimension<"I", U> {}; - -template -struct dim_thermodynamic_temperature : base_dimension<"Θ", U> {}; - -template -struct dim_substance : base_dimension<"N", U> {}; - -template -struct dim_luminous_intensity : base_dimension<"J", U> {}; - -// ------------------------ derived dimensions ----------------------------- - - -template A, DimensionOf T> -struct dim_angular_velocity : derived_dimension, exponent> {}; - -template T> -struct dim_frequency : derived_dimension> {}; - -template L> -struct dim_area : derived_dimension> {}; - -template L> -struct dim_volume : derived_dimension> {}; - -template L, DimensionOf T> -struct dim_speed : derived_dimension, exponent> {}; - -template L, DimensionOf T> -struct dim_acceleration : derived_dimension, exponent> {}; - -template M, DimensionOf A> -struct dim_force : derived_dimension, exponent> {}; - -template M, DimensionOf V> -struct dim_momentum : derived_dimension, exponent> {}; - -template F, DimensionOf L> -struct dim_energy : derived_dimension, exponent> {}; - -template E, DimensionOf A> -struct dim_torque : derived_dimension, exponent> {}; - -template M, DimensionOf L> -struct dim_density : derived_dimension, exponent> {}; - -template E, DimensionOf T> -struct dim_power : derived_dimension, exponent> {}; - -template P, DimensionOf C> -struct dim_voltage : derived_dimension, exponent> {}; - -template V, DimensionOf C> -struct dim_resistance : derived_dimension, exponent> {}; - -template T, DimensionOf C> -struct dim_electric_charge : derived_dimension, exponent> {}; - -template C, DimensionOf V> -struct dim_capacitance : derived_dimension, exponent> {}; - -template F, DimensionOf L> -struct dim_surface_tension : derived_dimension, exponent> {}; - -template F, DimensionOf A> -struct dim_pressure : derived_dimension, exponent> {}; - -template V, DimensionOf T, DimensionOf L> -struct dim_magnetic_induction : derived_dimension, exponent, exponent> {}; - -template B, DimensionOf A> -struct dim_magnetic_flux : derived_dimension, exponent> {}; - -template F, DimensionOf I> -struct dim_inductance : derived_dimension, exponent> {}; - -template R> -struct dim_conductance : derived_dimension> {}; - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // TODO Add when downcasting issue is solved -// template T> -// struct dim_radioactivity : derived_dimension> {}; - -template T, DimensionOf M> -struct dim_catalytic_activity : derived_dimension, exponent> {}; - -template E, DimensionOf M> -struct dim_absorbed_dose : derived_dimension, exponent> {}; - -template I, DimensionOf L> -struct dim_current_density : derived_dimension, exponent> {}; - -template M, DimensionOf L> -struct dim_concentration : derived_dimension, exponent> {}; - -template I, DimensionOf L> -struct dim_luminance : derived_dimension, exponent> {}; - -template P, DimensionOf T> -struct dim_dynamic_viscosity : derived_dimension, exponent> {}; - -template E, DimensionOf T> -struct dim_heat_capacity : derived_dimension, exponent> {}; - -template C, DimensionOf M> -struct dim_specific_heat_capacity : derived_dimension, exponent> {}; - -template C, DimensionOf M> -struct dim_molar_heat_capacity : derived_dimension, exponent> {}; - -template P, DimensionOf L, DimensionOf T> -struct dim_thermal_conductivity : derived_dimension, exponent, exponent> {}; - +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // TODO Add when downcasting issue is solved -// template E, DimensionOf L> -// struct dim_energy_density : derived_dimension, exponent> {}; - -template V, DimensionOf L> -struct dim_electric_field_strength : derived_dimension, exponent> {}; - -template Q, DimensionOf L> -struct dim_charge_density : derived_dimension, exponent> {}; - -template Q, DimensionOf L> -struct dim_surface_charge_density : derived_dimension, exponent> {}; - -template C, DimensionOf L> -struct dim_permittivity : derived_dimension, exponent> {}; - -template H, DimensionOf L> -struct dim_permeability : derived_dimension, exponent> {}; - -template E, DimensionOf M> -struct dim_molar_energy : derived_dimension, exponent> {}; - -template -concept Length = QuantityOf; - -template -concept Mass = QuantityOf; - -template -concept Time = QuantityOf; - -template -concept Current = QuantityOf; - -template -concept Temperature = QuantityOf; - -template -concept Substance = QuantityOf; - -template -concept LuminousIntensity = QuantityOf; - -template -concept Angle = QuantityOf; - -template -concept AngularVelocity = QuantityOf; - -template -concept Frequency = QuantityOf; - -template -concept Area = QuantityOf; - -template -concept Volume = QuantityOf; - -template -concept Speed = QuantityOf; - -template -concept Acceleration = QuantityOf; - -template -concept Force = QuantityOf; - -template -concept Momentum = QuantityOf; - -template -concept Energy = QuantityOf; - -template -concept Torque = QuantityOf; - -template -concept Density = QuantityOf; - -template -concept Power = QuantityOf; - -template -concept Voltage = QuantityOf; - -template -concept ElectricCharge = QuantityOf; - -template -concept Capacitance = QuantityOf; - -template -concept SurfaceTension = QuantityOf; - -template -concept Pressure = QuantityOf; - -template -concept MagneticInduction = QuantityOf; - -template -concept MagneticFlux = QuantityOf; - -template -concept Inductance = QuantityOf; - -template -concept Conductance = QuantityOf; - -// TODO Add when downcasting issue is solved -// template -// concept Radioactivity = QuantityOf; - -template -concept CatalyticActivity = QuantityOf; - -template -concept AbsorbedDose = QuantityOf; - -template -concept CurrentDensity = QuantityOf; - -template -concept Concentration = QuantityOf; - -template -concept Luminance = QuantityOf; - -template -concept DynamicViscosity = QuantityOf; - -template -concept HeatCapacity = QuantityOf; - -template -concept SpecificHeatCapacity = QuantityOf; - -template -concept MolarHeatCapacity = QuantityOf; - -template -concept ThermalConductivity = QuantityOf; - -// TODO Add when downcasting issue is solved -// template -// concept EnergyDensity = QuantityOf; - -template -concept ElectricFieldStrength = QuantityOf; - -template -concept ChargeDensity = QuantityOf; - -template -concept SurfaceChargeDensity = QuantityOf; - -template -concept Permittivity = QuantityOf; - -template -concept Permeability = QuantityOf; - -template -concept MolarEnergy = QuantityOf; - -} // namespace units::physical +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/include/units/physical/si/base/substance.h b/src/include/units/physical/si/base/amount_of_substance.h similarity index 84% rename from src/include/units/physical/si/base/substance.h rename to src/include/units/physical/si/base/amount_of_substance.h index 4c3c5a5a..68bf984f 100644 --- a/src/include/units/physical/si/base/substance.h +++ b/src/include/units/physical/si/base/amount_of_substance.h @@ -30,16 +30,16 @@ namespace units::physical::si { struct mole : named_unit {}; -struct dim_substance : physical::dim_substance {}; +struct dim_amount_of_substance : physical::dim_amount_of_substance {}; template -using substance = quantity; +using amount_of_substance = quantity; inline namespace literals { // mol -constexpr auto operator"" _q_mol(unsigned long long l) { return substance(l); } -constexpr auto operator"" _q_mol(long double l) { return substance(l); } +constexpr auto operator"" _q_mol(unsigned long long l) { return amount_of_substance(l); } +constexpr auto operator"" _q_mol(long double l) { return amount_of_substance(l); } } // namespace literals diff --git a/src/include/units/physical/si/base/current.h b/src/include/units/physical/si/base/current.h deleted file mode 100644 index af808511..00000000 --- a/src/include/units/physical/si/base/current.h +++ /dev/null @@ -1,146 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2018 Mateusz Pusz -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include -#include -#include - -namespace units::physical::si { - -struct ampere : named_unit {}; -struct yoctoampere : prefixed_unit {}; -struct zeptoampere : prefixed_unit {}; -struct attoampere : prefixed_unit {}; -struct femtoampere : prefixed_unit {}; -struct picoampere : prefixed_unit {}; -struct nanoampere : prefixed_unit {}; -struct microampere : prefixed_unit {}; -struct milliampere : prefixed_unit {}; -struct centiampere : prefixed_unit {}; -struct deciampere : prefixed_unit {}; -struct decaampere : prefixed_unit {}; -struct hectoampere : prefixed_unit {}; -struct kiloampere : prefixed_unit {}; -struct megaampere : prefixed_unit {}; -struct gigaampere : prefixed_unit {}; -struct teraampere : prefixed_unit {}; -struct petaampere : prefixed_unit {}; -struct exaampere : prefixed_unit {}; -struct zettaampere : prefixed_unit {}; -struct yottaampere : prefixed_unit {}; - -struct dim_electric_current : physical::dim_electric_current {}; - -template -using current = quantity; - -inline namespace literals { - -// A -constexpr auto operator"" _q_A(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_A(long double l) { return current(l); } - -// yA -constexpr auto operator"" _q_yA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_yA(long double l) { return current(l); } - -// zA -constexpr auto operator"" _q_zA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_zA(long double l) { return current(l); } - -// aA -constexpr auto operator"" _q_aA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_aA(long double l) { return current(l); } - -// fA -constexpr auto operator"" _q_fA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_fA(long double l) { return current(l); } - -// pA -constexpr auto operator"" _q_pA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_pA(long double l) { return current(l); } - -// nA -constexpr auto operator"" _q_nA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_nA(long double l) { return current(l); } - -// uA -constexpr auto operator"" _q_uA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_uA(long double l) { return current(l); } - -// mA -constexpr auto operator"" _q_mA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_mA(long double l) { return current(l); } - -// cA -constexpr auto operator"" _q_cA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_cA(long double l) { return current(l); } - -// dA -constexpr auto operator"" _q_dA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_dA(long double l) { return current(l); } - -// daA -constexpr auto operator"" _q_daA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_daA(long double l) { return current(l); } - -// hA -constexpr auto operator"" _q_hA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_hA(long double l) { return current(l); } - -// kA -constexpr auto operator"" _q_kA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_kA(long double l) { return current(l); } - -// MA -constexpr auto operator"" _q_MA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_MA(long double l) { return current(l); } - -// GA -constexpr auto operator"" _q_GA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_GA(long double l) { return current(l); } - -// TA -constexpr auto operator"" _q_TA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_TA(long double l) { return current(l); } - -// PA -constexpr auto operator"" _q_PA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_PA(long double l) { return current(l); } - -// EA -constexpr auto operator"" _q_EA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_EA(long double l) { return current(l); } - -// ZA -constexpr auto operator"" _q_ZA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_ZA(long double l) { return current(l); } - -// YA -constexpr auto operator"" _q_YA(unsigned long long l) { return current(l); } -constexpr auto operator"" _q_YA(long double l) { return current(l); } - -} // namespace literals - -} // namespace units::physical::si diff --git a/src/include/units/physical/si/base/electric_current.h b/src/include/units/physical/si/base/electric_current.h new file mode 100644 index 00000000..db2caa20 --- /dev/null +++ b/src/include/units/physical/si/base/electric_current.h @@ -0,0 +1,146 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include +#include + +namespace units::physical::si { + +struct ampere : named_unit {}; +struct yoctoampere : prefixed_unit {}; +struct zeptoampere : prefixed_unit {}; +struct attoampere : prefixed_unit {}; +struct femtoampere : prefixed_unit {}; +struct picoampere : prefixed_unit {}; +struct nanoampere : prefixed_unit {}; +struct microampere : prefixed_unit {}; +struct milliampere : prefixed_unit {}; +struct centiampere : prefixed_unit {}; +struct deciampere : prefixed_unit {}; +struct decaampere : prefixed_unit {}; +struct hectoampere : prefixed_unit {}; +struct kiloampere : prefixed_unit {}; +struct megaampere : prefixed_unit {}; +struct gigaampere : prefixed_unit {}; +struct teraampere : prefixed_unit {}; +struct petaampere : prefixed_unit {}; +struct exaampere : prefixed_unit {}; +struct zettaampere : prefixed_unit {}; +struct yottaampere : prefixed_unit {}; + +struct dim_electric_current : physical::dim_electric_current {}; + +template +using electric_current = quantity; + +inline namespace literals { + +// A +constexpr auto operator"" _q_A(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_A(long double l) { return electric_current(l); } + +// yA +constexpr auto operator"" _q_yA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_yA(long double l) { return electric_current(l); } + +// zA +constexpr auto operator"" _q_zA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_zA(long double l) { return electric_current(l); } + +// aA +constexpr auto operator"" _q_aA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_aA(long double l) { return electric_current(l); } + +// fA +constexpr auto operator"" _q_fA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_fA(long double l) { return electric_current(l); } + +// pA +constexpr auto operator"" _q_pA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_pA(long double l) { return electric_current(l); } + +// nA +constexpr auto operator"" _q_nA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_nA(long double l) { return electric_current(l); } + +// uA +constexpr auto operator"" _q_uA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_uA(long double l) { return electric_current(l); } + +// mA +constexpr auto operator"" _q_mA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_mA(long double l) { return electric_current(l); } + +// cA +constexpr auto operator"" _q_cA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_cA(long double l) { return electric_current(l); } + +// dA +constexpr auto operator"" _q_dA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_dA(long double l) { return electric_current(l); } + +// daA +constexpr auto operator"" _q_daA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_daA(long double l) { return electric_current(l); } + +// hA +constexpr auto operator"" _q_hA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_hA(long double l) { return electric_current(l); } + +// kA +constexpr auto operator"" _q_kA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_kA(long double l) { return electric_current(l); } + +// MA +constexpr auto operator"" _q_MA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_MA(long double l) { return electric_current(l); } + +// GA +constexpr auto operator"" _q_GA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_GA(long double l) { return electric_current(l); } + +// TA +constexpr auto operator"" _q_TA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_TA(long double l) { return electric_current(l); } + +// PA +constexpr auto operator"" _q_PA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_PA(long double l) { return electric_current(l); } + +// EA +constexpr auto operator"" _q_EA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_EA(long double l) { return electric_current(l); } + +// ZA +constexpr auto operator"" _q_ZA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_ZA(long double l) { return electric_current(l); } + +// YA +constexpr auto operator"" _q_YA(unsigned long long l) { return electric_current(l); } +constexpr auto operator"" _q_YA(long double l) { return electric_current(l); } + +} // namespace literals + +} // namespace units::physical::si diff --git a/src/include/units/physical/si/base/temperature.h b/src/include/units/physical/si/base/thermodynamic_temperature.h similarity index 83% rename from src/include/units/physical/si/base/temperature.h rename to src/include/units/physical/si/base/thermodynamic_temperature.h index c52fd838..e75b7c3c 100644 --- a/src/include/units/physical/si/base/temperature.h +++ b/src/include/units/physical/si/base/thermodynamic_temperature.h @@ -32,13 +32,13 @@ struct kelvin : named_unit {}; struct dim_thermodynamic_temperature : physical::dim_thermodynamic_temperature {}; template -using temperature = quantity; +using thermodynamic_temperature = quantity; inline namespace literals { // K -constexpr auto operator"" _q_K(unsigned long long l) { return temperature(l); } -constexpr auto operator"" _q_K(long double l) { return temperature(l); } +constexpr auto operator"" _q_K(unsigned long long l) { return thermodynamic_temperature(l); } +constexpr auto operator"" _q_K(long double l) { return thermodynamic_temperature(l); } } // namespace literals diff --git a/src/include/units/physical/si/bits/derived/catalytic_activity.h b/src/include/units/physical/si/bits/derived/catalytic_activity.h index 8a39791e..1a7187b0 100644 --- a/src/include/units/physical/si/bits/derived/catalytic_activity.h +++ b/src/include/units/physical/si/bits/derived/catalytic_activity.h @@ -29,7 +29,7 @@ #endif #include -#include +#include #include #include #include @@ -60,7 +60,7 @@ struct yottakatal : prefixed_unit {}; struct enzyme_unit : named_scaled_unit {}; -struct dim_catalytic_activity : physical::dim_catalytic_activity {}; +struct dim_catalytic_activity : physical::dim_catalytic_activity {}; template using catalytic_activity = quantity; diff --git a/src/include/units/physical/si/bits/derived/concentration.h b/src/include/units/physical/si/bits/derived/concentration.h index 601800cd..ff6a1a5f 100644 --- a/src/include/units/physical/si/bits/derived/concentration.h +++ b/src/include/units/physical/si/bits/derived/concentration.h @@ -30,13 +30,13 @@ #include #include -#include +#include #include namespace units::physical::si { struct mol_per_metre_cub : unit {}; -struct dim_concentration : physical::dim_concentration {}; +struct dim_concentration : physical::dim_concentration {}; template using concentration = quantity; diff --git a/src/include/units/physical/si/bits/derived/current_density.h b/src/include/units/physical/si/bits/derived/current_density.h index ad490f9d..a727515d 100644 --- a/src/include/units/physical/si/bits/derived/current_density.h +++ b/src/include/units/physical/si/bits/derived/current_density.h @@ -29,7 +29,7 @@ #endif #include -#include +#include #include #include #include diff --git a/src/include/units/physical/si/bits/derived/electric_charge.h b/src/include/units/physical/si/bits/derived/electric_charge.h index a0490422..fc5c9367 100644 --- a/src/include/units/physical/si/bits/derived/electric_charge.h +++ b/src/include/units/physical/si/bits/derived/electric_charge.h @@ -29,7 +29,7 @@ #endif #include -#include +#include #include #include diff --git a/src/include/units/physical/si/bits/derived/heat_capacity.h b/src/include/units/physical/si/bits/derived/heat_capacity.h index 12b49b51..ece7e069 100644 --- a/src/include/units/physical/si/bits/derived/heat_capacity.h +++ b/src/include/units/physical/si/bits/derived/heat_capacity.h @@ -29,10 +29,10 @@ #endif #include -#include +#include #include #include -#include +#include #include namespace units::physical::si { @@ -43,7 +43,7 @@ struct joule_per_mole_kelvin : unit {}; struct dim_heat_capacity : physical::dim_heat_capacity {}; struct dim_specific_heat_capacity : physical::dim_specific_heat_capacity {}; -struct dim_molar_heat_capacity : physical::dim_molar_heat_capacity {}; +struct dim_molar_heat_capacity : physical::dim_molar_heat_capacity {}; template using heat_capacity = quantity; diff --git a/src/include/units/physical/si/bits/derived/inductance.h b/src/include/units/physical/si/bits/derived/inductance.h index f14628c5..e9586347 100644 --- a/src/include/units/physical/si/bits/derived/inductance.h +++ b/src/include/units/physical/si/bits/derived/inductance.h @@ -30,7 +30,7 @@ #include #include -#include +#include #include namespace units::physical::si { diff --git a/src/include/units/physical/si/bits/derived/molar_energy.h b/src/include/units/physical/si/bits/derived/molar_energy.h index 3909a66d..aaaa0ef0 100644 --- a/src/include/units/physical/si/bits/derived/molar_energy.h +++ b/src/include/units/physical/si/bits/derived/molar_energy.h @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include @@ -38,7 +38,7 @@ namespace units::physical::si { struct joule_per_mole : unit {}; -struct dim_molar_energy : physical::dim_molar_energy {}; +struct dim_molar_energy : physical::dim_molar_energy {}; template using molar_energy = quantity; diff --git a/src/include/units/physical/si/bits/derived/resistance.h b/src/include/units/physical/si/bits/derived/resistance.h index f25c4d70..37e82f3e 100644 --- a/src/include/units/physical/si/bits/derived/resistance.h +++ b/src/include/units/physical/si/bits/derived/resistance.h @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include diff --git a/src/include/units/physical/si/bits/derived/thermal_conductivity.h b/src/include/units/physical/si/bits/derived/thermal_conductivity.h index 3a85ab86..cc8e3ba4 100644 --- a/src/include/units/physical/si/bits/derived/thermal_conductivity.h +++ b/src/include/units/physical/si/bits/derived/thermal_conductivity.h @@ -30,7 +30,7 @@ #include #include -#include +#include #include namespace units::physical::si { diff --git a/src/include/units/physical/si/bits/derived/voltage.h b/src/include/units/physical/si/bits/derived/voltage.h index 2c717ab3..4e49d896 100644 --- a/src/include/units/physical/si/bits/derived/voltage.h +++ b/src/include/units/physical/si/bits/derived/voltage.h @@ -29,7 +29,7 @@ #endif #include -#include +#include #include #include #include diff --git a/src/include/units/physical/si/si.h b/src/include/units/physical/si/si.h index 29d51072..46a70c69 100644 --- a/src/include/units/physical/si/si.h +++ b/src/include/units/physical/si/si.h @@ -24,12 +24,12 @@ #define MP_UNITS_SYSTEM_SI -#include +#include #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/include/units/prefix.h b/src/include/units/prefix.h index 36740e08..06e363fc 100644 --- a/src/include/units/prefix.h +++ b/src/include/units/prefix.h @@ -23,7 +23,7 @@ #pragma once #include -#include +#include #include #include diff --git a/src/include/units/quantity_cast.h b/src/include/units/quantity_cast.h index e31b179a..c8bf4253 100644 --- a/src/include/units/quantity_cast.h +++ b/src/include/units/quantity_cast.h @@ -57,10 +57,6 @@ constexpr auto quantity_ratio(const quantity&) } // namespace detail -// QuantityOf -template -concept QuantityOf = Quantity && Dimension && equivalent; - // quantity_cast namespace detail {