From 2a522e356e4ed74b925103be33170b6fe0e749d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johel=20Ernesto=20Guerrero=20Pe=C3=B1a?= Date: Fri, 25 Dec 2020 18:19:26 -0400 Subject: [PATCH] feat: unit_constants --- src/include/units/bits/one_rep.h | 69 +++++++++++++++ src/include/units/data/base/information.h | 19 +++++ src/include/units/data/derived/bitrate.h | 11 +++ .../physical/si/base/amount_of_substance.h | 7 ++ .../units/physical/si/base/electric_current.h | 27 ++++++ src/include/units/physical/si/base/length.h | 28 ++++++ .../physical/si/base/luminous_intensity.h | 27 ++++++ src/include/units/physical/si/base/mass.h | 49 +++++++++++ .../si/base/thermodynamic_temperature.h | 7 ++ src/include/units/physical/si/base/time.h | 18 ++++ .../units/physical/si/cgs/base/length.h | 8 +- src/include/units/physical/si/cgs/base/mass.h | 8 +- src/include/units/physical/si/cgs/base/time.h | 8 +- .../physical/si/cgs/derived/acceleration.h | 6 ++ .../units/physical/si/cgs/derived/area.h | 8 +- .../units/physical/si/cgs/derived/energy.h | 6 ++ .../units/physical/si/cgs/derived/force.h | 6 ++ .../units/physical/si/cgs/derived/power.h | 2 +- .../units/physical/si/cgs/derived/pressure.h | 6 ++ .../units/physical/si/cgs/derived/speed.h | 2 +- .../units/physical/si/derived/absorbed_dose.h | 28 +++++- .../units/physical/si/derived/acceleration.h | 2 +- .../physical/si/derived/angular_velocity.h | 1 - src/include/units/physical/si/derived/area.h | 27 ++++++ .../units/physical/si/derived/capacitance.h | 26 ++++++ .../physical/si/derived/catalytic_activity.h | 27 ++++++ .../units/physical/si/derived/conductance.h | 22 +++++ .../physical/si/derived/current_density.h | 1 + .../units/physical/si/derived/density.h | 1 + .../physical/si/derived/dynamic_viscosity.h | 6 ++ .../physical/si/derived/electric_charge.h | 6 ++ .../units/physical/si/derived/energy.h | 24 ++++++ src/include/units/physical/si/derived/force.h | 26 ++++++ .../units/physical/si/derived/frequency.h | 22 +++++ .../units/physical/si/derived/inductance.h | 22 +++++ .../units/physical/si/derived/magnetic_flux.h | 22 +++++ .../physical/si/derived/magnetic_induction.h | 23 +++++ .../units/physical/si/derived/molar_energy.h | 2 +- .../units/physical/si/derived/momentum.h | 2 +- src/include/units/physical/si/derived/power.h | 22 +++++ .../units/physical/si/derived/pressure.h | 26 ++++++ .../units/physical/si/derived/resistance.h | 22 +++++ src/include/units/physical/si/derived/speed.h | 4 +- .../physical/si/derived/surface_tension.h | 6 +- .../si/derived/thermal_conductivity.h | 2 +- .../units/physical/si/derived/torque.h | 6 ++ .../units/physical/si/derived/voltage.h | 26 ++++++ .../units/physical/si/derived/volume.h | 47 ++++++++++ .../units/physical/si/fps/base/length.h | 16 +++- src/include/units/physical/si/fps/base/mass.h | 15 +++- src/include/units/physical/si/fps/base/time.h | 8 +- .../physical/si/fps/derived/acceleration.h | 2 +- .../units/physical/si/fps/derived/area.h | 8 +- .../units/physical/si/fps/derived/density.h | 1 + .../units/physical/si/fps/derived/energy.h | 8 ++ .../units/physical/si/fps/derived/force.h | 8 ++ .../units/physical/si/fps/derived/power.h | 9 +- .../units/physical/si/fps/derived/pressure.h | 8 ++ .../units/physical/si/fps/derived/speed.h | 11 ++- .../units/physical/si/fps/derived/volume.h | 9 +- .../units/physical/si/iau/base/length.h | 11 +++ .../units/physical/si/imperial/base/length.h | 9 ++ .../physical/si/international/base/length.h | 13 +++ .../physical/si/international/derived/area.h | 6 ++ .../physical/si/international/derived/speed.h | 2 +- .../si/international/derived/volume.h | 6 ++ .../physical/si/typographic/base/length.h | 9 ++ .../units/physical/si/us/base/length.h | 10 ++- test/unit_test/static/CMakeLists.txt | 1 + test/unit_test/static/unit_constants.cpp | 85 +++++++++++++++++++ 70 files changed, 1000 insertions(+), 28 deletions(-) create mode 100644 src/include/units/bits/one_rep.h create mode 100644 test/unit_test/static/unit_constants.cpp diff --git a/src/include/units/bits/one_rep.h b/src/include/units/bits/one_rep.h new file mode 100644 index 000000000..2403bd412 --- /dev/null +++ b/src/include/units/bits/one_rep.h @@ -0,0 +1,69 @@ +// 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::detail { + +struct one_rep { + template + [[nodiscard]] friend constexpr Rep operator*(const Rep& lhs, one_rep) + { + return lhs; + } + template + [[nodiscard]] friend constexpr Rep operator/(const Rep& lhs, one_rep) + { + return lhs; + } + + template + [[nodiscard]] constexpr operator Rep() const noexcept + { + return quantity_values::one(); + } + + [[nodiscard]] bool operator==(const one_rep&) const = default; + [[nodiscard]] auto operator<=>(const one_rep&) const = default; +}; + +} // namespace units::detail + +namespace std { +template<> +struct common_type { + using type = units::detail::one_rep; +}; +template +struct common_type { + using type = Rep; +}; +template +struct common_type { + using type = Rep; +}; + +} // namespace std diff --git a/src/include/units/data/base/information.h b/src/include/units/data/base/information.h index ebe28152f..d4c98e7a7 100644 --- a/src/include/units/data/base/information.h +++ b/src/include/units/data/base/information.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -71,4 +72,22 @@ constexpr auto operator"" _q_PiB(unsigned long long l) { return information{}; +inline constexpr auto Kib = information{}; +inline constexpr auto Mib = information{}; +inline constexpr auto Gib = information{}; +inline constexpr auto Tib = information{}; +inline constexpr auto Pib = information{}; + +inline constexpr auto B = information{}; +inline constexpr auto KiB = information{}; +inline constexpr auto MiB = information{}; +inline constexpr auto GiB = information{}; +inline constexpr auto TiB = information{}; +inline constexpr auto PiB = information{}; + +} // namespace unit_constants + } // namespace units::data diff --git a/src/include/units/data/derived/bitrate.h b/src/include/units/data/derived/bitrate.h index 94cbf166d..3a600c3ec 100644 --- a/src/include/units/data/derived/bitrate.h +++ b/src/include/units/data/derived/bitrate.h @@ -56,4 +56,15 @@ constexpr auto operator"" _q_Pib_per_s(unsigned long long l) { return bitrate{}; +inline constexpr auto Kib_per_s = bitrate{}; +inline constexpr auto Mib_per_s = bitrate{}; +inline constexpr auto Gib_per_s = bitrate{}; +inline constexpr auto Tib_per_s = bitrate{}; +inline constexpr auto Pib_per_s = bitrate{}; + +} // namespace unit_constants + } // namespace units::data diff --git a/src/include/units/physical/si/base/amount_of_substance.h b/src/include/units/physical/si/base/amount_of_substance.h index 1cdea8d00..faf355cca 100644 --- a/src/include/units/physical/si/base/amount_of_substance.h +++ b/src/include/units/physical/si/base/amount_of_substance.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -43,4 +44,10 @@ constexpr auto operator"" _q_mol(long double l) { return amount_of_substance{}; + +} // namespace unit_constants + } // 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 index efb46e977..0aa9d33d4 100644 --- a/src/include/units/physical/si/base/electric_current.h +++ b/src/include/units/physical/si/base/electric_current.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -143,4 +144,30 @@ constexpr auto operator"" _q_YA(long double l) { return electric_current{}; +inline constexpr auto yA = electric_current{}; +inline constexpr auto zA = electric_current{}; +inline constexpr auto aA = electric_current{}; +inline constexpr auto fA = electric_current{}; +inline constexpr auto pA = electric_current{}; +inline constexpr auto nA = electric_current{}; +inline constexpr auto uA = electric_current{}; +inline constexpr auto mA = electric_current{}; +inline constexpr auto cA = electric_current{}; +inline constexpr auto dA = electric_current{}; +inline constexpr auto daA = electric_current{}; +inline constexpr auto hA = electric_current{}; +inline constexpr auto kA = electric_current{}; +inline constexpr auto MA = electric_current{}; +inline constexpr auto GA = electric_current{}; +inline constexpr auto TA = electric_current{}; +inline constexpr auto PA = electric_current{}; +inline constexpr auto EA = electric_current{}; +inline constexpr auto ZA = electric_current{}; +inline constexpr auto YA = electric_current{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/base/length.h b/src/include/units/physical/si/base/length.h index ecc8ae840..de89eddd4 100644 --- a/src/include/units/physical/si/base/length.h +++ b/src/include/units/physical/si/base/length.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -149,4 +150,31 @@ constexpr auto operator"" _q_au(long double l) { return length{}; +inline constexpr auto ym = length{}; +inline constexpr auto zm = length{}; +inline constexpr auto am = length{}; +inline constexpr auto fm = length{}; +inline constexpr auto pm = length{}; +inline constexpr auto nm = length{}; +inline constexpr auto um = length{}; +inline constexpr auto mm = length{}; +inline constexpr auto cm = length{}; +inline constexpr auto dm = length{}; +inline constexpr auto dam = length{}; +inline constexpr auto hm = length{}; +inline constexpr auto km = length{}; +inline constexpr auto Mm = length{}; +inline constexpr auto Gm = length{}; +inline constexpr auto Tm = length{}; +inline constexpr auto Pm = length{}; +inline constexpr auto Em = length{}; +inline constexpr auto Zm = length{}; +inline constexpr auto Ym = length{}; +inline constexpr auto au = length{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/base/luminous_intensity.h b/src/include/units/physical/si/base/luminous_intensity.h index e37269049..029c44ddb 100644 --- a/src/include/units/physical/si/base/luminous_intensity.h +++ b/src/include/units/physical/si/base/luminous_intensity.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -143,4 +144,30 @@ constexpr auto operator"" _q_Ycd(long double l) { return luminous_intensity{}; +inline constexpr auto ycd = luminous_intensity{}; +inline constexpr auto zcd = luminous_intensity{}; +inline constexpr auto acd = luminous_intensity{}; +inline constexpr auto fcd = luminous_intensity{}; +inline constexpr auto pcd = luminous_intensity{}; +inline constexpr auto ncd = luminous_intensity{}; +inline constexpr auto ucd = luminous_intensity{}; +inline constexpr auto mcd = luminous_intensity{}; +inline constexpr auto ccd = luminous_intensity{}; +inline constexpr auto dcd = luminous_intensity{}; +inline constexpr auto dacd = luminous_intensity{}; +inline constexpr auto hcd = luminous_intensity{}; +inline constexpr auto kcd = luminous_intensity{}; +inline constexpr auto Mcd = luminous_intensity{}; +inline constexpr auto Gcd = luminous_intensity{}; +inline constexpr auto Tcd = luminous_intensity{}; +inline constexpr auto Pcd = luminous_intensity{}; +inline constexpr auto Ecd = luminous_intensity{}; +inline constexpr auto Zcd = luminous_intensity{}; +inline constexpr auto Ycd = luminous_intensity{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/base/mass.h b/src/include/units/physical/si/base/mass.h index 3f99d4e47..a9a067214 100644 --- a/src/include/units/physical/si/base/mass.h +++ b/src/include/units/physical/si/base/mass.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -255,4 +256,52 @@ constexpr auto operator"" _q_Da(long double l) { return mass{}; +inline constexpr auto yg = mass{}; +inline constexpr auto zg = mass{}; +inline constexpr auto ag = mass{}; +inline constexpr auto fg = mass{}; +inline constexpr auto pg = mass{}; +inline constexpr auto ng = mass{}; +inline constexpr auto ug = mass{}; +inline constexpr auto mg = mass{}; +inline constexpr auto cg = mass{}; +inline constexpr auto dg = mass{}; +inline constexpr auto dag = mass{}; +inline constexpr auto hg = mass{}; +inline constexpr auto kg = mass{}; +inline constexpr auto Mg = mass{}; +inline constexpr auto Gg = mass{}; +inline constexpr auto Tg = mass{}; +inline constexpr auto Pg = mass{}; +inline constexpr auto Eg = mass{}; +inline constexpr auto Zg = mass{}; +inline constexpr auto Yg = mass{}; +inline constexpr auto t = mass{}; +inline constexpr auto yt = mass{}; +inline constexpr auto zt = mass{}; +inline constexpr auto at = mass{}; +inline constexpr auto ft = mass{}; +inline constexpr auto pt = mass{}; +inline constexpr auto nt = mass{}; +inline constexpr auto ut = mass{}; +inline constexpr auto mt = mass{}; +inline constexpr auto ct = mass{}; +inline constexpr auto dt = mass{}; +inline constexpr auto dat = mass{}; +inline constexpr auto ht = mass{}; +inline constexpr auto kt = mass{}; +inline constexpr auto Mt = mass{}; +inline constexpr auto Gt = mass{}; +inline constexpr auto Tt = mass{}; +inline constexpr auto Pt = mass{}; +inline constexpr auto Et = mass{}; +inline constexpr auto Zt = mass{}; +inline constexpr auto Yt = mass{}; +inline constexpr auto Da = mass{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/base/thermodynamic_temperature.h b/src/include/units/physical/si/base/thermodynamic_temperature.h index 0e7f251b2..14f82175e 100644 --- a/src/include/units/physical/si/base/thermodynamic_temperature.h +++ b/src/include/units/physical/si/base/thermodynamic_temperature.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include @@ -42,4 +43,10 @@ constexpr auto operator"" _q_K(long double l) { return thermodynamic_temperature } // namespace literals +namespace unit_constants { + +inline constexpr auto K = thermodynamic_temperature{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/base/time.h b/src/include/units/physical/si/base/time.h index 1ab3f6216..eb50ffb8c 100644 --- a/src/include/units/physical/si/base/time.h +++ b/src/include/units/physical/si/base/time.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -98,4 +99,21 @@ constexpr auto operator"" _q_d(long double l) { return time(l) } // namespace literals +namespace unit_constants { + +inline constexpr auto ys = time{}; +inline constexpr auto zs = time{}; +inline constexpr auto as = time{}; +inline constexpr auto fs = time{}; +inline constexpr auto ps = time{}; +inline constexpr auto ns = time{}; +inline constexpr auto us = time{}; +inline constexpr auto ms = time{}; +inline constexpr auto s = time{}; +inline constexpr auto min = time{}; +inline constexpr auto h = time{}; +inline constexpr auto d = time{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/cgs/base/length.h b/src/include/units/physical/si/cgs/base/length.h index 40153b424..de598891a 100644 --- a/src/include/units/physical/si/cgs/base/length.h +++ b/src/include/units/physical/si/cgs/base/length.h @@ -40,6 +40,12 @@ inline namespace literals { constexpr auto operator"" _q_cm(unsigned long long l) { return length(l); } constexpr auto operator"" _q_cm(long double l) { return length(l); } -} +} // namespace literals + +namespace unit_constants { + +inline constexpr auto cm = length{}; + +} // namespace unit_constants } // namespace units::physical::si::cgs diff --git a/src/include/units/physical/si/cgs/base/mass.h b/src/include/units/physical/si/cgs/base/mass.h index b458cbf03..b08fb88ce 100644 --- a/src/include/units/physical/si/cgs/base/mass.h +++ b/src/include/units/physical/si/cgs/base/mass.h @@ -40,6 +40,12 @@ inline namespace literals { constexpr auto operator"" _q_g(unsigned long long l) { return mass(l); } constexpr auto operator"" _q_g(long double l) { return mass(l); } -} +} // namespace literals + +namespace unit_constants { + +inline constexpr auto g = mass{}; + +} // namespace unit_constants } // namespace units::physical::si::cgs diff --git a/src/include/units/physical/si/cgs/base/time.h b/src/include/units/physical/si/cgs/base/time.h index 5e40151c8..28e1f2254 100644 --- a/src/include/units/physical/si/cgs/base/time.h +++ b/src/include/units/physical/si/cgs/base/time.h @@ -36,6 +36,12 @@ inline namespace literals { using si::literals::operator"" _q_s; -} +} // namespace literals + +namespace unit_constants { + +using si::unit_constants::s; + +} // namespace unit_constants } // namespace units::physical::si::cgs diff --git a/src/include/units/physical/si/cgs/derived/acceleration.h b/src/include/units/physical/si/cgs/derived/acceleration.h index d53cbb10c..b8ebe9e99 100644 --- a/src/include/units/physical/si/cgs/derived/acceleration.h +++ b/src/include/units/physical/si/cgs/derived/acceleration.h @@ -42,4 +42,10 @@ constexpr auto operator"" _q_Gal(long double l) { return acceleration{}; + +} // namespace unit_constants + } // namespace units::physical::si::cgs diff --git a/src/include/units/physical/si/cgs/derived/area.h b/src/include/units/physical/si/cgs/derived/area.h index cfa6bae22..66b102953 100644 --- a/src/include/units/physical/si/cgs/derived/area.h +++ b/src/include/units/physical/si/cgs/derived/area.h @@ -41,6 +41,12 @@ inline namespace literals { constexpr auto operator"" _q_cm2(unsigned long long l) { return area(l); } constexpr auto operator"" _q_cm2(long double l) { return area(l); } -} +} // namespace literals + +namespace unit_constants { + +inline constexpr auto cm2 = area{}; + +} // namespace unit_constants } // namespace units::physical::si::cgs diff --git a/src/include/units/physical/si/cgs/derived/energy.h b/src/include/units/physical/si/cgs/derived/energy.h index e540521da..92897b061 100644 --- a/src/include/units/physical/si/cgs/derived/energy.h +++ b/src/include/units/physical/si/cgs/derived/energy.h @@ -44,4 +44,10 @@ constexpr auto operator"" _q_erg(long double l) { return energy{}; + +} // namespace unit_constants + } // namespace units::physical::si::cgs diff --git a/src/include/units/physical/si/cgs/derived/force.h b/src/include/units/physical/si/cgs/derived/force.h index 7b12ed8b4..8ee040a3a 100644 --- a/src/include/units/physical/si/cgs/derived/force.h +++ b/src/include/units/physical/si/cgs/derived/force.h @@ -45,4 +45,10 @@ constexpr auto operator"" _q_dyn(long double l) { return force{}; + +} // namespace unit_constants + } // namespace units::physical::si::cgs diff --git a/src/include/units/physical/si/cgs/derived/power.h b/src/include/units/physical/si/cgs/derived/power.h index 8f00accac..d15ed8a05 100644 --- a/src/include/units/physical/si/cgs/derived/power.h +++ b/src/include/units/physical/si/cgs/derived/power.h @@ -38,7 +38,7 @@ using power = quantity; inline namespace literals { -// ergps +// erg/s constexpr auto operator"" _q_erg_per_s(unsigned long long l) { return power(l); } constexpr auto operator"" _q_erg_per_s(long double l) { return power(l); } diff --git a/src/include/units/physical/si/cgs/derived/pressure.h b/src/include/units/physical/si/cgs/derived/pressure.h index 63aef87eb..607806f88 100644 --- a/src/include/units/physical/si/cgs/derived/pressure.h +++ b/src/include/units/physical/si/cgs/derived/pressure.h @@ -45,4 +45,10 @@ constexpr auto operator"" _q_Ba(long double l) { return pressure{}; + +} // namespace unit_constants + } // namespace units::physical::si::cgs diff --git a/src/include/units/physical/si/cgs/derived/speed.h b/src/include/units/physical/si/cgs/derived/speed.h index 22ecb4df2..80c742327 100644 --- a/src/include/units/physical/si/cgs/derived/speed.h +++ b/src/include/units/physical/si/cgs/derived/speed.h @@ -37,7 +37,7 @@ using speed = quantity; inline namespace literals { -// cmps +// cm/s constexpr auto operator"" _q_cm_per_s(unsigned long long l) { return speed(l); } constexpr auto operator"" _q_cm_per_s(long double l) { return speed(l); } diff --git a/src/include/units/physical/si/derived/absorbed_dose.h b/src/include/units/physical/si/derived/absorbed_dose.h index 56d0df1f2..bb2fdefc0 100644 --- a/src/include/units/physical/si/derived/absorbed_dose.h +++ b/src/include/units/physical/si/derived/absorbed_dose.h @@ -58,7 +58,7 @@ using absorbed_dose = quantity; inline namespace literals { -// G +// Gy constexpr auto operator"" _q_Gy(unsigned long long l) { return absorbed_dose(l); } constexpr auto operator"" _q_Gy(long double l) { return absorbed_dose(l); } @@ -144,4 +144,30 @@ constexpr auto operator"" _q_YGy(long double l) { return absorbed_dose{}; +inline constexpr auto yGy = absorbed_dose{}; +inline constexpr auto zGy = absorbed_dose{}; +inline constexpr auto aGy = absorbed_dose{}; +inline constexpr auto fGy = absorbed_dose{}; +inline constexpr auto pGy = absorbed_dose{}; +inline constexpr auto nGy = absorbed_dose{}; +inline constexpr auto uGy = absorbed_dose{}; +inline constexpr auto mGy = absorbed_dose{}; +inline constexpr auto cGy = absorbed_dose{}; +inline constexpr auto dGy = absorbed_dose{}; +inline constexpr auto daGy = absorbed_dose{}; +inline constexpr auto hGy = absorbed_dose{}; +inline constexpr auto kGy = absorbed_dose{}; +inline constexpr auto MGy = absorbed_dose{}; +inline constexpr auto GGy = absorbed_dose{}; +inline constexpr auto TGy = absorbed_dose{}; +inline constexpr auto PGy = absorbed_dose{}; +inline constexpr auto EGy = absorbed_dose{}; +inline constexpr auto ZGy = absorbed_dose{}; +inline constexpr auto YGy = absorbed_dose{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/acceleration.h b/src/include/units/physical/si/derived/acceleration.h index 20e6de335..7aeb01bcf 100644 --- a/src/include/units/physical/si/derived/acceleration.h +++ b/src/include/units/physical/si/derived/acceleration.h @@ -36,7 +36,7 @@ using acceleration = quantity; inline namespace literals { -// mps2 +// m/s2 constexpr auto operator"" _q_m_per_s2(unsigned long long l) { return acceleration(l); } constexpr auto operator"" _q_m_per_s2(long double l) { return acceleration(l); } diff --git a/src/include/units/physical/si/derived/angular_velocity.h b/src/include/units/physical/si/derived/angular_velocity.h index cd892f7c7..d513505e8 100644 --- a/src/include/units/physical/si/derived/angular_velocity.h +++ b/src/include/units/physical/si/derived/angular_velocity.h @@ -43,7 +43,6 @@ inline namespace literals { constexpr auto operator"" _q_rad_per_s(unsigned long long l) { return angular_velocity(l); } constexpr auto operator"" _q_rad_per_s(long double l) { return angular_velocity(l); } - } // namespace literals } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/area.h b/src/include/units/physical/si/derived/area.h index 152cb90b2..9d04a9fb4 100644 --- a/src/include/units/physical/si/derived/area.h +++ b/src/include/units/physical/si/derived/area.h @@ -149,4 +149,31 @@ constexpr auto operator"" _q_ha(long double l) { return area{}; +inline constexpr auto ym2 = area{}; +inline constexpr auto zm2 = area{}; +inline constexpr auto am2 = area{}; +inline constexpr auto fm2 = area{}; +inline constexpr auto pm2 = area{}; +inline constexpr auto nm2 = area{}; +inline constexpr auto um2 = area{}; +inline constexpr auto mm2 = area{}; +inline constexpr auto cm2 = area{}; +inline constexpr auto dm2 = area{}; +inline constexpr auto dam2 = area{}; +inline constexpr auto hm2 = area{}; +inline constexpr auto km2 = area{}; +inline constexpr auto Mm2 = area{}; +inline constexpr auto Gm2 = area{}; +inline constexpr auto Tm2 = area{}; +inline constexpr auto Pm2 = area{}; +inline constexpr auto Em2 = area{}; +inline constexpr auto Zm2 = area{}; +inline constexpr auto Ym2 = area{}; +inline constexpr auto ha = area{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/capacitance.h b/src/include/units/physical/si/derived/capacitance.h index 863733723..83fd2996b 100644 --- a/src/include/units/physical/si/derived/capacitance.h +++ b/src/include/units/physical/si/derived/capacitance.h @@ -145,4 +145,30 @@ constexpr auto operator"" _q_YF(long double l) { return capacitance{}; +inline constexpr auto yF = capacitance{}; +inline constexpr auto zF = capacitance{}; +inline constexpr auto aF = capacitance{}; +inline constexpr auto fF = capacitance{}; +inline constexpr auto pF = capacitance{}; +inline constexpr auto nF = capacitance{}; +inline constexpr auto uF = capacitance{}; +inline constexpr auto mF = capacitance{}; +inline constexpr auto cF = capacitance{}; +inline constexpr auto dF = capacitance{}; +inline constexpr auto daF = capacitance{}; +inline constexpr auto hF = capacitance{}; +inline constexpr auto kF = capacitance{}; +inline constexpr auto MF = capacitance{}; +inline constexpr auto GF = capacitance{}; +inline constexpr auto TF = capacitance{}; +inline constexpr auto PF = capacitance{}; +inline constexpr auto EF = capacitance{}; +inline constexpr auto ZF = capacitance{}; +inline constexpr auto YF = capacitance{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/catalytic_activity.h b/src/include/units/physical/si/derived/catalytic_activity.h index a82bbe2fe..b5de46915 100644 --- a/src/include/units/physical/si/derived/catalytic_activity.h +++ b/src/include/units/physical/si/derived/catalytic_activity.h @@ -151,5 +151,32 @@ constexpr auto operator"" _q_U(long double l) { return catalytic_activity{}; +inline constexpr auto ykat = catalytic_activity{}; +inline constexpr auto zkat = catalytic_activity{}; +inline constexpr auto akat = catalytic_activity{}; +inline constexpr auto fkat = catalytic_activity{}; +inline constexpr auto pkat = catalytic_activity{}; +inline constexpr auto nkat = catalytic_activity{}; +inline constexpr auto ukat = catalytic_activity{}; +inline constexpr auto mkat = catalytic_activity{}; +inline constexpr auto ckat = catalytic_activity{}; +inline constexpr auto dkat = catalytic_activity{}; +inline constexpr auto dakat = catalytic_activity{}; +inline constexpr auto hkat = catalytic_activity{}; +inline constexpr auto kkat = catalytic_activity{}; +inline constexpr auto Mkat = catalytic_activity{}; +inline constexpr auto Gkat = catalytic_activity{}; +inline constexpr auto Tkat = catalytic_activity{}; +inline constexpr auto Pkat = catalytic_activity{}; +inline constexpr auto Ekat = catalytic_activity{}; +inline constexpr auto Zkat = catalytic_activity{}; +inline constexpr auto Ykat = catalytic_activity{}; +inline constexpr auto U = catalytic_activity{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/conductance.h b/src/include/units/physical/si/derived/conductance.h index db0d82c72..1edb7cdef 100644 --- a/src/include/units/physical/si/derived/conductance.h +++ b/src/include/units/physical/si/derived/conductance.h @@ -124,5 +124,27 @@ constexpr auto operator"" _q_YS(long double l) { return conductance{}; +inline constexpr auto yS = conductance{}; +inline constexpr auto zS = conductance{}; +inline constexpr auto aS = conductance{}; +inline constexpr auto fS = conductance{}; +inline constexpr auto pS = conductance{}; +inline constexpr auto nS = conductance{}; +inline constexpr auto uS = conductance{}; +inline constexpr auto mS = conductance{}; +inline constexpr auto kS = conductance{}; +inline constexpr auto MS = conductance{}; +inline constexpr auto GS = conductance{}; +inline constexpr auto TS = conductance{}; +inline constexpr auto PS = conductance{}; +inline constexpr auto ES = conductance{}; +inline constexpr auto ZS = conductance{}; +inline constexpr auto YS = conductance{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/current_density.h b/src/include/units/physical/si/derived/current_density.h index cf7999310..335cf6a78 100644 --- a/src/include/units/physical/si/derived/current_density.h +++ b/src/include/units/physical/si/derived/current_density.h @@ -39,6 +39,7 @@ using current_density = quantity; inline namespace literals { +// A / m² constexpr auto operator"" _q_A_per_m2(unsigned long long l) { return current_density(l); } constexpr auto operator"" _q_A_per_m2(long double l) { return current_density(l); } diff --git a/src/include/units/physical/si/derived/density.h b/src/include/units/physical/si/derived/density.h index e74d690d0..28bbe6ab8 100644 --- a/src/include/units/physical/si/derived/density.h +++ b/src/include/units/physical/si/derived/density.h @@ -39,6 +39,7 @@ using density = quantity; inline namespace literals { +// kg / m³ constexpr auto operator"" _q_kg_per_m3(unsigned long long l) { return density(l); } constexpr auto operator"" _q_kg_per_m3(long double l) { return density(l); } diff --git a/src/include/units/physical/si/derived/dynamic_viscosity.h b/src/include/units/physical/si/derived/dynamic_viscosity.h index cb83d58d5..e54c65292 100644 --- a/src/include/units/physical/si/derived/dynamic_viscosity.h +++ b/src/include/units/physical/si/derived/dynamic_viscosity.h @@ -43,5 +43,11 @@ constexpr auto operator"" _q_Pa_s(long double l) { return dynamic_viscosity{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/electric_charge.h b/src/include/units/physical/si/derived/electric_charge.h index 80608187c..be52b6ea9 100644 --- a/src/include/units/physical/si/derived/electric_charge.h +++ b/src/include/units/physical/si/derived/electric_charge.h @@ -44,4 +44,10 @@ constexpr auto operator"" _q_C(long double l) { return electric_charge{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/energy.h b/src/include/units/physical/si/derived/energy.h index 9de89aae8..3614e9734 100644 --- a/src/include/units/physical/si/derived/energy.h +++ b/src/include/units/physical/si/derived/energy.h @@ -135,4 +135,28 @@ constexpr auto operator"" _q_GeV(long double l) { return energy{}; +inline constexpr auto yJ = energy{}; +inline constexpr auto zJ = energy{}; +inline constexpr auto aJ = energy{}; +inline constexpr auto fJ = energy{}; +inline constexpr auto pJ = energy{}; +inline constexpr auto nJ = energy{}; +inline constexpr auto uJ = energy{}; +inline constexpr auto mJ = energy{}; +inline constexpr auto kJ = energy{}; +inline constexpr auto MJ = energy{}; +inline constexpr auto GJ = energy{}; +inline constexpr auto TJ = energy{}; +inline constexpr auto PJ = energy{}; +inline constexpr auto EJ = energy{}; +inline constexpr auto ZJ = energy{}; +inline constexpr auto YJ = energy{}; +inline constexpr auto eV = energy{}; +inline constexpr auto GeV = energy{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/force.h b/src/include/units/physical/si/derived/force.h index 40aefb98e..8e31d7fa9 100644 --- a/src/include/units/physical/si/derived/force.h +++ b/src/include/units/physical/si/derived/force.h @@ -145,4 +145,30 @@ constexpr auto operator"" _q_YN(long double l) { return force{}; +inline constexpr auto yN = force{}; +inline constexpr auto zN = force{}; +inline constexpr auto aN = force{}; +inline constexpr auto fN = force{}; +inline constexpr auto pN = force{}; +inline constexpr auto nN = force{}; +inline constexpr auto uN = force{}; +inline constexpr auto mN = force{}; +inline constexpr auto cN = force{}; +inline constexpr auto dN = force{}; +inline constexpr auto daN = force{}; +inline constexpr auto hN = force{}; +inline constexpr auto kN = force{}; +inline constexpr auto MN = force{}; +inline constexpr auto GN = force{}; +inline constexpr auto TN = force{}; +inline constexpr auto PN = force{}; +inline constexpr auto EN = force{}; +inline constexpr auto ZN = force{}; +inline constexpr auto YN = force{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/frequency.h b/src/include/units/physical/si/derived/frequency.h index 89e03ba40..b69455fa0 100644 --- a/src/include/units/physical/si/derived/frequency.h +++ b/src/include/units/physical/si/derived/frequency.h @@ -123,4 +123,26 @@ constexpr auto operator"" _q_YHz(long double l) { return frequency{}; +inline constexpr auto yHz = frequency{}; +inline constexpr auto zHz = frequency{}; +inline constexpr auto aHz = frequency{}; +inline constexpr auto fHz = frequency{}; +inline constexpr auto pHz = frequency{}; +inline constexpr auto nHz = frequency{}; +inline constexpr auto uHz = frequency{}; +inline constexpr auto mHz = frequency{}; +inline constexpr auto kHz = frequency{}; +inline constexpr auto MHz = frequency{}; +inline constexpr auto GHz = frequency{}; +inline constexpr auto THz = frequency{}; +inline constexpr auto PHz = frequency{}; +inline constexpr auto EHz = frequency{}; +inline constexpr auto ZHz = frequency{}; +inline constexpr auto YHz = frequency{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/inductance.h b/src/include/units/physical/si/derived/inductance.h index f804c12a6..6f2a98219 100644 --- a/src/include/units/physical/si/derived/inductance.h +++ b/src/include/units/physical/si/derived/inductance.h @@ -125,4 +125,26 @@ constexpr auto operator"" _q_YH(long double l) { return inductance{}; +inline constexpr auto yH = inductance{}; +inline constexpr auto zH = inductance{}; +inline constexpr auto aH = inductance{}; +inline constexpr auto fH = inductance{}; +inline constexpr auto pH = inductance{}; +inline constexpr auto nH = inductance{}; +inline constexpr auto uH = inductance{}; +inline constexpr auto mH = inductance{}; +inline constexpr auto kH = inductance{}; +inline constexpr auto MH = inductance{}; +inline constexpr auto GH = inductance{}; +inline constexpr auto TH = inductance{}; +inline constexpr auto PH = inductance{}; +inline constexpr auto EH = inductance{}; +inline constexpr auto ZH = inductance{}; +inline constexpr auto YH = inductance{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/magnetic_flux.h b/src/include/units/physical/si/derived/magnetic_flux.h index eeb63ed4b..d6a545625 100644 --- a/src/include/units/physical/si/derived/magnetic_flux.h +++ b/src/include/units/physical/si/derived/magnetic_flux.h @@ -125,4 +125,26 @@ constexpr auto operator"" _q_YWb(long double l) { return magnetic_flux{}; +inline constexpr auto yWb = magnetic_flux{}; +inline constexpr auto zWb = magnetic_flux{}; +inline constexpr auto aWb = magnetic_flux{}; +inline constexpr auto fWb = magnetic_flux{}; +inline constexpr auto pWb = magnetic_flux{}; +inline constexpr auto nWb = magnetic_flux{}; +inline constexpr auto uWb = magnetic_flux{}; +inline constexpr auto mWb = magnetic_flux{}; +inline constexpr auto kWb = magnetic_flux{}; +inline constexpr auto MWb = magnetic_flux{}; +inline constexpr auto GWb = magnetic_flux{}; +inline constexpr auto TWb = magnetic_flux{}; +inline constexpr auto PWb = magnetic_flux{}; +inline constexpr auto EWb = magnetic_flux{}; +inline constexpr auto ZWb = magnetic_flux{}; +inline constexpr auto YWb = magnetic_flux{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/magnetic_induction.h b/src/include/units/physical/si/derived/magnetic_induction.h index d8109462e..8755d25df 100644 --- a/src/include/units/physical/si/derived/magnetic_induction.h +++ b/src/include/units/physical/si/derived/magnetic_induction.h @@ -133,4 +133,27 @@ constexpr auto operator"" _q_G(long double l) { return magnetic_induction{}; +inline constexpr auto yT = magnetic_induction{}; +inline constexpr auto zT = magnetic_induction{}; +inline constexpr auto aT = magnetic_induction{}; +inline constexpr auto fT = magnetic_induction{}; +inline constexpr auto pT = magnetic_induction{}; +inline constexpr auto nT = magnetic_induction{}; +inline constexpr auto uT = magnetic_induction{}; +inline constexpr auto mT = magnetic_induction{}; +inline constexpr auto kT = magnetic_induction{}; +inline constexpr auto MT = magnetic_induction{}; +inline constexpr auto GT = magnetic_induction{}; +inline constexpr auto TT = magnetic_induction{}; +inline constexpr auto PT = magnetic_induction{}; +inline constexpr auto ET = magnetic_induction{}; +inline constexpr auto ZT = magnetic_induction{}; +inline constexpr auto YT = magnetic_induction{}; +inline constexpr auto G = magnetic_induction{}; + +} // namespace unit_constants + } // namespace units diff --git a/src/include/units/physical/si/derived/molar_energy.h b/src/include/units/physical/si/derived/molar_energy.h index ccca1978d..5d5049399 100644 --- a/src/include/units/physical/si/derived/molar_energy.h +++ b/src/include/units/physical/si/derived/molar_energy.h @@ -39,7 +39,7 @@ using molar_energy = quantity; inline namespace literals { -// H/m +// J/mol constexpr auto operator"" _q_J_per_mol(unsigned long long l) { return molar_energy(l); } constexpr auto operator"" _q_J_per_mol(long double l) { return molar_energy(l); } diff --git a/src/include/units/physical/si/derived/momentum.h b/src/include/units/physical/si/derived/momentum.h index acce4b945..01e4a8c46 100644 --- a/src/include/units/physical/si/derived/momentum.h +++ b/src/include/units/physical/si/derived/momentum.h @@ -37,7 +37,7 @@ using momentum = quantity; inline namespace literals { -// kgmps +// kg*m/s constexpr auto operator"" _q_kg_m_per_s(unsigned long long l) { return momentum(l); } constexpr auto operator"" _q_kg_m_per_s(long double l) { return momentum(l); } diff --git a/src/include/units/physical/si/derived/power.h b/src/include/units/physical/si/derived/power.h index 30fb0ac53..97986fe99 100644 --- a/src/include/units/physical/si/derived/power.h +++ b/src/include/units/physical/si/derived/power.h @@ -124,4 +124,26 @@ constexpr auto operator"" _q_YW(long double l) { return power{}; +inline constexpr auto yW = power{}; +inline constexpr auto zW = power{}; +inline constexpr auto aW = power{}; +inline constexpr auto fW = power{}; +inline constexpr auto pW = power{}; +inline constexpr auto nW = power{}; +inline constexpr auto uW = power{}; +inline constexpr auto mW = power{}; +inline constexpr auto kW = power{}; +inline constexpr auto MW = power{}; +inline constexpr auto GW = power{}; +inline constexpr auto TW = power{}; +inline constexpr auto PW = power{}; +inline constexpr auto EW = power{}; +inline constexpr auto ZW = power{}; +inline constexpr auto YW = power{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/pressure.h b/src/include/units/physical/si/derived/pressure.h index 01d15449e..8e0d65bc6 100644 --- a/src/include/units/physical/si/derived/pressure.h +++ b/src/include/units/physical/si/derived/pressure.h @@ -145,4 +145,30 @@ constexpr auto operator"" _q_YPa(long double l) { return pressure{}; +inline constexpr auto yPa = pressure{}; +inline constexpr auto zPa = pressure{}; +inline constexpr auto aPa = pressure{}; +inline constexpr auto fPa = pressure{}; +inline constexpr auto pPa = pressure{}; +inline constexpr auto nPa = pressure{}; +inline constexpr auto uPa = pressure{}; +inline constexpr auto mPa = pressure{}; +inline constexpr auto cPa = pressure{}; +inline constexpr auto dPa = pressure{}; +inline constexpr auto daPa = pressure{}; +inline constexpr auto hPa = pressure{}; +inline constexpr auto kPa = pressure{}; +inline constexpr auto MPa = pressure{}; +inline constexpr auto GPa = pressure{}; +inline constexpr auto TPa = pressure{}; +inline constexpr auto PPa = pressure{}; +inline constexpr auto EPa = pressure{}; +inline constexpr auto ZPa = pressure{}; +inline constexpr auto YPa = pressure{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/resistance.h b/src/include/units/physical/si/derived/resistance.h index be26345da..fea1f5120 100644 --- a/src/include/units/physical/si/derived/resistance.h +++ b/src/include/units/physical/si/derived/resistance.h @@ -125,4 +125,26 @@ constexpr auto operator"" _q_YR(long double l) { return resistance{}; +inline constexpr auto yR = resistance{}; +inline constexpr auto zR = resistance{}; +inline constexpr auto aR = resistance{}; +inline constexpr auto fR = resistance{}; +inline constexpr auto pR = resistance{}; +inline constexpr auto nR = resistance{}; +inline constexpr auto uR = resistance{}; +inline constexpr auto mR = resistance{}; +inline constexpr auto kR = resistance{}; +inline constexpr auto MR = resistance{}; +inline constexpr auto GR = resistance{}; +inline constexpr auto TR = resistance{}; +inline constexpr auto PR = resistance{}; +inline constexpr auto ER = resistance{}; +inline constexpr auto ZR = resistance{}; +inline constexpr auto YR = resistance{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/speed.h b/src/include/units/physical/si/derived/speed.h index 4bb44a41a..63ccb144b 100644 --- a/src/include/units/physical/si/derived/speed.h +++ b/src/include/units/physical/si/derived/speed.h @@ -39,11 +39,11 @@ using speed = quantity; inline namespace literals { -// mps +// m/s constexpr auto operator"" _q_m_per_s(unsigned long long l) { return speed(l); } constexpr auto operator"" _q_m_per_s(long double l) { return speed(l); } -// kmph +// km/h constexpr auto operator"" _q_km_per_h(unsigned long long l) { return speed(l); } constexpr auto operator"" _q_km_per_h(long double l) { return speed(l); } diff --git a/src/include/units/physical/si/derived/surface_tension.h b/src/include/units/physical/si/derived/surface_tension.h index 30f37c643..644a39a52 100644 --- a/src/include/units/physical/si/derived/surface_tension.h +++ b/src/include/units/physical/si/derived/surface_tension.h @@ -37,9 +37,9 @@ using surface_tension = quantity; inline namespace literals { - // Nm - constexpr auto operator"" _q_N_per_m(unsigned long long l) { return surface_tension(l); } - constexpr auto operator"" _q_N_per_m(long double l) { return surface_tension(l); } +// N/m +constexpr auto operator"" _q_N_per_m(unsigned long long l) { return surface_tension(l); } +constexpr auto operator"" _q_N_per_m(long double l) { return surface_tension(l); } } // namespace literals diff --git a/src/include/units/physical/si/derived/thermal_conductivity.h b/src/include/units/physical/si/derived/thermal_conductivity.h index cb5eb6e6b..aea394508 100644 --- a/src/include/units/physical/si/derived/thermal_conductivity.h +++ b/src/include/units/physical/si/derived/thermal_conductivity.h @@ -38,7 +38,7 @@ using thermal_conductivity = quantity; inline namespace literals { -// J/K +// W/(m K) constexpr auto operator"" _q_W_per_m_K(unsigned long long l) { return thermal_conductivity(l); } constexpr auto operator"" _q_W_per_m_K(long double l) { return thermal_conductivity(l); } diff --git a/src/include/units/physical/si/derived/torque.h b/src/include/units/physical/si/derived/torque.h index 932a21ebd..694aac87e 100644 --- a/src/include/units/physical/si/derived/torque.h +++ b/src/include/units/physical/si/derived/torque.h @@ -45,4 +45,10 @@ constexpr auto operator"" _q_Nm(long double l) { return torque{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/voltage.h b/src/include/units/physical/si/derived/voltage.h index 77b4a7cf2..005338b5c 100644 --- a/src/include/units/physical/si/derived/voltage.h +++ b/src/include/units/physical/si/derived/voltage.h @@ -145,4 +145,30 @@ constexpr auto operator"" _q_YV(long double l) { return voltage{}; +inline constexpr auto yV = voltage{}; +inline constexpr auto zV = voltage{}; +inline constexpr auto aV = voltage{}; +inline constexpr auto fV = voltage{}; +inline constexpr auto pV = voltage{}; +inline constexpr auto nV = voltage{}; +inline constexpr auto uV = voltage{}; +inline constexpr auto mV = voltage{}; +inline constexpr auto cV = voltage{}; +inline constexpr auto dV = voltage{}; +inline constexpr auto daV = voltage{}; +inline constexpr auto hV = voltage{}; +inline constexpr auto kV = voltage{}; +inline constexpr auto MV = voltage{}; +inline constexpr auto GV = voltage{}; +inline constexpr auto TV = voltage{}; +inline constexpr auto PV = voltage{}; +inline constexpr auto EV = voltage{}; +inline constexpr auto ZV = voltage{}; +inline constexpr auto YV = voltage{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/derived/volume.h b/src/include/units/physical/si/derived/volume.h index e81b760f2..c8fdd9c45 100644 --- a/src/include/units/physical/si/derived/volume.h +++ b/src/include/units/physical/si/derived/volume.h @@ -249,4 +249,51 @@ constexpr auto operator"" _q_Yl(long double l) { return volume{}; +inline constexpr auto ym3 = volume{}; +inline constexpr auto zm3 = volume{}; +inline constexpr auto am3 = volume{}; +inline constexpr auto fm3 = volume{}; +inline constexpr auto pm3 = volume{}; +inline constexpr auto nm3 = volume{}; +inline constexpr auto um3 = volume{}; +inline constexpr auto mm3 = volume{}; +inline constexpr auto cm3 = volume{}; +inline constexpr auto dm3 = volume{}; +inline constexpr auto dam3 = volume{}; +inline constexpr auto hm3 = volume{}; +inline constexpr auto km3 = volume{}; +inline constexpr auto Mm3 = volume{}; +inline constexpr auto Gm3 = volume{}; +inline constexpr auto Tm3 = volume{}; +inline constexpr auto Pm3 = volume{}; +inline constexpr auto Em3 = volume{}; +inline constexpr auto Zm3 = volume{}; +inline constexpr auto Ym3 = volume{}; +inline constexpr auto l = volume{}; +inline constexpr auto yl = volume{}; +inline constexpr auto zl = volume{}; +inline constexpr auto al = volume{}; +inline constexpr auto fl = volume{}; +inline constexpr auto pl = volume{}; +inline constexpr auto nl = volume{}; +inline constexpr auto ul = volume{}; +inline constexpr auto ml = volume{}; +inline constexpr auto cl = volume{}; +inline constexpr auto dl = volume{}; +inline constexpr auto dal = volume{}; +inline constexpr auto hl = volume{}; +inline constexpr auto kl = volume{}; +inline constexpr auto Ml = volume{}; +inline constexpr auto Gl = volume{}; +inline constexpr auto Tl = volume{}; +inline constexpr auto Pl = volume{}; +inline constexpr auto El = volume{}; +inline constexpr auto Zl = volume{}; +inline constexpr auto Yl = volume{}; + +} // namespace unit_constants + } // namespace units::physical::si diff --git a/src/include/units/physical/si/fps/base/length.h b/src/include/units/physical/si/fps/base/length.h index 1424347a0..9fb1b144b 100644 --- a/src/include/units/physical/si/fps/base/length.h +++ b/src/include/units/physical/si/fps/base/length.h @@ -91,7 +91,21 @@ constexpr auto operator"" _q_mile(long double l) { return length(l); } constexpr auto operator"" _q_naut_mi(long double l) { return length(l); } +} // namespace literals -} +namespace unit_constants { + +inline constexpr auto thou = length{}; +inline constexpr auto mil = thou; + +inline constexpr auto in = length{}; +inline constexpr auto ft = length{}; +inline constexpr auto yd = length{}; +inline constexpr auto ftm = length{}; +inline constexpr auto kyd = length{}; +inline constexpr auto mile = length{}; +inline constexpr auto naut_mi = length{}; + +} // namespace unit_constants } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/fps/base/mass.h b/src/include/units/physical/si/fps/base/mass.h index da264dbd9..60d44ea92 100644 --- a/src/include/units/physical/si/fps/base/mass.h +++ b/src/include/units/physical/si/fps/base/mass.h @@ -89,7 +89,20 @@ constexpr auto operator"" _q_ston(long double l) { return mass(l); } constexpr auto operator"" _q_lton(long double l) { return mass(l); } +} // namespace literals -} +namespace unit_constants { + +inline constexpr auto gr = mass{}; +inline constexpr auto dr = mass{}; +inline constexpr auto oz = mass{}; +inline constexpr auto lb = mass{}; +inline constexpr auto st = mass{}; +inline constexpr auto qr = mass{}; +inline constexpr auto cwt = mass{}; +inline constexpr auto ston = mass{}; +inline constexpr auto lton = mass{}; + +} // namespace unit_constants } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/fps/base/time.h b/src/include/units/physical/si/fps/base/time.h index b9a00c71a..4aa070d1a 100644 --- a/src/include/units/physical/si/fps/base/time.h +++ b/src/include/units/physical/si/fps/base/time.h @@ -38,6 +38,12 @@ inline namespace literals { using si::literals::operator"" _q_s; -} +} // namespace literals + +namespace unit_constants { + +using si::unit_constants::s; + +} // namespace unit_constants } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/fps/derived/acceleration.h b/src/include/units/physical/si/fps/derived/acceleration.h index c5e7e27b2..eb641455e 100644 --- a/src/include/units/physical/si/fps/derived/acceleration.h +++ b/src/include/units/physical/si/fps/derived/acceleration.h @@ -36,7 +36,7 @@ using acceleration = quantity; inline namespace literals { -// ft_per_s2 +// ft/s2 constexpr auto operator"" _q_ft_per_s2(unsigned long long l) { return acceleration(l); } constexpr auto operator"" _q_ft_per_s2(long double l) { return acceleration(l); } diff --git a/src/include/units/physical/si/fps/derived/area.h b/src/include/units/physical/si/fps/derived/area.h index 382528929..2167ad0af 100644 --- a/src/include/units/physical/si/fps/derived/area.h +++ b/src/include/units/physical/si/fps/derived/area.h @@ -41,6 +41,12 @@ inline namespace literals { constexpr auto operator"" _q_ft2(unsigned long long l) { return area(l); } constexpr auto operator"" _q_ft2(long double l) { return area(l); } -} +} // namespace literals + +namespace unit_constants { + +inline constexpr auto ft2 = area{}; + +} // namespace unit_constants } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/fps/derived/density.h b/src/include/units/physical/si/fps/derived/density.h index f8791d24a..601eb7120 100644 --- a/src/include/units/physical/si/fps/derived/density.h +++ b/src/include/units/physical/si/fps/derived/density.h @@ -38,6 +38,7 @@ using density = quantity; inline namespace literals { +// lb/ft³ constexpr auto operator"" _q_lb_per_ft3(unsigned long long l) { return density(l); } constexpr auto operator"" _q_lb_per_ft3(long double l) { return density(l); } diff --git a/src/include/units/physical/si/fps/derived/energy.h b/src/include/units/physical/si/fps/derived/energy.h index 03b8fc66b..1fda60f96 100644 --- a/src/include/units/physical/si/fps/derived/energy.h +++ b/src/include/units/physical/si/fps/derived/energy.h @@ -45,6 +45,7 @@ using energy = quantity; inline namespace literals { +// foot poundal constexpr auto operator"" _q_ft_pdl(unsigned long long l) { return energy(l); } constexpr auto operator"" _q_ft_pdl(long double l) { return energy(l); } @@ -54,4 +55,11 @@ constexpr auto operator"" _q_ft_lbf(long double l) { return energy{}; +inline constexpr auto ft_lbf = energy{}; + +} // namespace unit_constants + } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/fps/derived/force.h b/src/include/units/physical/si/fps/derived/force.h index 592a2e939..a78e6d86d 100644 --- a/src/include/units/physical/si/fps/derived/force.h +++ b/src/include/units/physical/si/fps/derived/force.h @@ -62,4 +62,12 @@ constexpr auto operator"" _q_klbf(long double l) { return force{}; +inline constexpr auto lbf = force{}; +inline constexpr auto klbf = force{}; + +} // namespace unit_constants + } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/fps/derived/power.h b/src/include/units/physical/si/fps/derived/power.h index 716f2a2c9..e03229fba 100644 --- a/src/include/units/physical/si/fps/derived/power.h +++ b/src/include/units/physical/si/fps/derived/power.h @@ -46,15 +46,20 @@ inline namespace literals { constexpr auto operator"" _q_ft_pdl_per_s(unsigned long long l) { return power(l); } constexpr auto operator"" _q_ft_pdl_per_s(long double l) { return power(l); } - // foot pound force per second constexpr auto operator"" _q_ft_lbf_per_s(unsigned long long l) { return power(l); } constexpr auto operator"" _q_ft_lbf_per_s(long double l) { return power(l); } - +// horse power constexpr auto operator"" _q_hp(unsigned long long l) { return power(l); } constexpr auto operator"" _q_hp(long double l) { return power(l); } } // namespace literals +namespace unit_constants { + +inline constexpr auto hp = power{}; + +} // namespace unit_constants + } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/fps/derived/pressure.h b/src/include/units/physical/si/fps/derived/pressure.h index f7820300c..5cb9a183b 100644 --- a/src/include/units/physical/si/fps/derived/pressure.h +++ b/src/include/units/physical/si/fps/derived/pressure.h @@ -44,6 +44,7 @@ struct pound_force_per_inch_sq : named_scaled_unit {}; inline namespace literals { + // Poundal per square foot constexpr auto operator"" _q_pdl_per_ft2(unsigned long long l) { return pressure(l); } constexpr auto operator"" _q_pdl_per_ft2(long double l) { return pressure(l); } @@ -58,4 +59,11 @@ constexpr auto operator"" _q_kpsi(long double l) { return pressure{}; +inline constexpr auto kpsi = pressure{}; + +} // namespace unit_constants + } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/fps/derived/speed.h b/src/include/units/physical/si/fps/derived/speed.h index 74ccf82ef..56dcd9c2e 100644 --- a/src/include/units/physical/si/fps/derived/speed.h +++ b/src/include/units/physical/si/fps/derived/speed.h @@ -44,16 +44,25 @@ struct knot : alias_unit {}; inline namespace literals { +// ft/s constexpr auto operator"" _q_ft_per_s(unsigned long long l) { return speed(l); } constexpr auto operator"" _q_ft_per_s(long double l) { return speed(l); } +// mph constexpr auto operator"" _q_mph(unsigned long long l) { return speed(l); } constexpr auto operator"" _q_mph(long double l) { return speed(l); } +// kn constexpr auto operator"" _q_knot(unsigned long long l) { return speed(l); } constexpr auto operator"" _q_knot(long double l) { return speed(l); } - } // namespace literals +namespace unit_constants { + +inline constexpr auto mph = speed{}; +inline constexpr auto knot = speed{}; + +} // namespace unit_constants + } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/fps/derived/volume.h b/src/include/units/physical/si/fps/derived/volume.h index 4e834b0c6..7701f8d40 100644 --- a/src/include/units/physical/si/fps/derived/volume.h +++ b/src/include/units/physical/si/fps/derived/volume.h @@ -42,10 +42,17 @@ inline namespace literals { constexpr auto operator"" _q_ft3(unsigned long long l) { return volume(l); } constexpr auto operator"" _q_ft3(long double l) { return volume(l); } -// yard3 +// yd3 constexpr auto operator"" _q_yd3(unsigned long long l) { return volume(l); } constexpr auto operator"" _q_yd3(long double l) { return volume(l); } } // namespace literals +namespace unit_constants { + +inline constexpr auto ft3 = volume{}; +inline constexpr auto yd3 = volume{}; + +} // namespace unit_constants + } // namespace units::physical::si::fps diff --git a/src/include/units/physical/si/iau/base/length.h b/src/include/units/physical/si/iau/base/length.h index 863af4cb5..f09ea5a8c 100644 --- a/src/include/units/physical/si/iau/base/length.h +++ b/src/include/units/physical/si/iau/base/length.h @@ -38,15 +38,26 @@ struct angstrom : named_scaled_unit(l); } constexpr auto operator"" _q_ly(long double l) { return si::length(l); } +// pc constexpr auto operator"" _q_pc(unsigned long long l) { return si::length(l); } constexpr auto operator"" _q_pc(long double l) { return si::length(l); } +// angstrom constexpr auto operator"" _q_angstrom(unsigned long long l) { return si::length(l); } constexpr auto operator"" _q_angstrom(long double l) { return si::length(l); } } // namespace literals +namespace unit_constants { + +inline constexpr auto ly = si::length{}; +inline constexpr auto pc = si::length{}; +inline constexpr auto angstrom = si::length{}; + +} // namespace unit_constants + } // namespace units::physical::si::iau diff --git a/src/include/units/physical/si/imperial/base/length.h b/src/include/units/physical/si/imperial/base/length.h index fa9c1591e..49fffe0c2 100644 --- a/src/include/units/physical/si/imperial/base/length.h +++ b/src/include/units/physical/si/imperial/base/length.h @@ -34,12 +34,21 @@ struct rod : named_scaled_unit {}; inline namespace literals { +// ch constexpr auto operator"" _q_ch(unsigned long long l) { return si::length(l); } constexpr auto operator"" _q_ch(long double l) { return si::length(l); } +// rd constexpr auto operator"" _q_rd(unsigned long long l) { return si::length(l); } constexpr auto operator"" _q_rd(long double l) { return si::length(l); } } // namespace literals +namespace unit_constants { + +inline constexpr auto ch = si::length{}; +inline constexpr auto rd = si::length{}; + +} // namespace unit_constants + } // namespace units::physical::si::imperial diff --git a/src/include/units/physical/si/international/base/length.h b/src/include/units/physical/si/international/base/length.h index 62d9aab50..3d33bcc97 100644 --- a/src/include/units/physical/si/international/base/length.h +++ b/src/include/units/physical/si/international/base/length.h @@ -94,4 +94,17 @@ constexpr auto operator"" _q_mil(long double l) { return si::length{}; +inline constexpr auto ft = si::length{}; +inline constexpr auto fathom = si::length{}; +inline constexpr auto in = si::length{}; +inline constexpr auto mi = si::length{}; +inline constexpr auto mi_naut = si::length{}; +inline constexpr auto thou = si::length{}; +inline constexpr auto mil = si::length{}; + +} // namespace unit_constants + } // namespace units::physical::si::international diff --git a/src/include/units/physical/si/international/derived/area.h b/src/include/units/physical/si/international/derived/area.h index 4d68177f5..e5805bf6f 100644 --- a/src/include/units/physical/si/international/derived/area.h +++ b/src/include/units/physical/si/international/derived/area.h @@ -37,4 +37,10 @@ constexpr auto operator"" _q_ft2(long double l) { return si::area{}; + +} // namespace unit_constants + } // namespace units::physical::si::international diff --git a/src/include/units/physical/si/international/derived/speed.h b/src/include/units/physical/si/international/derived/speed.h index 525a949fb..b9a7fffde 100644 --- a/src/include/units/physical/si/international/derived/speed.h +++ b/src/include/units/physical/si/international/derived/speed.h @@ -31,7 +31,7 @@ struct mile_per_hour : deduced_unit(l); } constexpr auto operator"" _q_mi_per_h(long double l) { return si::speed(l); } diff --git a/src/include/units/physical/si/international/derived/volume.h b/src/include/units/physical/si/international/derived/volume.h index 0c44a9973..91f6b47c1 100644 --- a/src/include/units/physical/si/international/derived/volume.h +++ b/src/include/units/physical/si/international/derived/volume.h @@ -37,4 +37,10 @@ constexpr auto operator"" _q_ft3(long double l) { return si::volume{}; + +} // namespace unit_constants + } // namespace units::physical::si::international diff --git a/src/include/units/physical/si/typographic/base/length.h b/src/include/units/physical/si/typographic/base/length.h index bea192c16..cff0a247e 100644 --- a/src/include/units/physical/si/typographic/base/length.h +++ b/src/include/units/physical/si/typographic/base/length.h @@ -53,4 +53,13 @@ constexpr auto operator"" _q_point_prn(long double l) { return si::length{}; +inline constexpr auto pica_prn = si::length{}; +inline constexpr auto point_comp = si::length{}; +inline constexpr auto point_prn = si::length{}; + +} // namespace unit_constants + } // namespace units::physical::si::typographic diff --git a/src/include/units/physical/si/us/base/length.h b/src/include/units/physical/si/us/base/length.h index a3a70bcdf..34e40f8b7 100644 --- a/src/include/units/physical/si/us/base/length.h +++ b/src/include/units/physical/si/us/base/length.h @@ -47,10 +47,18 @@ constexpr auto operator"" _q_ft_us(long double l) { return si::length(l); } constexpr auto operator"" _q_fathom_us(long double l) { return si::length(l); } -// ft +// mi constexpr auto operator"" _q_mi_us(unsigned long long l) { return si::length(l); } constexpr auto operator"" _q_mi_us(long double l) { return si::length(l); } } // namespace literals +namespace unit_constants { + +inline constexpr auto ft = si::length{}; +inline constexpr auto fathom = si::length{}; +inline constexpr auto mi = si::length{}; + +} // namespace unit_constants + } // namespace units::physical::si::us diff --git a/test/unit_test/static/CMakeLists.txt b/test/unit_test/static/CMakeLists.txt index 122847028..d44aa5295 100644 --- a/test/unit_test/static/CMakeLists.txt +++ b/test/unit_test/static/CMakeLists.txt @@ -43,6 +43,7 @@ add_library(unit_tests_static si_fps_test.cpp symbol_text_test.cpp type_list_test.cpp + unit_constants.cpp unit_test.cpp us_test.cpp ) diff --git a/test/unit_test/static/unit_constants.cpp b/test/unit_test/static/unit_constants.cpp new file mode 100644 index 000000000..876b0cd15 --- /dev/null +++ b/test/unit_test/static/unit_constants.cpp @@ -0,0 +1,85 @@ +// 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. + +#include "units/bits/external/hacks.h" +#include "units/physical/dimensions/length.h" +#include "units/physical/dimensions/speed.h" +#include "units/physical/si/base/length.h" +#include "units/physical/si/base/mass.h" +#include "units/physical/si/base/time.h" +#include "units/physical/si/derived/area.h" +#include "units/physical/si/derived/speed.h" +#include +#include +#include + +#if defined(COMP_MSVC) +#pragma warning( disable : 4459 ) // Disable shadowing warning. +#endif + +using namespace units::physical; +using namespace si; +using namespace unit_constants; + +static_assert(2 * m == 2_q_m); +static_assert(2 * s == 2_q_s); +#if !defined(COMP_MSVC) || defined(NDEBUG) +static_assert([]() { + assert(!requires { s / 2; }); + assert(!requires { s * 2; }); + assert(!requires { s + 2; }); + assert(!requires { s + s; }); + return 1_q_s + s == 2_q_s; +}()); +#endif + +constexpr auto m_per_s = m / s; + +static_assert(2_q_m / s == 2_q_m_per_s); +static_assert(2 * m / s == 2_q_m_per_s); +static_assert(2 / s * m == 2_q_m_per_s); +static_assert(2 * (m / s) == 2_q_m_per_s); +static_assert(2 * ::m_per_s == 2_q_m_per_s); +static_assert(std::is_same_v); + +static_assert(120 * km / (2 * h) == 60_q_km_per_h); +static_assert(120 * km / 2 / h == 60_q_km_per_h); +static_assert([] { + const auto length{120}; + const auto duration{2}; + return length * km / (duration * h); +}() == 60_q_km_per_h); +static_assert(std::is_same_v); +static_assert(std::is_same_v); +static_assert(std::is_same_v); + +static_assert(1. / 4 * m2 == 1._q_m2 / 4); + +static_assert([] { + Speed auto v0 = 10 * m / s; + signed s = 2; // hides ^ + Length auto v = 20 * m / s; + /* */ v0 = 10 * m / ::s; + return !std::is_same_v; +}()); + +int main() {}