From 97da55edfa40f43f24c653b744b5e25df773e14f Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 29 Dec 2022 18:59:10 +0100 Subject: [PATCH] refactor: the rest of the systems refactored for V2 --- example/avg_speed.cpp | 17 +- example/clcpp_response.cpp | 149 ++++++++++++ example/foot_pound_second.cpp | 117 ++++++++++ example/glide_computer_example.cpp | 4 +- example/hello_units.cpp | 5 +- src/core/include/units/bits/external/hacks.h | 2 + src/core/include/units/unit.h | 20 +- src/systems/CMakeLists.txt | 41 ++-- src/systems/{si-cgs => cgs}/CMakeLists.txt | 2 +- .../units/si => cgs/include/units}/cgs/cgs.h | 6 +- src/systems/hep/CMakeLists.txt | 25 ++ src/systems/hep/include/units/hep/hep.h | 91 ++++++++ src/systems/{si-iau => iau}/CMakeLists.txt | 2 +- src/systems/iau/include/units/iau/iau.h | 82 +++++++ .../{si-imperial => imperial}/CMakeLists.txt | 5 +- .../include/units/imperial/imperial.h | 98 ++++++++ src/systems/international/CMakeLists.txt | 25 ++ .../units/international/international.h | 100 ++++++++ src/systems/si-fps/CMakeLists.txt | 41 ---- .../include/units/isq/si/fps/acceleration.h | 69 ------ .../si-fps/include/units/isq/si/fps/area.h | 87 ------- .../si-fps/include/units/isq/si/fps/density.h | 71 ------ .../si-fps/include/units/isq/si/fps/energy.h | 85 ------- .../si-fps/include/units/isq/si/fps/force.h | 120 ---------- .../si-fps/include/units/isq/si/fps/fps.h | 38 ---- .../si-fps/include/units/isq/si/fps/length.h | 190 ---------------- .../si-fps/include/units/isq/si/fps/mass.h | 192 ---------------- .../si-fps/include/units/isq/si/fps/power.h | 113 ---------- .../include/units/isq/si/fps/pressure.h | 118 ---------- .../si-fps/include/units/isq/si/fps/speed.h | 112 --------- .../si-fps/include/units/isq/si/fps/time.h | 80 ------- .../si-fps/include/units/isq/si/fps/volume.h | 99 -------- src/systems/si-hep/CMakeLists.txt | 29 --- .../si-hep/include/units/isq/si/hep/area.h | 138 ------------ .../si-hep/include/units/isq/si/hep/energy.h | 213 ------------------ .../si-hep/include/units/isq/si/hep/mass.h | 212 ----------------- .../include/units/isq/si/hep/momentum.h | 165 -------------- .../si-iau/include/units/isq/si/iau/iau.h | 27 --- .../si-iau/include/units/isq/si/iau/length.h | 112 --------- .../include/units/isq/si/imperial/imperial.h | 27 --- .../include/units/isq/si/imperial/length.h | 97 -------- src/systems/si-international/CMakeLists.txt | 31 --- .../include/units/isq/si/international/area.h | 83 ------- .../isq/si/international/international.h | 30 --- .../units/isq/si/international/length.h | 189 ---------------- .../units/isq/si/international/speed.h | 107 --------- .../units/isq/si/international/volume.h | 83 ------- src/systems/si-typographic/CMakeLists.txt | 28 --- .../include/units/isq/si/typographic/length.h | 124 ---------- .../include/units/isq/si/uscs/length.h | 116 ---------- .../si-uscs/include/units/isq/si/uscs/uscs.h | 27 --- .../{si-uscs => typographic}/CMakeLists.txt | 2 +- .../include/units}/typographic/typographic.h | 18 +- src/systems/usc/CMakeLists.txt | 25 ++ src/systems/usc/include/units/usc/usc.h | 163 ++++++++++++++ test/unit_test/runtime/fmt_test.cpp | 2 +- test/unit_test/static/CMakeLists.txt | 7 +- .../unit_test/static/hep_test.cpp | 31 ++- test/unit_test/static/imperial_test.cpp | 80 +++++++ test/unit_test/static/si_hep_test.cpp | 73 ------ test/unit_test/static/us_test.cpp | 55 ----- test/unit_test/static/usc_test.cpp | 121 ++++++++++ 62 files changed, 1179 insertions(+), 3442 deletions(-) create mode 100644 example/clcpp_response.cpp create mode 100644 example/foot_pound_second.cpp rename src/systems/{si-cgs => cgs}/CMakeLists.txt (93%) rename src/systems/{si-cgs/include/units/si => cgs/include/units}/cgs/cgs.h (94%) create mode 100644 src/systems/hep/CMakeLists.txt create mode 100644 src/systems/hep/include/units/hep/hep.h rename src/systems/{si-iau => iau}/CMakeLists.txt (91%) create mode 100644 src/systems/iau/include/units/iau/iau.h rename src/systems/{si-imperial => imperial}/CMakeLists.txt (85%) create mode 100644 src/systems/imperial/include/units/imperial/imperial.h create mode 100644 src/systems/international/CMakeLists.txt create mode 100644 src/systems/international/include/units/international/international.h delete mode 100644 src/systems/si-fps/CMakeLists.txt delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/acceleration.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/area.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/density.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/energy.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/force.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/fps.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/length.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/mass.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/power.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/pressure.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/speed.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/time.h delete mode 100644 src/systems/si-fps/include/units/isq/si/fps/volume.h delete mode 100644 src/systems/si-hep/CMakeLists.txt delete mode 100644 src/systems/si-hep/include/units/isq/si/hep/area.h delete mode 100644 src/systems/si-hep/include/units/isq/si/hep/energy.h delete mode 100644 src/systems/si-hep/include/units/isq/si/hep/mass.h delete mode 100644 src/systems/si-hep/include/units/isq/si/hep/momentum.h delete mode 100644 src/systems/si-iau/include/units/isq/si/iau/iau.h delete mode 100644 src/systems/si-iau/include/units/isq/si/iau/length.h delete mode 100644 src/systems/si-imperial/include/units/isq/si/imperial/imperial.h delete mode 100644 src/systems/si-imperial/include/units/isq/si/imperial/length.h delete mode 100644 src/systems/si-international/CMakeLists.txt delete mode 100644 src/systems/si-international/include/units/isq/si/international/area.h delete mode 100644 src/systems/si-international/include/units/isq/si/international/international.h delete mode 100644 src/systems/si-international/include/units/isq/si/international/length.h delete mode 100644 src/systems/si-international/include/units/isq/si/international/speed.h delete mode 100644 src/systems/si-international/include/units/isq/si/international/volume.h delete mode 100644 src/systems/si-typographic/CMakeLists.txt delete mode 100644 src/systems/si-typographic/include/units/isq/si/typographic/length.h delete mode 100644 src/systems/si-uscs/include/units/isq/si/uscs/length.h delete mode 100644 src/systems/si-uscs/include/units/isq/si/uscs/uscs.h rename src/systems/{si-uscs => typographic}/CMakeLists.txt (91%) rename src/systems/{si-typographic/include/units/isq/si => typographic/include/units}/typographic/typographic.h (64%) create mode 100644 src/systems/usc/CMakeLists.txt create mode 100644 src/systems/usc/include/units/usc/usc.h rename src/systems/si-hep/include/units/isq/si/hep/hep.h => test/unit_test/static/hep_test.cpp (65%) create mode 100644 test/unit_test/static/imperial_test.cpp delete mode 100644 test/unit_test/static/si_hep_test.cpp delete mode 100644 test/unit_test/static/us_test.cpp create mode 100644 test/unit_test/static/usc_test.cpp diff --git a/example/avg_speed.cpp b/example/avg_speed.cpp index fd46a74b..2ccc1ef1 100644 --- a/example/avg_speed.cpp +++ b/example/avg_speed.cpp @@ -20,11 +20,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +#include #include #include -#include -#include #include +#include #include #include @@ -87,7 +87,7 @@ void example() // Customary Units (int) { - using namespace units::si::international::unit_symbols; + using namespace units::international::unit_symbols; constexpr auto distance = isq::length(140, mi); constexpr auto duration = isq::time(2, h); @@ -103,7 +103,8 @@ void example() // Customary Units (double) { - using namespace units::si::international::unit_symbols; + using namespace units::international::unit_symbols; + constexpr auto distance = isq::length(140., mi); constexpr auto duration = isq::time(2., h); @@ -121,8 +122,8 @@ void example() // CGS (int) { - constexpr auto distance = isq::length(22'000'000, si::cgs::centimetre); - constexpr auto duration = isq::time(7200, si::cgs::second); + constexpr auto distance = isq::length(22'000'000, cgs::centimetre); + constexpr auto duration = isq::time(7200, cgs::second); std::cout << "\nCGS units with 'int' as representation\n"; @@ -135,8 +136,8 @@ void example() // CGS (double) { - constexpr auto distance = isq::length(22'000'000., si::cgs::centimetre); - constexpr auto duration = isq::time(7200., si::cgs::second); + constexpr auto distance = isq::length(22'000'000., cgs::centimetre); + constexpr auto duration = isq::time(7200., cgs::second); std::cout << "\nCGS units with 'double' as representation\n"; diff --git a/example/clcpp_response.cpp b/example/clcpp_response.cpp new file mode 100644 index 00000000..a572bd90 --- /dev/null +++ b/example/clcpp_response.cpp @@ -0,0 +1,149 @@ +/* + Copyright (c) 2003-2019 Andy Little. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see http://www.gnu.org/licenses./ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + +void simple_quantities() +{ + using namespace units; + using namespace units::si; + using namespace units::international; + + using distance = quantity]>; + using duration = quantity; + + constexpr distance km = isq::distance[kilo](1.0); + constexpr distance miles = isq::distance[mile](1.0); + + constexpr duration sec = isq::duration[second](1); + constexpr duration min = isq::duration[minute](1); + constexpr duration hr = isq::duration[hour](1); + + std::cout << "A physical quantities library can choose the simple\n"; + std::cout << "option to provide output using a single type for each base unit:\n\n"; + std::cout << km << '\n'; + std::cout << miles << '\n'; + std::cout << sec << '\n'; + std::cout << min << '\n'; + std::cout << hr << "\n\n"; +} + +void quantities_with_typed_units() +{ + using namespace units; + using namespace units::si; + using namespace units::international; + + constexpr auto km = isq::distance[kilo](1.0); + constexpr auto miles = isq::distance[mile](1.0); + + std::cout.precision(6); + + constexpr auto sec = isq::duration[second](1); + constexpr auto min = isq::duration[minute](1); + constexpr auto hr = isq::duration[hour](1); + + std::cout << "A more flexible option is to provide separate types for each unit,\n\n"; + std::cout << km << '\n'; + std::cout << miles << '\n'; + std::cout << sec << '\n'; + std::cout << min << '\n'; + std::cout << hr << "\n\n"; + + constexpr quantity meter{1}; + std::cout << "then a wide range of pre-defined units can be defined and converted,\n" + " for consistency and repeatability across applications:\n\n"; + + std::cout << meter << '\n'; + + std::cout << " = " << meter[astronomical_unit] << '\n'; + std::cout << " = " << meter[iau::angstrom] << '\n'; + std::cout << " = " << meter[imperial::chain] << '\n'; + std::cout << " = " << meter[imperial::fathom] << '\n'; + std::cout << " = " << meter[usc::fathom] << '\n'; + std::cout << " = " << meter[international::foot] << '\n'; + std::cout << " = " << meter[usc::survey1893::us_survey_foot] << '\n'; + std::cout << " = " << meter[international::inch] << '\n'; + std::cout << " = " << meter[iau::light_year] << '\n'; + std::cout << " = " << meter[international::mile] << '\n'; + std::cout << " = " << meter[international::nautical_mile] << '\n'; + std::cout << " = " << meter[iau::parsec] << '\n'; + std::cout << " = " << meter[typographic::pica_dtp] << '\n'; + std::cout << " = " << meter[typographic::pica_us] << '\n'; + std::cout << " = " << meter[typographic::point_dtp] << '\n'; + std::cout << " = " << meter[typographic::point_us] << '\n'; + std::cout << " = " << meter[imperial::rod] << '\n'; + std::cout << " = " << meter[international::yard] << '\n'; +} + +void calcs_comparison() +{ + using namespace units; + using namespace units::si::unit_symbols; + + std::cout << "\nA distinct unit for each type is efficient and accurate\n" + "when adding two values of the same very big\n" + "or very small type:\n\n"; + + const auto L1A = isq::length[fm](2.f); + const auto L2A = isq::length[fm](3.f); + const auto LrA = L1A + L2A; + std::cout << STD_FMT::format("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, LrA); + + std::cout << "The single unit method must convert large\n" + "or small values in other units to the base unit.\n" + "This is both inefficient and inaccurate\n\n"; + + const auto L1B = L1A[m]; + const auto L2B = L2A[m]; + const auto LrB = L1B + L2B; + std::cout << STD_FMT::format("{:%.30eQ %q}\n + {:%.30eQ %q}\n = {:%.30eQ %q}\n\n", L1B, L2B, LrB); + + std::cout << "In multiplication and division:\n\n"; + + const quantity], float> ArA = L1A * L2A; + std::cout << STD_FMT::format("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, ArA); + + std::cout << "similar problems arise\n\n"; + + const quantity ArB = L1B * L2B; + std::cout << STD_FMT::format("{:%.30eQ %q}\n * {:%.30eQ %q}\n = {:%.30eQ %q}\n\n", L1B, L2B, ArB); +} + +} // namespace + +int main() +{ + std::cout << "This demo was originally posted on com.lang.c++.moderated in 2006\n"; + std::cout << "https://groups.google.com/g/comp.lang.c++.moderated/c/upv7hZExtf4/m/XruKUk8LhXYJ\n"; + std::cout << "Here converted to use mp-units library.\n\n"; + + simple_quantities(); + quantities_with_typed_units(); + calcs_comparison(); +} diff --git a/example/foot_pound_second.cpp b/example/foot_pound_second.cpp new file mode 100644 index 00000000..0d0cbb02 --- /dev/null +++ b/example/foot_pound_second.cpp @@ -0,0 +1,117 @@ +// 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 +#include +#include +#include +#include +#include +#include + +using namespace units; +using namespace units::international::unit_symbols; +using namespace units::si::unit_symbols; + + +// Some basic specs for the warship +struct Ship { + quantity length; + quantity draft; + quantity beam; + + quantity speed; + quantity mass; + + quantity mainGuns; + quantity shellMass; + quantity shellSpeed; + quantity power; +}; + +// Print 'q' in its current units and print its value cast to the units in each of Us +template +auto fmt_line(const Q& q) +{ + return STD_FMT::format("{:22}", q) + (STD_FMT::format(",{:20}", quantity_cast(q)) + ...); +} + +// Print the ship details in the units as defined in the Ship struct, in other si::imperial units, and in SI +void print_details(std::string_view description, const Ship& ship) +{ + const auto waterDensity = isq::density[lb / cubic](62.4); + std::cout << STD_FMT::format("{}\n", description); + std::cout << STD_FMT::format("{:20} : {}\n", "length", fmt_line(ship.length)) + << STD_FMT::format("{:20} : {}\n", "draft", fmt_line(ship.draft)) + << STD_FMT::format("{:20} : {}\n", "beam", fmt_line(ship.beam)) + << STD_FMT::format("{:20} : {}\n", "mass", fmt_line(ship.mass)) + << STD_FMT::format("{:20} : {}\n", "speed", fmt_line(ship.speed)) + << STD_FMT::format("{:20} : {}\n", "power", fmt_line(ship.power)) + << STD_FMT::format("{:20} : {}\n", "main guns", fmt_line(ship.mainGuns)) + << STD_FMT::format("{:20} : {}\n", "fire shells weighing", fmt_line(ship.shellMass)) + << STD_FMT::format("{:20} : {}\n", "fire shells at", fmt_line(ship.shellSpeed)) + << STD_FMT::format("{:20} : {}\n", "volume underwater", fmt_line(ship.mass / waterDensity)); +} + +int main() +{ + using units::international::unit_symbols::ft; // collides with si::femto + + // KMS Bismark, using the units the Germans would use, taken from Wiki + auto bismark = Ship{.length{isq::length[m](251.)}, + .draft{isq::length[m](9.3)}, + .beam{isq::length[m](36)}, + .speed{isq::speed[km / h](56)}, + .mass{isq::mass[t](50'300)}, + .mainGuns{isq::length[mm](380)}, + .shellMass{isq::mass[kg](800)}, + .shellSpeed{isq::speed[m / s](820.)}, + .power{isq::power[kW](110.45)}}; + + // USS Iowa, using units from the foot-pound-second system + auto iowa = Ship{.length{isq::length[ft](860.)}, + .draft{isq::length[ft](37.) + isq::length[in](2.)}, + .beam{isq::length[ft](108.) + isq::length[in](2.)}, + .speed{isq::speed[kt](33)}, + .mass{isq::mass[imperial::long_ton](57'540)}, + .mainGuns{isq::length[in](16)}, + .shellMass{isq::mass[lb](2700)}, + .shellSpeed{isq::speed[ft / s](2690.)}, + .power{isq::power[hp](212'000)}}; + + // HMS King George V, using units from the foot-pound-second system + auto kgv = Ship{.length{isq::length[ft](745.1)}, + .draft{isq::length[ft](33.) + isq::length[in](7.5)}, + .beam{isq::length[ft](103.2) + isq::length[in](2.5)}, + .speed{isq::speed[kt](28.3)}, + .mass{isq::mass[imperial::long_ton](42'245)}, + .mainGuns{isq::length[in](14)}, + .shellMass{isq::mass[lb](1'590)}, + .shellSpeed{isq::speed[ft / s](2483.)}, + .power{isq::power[hp](110'000)}}; + + print_details("KMS Bismark, defined in appropriate units from the SI system", bismark); + std::cout << "\n\n"; + print_details("USS Iowa, defined in appropriate units foot-pound-second system", iowa); + std::cout << "\n\n"; + print_details("HMS King George V, defined in appropriate units foot-pound-second system", kgv); +} diff --git a/example/glide_computer_example.cpp b/example/glide_computer_example.cpp index eb24d4a9..10f7ae8b 100644 --- a/example/glide_computer_example.cpp +++ b/example/glide_computer_example.cpp @@ -23,8 +23,8 @@ #include "glide_computer.h" #include #include +#include #include -#include #include #include #include @@ -67,7 +67,7 @@ auto get_weather_conditions() auto get_waypoints() { using namespace geographic::literals; - using namespace units::si::international::unit_symbols; + using namespace units::international::unit_symbols; static const std::array waypoints = { waypoint{"EPPR", {54.24772_N, 18.6745_E}, altitude{16. * isq::altitude[ft]}}, // N54°14'51.8" E18°40'28.2" waypoint{"EPGI", {53.52442_N, 18.84947_E}, altitude{115. * isq::altitude[ft]}} // N53°31'27.9" E18°50'58.1" diff --git a/example/hello_units.cpp b/example/hello_units.cpp index 1198ca23..743c415d 100644 --- a/example/hello_units.cpp +++ b/example/hello_units.cpp @@ -21,10 +21,9 @@ // SOFTWARE. #include +#include #include #include -#include -#include #include #include @@ -38,7 +37,7 @@ constexpr quantity_of auto avg_speed(quantity_of auto int main() { using namespace units::si::unit_symbols; - using namespace units::si::international::unit_symbols; + using namespace units::international::unit_symbols; constexpr auto v1 = isq::speed(110, km / h); constexpr auto v2 = isq::speed(70., mph); diff --git a/src/core/include/units/bits/external/hacks.h b/src/core/include/units/bits/external/hacks.h index 67c1086c..467a1808 100644 --- a/src/core/include/units/bits/external/hacks.h +++ b/src/core/include/units/bits/external/hacks.h @@ -52,6 +52,7 @@ #define UNITS_DIAGNOSTIC_IGNORE_SHADOW UNITS_DIAGNOSTIC_IGNORE("-Wshadow") #define UNITS_DIAGNOSTIC_IGNORE_UNREACHABLE #define UNITS_DIAGNOSTIC_IGNORE_ZERO_AS_NULLPOINTER_CONSTANT UNITS_DIAGNOSTIC_IGNORE("-Wzero-as-nullpointer-constant") +#define UNITS_DIAGNOSTIC_IGNORE_DEPRECATED UNITS_DIAGNOSTIC_IGNORE("-Wdeprecated-declarations") #else #define UNITS_DIAGNOSTIC_PUSH UNITS_PRAGMA(warning(push)) #define UNITS_DIAGNOSTIC_POP UNITS_PRAGMA(warning(pop)) @@ -65,6 +66,7 @@ #define UNITS_DIAGNOSTIC_IGNORE_SHADOW UNITS_DIAGNOSTIC_IGNORE(4459) #define UNITS_DIAGNOSTIC_IGNORE_UNREACHABLE UNITS_DIAGNOSTIC_IGNORE(4702) #define UNITS_DIAGNOSTIC_IGNORE_ZERO_AS_NULLPOINTER_CONSTANT +#define UNITS_DIAGNOSTIC_IGNORE_DEPRECATED #endif #if _LIBCPP_VERSION diff --git a/src/core/include/units/unit.h b/src/core/include/units/unit.h index 2098adf7..33f551e1 100644 --- a/src/core/include/units/unit.h +++ b/src/core/include/units/unit.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -523,12 +524,23 @@ template template [[nodiscard]] consteval bool less(Lhs, Rhs) { - if ((is_derived_from_specialization_of_constant_unit && is_derived_from_specialization_of_constant_unit) || - (!is_derived_from_specialization_of_constant_unit && !is_derived_from_specialization_of_constant_unit)) - return Lhs::symbol < Rhs::symbol; - else + if constexpr ((is_derived_from_specialization_of_constant_unit && + is_derived_from_specialization_of_constant_unit) || + (!is_derived_from_specialization_of_constant_unit && + !is_derived_from_specialization_of_constant_unit)) { + if constexpr (requires { + Lhs::symbol; + Rhs::symbol; + }) + // prefer symbols comparison if possible as it gives typically better results + // i.e. it puts upper case in from so `N m` is correct + return Lhs::symbol < Rhs::symbol; + else + return type_name() < type_name(); + } else { // put constants at the front of units list in the expression return is_derived_from_specialization_of_constant_unit; + } } diff --git a/src/systems/CMakeLists.txt b/src/systems/CMakeLists.txt index 40d50f47..b21c786b 100644 --- a/src/systems/CMakeLists.txt +++ b/src/systems/CMakeLists.txt @@ -23,37 +23,38 @@ cmake_minimum_required(VERSION 3.19) # systems +add_subdirectory(angular) +add_subdirectory(iec80000) add_subdirectory(isq) - +add_subdirectory(isq_angle) add_subdirectory(natural) add_subdirectory(si) -add_subdirectory(si-cgs) - -# add_subdirectory(si-fps) -# add_subdirectory(si-hep) -# add_subdirectory(si-iau) -# add_subdirectory(si-imperial) -# add_subdirectory(si-international) -# add_subdirectory(si-typographic) -# add_subdirectory(si-uscs) +add_subdirectory(cgs) +add_subdirectory(hep) +add_subdirectory(iau) +add_subdirectory(imperial) +add_subdirectory(international) +add_subdirectory(typographic) +add_subdirectory(usc) # wrapper for all the systems add_library(mp-units-systems INTERFACE) target_link_libraries( mp-units-systems INTERFACE + mp-units::angular + mp-units::iec80000 mp-units::isq - # mp-units::isq-iec80000 - # mp-units::isq-natural + mp-units::isq_angle + mp-units::natural mp-units::si - mp-units::si-cgs - # mp-units::si-fps - # mp-units::si-hep - # mp-units::si-iau - # mp-units::si-imperial - # mp-units::si-international - # mp-units::si-typographic - # mp-units::si-uscs + mp-units::cgs + mp-units::hep + mp-units::iau + mp-units::imperial + mp-units::international + mp-units::typographic + mp-units::usc ) add_library(mp-units::systems ALIAS mp-units-systems) set_target_properties(mp-units-systems PROPERTIES EXPORT_NAME systems) diff --git a/src/systems/si-cgs/CMakeLists.txt b/src/systems/cgs/CMakeLists.txt similarity index 93% rename from src/systems/si-cgs/CMakeLists.txt rename to src/systems/cgs/CMakeLists.txt index 802ab5df..5c5f8889 100644 --- a/src/systems/si-cgs/CMakeLists.txt +++ b/src/systems/cgs/CMakeLists.txt @@ -22,4 +22,4 @@ cmake_minimum_required(VERSION 3.19) -add_units_module(si-cgs DEPENDENCIES mp-units::si HEADERS include/units/si/cgs/cgs.h) +add_units_module(cgs DEPENDENCIES mp-units::si HEADERS include/units/cgs/cgs.h) diff --git a/src/systems/si-cgs/include/units/si/cgs/cgs.h b/src/systems/cgs/include/units/cgs/cgs.h similarity index 94% rename from src/systems/si-cgs/include/units/si/cgs/cgs.h rename to src/systems/cgs/include/units/cgs/cgs.h index 17d9016e..ebb80ae6 100644 --- a/src/systems/si-cgs/include/units/si/cgs/cgs.h +++ b/src/systems/cgs/include/units/cgs/cgs.h @@ -25,10 +25,10 @@ #include #include -namespace units::si::cgs { +namespace units::cgs { // clang-format off -inline constexpr struct centimetre : si::centi_ {} centimetre; +inline constexpr struct centimetre : decltype(si::centi) {} centimetre; inline constexpr struct gram : decltype(si::gram) {} gram; inline constexpr struct second : decltype(si::second) {} second; inline constexpr struct gal : named_unit<"Gal", centimetre / square> {} gal; @@ -53,4 +53,4 @@ inline constexpr auto St = stokes; } // namespace unit_symbols -} // namespace units::si::cgs +} // namespace units::cgs diff --git a/src/systems/hep/CMakeLists.txt b/src/systems/hep/CMakeLists.txt new file mode 100644 index 00000000..d778901b --- /dev/null +++ b/src/systems/hep/CMakeLists.txt @@ -0,0 +1,25 @@ +# The MIT License (MIT) +# +# Copyright (c) 2021 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. + +cmake_minimum_required(VERSION 3.19) + +add_units_module(hep DEPENDENCIES mp-units::si HEADERS include/units/hep/hep.h) diff --git a/src/systems/hep/include/units/hep/hep.h b/src/systems/hep/include/units/hep/hep.h new file mode 100644 index 00000000..df277f4e --- /dev/null +++ b/src/systems/hep/include/units/hep/hep.h @@ -0,0 +1,91 @@ +// The MIT License (MIT) +// +// Copyright (c) 2021 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::hep { + +// energy +using si::electronvolt; + +// clang-format off + +// area +// effective cross-sectional area according to EU council directive 80/181/EEC +// https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:01980L0181-20090527#page=10 +// https://www.fedlex.admin.ch/eli/cc/1994/3109_3109_3109/de +inline constexpr struct barn : named_unit<"b", mag_power<10, -28> * square> {} barn; + +// mass +inline constexpr struct electron_mass : named_unit<"m_e", mag * mag_power<10, -31> * si::kilogram> {} electron_mass; +inline constexpr struct proton_mass : named_unit<"m_p", mag * mag_power<10, -27> * si::kilogram> {} proton_mass; +inline constexpr struct neutron_mass : named_unit<"m_n", mag * mag_power<10, -27> * si::kilogram> {} neutron_mass; +// clang-format on + +namespace unit_symbols { + +using si::unit_symbols::eV; + +inline constexpr auto yeV = si::yocto; +inline constexpr auto zeV = si::zepto; +inline constexpr auto aeV = si::atto; +inline constexpr auto feV = si::femto; +inline constexpr auto peV = si::pico; +inline constexpr auto neV = si::nano; +inline constexpr auto ueV = si::micro; +inline constexpr auto meV = si::milli; +inline constexpr auto ceV = si::centi; +inline constexpr auto deV = si::deci; +inline constexpr auto daeV = si::deca; +inline constexpr auto heV = si::hecto; +inline constexpr auto keV = si::kilo; +inline constexpr auto MeV = si::mega; +inline constexpr auto GeV = si::giga; +inline constexpr auto TeV = si::tera; +inline constexpr auto PeV = si::peta; +inline constexpr auto EeV = si::exa; +inline constexpr auto ZeV = si::zetta; +inline constexpr auto YeV = si::yotta; + +inline constexpr auto yb = si::yocto; +inline constexpr auto zb = si::zepto; +inline constexpr auto ab = si::atto; +inline constexpr auto fb = si::femto; +inline constexpr auto pb = si::pico; +inline constexpr auto nb = si::nano; +inline constexpr auto ub = si::micro; +inline constexpr auto mb = si::milli; +inline constexpr auto b = barn; + +inline constexpr auto m_e = electron_mass; +inline constexpr auto m_p = proton_mass; +inline constexpr auto m_n = neutron_mass; + +inline constexpr auto c = si::si2019::speed_of_light_in_vacuum_unit; +inline constexpr auto c2 = square; + +} // namespace unit_symbols + +} // namespace units::hep diff --git a/src/systems/si-iau/CMakeLists.txt b/src/systems/iau/CMakeLists.txt similarity index 91% rename from src/systems/si-iau/CMakeLists.txt rename to src/systems/iau/CMakeLists.txt index 7e86c0d2..3ac37221 100644 --- a/src/systems/si-iau/CMakeLists.txt +++ b/src/systems/iau/CMakeLists.txt @@ -23,5 +23,5 @@ cmake_minimum_required(VERSION 3.19) add_units_module( - si-iau DEPENDENCIES mp-units::si HEADERS include/units/isq/si/iau/iau.h include/units/isq/si/iau/length.h + iau DEPENDENCIES mp-units::si HEADERS include/units/iau/iau.h ) diff --git a/src/systems/iau/include/units/iau/iau.h b/src/systems/iau/include/units/iau/iau.h new file mode 100644 index 00000000..067173e1 --- /dev/null +++ b/src/systems/iau/include/units/iau/iau.h @@ -0,0 +1,82 @@ +// 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::iau { + +// https://en.wikipedia.org/wiki/Astronomical_system_of_units + +// clang-format off +// time +inline constexpr struct day : named_unit<"D", si::day> {} day; +inline constexpr struct Julian_year : named_unit<"a", mag<86400> * si::second> {} Julian_year; + +// mass +inline constexpr struct solar_mass : named_unit * mag_power<10, 30> * si::kilogram> {} solar_mass; +inline constexpr struct Jupiter_mass : named_unit<"M_JUP", mag * mag_power<10, 27> * si::kilogram> {} Jupiter_mass; +inline constexpr struct Earth_mass : named_unit<"M_EARTH", mag * mag_power<10, 24> * si::kilogram> {} Earth_mass; + +// length +using si::astronomical_unit; + +// https://en.wikipedia.org/wiki/Lunar_distance_(astronomy) +inline constexpr struct lunar_distance : named_unit<"LD", mag<384'399> * si::kilo> {} lunar_distance; + +// https://en.wikipedia.org/wiki/Light-year +inline constexpr struct light_year : named_unit<"ly", mag<9'460'730'472'580'800> * si::metre> {} light_year; + +// https://en.wikipedia.org/wiki/Parsec +inline constexpr struct parsec : named_unit<"pc", mag<30'856'775'814'913'673> * si::metre> {} parsec; + +// https://en.wikipedia.org/wiki/Angstrom +inline constexpr struct angstrom : named_unit * si::metre> {} angstrom; + +// speed +inline constexpr struct speed_of_light_unit : constant_unit<"c_0", si::si2019::speed_of_light_in_vacuum_unit> {} speed_of_light_unit; +inline constexpr auto speed_of_light = isq::speed_of_light[speed_of_light_unit]; + +// clang-format on + +namespace unit_symbols { + +inline constexpr auto D = day; +inline constexpr auto a = Julian_year; + +inline constexpr auto M_SUN = solar_mass; +inline constexpr auto M_JUP = Jupiter_mass; +inline constexpr auto M_EARTH = Earth_mass; + +inline constexpr auto au = astronomical_unit; +inline constexpr auto LD = lunar_distance; +inline constexpr auto ly = light_year; +inline constexpr auto pc = parsec; +inline constexpr auto A = angstrom; + +inline constexpr auto c_0 = speed_of_light_unit; + +} // namespace unit_symbols + +} // namespace units::iau diff --git a/src/systems/si-imperial/CMakeLists.txt b/src/systems/imperial/CMakeLists.txt similarity index 85% rename from src/systems/si-imperial/CMakeLists.txt rename to src/systems/imperial/CMakeLists.txt index 3a441611..66a926f2 100644 --- a/src/systems/si-imperial/CMakeLists.txt +++ b/src/systems/imperial/CMakeLists.txt @@ -22,7 +22,4 @@ cmake_minimum_required(VERSION 3.19) -add_units_module( - si-imperial DEPENDENCIES mp-units::si HEADERS include/units/isq/si/imperial/imperial.h - include/units/isq/si/imperial/length.h -) +add_units_module(imperial DEPENDENCIES mp-units::si mp-units::international HEADERS include/units/imperial/imperial.h) diff --git a/src/systems/imperial/include/units/imperial/imperial.h b/src/systems/imperial/include/units/imperial/imperial.h new file mode 100644 index 00000000..65374ed1 --- /dev/null +++ b/src/systems/imperial/include/units/imperial/imperial.h @@ -0,0 +1,98 @@ +// 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::imperial { + +using namespace international; + +// clang-format off +// https://en.wikipedia.org/wiki/Imperial_units#Length +inline constexpr struct hand : named_unit<"hh", mag * foot> {} hand; +inline constexpr struct barleycorn : named_unit<"Bc", mag * inch> {} barleycorn; +inline constexpr struct thou : named_unit<"th", mag * foot> {} thou; +inline constexpr struct chain : named_unit<"ch", mag<22> * yard> {} chain; +inline constexpr struct furlong : named_unit<"fur", mag<10> * chain> {} furlong; + +// maritime units +inline constexpr struct cable : named_unit<"cb", mag * nautical_mile> {} cable; +inline constexpr struct fathom : named_unit<"ftm", mag * nautical_mile> {} fathom; + +// survey +inline constexpr struct link : named_unit<"li", mag * chain> {} link; +inline constexpr struct rod : named_unit<"rd", mag<25> * link> {} rod; + +// https://en.wikipedia.org/wiki/Imperial_units#Area +inline constexpr struct perch : decltype(square) {} perch; +inline constexpr struct rood : decltype(mag<40> * perch) {} rood; +inline constexpr struct acre : decltype(mag<4> * rood) {} acre; + +// https://en.wikipedia.org/wiki/Imperial_units#Volume +inline constexpr struct gallon : named_unit<"gal", mag * si::litre> {} gallon; +inline constexpr struct quart : named_unit<"qt", mag * gallon> {} quart; +inline constexpr struct pint : named_unit<"pt", mag * quart> {} pint; +inline constexpr struct gill : named_unit<"gi", mag * pint> {} gill; +inline constexpr struct fluid_ounce : named_unit<"fl oz", mag * gill> {} fluid_ounce; + +// https://en.wikipedia.org/wiki/Avoirdupois_system#Post-Elizabethan_units +inline constexpr auto drachm = dram; +inline constexpr struct stone : named_unit<"st", mag<14> * pound> {} stone; +inline constexpr struct quarter : named_unit<"qr", mag<2> * stone> {} quarter; +inline constexpr struct long_hundredweight : named_unit<"cwt", mag<8> * stone> {} long_hundredweight; +inline constexpr struct ton : named_unit<"t", mag<2'240> * pound> {} ton; +inline constexpr auto long_ton = ton; +// clang-format on + +namespace unit_symbols { + +using namespace international::unit_symbols; + +inline constexpr auto hh = hand; +inline constexpr auto Bc = barleycorn; +inline constexpr auto th = thou; +inline constexpr auto ch = chain; +inline constexpr auto fur = furlong; + +inline constexpr auto cb = cable; +inline constexpr auto ftm = fathom; + +inline constexpr auto li = link; +inline constexpr auto rd = rod; + +inline constexpr auto gal = gallon; +inline constexpr auto qt = quart; +inline constexpr auto pt = pint; +inline constexpr auto gi = gill; +inline constexpr auto fl_oz = fluid_ounce; + +inline constexpr auto st = stone; +inline constexpr auto qr = quarter; +inline constexpr auto cwt = long_hundredweight; +inline constexpr auto t = ton; + +} // namespace unit_symbols + +} // namespace units::imperial diff --git a/src/systems/international/CMakeLists.txt b/src/systems/international/CMakeLists.txt new file mode 100644 index 00000000..27bd41e5 --- /dev/null +++ b/src/systems/international/CMakeLists.txt @@ -0,0 +1,25 @@ +# 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. + +cmake_minimum_required(VERSION 3.19) + +add_units_module(international DEPENDENCIES mp-units::si HEADERS include/units/international/international.h) diff --git a/src/systems/international/include/units/international/international.h b/src/systems/international/include/units/international/international.h new file mode 100644 index 00000000..b37af7d9 --- /dev/null +++ b/src/systems/international/include/units/international/international.h @@ -0,0 +1,100 @@ +// 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::international { + +// clang-format off +// mass +inline constexpr struct pound : named_unit<"lb", mag * si::kilogram> {} pound; +inline constexpr struct ounce : named_unit<"oz", mag * pound> {} ounce; +inline constexpr struct dram : named_unit<"dr", mag * ounce> {} dram; +inline constexpr struct grain : named_unit<"gr", mag * pound> {} grain; + +// length +inline constexpr struct yard : named_unit<"yd", mag * si::metre> {} yard; +inline constexpr struct foot : named_unit<"ft", mag * yard> {} foot; +inline constexpr struct inch : named_unit<"in", mag * foot> {} inch; +inline constexpr struct pica : named_unit<"P", mag * inch> {} pica; +inline constexpr struct point : named_unit<"p", mag * pica> {} point; +inline constexpr struct mil : named_unit<"mil", mag * inch> {} mil; +inline constexpr struct twip : named_unit<"twip", mag * point> {} twip; +inline constexpr struct mile : named_unit<"mi", mag<1760> * yard> {} mile; +inline constexpr struct league : named_unit<"le", mag<3> * mile> {} league; + +inline constexpr struct nautical_mile : named_unit<"nmi", mag<1852> * si::metre> {} nautical_mile; + +// speed +inline constexpr struct knot : named_unit<"kn", nautical_mile / si::hour> {} knot; + +// force +// https://en.wikipedia.org/wiki/Poundal +inline constexpr struct poundal : named_unit<"pdl", pound * foot / square> {} poundal; + +// https://en.wikipedia.org/wiki/Pound_(force) +inline constexpr struct pound_force : named_unit<"lbf", pound * si::standard_gravity_unit> {} pound_force; + +// https://en.wikipedia.org/wiki/Kip_(unit), +inline constexpr struct kip : decltype(si::kilo) {} kip; + +// pressure +inline constexpr struct psi : named_unit<"psi", pound_force / square> {} psi; + +// power +// https://en.wikipedia.org/wiki/Horsepower#Definitions +inline constexpr struct mechanical_horsepower : named_unit<"hp(I)", mag<33'000> * foot * pound_force / si::minute> {} mechanical_horsepower; +// clang-format on + + +namespace unit_symbols { + +inline constexpr auto lb = pound; +inline constexpr auto oz = ounce; +inline constexpr auto dr = dram; +inline constexpr auto gr = grain; + +inline constexpr auto yd = yard; +inline constexpr auto ft = foot; +inline constexpr auto in = inch; +inline constexpr auto P = pica; +inline constexpr auto p = point; +inline constexpr auto mi = mile; +inline constexpr auto le = league; + +inline constexpr auto nmi = nautical_mile; + +inline constexpr auto kn = knot; +inline constexpr auto kt = knot; +inline constexpr auto mph = mile / si::hour; + +inline constexpr auto pdl = poundal; +inline constexpr auto lbf = pound_force; + +inline constexpr auto hp = mechanical_horsepower; + +} // namespace unit_symbols + +} // namespace units::international diff --git a/src/systems/si-fps/CMakeLists.txt b/src/systems/si-fps/CMakeLists.txt deleted file mode 100644 index ffd302de..00000000 --- a/src/systems/si-fps/CMakeLists.txt +++ /dev/null @@ -1,41 +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. - -cmake_minimum_required(VERSION 3.19) - -add_units_module( - si-fps - DEPENDENCIES mp-units::si-international - HEADERS include/units/isq/si/fps/acceleration.h - include/units/isq/si/fps/area.h - include/units/isq/si/fps/density.h - include/units/isq/si/fps/energy.h - include/units/isq/si/fps/force.h - include/units/isq/si/fps/fps.h - include/units/isq/si/fps/length.h - include/units/isq/si/fps/mass.h - include/units/isq/si/fps/power.h - include/units/isq/si/fps/pressure.h - include/units/isq/si/fps/speed.h - include/units/isq/si/fps/time.h - include/units/isq/si/fps/volume.h -) diff --git a/src/systems/si-fps/include/units/isq/si/fps/acceleration.h b/src/systems/si-fps/include/units/isq/si/fps/acceleration.h deleted file mode 100644 index da1c9593..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/acceleration.h +++ /dev/null @@ -1,69 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::fps { - -struct foot_per_second_sq : derived_unit {}; -struct dim_acceleration : isq::dim_acceleration {}; - -template U, Representation Rep = double> -using acceleration = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// ft/s2 -constexpr auto operator"" _q_ft_per_s2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return acceleration(static_cast(l)); -} -constexpr auto operator"" _q_ft_per_s2(long double l) { return acceleration(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline acceleration { - -template -using ft_per_s2 = units::isq::si::fps::acceleration; - -} // namespace units::aliases::isq::si::fps::inline acceleration - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/area.h b/src/systems/si-fps/include/units/isq/si/fps/area.h deleted file mode 100644 index 076dab96..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/area.h +++ /dev/null @@ -1,87 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::fps { - -struct square_foot : derived_unit {}; -struct dim_area : isq::dim_area {}; - - -template U, Representation Rep = double> -using area = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// ft2 -constexpr auto operator"" _q_ft2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_ft2(long double l) { return area(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace area_references { - -inline constexpr auto ft2 = reference{}; - -} // namespace area_references - -namespace references { - -using namespace area_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline area { - -template -using ft2 = units::isq::si::fps::area; - -} // namespace units::aliases::isq::si::fps::inline area - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/density.h b/src/systems/si-fps/include/units/isq/si/fps/density.h deleted file mode 100644 index 41ee340e..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/density.h +++ /dev/null @@ -1,71 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include - -namespace units::isq::si::fps { - -struct pound_per_foot_cub : derived_unit {}; - -struct dim_density : isq::dim_density {}; - -template U, Representation Rep = double> -using density = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// lb/ft³ -constexpr auto operator"" _q_lb_per_ft3(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return density(static_cast(l)); -} -constexpr auto operator"" _q_lb_per_ft3(long double l) { return density(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline density { - -template -using lb_per_ft3 = units::isq::si::fps::density; - -} // namespace units::aliases::isq::si::fps::inline density - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/energy.h b/src/systems/si-fps/include/units/isq/si/fps/energy.h deleted file mode 100644 index 593319a0..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/energy.h +++ /dev/null @@ -1,85 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include - -namespace units::isq::si::fps { - -// https://en.wikipedia.org/wiki/Foot-poundal -struct foot_poundal : derived_unit {}; - -struct dim_energy : isq::dim_energy {}; - -// https://en.wikipedia.org/wiki/Foot-pound_(energy) -struct foot_pound_force : derived_scaled_unit {}; - -template U, Representation Rep = double> -using energy = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// foot poundal -constexpr auto operator"" _q_ft_pdl(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_ft_pdl(long double l) { return energy(l); } - -// foot_pound force -constexpr auto operator"" _q_ft_lbf(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_ft_lbf(long double l) { return energy(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline energy { - -template -using ft_pdl = units::isq::si::fps::energy; -template -using ft_lbf = units::isq::si::fps::energy; - -} // namespace units::aliases::isq::si::fps::inline energy - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/force.h b/src/systems/si-fps/include/units/isq/si/fps/force.h deleted file mode 100644 index f8569719..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/force.h +++ /dev/null @@ -1,120 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include -#include - -namespace units::isq::si::fps { - -// https://en.wikipedia.org/wiki/Poundal -struct poundal : named_unit {}; - -// https://en.wikipedia.org/wiki/Pound_(force) -struct pound_force : named_scaled_unit(), poundal> {}; - -struct kilopound_force : prefixed_unit {}; - -// https://en.wikipedia.org/wiki/Kip_(unit), -struct kip : alias_unit {}; - -struct dim_force : isq::dim_force {}; - -template U, Representation Rep = double> -using force = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// poundal -constexpr auto operator"" _q_pdl(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return force(static_cast(l)); -} -constexpr auto operator"" _q_pdl(long double l) { return force(l); } - -// pound force -constexpr auto operator"" _q_lbf(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return force(static_cast(l)); -} -constexpr auto operator"" _q_lbf(long double l) { return force(l); } - -// kilopound force -constexpr auto operator"" _q_klbf(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return force(static_cast(l)); -} -constexpr auto operator"" _q_klbf(long double l) { return force(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace force_references { - -inline constexpr auto pdl = reference{}; -inline constexpr auto lbf = reference{}; -inline constexpr auto klbf = reference{}; - -} // namespace force_references - -namespace references { - -using namespace force_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline force { - -template -using pdl = units::isq::si::fps::force; -template -using lbf = units::isq::si::fps::force; -template -using klbf = units::isq::si::fps::force; - -} // namespace units::aliases::isq::si::fps::inline force - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/fps.h b/src/systems/si-fps/include/units/isq/si/fps/fps.h deleted file mode 100644 index 6bd88132..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/fps.h +++ /dev/null @@ -1,38 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -// IWYU pragma: end_exports diff --git a/src/systems/si-fps/include/units/isq/si/fps/length.h b/src/systems/si-fps/include/units/isq/si/fps/length.h deleted file mode 100644 index adc29a8d..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/length.h +++ /dev/null @@ -1,190 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::fps { - -// https://en.wikipedia.org/wiki/Foot_(unit) -using si::international::fathom; -using si::international::foot; -using si::international::inch; -using si::international::mil; -using si::international::mile; -using si::international::thou; -using si::international::yard; - -// thousandth of an inch -struct thousandth : alias_unit {}; - -struct kiloyard : prefixed_unit {}; - -struct nautical_mile : named_scaled_unit(), yard> {}; - -struct dim_length : isq::dim_length {}; - -template U, Representation Rep = double> -using length = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// Thousandth -constexpr auto operator"" _q_thou(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return length(static_cast(l)); -} -constexpr auto operator"" _q_thou(long double l) { return length(l); } -constexpr auto operator"" _q_mil(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return length(static_cast(l)); -} -constexpr auto operator"" _q_mil(long double l) { return length(l); } - - -// Inch -constexpr auto operator"" _q_in(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return length(static_cast(l)); -} -constexpr auto operator"" _q_in(long double l) { return length(l); } - -// Foot -constexpr auto operator"" _q_ft(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return length(static_cast(l)); -} -constexpr auto operator"" _q_ft(long double l) { return length(l); } - -// Yard -constexpr auto operator"" _q_yd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return length(static_cast(l)); -} -constexpr auto operator"" _q_yd(long double l) { return length(l); } - -// Fathom -constexpr auto operator"" _q_ftm(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return length(static_cast(l)); -} -constexpr auto operator"" _q_ftm(long double l) { return length(l); } - -// Kiloyard -constexpr auto operator"" _q_kyd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return length(static_cast(l)); -} -constexpr auto operator"" _q_kyd(long double l) { return length(l); } - -// Mile -constexpr auto operator"" _q_mile(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return length(static_cast(l)); -} -constexpr auto operator"" _q_mile(long double l) { return length(l); } - -// Nautical mile -constexpr auto operator"" _q_naut_mi(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return length(static_cast(l)); -} -constexpr auto operator"" _q_naut_mi(long double l) { return length(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace length_references { - -inline constexpr auto thou = reference{}; -inline constexpr auto mil = thou; - -inline constexpr auto in = reference{}; -inline constexpr auto ft = reference{}; -inline constexpr auto yd = reference{}; -inline constexpr auto ftm = reference{}; -inline constexpr auto kyd = reference{}; -inline constexpr auto mile = reference{}; -inline constexpr auto naut_mi = reference{}; - -} // namespace length_references - -namespace references { - -using namespace length_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline length { - -template -using thou = units::isq::si::fps::length; -template -using mil = thou; - -template -using in = units::isq::si::fps::length; -template -using ft = units::isq::si::fps::length; -template -using yd = units::isq::si::fps::length; -template -using ftm = units::isq::si::fps::length; -template -using kyd = units::isq::si::fps::length; -template -using mile = units::isq::si::fps::length; -template -using naut_mi = units::isq::si::fps::length; - -} // namespace units::aliases::isq::si::fps::inline length - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/mass.h b/src/systems/si-fps/include/units/isq/si/fps/mass.h deleted file mode 100644 index 246aba06..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/mass.h +++ /dev/null @@ -1,192 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::fps { - -// https://en.wikipedia.org/wiki/Pound_(mass) -struct pound : named_scaled_unit(), si::kilogram> {}; - -struct dim_mass : isq::dim_mass {}; - -template U, Representation Rep = double> -using mass = quantity; - -struct grain : named_scaled_unit(), pound> {}; - -struct dram : named_scaled_unit(), pound> {}; - -struct ounce : named_scaled_unit(), pound> {}; - -struct stone : named_scaled_unit(), pound> {}; - -struct quarter : named_scaled_unit(), pound> {}; - -struct hundredweight : named_scaled_unit(), pound> {}; - -struct short_ton : named_scaled_unit(), pound> {}; - -struct long_ton : named_scaled_unit(), pound> {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// Grain -constexpr auto operator"" _q_gr(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_gr(long double l) { return mass(l); } - -// Dram -constexpr auto operator"" _q_dr(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_dr(long double l) { return mass(l); } - -// Ounce -constexpr auto operator"" _q_oz(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_oz(long double l) { return mass(l); } - -// Pound -constexpr auto operator"" _q_lb(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_lb(long double l) { return mass(l); } - -// Stone -constexpr auto operator"" _q_st(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_st(long double l) { return mass(l); } - -// Quarter -constexpr auto operator"" _q_qr(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_qr(long double l) { return mass(l); } - -// Hundredweight -constexpr auto operator"" _q_cwt(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_cwt(long double l) { return mass(l); } - -// Short ton -constexpr auto operator"" _q_ston(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_ston(long double l) { return mass(l); } - -// Long Ton -constexpr auto operator"" _q_lton(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_lton(long double l) { return mass(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace mass_references { - -inline constexpr auto gr = reference{}; -inline constexpr auto dr = reference{}; -inline constexpr auto oz = reference{}; -inline constexpr auto lb = reference{}; -inline constexpr auto st = reference{}; -inline constexpr auto qr = reference{}; -inline constexpr auto cwt = reference{}; -inline constexpr auto ston = reference{}; -inline constexpr auto lton = reference{}; - -} // namespace mass_references - -namespace references { - -using namespace mass_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline mass { - -template -using gr = units::isq::si::fps::mass; -template -using dr = units::isq::si::fps::mass; -template -using oz = units::isq::si::fps::mass; -template -using lb = units::isq::si::fps::mass; -template -using st = units::isq::si::fps::mass; -template -using qr = units::isq::si::fps::mass; -template -using cwt = units::isq::si::fps::mass; -template -using ston = units::isq::si::fps::mass; -template -using lton = units::isq::si::fps::mass; - -} // namespace units::aliases::isq::si::fps::inline mass - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/power.h b/src/systems/si-fps/include/units/isq/si/fps/power.h deleted file mode 100644 index 85930563..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/power.h +++ /dev/null @@ -1,113 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include - -namespace units::isq::si::fps { - -struct foot_poundal_per_second : derived_unit {}; - -struct dim_power : isq::dim_power {}; - -struct foot_pound_force_per_second : - derived_scaled_unit {}; - -struct horse_power : named_scaled_unit(), foot_pound_force_per_second> {}; - -template U, Representation Rep = double> -using power = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// foot pound force per second -constexpr auto operator"" _q_ft_pdl_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return power(static_cast(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) -{ - gsl_ExpectsAudit(std::in_range(l)); - return power(static_cast(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) -{ - gsl_ExpectsAudit(std::in_range(l)); - return power(static_cast(l)); -} -constexpr auto operator"" _q_hp(long double l) { return power(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace power_references { - -inline constexpr auto hp = reference{}; - -} // namespace power_references - -namespace references { - -using namespace power_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline power { - -template -using ft_pdl_per_s = units::isq::si::fps::power; -template -using ft_lbf_per_s = units::isq::si::fps::power; -template -using hp = units::isq::si::fps::power; - -} // namespace units::aliases::isq::si::fps::inline power - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/pressure.h b/src/systems/si-fps/include/units/isq/si/fps/pressure.h deleted file mode 100644 index e155d961..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/pressure.h +++ /dev/null @@ -1,118 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include -#include - -namespace units::isq::si::fps { - -struct poundal_per_foot_sq : derived_unit {}; - -struct dim_pressure : isq::dim_pressure {}; - -template U, Representation Rep = double> -using pressure = quantity; - -struct pound_force_per_foot_sq : - named_scaled_unit(), poundal_per_foot_sq> {}; - -struct pound_force_per_inch_sq : - named_scaled_unit(), pound_force_per_foot_sq> {}; - -struct kilopound_force_per_inch_sq : prefixed_unit {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// Poundal per square foot -constexpr auto operator"" _q_pdl_per_ft2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return pressure(static_cast(l)); -} -constexpr auto operator"" _q_pdl_per_ft2(long double l) { return pressure(l); } - -// Pounds per square inch -constexpr auto operator"" _q_psi(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return pressure(static_cast(l)); -} -constexpr auto operator"" _q_psi(long double l) { return pressure(l); } - -// kilopounds per square inch -constexpr auto operator"" _q_kpsi(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return pressure(static_cast(l)); -} -constexpr auto operator"" _q_kpsi(long double l) { return pressure(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace pressure_references { - -inline constexpr auto psi = reference{}; -inline constexpr auto kpsi = reference{}; - -} // namespace pressure_references - -namespace references { - -using namespace pressure_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline pressure { - -template -using pdl_per_ft2 = units::isq::si::fps::pressure; -template -using psi = units::isq::si::fps::pressure; -template -using kpsi = units::isq::si::fps::pressure; - -} // namespace units::aliases::isq::si::fps::inline pressure - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/speed.h b/src/systems/si-fps/include/units/isq/si/fps/speed.h deleted file mode 100644 index 6ec5944d..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/speed.h +++ /dev/null @@ -1,112 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include - -namespace units::isq::si::fps { - -struct foot_per_second : derived_unit {}; -struct dim_speed : isq::dim_speed {}; - -template U, Representation Rep = double> -using speed = quantity; - -struct mile_per_hour : derived_scaled_unit {}; -struct nautical_mile_per_hour : derived_scaled_unit {}; -struct knot : alias_unit {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// ft/s -constexpr auto operator"" _q_ft_per_s(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return speed(static_cast(l)); -} -constexpr auto operator"" _q_ft_per_s(long double l) { return speed(l); } - -// mph -constexpr auto operator"" _q_mph(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return speed(static_cast(l)); -} -constexpr auto operator"" _q_mph(long double l) { return speed(l); } - -// kn -constexpr auto operator"" _q_kn(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return speed(static_cast(l)); -} -constexpr auto operator"" _q_kn(long double l) { return speed(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace speed_references { - -inline constexpr auto mph = reference{}; -inline constexpr auto kn = reference{}; - -} // namespace speed_references - -namespace references { - -using namespace speed_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline speed { - -template -using ft_per_s = units::isq::si::fps::speed; -template -using mph = units::isq::si::fps::speed; -template -using kn = units::isq::si::fps::speed; - -} // namespace units::aliases::isq::si::fps::inline speed - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/time.h b/src/systems/si-fps/include/units/isq/si/fps/time.h deleted file mode 100644 index 6bf892b8..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/time.h +++ /dev/null @@ -1,80 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::fps { - -using si::hour; -using si::minute; -using si::second; - -using si::dim_time; -using si::time; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -using si::literals::operator"" _q_s; - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace time_references { - -using si::references::s; - -} // namespace time_references - -namespace references { - -using namespace time_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline time { - -using namespace units::aliases::isq::si::time; - -} // namespace units::aliases::isq::si::fps::inline time - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-fps/include/units/isq/si/fps/volume.h b/src/systems/si-fps/include/units/isq/si/fps/volume.h deleted file mode 100644 index 7df571e2..00000000 --- a/src/systems/si-fps/include/units/isq/si/fps/volume.h +++ /dev/null @@ -1,99 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::fps { - -struct cubic_foot : derived_unit {}; -struct dim_volume : isq::dim_volume {}; - -struct cubic_yard : derived_scaled_unit {}; - -template U, Representation Rep = double> -using volume = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// ft3 -constexpr auto operator"" _q_ft3(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return volume(static_cast(l)); -} -constexpr auto operator"" _q_ft3(long double l) { return volume(l); } - -// yd3 -constexpr auto operator"" _q_yd3(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return volume(static_cast(l)); -} -constexpr auto operator"" _q_yd3(long double l) { return volume(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace volume_references { - -inline constexpr auto ft3 = reference{}; -inline constexpr auto yd3 = reference{}; - -} // namespace volume_references - -namespace references { - -using namespace volume_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::fps - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::fps::inline volume { - -template -using ft3 = units::isq::si::fps::volume; -template -using yd3 = units::isq::si::fps::volume; - -} // namespace units::aliases::isq::si::fps::inline volume - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-hep/CMakeLists.txt b/src/systems/si-hep/CMakeLists.txt deleted file mode 100644 index 635d2981..00000000 --- a/src/systems/si-hep/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2021 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. - -cmake_minimum_required(VERSION 3.19) - -add_units_module( - si-hep DEPENDENCIES mp-units::si - HEADERS include/units/isq/si/hep/area.h include/units/isq/si/hep/energy.h include/units/isq/si/hep/hep.h - include/units/isq/si/hep/mass.h include/units/isq/si/hep/momentum.h -) diff --git a/src/systems/si-hep/include/units/isq/si/hep/area.h b/src/systems/si-hep/include/units/isq/si/hep/area.h deleted file mode 100644 index 65130f8a..00000000 --- a/src/systems/si-hep/include/units/isq/si/hep/area.h +++ /dev/null @@ -1,138 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2021 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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::hep { - -// effective cross-sectional area according to EU council directive 80/181/EEC -// https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:01980L0181-20090527#page=10 -// https://www.fedlex.admin.ch/eli/cc/1994/3109_3109_3109/de -struct barn : named_scaled_unit(), square_metre> {}; -struct yocto_barn : prefixed_unit {}; -struct zepto_barn : prefixed_unit {}; -struct atto_barn : prefixed_unit {}; -struct femto_barn : prefixed_unit {}; -struct pico_barn : prefixed_unit {}; -struct nano_barn : prefixed_unit {}; -struct micro_barn : prefixed_unit {}; -struct milli_barn : prefixed_unit {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { -constexpr auto operator"" _q_yb(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_yb(long double l) { return area(l); } -constexpr auto operator"" _q_zb(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_zb(long double l) { return area(l); } -constexpr auto operator"" _q_ab(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_ab(long double l) { return area(l); } -constexpr auto operator"" _q_fb(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_fb(long double l) { return area(l); } -constexpr auto operator"" _q_pb(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_pb(long double l) { return area(l); } -constexpr auto operator"" _q_nb(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_nb(long double l) { return area(l); } -constexpr auto operator"" _q_ub(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_ub(long double l) { return area(l); } -constexpr auto operator"" _q_mb(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_mb(long double l) { return area(l); } -constexpr auto operator"" _q_b(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return area(static_cast(l)); -} -constexpr auto operator"" _q_b(long double l) { return area(l); } -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace area_references { - -inline constexpr auto barn = reference{}; - -} // namespace area_references - -namespace references { - -using namespace area_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::hep - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::hep::inline area { - -template -using barn = units::isq::si::area; - -} // namespace units::aliases::isq::si::hep::inline area - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-hep/include/units/isq/si/hep/energy.h b/src/systems/si-hep/include/units/isq/si/hep/energy.h deleted file mode 100644 index dd76f8fe..00000000 --- a/src/systems/si-hep/include/units/isq/si/hep/energy.h +++ /dev/null @@ -1,213 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2021 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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -#include -// IWYU pragma: end_exports -#include - -namespace units::isq::si::hep { -using units::isq::si::electronvolt; - -struct yeV : prefixed_unit {}; // N.B. very rarely used -struct zeV : prefixed_unit {}; // N.B. very rarely used -struct aeV : prefixed_unit {}; // N.B. very rarely used -struct feV : prefixed_unit {}; -struct peV : prefixed_unit {}; -struct neV : prefixed_unit {}; -struct ueV : prefixed_unit {}; -struct meV : prefixed_unit {}; -using eV = electronvolt; -struct keV : prefixed_unit {}; -struct MeV : prefixed_unit {}; -using GeV = gigaelectronvolt; -struct TeV : prefixed_unit {}; -struct PeV : prefixed_unit {}; -struct EeV : prefixed_unit {}; // N.B. very rarely used -struct ZeV : prefixed_unit {}; // N.B. very rarely used -struct YeV : prefixed_unit {}; // N.B. very rarely used - -template U, Representation Rep = double> -using energy = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -constexpr auto operator"" _q_feV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_feV(long double l) { return energy(l); } -constexpr auto operator"" _q_peV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_peV(long double l) { return energy(l); } -constexpr auto operator"" _q_neV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_neV(long double l) { return energy(l); } -constexpr auto operator"" _q_ueV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_ueV(long double l) { return energy(l); } -constexpr auto operator"" _q_meV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_meV(long double l) { return energy(l); } - -constexpr auto operator"" _q_eV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_eV(long double l) { return energy(l); } - -constexpr auto operator"" _q_keV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_keV(long double l) { return energy(l); } -constexpr auto operator"" _q_MeV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_MeV(long double l) { return energy(l); } -constexpr auto operator"" _q_GeV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_GeV(long double l) { return energy(l); } -constexpr auto operator"" _q_TeV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_TeV(long double l) { return energy(l); } -constexpr auto operator"" _q_PeV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_PeV(long double l) { return energy(l); } -constexpr auto operator"" _q_EeV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_EeV(long double l) { return energy(l); } -constexpr auto operator"" _q_ZeV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_ZeV(long double l) { return energy(l); } -constexpr auto operator"" _q_YeV(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return energy(static_cast(l)); -} -constexpr auto operator"" _q_YeV(long double l) { return energy(l); } -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace energy_references { - -inline constexpr auto eV = reference{}; - -} // namespace energy_references - -namespace references { - -using namespace energy_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::hep - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::hep::inline energy { - -template -using yeV = units::isq::si::hep::energy; -template -using zeV = units::isq::si::hep::energy; -template -using aeV = units::isq::si::hep::energy; -template -using feV = units::isq::si::hep::energy; -template -using peV = units::isq::si::hep::energy; -template -using neV = units::isq::si::hep::energy; -template -using ueV = units::isq::si::hep::energy; -template -using meV = units::isq::si::hep::energy; - -template -using eV = units::isq::si::hep::energy; - -template -using keV = units::isq::si::hep::energy; -template -using MeV = units::isq::si::hep::energy; -template -using GeV = units::isq::si::hep::energy; -template -using TeV = units::isq::si::hep::energy; -template -using PeV = units::isq::si::hep::energy; -template -using EeV = units::isq::si::hep::energy; -template -using ZeV = units::isq::si::hep::energy; -template -using YeV = units::isq::si::hep::energy; - -} // namespace units::aliases::isq::si::hep::inline energy - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-hep/include/units/isq/si/hep/mass.h b/src/systems/si-hep/include/units/isq/si/hep/mass.h deleted file mode 100644 index cf97b869..00000000 --- a/src/systems/si-hep/include/units/isq/si/hep/mass.h +++ /dev/null @@ -1,212 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2021 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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -// Necessary to factor `1'672'621'923'695`, which appears in the proton mass. -template<> -inline constexpr std::optional units::known_first_factor<334'524'384'739> = 334'524'384'739; - -// Necessary to factor `17'826'619'216'279`, which appears in the value for eV/c^2. -template<> -inline constexpr std::optional units::known_first_factor<225'653'407'801> = 225'653'407'801; - -namespace units::isq::si::hep { - -struct eV_per_c2 : - named_scaled_unit() * mag_power<10, -35>(), kilogram> {}; -struct feV_per_c2 : prefixed_unit {}; -struct peV_per_c2 : prefixed_unit {}; -struct neV_per_c2 : prefixed_unit {}; -struct ueV_per_c2 : prefixed_unit {}; -struct meV_per_c2 : - prefixed_unit {}; // approximate mass of an electron/positron (0.511 MeV/c2) -struct keV_per_c2 : prefixed_unit {}; -struct MeV_per_c2 : prefixed_unit {}; -struct GeV_per_c2 : - prefixed_unit {}; // approximate mass of a proton (0.938 GeV/c2) or neutron -struct TeV_per_c2 : prefixed_unit {}; -struct PeV_per_c2 : prefixed_unit {}; -struct EeV_per_c2 : prefixed_unit {}; -struct YeV_per_c2 : prefixed_unit {}; -struct electron_mass : - named_scaled_unit() * mag_power<10, -31>(), - kilogram> {}; -struct proton_mass : - named_scaled_unit() * mag_power<10, -27>(), - kilogram> {}; -struct neutron_mass : - named_scaled_unit() * mag_power<10, -27>(), - kilogram> {}; - -struct dim_mass : isq::dim_mass {}; - -template U, Representation Rep = double> -using mass = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { -constexpr auto operator"" _q_feV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_feV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_peV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_peV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_neV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_neV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_ueV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_ueV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_meV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_meV_per_c2(long double l) { return mass(l); } - -// eV_per_c2 -constexpr auto operator"" _q_eV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_eV_per_c2(long double l) { return mass(l); } - -constexpr auto operator"" _q_keV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_keV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_MeV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_MeV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_GeV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_GeV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_TeV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_TeV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_PeV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_PeV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_EeV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_EeV_per_c2(long double l) { return mass(l); } -constexpr auto operator"" _q_YeV_per_c2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_YeV_per_c2(long double l) { return mass(l); } - -// special HEP masses -constexpr auto operator"" _q_electron_mass(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_electron_mass(long double l) { return mass(l); } -constexpr auto operator"" _q_proton_mass(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_proton_mass(long double l) { return mass(l); } -constexpr auto operator"" _q_neutron_mass(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return mass(static_cast(l)); -} -constexpr auto operator"" _q_neutron_mass(long double l) { return mass(l); } -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace mass_references { - -inline constexpr auto eV_per_c2 = reference{}; - -} // namespace mass_references - -namespace references { - -using namespace mass_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::hep - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::hep::inline mass { - -template -using eV_per_c2g = units::isq::si::hep::mass; - -} // namespace units::aliases::isq::si::hep::inline mass - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-hep/include/units/isq/si/hep/momentum.h b/src/systems/si-hep/include/units/isq/si/hep/momentum.h deleted file mode 100644 index a03ae821..00000000 --- a/src/systems/si-hep/include/units/isq/si/hep/momentum.h +++ /dev/null @@ -1,165 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2021 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 - -// IWYU pragma: begin_exports -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include - -// Necessary to factor `5'344'285'992'678`, which appears in the value for eV/c. -template<> -inline constexpr std::optional units::known_first_factor<296'904'777'371> = 157'667; - -namespace units::isq::si::hep { - -struct kilogram_metre_per_second : derived_unit {}; - -struct eV_per_c : - named_scaled_unit() * mag_power<10, -35>(), - kilogram_metre_per_second> {}; -struct feV_per_c : prefixed_unit {}; -struct peV_per_c : prefixed_unit {}; -struct neV_per_c : prefixed_unit {}; -struct ueV_per_c : prefixed_unit {}; -struct meV_per_c : prefixed_unit {}; -struct keV_per_c : prefixed_unit {}; -struct MeV_per_c : prefixed_unit {}; -struct GeV_per_c : prefixed_unit {}; -struct TeV_per_c : prefixed_unit {}; -struct PeV_per_c : prefixed_unit {}; -struct EeV_per_c : prefixed_unit {}; -struct YeV_per_c : prefixed_unit {}; - -struct dim_momentum : isq::dim_momentum {}; - -template U, Representation Rep = double> -using momentum = quantity; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -constexpr auto operator"" _q_feV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_feV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_peV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_peV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_neV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_neV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_ueV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_ueV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_meV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_meV_per_c(long double l) { return momentum(l); } - -// eV_per_c -constexpr auto operator"" _q_eV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_eV_per_c(long double l) { return momentum(l); } - -constexpr auto operator"" _q_keV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_keV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_MeV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_MeV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_GeV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_GeV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_TeV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_TeV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_PeV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_PeV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_EeV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_EeV_per_c(long double l) { return momentum(l); } -constexpr auto operator"" _q_YeV_per_c(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return momentum(static_cast(l)); -} -constexpr auto operator"" _q_YeV_per_c(long double l) { return momentum(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -} // namespace units::isq::si::hep - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::inline momentum { - -template -using eV_per_c = units::isq::si::hep::momentum; - -} // namespace units::aliases::isq::si::inline momentum - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-iau/include/units/isq/si/iau/iau.h b/src/systems/si-iau/include/units/isq/si/iau/iau.h deleted file mode 100644 index cf34a093..00000000 --- a/src/systems/si-iau/include/units/isq/si/iau/iau.h +++ /dev/null @@ -1,27 +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 - -// IWYU pragma: begin_exports -#include -// IWYU pragma: end_exports diff --git a/src/systems/si-iau/include/units/isq/si/iau/length.h b/src/systems/si-iau/include/units/isq/si/iau/length.h deleted file mode 100644 index 974dd8fc..00000000 --- a/src/systems/si-iau/include/units/isq/si/iau/length.h +++ /dev/null @@ -1,112 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::iau { - -// https://en.wikipedia.org/wiki/Light-year -struct light_year : named_scaled_unit(), si::metre> {}; - -// https://en.wikipedia.org/wiki/Parsec -struct parsec : named_scaled_unit(), si::metre> {}; - -// https://en.wikipedia.org/wiki/Angstrom -struct angstrom : named_scaled_unit(), si::metre> {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// ly -constexpr auto operator"" _q_ly(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_ly(long double l) { return si::length(l); } - -// pc -constexpr auto operator"" _q_pc(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_pc(long double l) { return si::length(l); } - -// angstrom -constexpr auto operator"" _q_angstrom(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_angstrom(long double l) { return si::length(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace length_references { - -inline constexpr auto ly = reference{}; -inline constexpr auto pc = reference{}; -inline constexpr auto angstrom = reference{}; - -} // namespace length_references - -namespace references { - -using namespace length_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::iau - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::iau::inline length { - -template -using ly = units::isq::si::length; -template -using pc = units::isq::si::length; -template -using angstrom = units::isq::si::length; - -} // namespace units::aliases::isq::si::iau::inline length - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-imperial/include/units/isq/si/imperial/imperial.h b/src/systems/si-imperial/include/units/isq/si/imperial/imperial.h deleted file mode 100644 index 09d40ffe..00000000 --- a/src/systems/si-imperial/include/units/isq/si/imperial/imperial.h +++ /dev/null @@ -1,27 +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 - -// IWYU pragma: begin_exports -#include -// IWYU pragma: end_exports diff --git a/src/systems/si-imperial/include/units/isq/si/imperial/length.h b/src/systems/si-imperial/include/units/isq/si/imperial/length.h deleted file mode 100644 index f6c278f4..00000000 --- a/src/systems/si-imperial/include/units/isq/si/imperial/length.h +++ /dev/null @@ -1,97 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::imperial { - -// https://en.wikipedia.org/wiki/Chain_(unit) -struct chain : named_scaled_unit(), si::international::yard> {}; - -// https://en.wikipedia.org/wiki/Rod_(unit) -struct rod : named_scaled_unit(), chain> {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// ch -constexpr auto operator"" _q_ch(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_ch(long double l) { return si::length(l); } - -// rd -constexpr auto operator"" _q_rd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_rd(long double l) { return si::length(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace length_references { - -inline constexpr auto ch = reference{}; -inline constexpr auto rd = reference{}; - -} // namespace length_references - -namespace references { - -using namespace length_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::imperial - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::imperial::inline length { - -template -using ch = units::isq::si::length; -template -using rd = units::isq::si::length; - -} // namespace units::aliases::isq::si::imperial::inline length - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-international/CMakeLists.txt b/src/systems/si-international/CMakeLists.txt deleted file mode 100644 index 82c940fd..00000000 --- a/src/systems/si-international/CMakeLists.txt +++ /dev/null @@ -1,31 +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. - -cmake_minimum_required(VERSION 3.19) - -add_units_module( - si-international - DEPENDENCIES mp-units::si - HEADERS include/units/isq/si/international/area.h include/units/isq/si/international/international.h - include/units/isq/si/international/length.h include/units/isq/si/international/speed.h - include/units/isq/si/international/volume.h -) diff --git a/src/systems/si-international/include/units/isq/si/international/area.h b/src/systems/si-international/include/units/isq/si/international/area.h deleted file mode 100644 index 40fdc533..00000000 --- a/src/systems/si-international/include/units/isq/si/international/area.h +++ /dev/null @@ -1,83 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include - -namespace units::isq::si::international { - -struct square_foot : derived_scaled_unit {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// ft2 -constexpr auto operator"" _q_ft2(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::area(static_cast(l)); -} -constexpr auto operator"" _q_ft2(long double l) { return si::area(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace area_references { - -inline constexpr auto ft2 = reference{}; - -} // namespace area_references - -namespace references { - -using namespace area_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::international - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::international::inline area { - -template -using ft2 = units::isq::si::area; - -} // namespace units::aliases::isq::si::international::inline area - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-international/include/units/isq/si/international/international.h b/src/systems/si-international/include/units/isq/si/international/international.h deleted file mode 100644 index f3a8f2ab..00000000 --- a/src/systems/si-international/include/units/isq/si/international/international.h +++ /dev/null @@ -1,30 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports diff --git a/src/systems/si-international/include/units/isq/si/international/length.h b/src/systems/si-international/include/units/isq/si/international/length.h deleted file mode 100644 index 3940cb34..00000000 --- a/src/systems/si-international/include/units/isq/si/international/length.h +++ /dev/null @@ -1,189 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::international { - -// si::international yard -// https://en.wikipedia.org/wiki/International_yard_and_pound -struct yard : named_scaled_unit(), si::metre> {}; - -// si::international foot -// https://en.wikipedia.org/wiki/Foot_(unit)#International_foot -struct foot : named_scaled_unit(), yard> {}; - -// https://en.wikipedia.org/wiki/Fathom#International_fathom -struct fathom : named_scaled_unit(), yard> {}; - -// si::international inch -// https://en.wikipedia.org/wiki/Inch#Equivalences -struct inch : named_scaled_unit(), yard> {}; - -// intrnational mile -// https://en.wikipedia.org/wiki/Mile#International_mile -struct mile : named_scaled_unit(), si::kilometre> {}; - -// si::international nautical mile -// https://en.wikipedia.org/wiki/Nautical_mile -struct nautical_mile : named_scaled_unit(), si::metre> {}; - -// thou -// https://en.wikipedia.org/wiki/Thousandth_of_an_inch -struct thou : named_scaled_unit(), inch> {}; - -// mil - different name for thou -// https://en.wikipedia.org/wiki/Thousandth_of_an_inch -using mil = thou; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// yd -constexpr auto operator"" _q_yd(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_yd(long double l) { return si::length(l); } - -// ft -constexpr auto operator"" _q_ft(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_ft(long double l) { return si::length(l); } - -// fathom -constexpr auto operator"" _q_fathom(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_fathom(long double l) { return si::length(l); } - -// in -constexpr auto operator"" _q_in(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_in(long double l) { return si::length(l); } - -// mi -constexpr auto operator"" _q_mi(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_mi(long double l) { return si::length(l); } - -// mi_naut -constexpr auto operator"" _q_naut_mi(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_naut_mi(long double l) { return si::length(l); } - -// thou -constexpr auto operator"" _q_thou(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_thou(long double l) { return si::length(l); } - -// mil -constexpr auto operator"" _q_mil(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_mil(long double l) { return si::length(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace length_references { - -inline constexpr auto yd = reference{}; -inline constexpr auto ft = reference{}; -inline constexpr auto fathom = reference{}; -inline constexpr auto in = reference{}; -inline constexpr auto mi = reference{}; -inline constexpr auto mi_naut = reference{}; -inline constexpr auto thou = reference{}; -inline constexpr auto mil = reference{}; - -} // namespace length_references - -namespace references { - -using namespace length_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::international - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::international::inline length { - -template -using yd = units::isq::si::length; -template -using ft = units::isq::si::length; -template -using fathom = units::isq::si::length; -template -using in = units::isq::si::length; -template -using mi = units::isq::si::length; -template -using mi_naut = units::isq::si::length; -template -using thou = units::isq::si::length; -template -using mil = units::isq::si::length; - -} // namespace units::aliases::isq::si::international::inline length - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-international/include/units/isq/si/international/speed.h b/src/systems/si-international/include/units/isq/si/international/speed.h deleted file mode 100644 index 84f2dbf1..00000000 --- a/src/systems/si-international/include/units/isq/si/international/speed.h +++ /dev/null @@ -1,107 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include - -namespace units::isq::si::international { - -struct mile_per_hour : derived_scaled_unit {}; -struct nautical_mile_per_hour : - derived_scaled_unit {}; -struct knot : alias_unit {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// mi/h -constexpr auto operator"" _q_mi_per_h(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::speed(static_cast(l)); -} -constexpr auto operator"" _q_mi_per_h(long double l) { return si::speed(l); } - -// nmi/h -constexpr auto operator"" _q_nmi_per_h(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::speed(static_cast(l)); -} -constexpr auto operator"" _q_nmi_per_h(long double l) { return si::speed(l); } - -// kn -constexpr auto operator"" _q_kn(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::speed(static_cast(l)); -} -constexpr auto operator"" _q_kn(long double l) { return si::speed(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace speed_references { - -inline constexpr auto kn = reference{}; - -} // namespace speed_references - -namespace references { - -using namespace speed_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::international - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::international::inline speed { - -template -using mi_per_h = units::isq::si::speed; - -template -using nmi_per_h = units::isq::si::speed; - -template -using kn = units::isq::si::speed; - -} // namespace units::aliases::isq::si::international::inline speed - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-international/include/units/isq/si/international/volume.h b/src/systems/si-international/include/units/isq/si/international/volume.h deleted file mode 100644 index 4a5fcbcd..00000000 --- a/src/systems/si-international/include/units/isq/si/international/volume.h +++ /dev/null @@ -1,83 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include -#include - -namespace units::isq::si::international { - -struct cubic_foot : derived_scaled_unit {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// ft3 -constexpr auto operator"" _q_ft3(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::volume(static_cast(l)); -} -constexpr auto operator"" _q_ft3(long double l) { return si::volume(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace volume_references { - -inline constexpr auto ft3 = reference{}; - -} // namespace volume_references - -namespace references { - -using namespace volume_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::international - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::international::inline volume { - -template -using ft3 = units::isq::si::volume; - -} // namespace units::aliases::isq::si::international::inline volume - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-typographic/CMakeLists.txt b/src/systems/si-typographic/CMakeLists.txt deleted file mode 100644 index 7e359ea2..00000000 --- a/src/systems/si-typographic/CMakeLists.txt +++ /dev/null @@ -1,28 +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. - -cmake_minimum_required(VERSION 3.19) - -add_units_module( - si-typographic DEPENDENCIES mp-units::si HEADERS include/units/isq/si/typographic/length.h - include/units/isq/si/typographic/typographic.h -) diff --git a/src/systems/si-typographic/include/units/isq/si/typographic/length.h b/src/systems/si-typographic/include/units/isq/si/typographic/length.h deleted file mode 100644 index e5b409c6..00000000 --- a/src/systems/si-typographic/include/units/isq/si/typographic/length.h +++ /dev/null @@ -1,124 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::typographic { - -// TODO Conflicts with (https://en.wikipedia.org/wiki/Pica_(typography)), verify correctness of below conversion factors -// and provide hyperlinks to definitions -struct pica_comp : named_scaled_unit() * mag_power<10, -9>(), si::metre> {}; -struct pica_prn : - named_scaled_unit() * mag_power<10, -3>(), si::metre> {}; -struct point_comp : - named_scaled_unit() * mag_power<10, -4>(), si::metre> {}; -struct point_prn : - named_scaled_unit() * mag_power<10, -4>(), si::metre> {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// pica comp -constexpr auto operator"" _q_pica_comp(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_pica_comp(long double l) { return si::length(l); } - -// pica prn -constexpr auto operator"" _q_pica_prn(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_pica_prn(long double l) { return si::length(l); } - -// point comp -constexpr auto operator"" _q_point_comp(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_point_comp(long double l) { return si::length(l); } - -// point prn -constexpr auto operator"" _q_point_prn(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_point_prn(long double l) { return si::length(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace length_references { - -inline constexpr auto pica_comp = reference{}; -inline constexpr auto pica_prn = reference{}; -inline constexpr auto point_comp = reference{}; -inline constexpr auto point_prn = reference{}; - -} // namespace length_references - -namespace references { - -using namespace length_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::typographic - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::typographic::inline length { - -template -using pica_comp = units::isq::si::length; -template -using pica_prn = units::isq::si::length; -template -using point_comp = units::isq::si::length; -template -using point_prn = units::isq::si::length; - -} // namespace units::aliases::isq::si::typographic::inline length - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-uscs/include/units/isq/si/uscs/length.h b/src/systems/si-uscs/include/units/isq/si/uscs/length.h deleted file mode 100644 index e2dafbb5..00000000 --- a/src/systems/si-uscs/include/units/isq/si/uscs/length.h +++ /dev/null @@ -1,116 +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 - -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports - -#include -#include - -namespace units::isq::si::uscs { - -// https://en.wikipedia.org/wiki/Foot_(unit)#US_survey_foot -// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6 -struct foot : named_scaled_unit(), si::metre> {}; - -// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6 -struct fathom : named_scaled_unit(), foot> {}; - -// https://en.wikipedia.org/wiki/Mile#U.S._survey_mile -// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6 -struct mile : named_scaled_unit(), foot> {}; - -#ifndef UNITS_NO_LITERALS - -inline namespace literals { - -// ft -constexpr auto operator"" _q_ft_us(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_ft_us(long double l) { return si::length(l); } - -// fathom -constexpr auto operator"" _q_fathom_us(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_fathom_us(long double l) -{ - return si::length(l); -} - -// mi -constexpr auto operator"" _q_mi_us(unsigned long long l) -{ - gsl_ExpectsAudit(std::in_range(l)); - return si::length(static_cast(l)); -} -constexpr auto operator"" _q_mi_us(long double l) { return si::length(l); } - -} // namespace literals - -#endif // UNITS_NO_LITERALS - -#ifndef UNITS_NO_REFERENCES - -namespace length_references { - -inline constexpr auto ft = reference{}; -inline constexpr auto fathom = reference{}; -inline constexpr auto mi = reference{}; - -} // namespace length_references - -namespace references { - -using namespace length_references; - -} // namespace references - -#endif // UNITS_NO_REFERENCES - -} // namespace units::isq::si::uscs - -#ifndef UNITS_NO_ALIASES - -namespace units::aliases::isq::si::uscs::inline length { - -template -using ft = units::isq::si::length; -template -using fathom = units::isq::si::length; -template -using mi = units::isq::si::length; - -} // namespace units::aliases::isq::si::uscs::inline length - -#endif // UNITS_NO_ALIASES diff --git a/src/systems/si-uscs/include/units/isq/si/uscs/uscs.h b/src/systems/si-uscs/include/units/isq/si/uscs/uscs.h deleted file mode 100644 index 7ab6186e..00000000 --- a/src/systems/si-uscs/include/units/isq/si/uscs/uscs.h +++ /dev/null @@ -1,27 +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 - -// IWYU pragma: begin_exports -#include -// IWYU pragma: end_exports diff --git a/src/systems/si-uscs/CMakeLists.txt b/src/systems/typographic/CMakeLists.txt similarity index 91% rename from src/systems/si-uscs/CMakeLists.txt rename to src/systems/typographic/CMakeLists.txt index 1a10f79e..d9c0419b 100644 --- a/src/systems/si-uscs/CMakeLists.txt +++ b/src/systems/typographic/CMakeLists.txt @@ -23,5 +23,5 @@ cmake_minimum_required(VERSION 3.19) add_units_module( - si-uscs DEPENDENCIES mp-units::si HEADERS include/units/isq/si/uscs/length.h include/units/isq/si/uscs/uscs.h + typographic DEPENDENCIES mp-units::usc HEADERS include/units/typographic/typographic.h ) diff --git a/src/systems/si-typographic/include/units/isq/si/typographic/typographic.h b/src/systems/typographic/include/units/typographic/typographic.h similarity index 64% rename from src/systems/si-typographic/include/units/isq/si/typographic/typographic.h rename to src/systems/typographic/include/units/typographic/typographic.h index eae31c9f..408bb49a 100644 --- a/src/systems/si-typographic/include/units/isq/si/typographic/typographic.h +++ b/src/systems/typographic/include/units/typographic/typographic.h @@ -22,6 +22,18 @@ #pragma once -// IWYU pragma: begin_exports -#include -// IWYU pragma: end_exports +#include +#include + +namespace units::typographic { + +// clang-format off +// https://en.wikipedia.org/wiki/Point_(typography) +inline constexpr struct pica_us : named_unit<"pica(us)", mag * usc::inch> {} pica_us; +inline constexpr struct point_us : named_unit<"point(us)", mag * pica_us> {} point_us; + +inline constexpr struct point_dtp : named_unit<"point(dtp)", mag * usc::inch> {} point_dtp; +inline constexpr struct pica_dtp : named_unit<"pica(dtp)", mag<12> * point_dtp> {} pica_dtp; +// clang-format on + +} // namespace units::typographic diff --git a/src/systems/usc/CMakeLists.txt b/src/systems/usc/CMakeLists.txt new file mode 100644 index 00000000..fb8c4040 --- /dev/null +++ b/src/systems/usc/CMakeLists.txt @@ -0,0 +1,25 @@ +# 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. + +cmake_minimum_required(VERSION 3.19) + +add_units_module(usc DEPENDENCIES mp-units::si mp-units::international HEADERS include/units/usc/usc.h) diff --git a/src/systems/usc/include/units/usc/usc.h b/src/systems/usc/include/units/usc/usc.h new file mode 100644 index 00000000..675fba56 --- /dev/null +++ b/src/systems/usc/include/units/usc/usc.h @@ -0,0 +1,163 @@ +// 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::usc { + +using namespace international; + +// clang-format off + +// https://en.wikipedia.org/wiki/United_States_customary_units#Length +// nautical +inline constexpr struct fathom : named_unit<"ftm(us)", mag<2> * yard> {} fathom; +inline constexpr struct cable : named_unit<"cb(us)", mag<120> * fathom> {} cable; + +// survey +struct us_survey_foot : named_unit<"ft(us)", mag * si::metre> {}; +struct us_survey_mile : named_unit<"mi(us)", mag<5280> * us_survey_foot{}> {}; + +[[deprecated("In accordance with NIST SP 811, as of January 1, 2023, the use of the U.S. survey foot and U.S. survey mile is deprecated.")]] +inline constexpr us_survey_foot us_survey_foot; + +[[deprecated("In accordance with NIST SP 811, as of January 1, 2023, the use of the U.S. survey foot and U.S. survey mile is deprecated.")]] +inline constexpr us_survey_mile us_survey_mile; + +inline constexpr struct link : named_unit<"li", mag * foot> {} link; +inline constexpr struct rod : named_unit<"rd", mag<25> * link> {} rod; +inline constexpr struct chain : named_unit<"ch", mag<4> * rod> {} chain; +inline constexpr struct furlong : named_unit<"fur", mag<10> * chain> {} furlong; +// clang-format on + +namespace survey1893 { + +// clang-format off +inline constexpr struct us_survey_foot : named_unit<"ft(us)", mag * si::metre> {} us_survey_foot; +inline constexpr struct link : named_unit<"li", mag * us_survey_foot> {} link; +inline constexpr struct rod : named_unit<"rd", mag<25> * link> {} rod; +inline constexpr struct chain : named_unit<"ch", mag<4> * rod> {} chain; +inline constexpr struct furlong : named_unit<"fur", mag<10> * chain> {} furlong; +inline constexpr struct us_survey_mile : named_unit<"mi(us)", mag<8> * furlong> {} us_survey_mile; +inline constexpr struct league : named_unit<"lea", mag<3> * us_survey_mile> {} league; +// clang-format on + +} // namespace survey1893 + +// clang-format off +// https://en.wikipedia.org/wiki/United_States_customary_units#Area +inline constexpr struct acre : named_unit<"acre", mag<10> * square> {} acre; +inline constexpr struct section : named_unit<"section", mag<640> * acre> {} section; + +// https://en.wikipedia.org/wiki/United_States_customary_units#Fluid_volume +inline constexpr struct gallon : named_unit<"gal", mag<231> * cubic> {} gallon; +inline constexpr struct pottle : named_unit<"pot", mag * gallon> {} pottle; +inline constexpr struct quart : named_unit<"qt", mag * pottle> {} quart; +inline constexpr struct pint : named_unit<"pt", mag * quart> {} pint; +inline constexpr struct cup : named_unit<"c", mag * pint> {} cup; +inline constexpr struct gill : named_unit<"gi", mag * cup> {} gill; +inline constexpr struct fluid_ounce : named_unit<"fl oz", mag * gill> {} fluid_ounce; +inline constexpr struct tablespoon : named_unit<"tbsp", mag * fluid_ounce> {} tablespoon; +inline constexpr struct shot : named_unit<"jig", mag<3> * tablespoon> {} shot; +inline constexpr struct teaspoon : named_unit<"tsp", mag * tablespoon> {} teaspoon; +inline constexpr struct minim : named_unit<"min", mag * teaspoon> {} minim; +inline constexpr struct fluid_dram : named_unit<"fl dr", mag<60> * minim> {} fluid_dram; +inline constexpr struct barrel : named_unit<"bbl", mag * gallon> {} barrel; +inline constexpr struct oil_barrel : named_unit<"bbl", mag * barrel> {} oil_barrel; +inline constexpr struct hogshead : decltype(mag<63> * gallon) {} hogshead; + +// https://en.wikipedia.org/wiki/United_States_customary_units#Dry_volume +inline constexpr struct dry_barrel : named_unit<"bbl", mag<7056> * cubic> {} dry_barrel; +inline constexpr struct bushel : named_unit<"bu", mag * si::litre> {} bushel; +inline constexpr struct peck : named_unit<"pk", mag * bushel> {} peck; +inline constexpr struct dry_gallon : named_unit<"gal", mag * peck> {} dry_gallon; +inline constexpr struct dry_quart : named_unit<"qt", mag * dry_gallon> {} dry_quart; +inline constexpr struct dry_pint : named_unit<"pt", mag * dry_quart> {} dry_pint; + +// https://en.wikipedia.org/wiki/United_States_customary_units#Mass_and_Weight +// https://en.wikipedia.org/wiki/Avoirdupois_system#American_customary_system +inline constexpr struct quarter : named_unit<"qr", mag<25> * pound> {} quarter; +inline constexpr struct short_hundredweight : named_unit<"cwt", mag<100> * pound> {} short_hundredweight; +inline constexpr struct ton : named_unit<"t", mag<2'000> * pound> {} ton; +inline constexpr auto short_ton = ton; +inline constexpr struct pennyweight : named_unit<"dwt", mag<24> * grain> {} pennyweight; +inline constexpr struct troy_once : named_unit<"oz t", mag<20> * pennyweight> {} troy_once; +inline constexpr struct troy_pound : named_unit<"lb t", mag<12> * troy_once> {} troy_pound; + +// https://en.wikipedia.org/wiki/United_States_customary_units#Temperature +inline constexpr struct degree_Fahrenheit : named_unit * si::degree_Celsius> {} degree_Fahrenheit; +// clang-format on + +namespace unit_symbols { + +using namespace international::unit_symbols; + +inline constexpr auto ftm = fathom; +inline constexpr auto cb = cable; +[[deprecated( + "In accordance with NIST SP 811, as of January 1, 2023, the use of the U.S. survey foot and U.S. survey mile is " + "deprecated.")]] inline constexpr struct us_survey_foot us_ft; +[[deprecated( + "In accordance with NIST SP 811, as of January 1, 2023, the use of the U.S. survey foot and U.S. survey mile is " + "deprecated.")]] inline constexpr struct us_survey_mile us_mi; +inline constexpr auto li = link; +inline constexpr auto rd = rod; +inline constexpr auto ch = chain; +inline constexpr auto fur = furlong; +inline constexpr auto lea = league; + +inline constexpr auto gal = gallon; +inline constexpr auto pot = pottle; +inline constexpr auto qt = quart; +inline constexpr auto pt = pint; +inline constexpr auto c = cup; +inline constexpr auto gi = gill; +inline constexpr auto fl_oz = fluid_ounce; +inline constexpr auto tbsp = tablespoon; +inline constexpr auto jig = shot; +inline constexpr auto tsp = teaspoon; +inline constexpr auto min = minim; +inline constexpr auto fl_dr = fluid_dram; +inline constexpr auto bbl = barrel; + +inline constexpr auto dry_bbl = dry_barrel; +inline constexpr auto bu = bushel; +inline constexpr auto pk = peck; +inline constexpr auto dry_gal = dry_gallon; +inline constexpr auto dry_qt = dry_quart; +inline constexpr auto dry_pt = dry_pint; + +inline constexpr auto qr = quarter; +inline constexpr auto cwt = short_hundredweight; +inline constexpr auto t = ton; +inline constexpr auto dwt = pennyweight; +inline constexpr auto oz_t = troy_once; +inline constexpr auto lb_t = troy_pound; + +inline constexpr auto deg_F = degree_Fahrenheit; + +} // namespace unit_symbols + +} // namespace units::usc diff --git a/test/unit_test/runtime/fmt_test.cpp b/test/unit_test/runtime/fmt_test.cpp index d6ffa4bd..17a72bd8 100644 --- a/test/unit_test/runtime/fmt_test.cpp +++ b/test/unit_test/runtime/fmt_test.cpp @@ -22,12 +22,12 @@ #include #include +#include #include #include #include #include #include -#include #include #include #include diff --git a/test/unit_test/static/CMakeLists.txt b/test/unit_test/static/CMakeLists.txt index 3f7b4dfc..61843a36 100644 --- a/test/unit_test/static/CMakeLists.txt +++ b/test/unit_test/static/CMakeLists.txt @@ -46,7 +46,9 @@ add_library( # dimensions_concepts_test.cpp fixed_string_test.cpp # fps_test.cpp - # iec80000_test.cpp + hep_test.cpp + iec80000_test.cpp + imperial_test.cpp isq_test.cpp isq_angle_test.cpp # kind_test.cpp @@ -59,12 +61,11 @@ add_library( reference_test.cpp # si_cgs_test.cpp # si_fps_test.cpp - # si_hep_test.cpp # si_test.cpp symbol_text_test.cpp type_list_test.cpp unit_test.cpp - # us_test.cpp + usc_test.cpp ) # if(NOT ${projectPrefix}LIBCXX) diff --git a/src/systems/si-hep/include/units/isq/si/hep/hep.h b/test/unit_test/static/hep_test.cpp similarity index 65% rename from src/systems/si-hep/include/units/isq/si/hep/hep.h rename to test/unit_test/static/hep_test.cpp index 3cfb0fa5..2909d801 100644 --- a/src/systems/si-hep/include/units/isq/si/hep/hep.h +++ b/test/unit_test/static/hep_test.cpp @@ -20,11 +20,28 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#pragma once +#include +#include +#include +#include -// IWYU pragma: begin_exports -#include -#include -#include -#include -// IWYU pragma: end_exports +template + requires units::is_scalar +inline constexpr bool units::is_vector = true; + +namespace { + +using namespace units; +using namespace units::hep::unit_symbols; +using namespace units::si::unit_symbols; + +// mass +static_assert(isq::mass[eV / c2](1'000) == isq::mass[keV / c2](1)); + +// momentum +static_assert(isq::momentum[eV / c](1'000'000) == isq::momentum[MeV / c](1)); + +// area +static_assert(isq::area[b](1e28) == isq::area[m2](1.)); + +} // namespace diff --git a/test/unit_test/static/imperial_test.cpp b/test/unit_test/static/imperial_test.cpp new file mode 100644 index 00000000..eefd753b --- /dev/null +++ b/test/unit_test/static/imperial_test.cpp @@ -0,0 +1,80 @@ +// 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 +#include +#include + +namespace { + +using namespace units; +using namespace units::imperial; +using namespace units::imperial::unit_symbols; + +/* ************** BASE DIMENSIONS **************** */ + +// https://en.wikipedia.org/wiki/United_States_customary_units#Length + +// International +static_assert(isq::length[twip](17'280) == isq::length[ft](1)); +static_assert(isq::length[th](12'000) == isq::length[ft](1)); +static_assert(isq::length[Bc](3) == isq::length[th](1'000)); +static_assert(isq::length[in](1) == isq::length[Bc](3)); +static_assert(isq::length[hh](1) == isq::length[in](4)); +static_assert(isq::length[ft](1) == isq::length[hh](3)); +static_assert(isq::length[yd](1) == isq::length[ft](3)); +static_assert(isq::length[ch](1) == isq::length[yd](22)); +static_assert(isq::length[fur](1) == isq::length[ch](10)); +static_assert(isq::length[mi](1) == isq::length[fur](8)); +static_assert(isq::length[le](1) == isq::length[mi](3)); + +// International Nautical +static_assert(isq::length[cb](1) == isq::length[ftm](100)); +static_assert(isq::length[nmi](1) == isq::length[cb](10)); + +// survey +static_assert(isq::length[li](100) == isq::length[ch](1)); +static_assert(isq::length[rd](1) == isq::length[li](25)); + +// Area +static_assert(isq::area[perch](1) == isq::length[rd](1) * isq::length[rd](1)); +static_assert(isq::area[rood](1) == isq::length[fur](1) * isq::length[rd](1)); +static_assert(isq::area[acre](1) == isq::length[fur](1) * isq::length[ch](1)); + +// Volume +static_assert(isq::volume[fl_oz](20) == isq::volume[pt](1)); +static_assert(isq::volume[gi](1) == isq::volume[fl_oz](5)); +static_assert(isq::volume[pt](1) == isq::volume[fl_oz](20)); +static_assert(isq::volume[qt](1) == isq::volume[pt](2)); +static_assert(isq::volume[gal](1) == isq::volume[pt](8)); + +// Mass +static_assert(isq::mass[gr](7'000) == isq::mass[lb](1)); +static_assert(isq::mass[dr](256) == isq::mass[lb](1)); +static_assert(isq::mass[oz](1) == isq::mass[dr](16)); +static_assert(isq::mass[lb](1) == isq::mass[oz](16)); +static_assert(isq::mass[st](1) == isq::mass[lb](14)); +static_assert(isq::mass[qr](1) == isq::mass[st](2)); +static_assert(isq::mass[cwt](1) == isq::mass[lb](112)); +static_assert(isq::mass[t](1) == isq::mass[cwt](20)); + +} // namespace diff --git a/test/unit_test/static/si_hep_test.cpp b/test/unit_test/static/si_hep_test.cpp deleted file mode 100644 index 62479696..00000000 --- a/test/unit_test/static/si_hep_test.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2021 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 -#include -#include -#include -#include -#include - -namespace { - -using namespace units::isq; - -template -inline constexpr units::ratio quantity_ratio = units::as_ratio(units::detail::quantity_magnitude); - -static_assert(quantity_ratio> == units::ratio(1)); - -// mass -static_assert(si::hep::mass(1'000) == si::hep::mass(1)); -static_assert(si::hep::mass(1'000) == si::mass(1)); -static_assert(si::mass(1'000) == si::hep::mass(1)); - -// momentum -static_assert(si::hep::momentum(1'000'000) == si::hep::momentum(1)); - -// area -static_assert(si::area(1e28) == si::area(1)); -// static_assert(si::area(1) == si::area(1e-28)); // numeric rounding issues on some -// platforms - - -namespace hep_literal_test { - -using namespace units::isq::si::hep::literals; - -static_assert(si::hep::energy(1'000) == 1_q_keV); -static_assert(si::hep::energy(1'000'000) == 1_q_MeV); - -static_assert(si::hep::mass(1'000) == 1_q_keV_per_c2); -static_assert(si::hep::mass(1'000'000) == 1_q_MeV_per_c2); - -static_assert(si::hep::momentum(1'000) == 1_q_keV_per_c); -static_assert(si::hep::momentum(1'000'000) == 1_q_MeV_per_c); - -// static_assert(si::area(1e-28L) == 1_q_b); // numeric rounding issues on some platforms -// static_assert(si::hep::area(1e-4L) == 1_q_b); // numeric rounding issues on some -// platforms -static_assert(si::area(1e-43) == 1_q_fb); - -} // namespace hep_literal_test - -} // namespace diff --git a/test/unit_test/static/us_test.cpp b/test/unit_test/static/us_test.cpp deleted file mode 100644 index 024f0eb7..00000000 --- a/test/unit_test/static/us_test.cpp +++ /dev/null @@ -1,55 +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. - -#include -#include -#include -#include -#include - -namespace { - -using namespace units; -using namespace units::isq::si; -using namespace units::isq::si::international; - -/* ************** BASE DIMENSIONS **************** */ - -// length - -static_assert(1_q_yd == 0.9144_q_m); -static_assert(1_q_yd == 3_q_ft); -static_assert(1_q_ft == 12_q_in); -static_assert(1_q_mi == 1760_q_yd); - -static_assert(5_q_in + 8_q_cm == 207_q_mm); - - -/* ************** DERIVED DIMENSIONS IN TERMS OF BASE UNITS **************** */ - -// speed - -static_assert(10.0_q_mi / 2_q_h == 5_q_mi_per_h); - -static_assert(mile_per_hour::symbol == "mi/h"); - -} // namespace diff --git a/test/unit_test/static/usc_test.cpp b/test/unit_test/static/usc_test.cpp new file mode 100644 index 00000000..fe2d9582 --- /dev/null +++ b/test/unit_test/static/usc_test.cpp @@ -0,0 +1,121 @@ +// 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 +#include +#include + +namespace { + +using namespace units; +using namespace units::usc; +using namespace units::usc::unit_symbols; + +/* ************** BASE DIMENSIONS **************** */ + +// https://en.wikipedia.org/wiki/United_States_customary_units#Length + +// International +static_assert(isq::length[twip](20) == isq::length[p](1)); +static_assert(isq::length[mil](1000) == isq::length[in](1)); +static_assert(isq::length[p](72) == isq::length[in](1)); +static_assert(isq::length[P](1) == isq::length[p](12)); +static_assert(isq::length[in](1) == isq::length[P](6)); +static_assert(isq::length[ft](1) == isq::length[in](12)); +static_assert(isq::length[yd](1) == isq::length[ft](3)); +static_assert(isq::length[mi](1) == isq::length[ft](5280)); +static_assert(isq::length[le](1) == isq::length[yd](5280)); + +// International Nautical +static_assert(isq::length[ftm](1) == isq::length[yd](2)); +static_assert(isq::length[cb](1) == isq::length[ftm](120)); +static_assert(isq::length[nmi](1) == isq::length[si::metre](1852)); + +// US survey +UNITS_DIAGNOSTIC_PUSH +UNITS_DIAGNOSTIC_IGNORE_DEPRECATED +static_assert(isq::length[us_ft](3937) == isq::length[si::metre](1200)); +static_assert(isq::length[us_mi](3937) == isq::length[si::kilo](6336)); +UNITS_DIAGNOSTIC_POP + +static_assert(isq::length[li](50) == isq::length[ft](33)); +static_assert(isq::length[rd](1) == isq::length[li](25)); +static_assert(isq::length[ch](1) == isq::length[rd](4)); +static_assert(isq::length[fur](1) == isq::length[ch](10)); +static_assert(isq::length[lea](1) == isq::length[mi](3)); + +static_assert(isq::length[survey1893::link](50) == isq::length[survey1893::us_survey_foot](33)); +static_assert(isq::length[survey1893::us_survey_foot](3937) == isq::length[si::metre](1200)); +static_assert(isq::length[survey1893::rod](1) == isq::length[survey1893::link](25)); +static_assert(isq::length[survey1893::chain](1) == isq::length[survey1893::rod](4)); +static_assert(isq::length[survey1893::furlong](1) == isq::length[survey1893::chain](10)); +static_assert(isq::length[survey1893::us_survey_mile](1) == isq::length[survey1893::furlong](8)); +static_assert(isq::length[survey1893::league](1) == isq::length[survey1893::us_survey_mile](3)); + +// Area +// static_assert(isq::area[square](1) == isq::area[square](144)); +static_assert(isq::area[square](1) == isq::area[square](4356)); +static_assert(isq::area[acre](1) == isq::area[square](43560)); +static_assert(isq::area[section](1) == isq::area[square](1)); + +// Volume +static_assert(isq::volume[cubic](1) == isq::volume[cubic](1'728)); +static_assert(isq::volume[cubic](1) == isq::volume[cubic](27)); +static_assert(isq::volume[acre * survey1893::us_survey_foot](1) == + isq::volume[cubic](43'560)); + +// Fluid volume +static_assert(isq::volume[fl_dr](1) == isq::volume[min](60)); +static_assert(isq::volume[tsp](1) == isq::volume[min](80)); +static_assert(isq::volume[tbsp](1) == isq::volume[tsp](3)); +static_assert(isq::volume[fl_oz](1) == isq::volume[tbsp](2)); +static_assert(isq::volume[jig](1) == isq::volume[tbsp](3)); +static_assert(isq::volume[gi](1) == isq::volume[fl_oz](4)); +static_assert(isq::volume[c](1) == isq::volume[gi](2)); +static_assert(isq::volume[pt](1) == isq::volume[c](2)); +static_assert(isq::volume[qt](1) == isq::volume[pt](2)); +static_assert(isq::volume[pot](1) == isq::volume[qt](2)); +static_assert(isq::volume[gal](1) == isq::volume[qt](4)); +static_assert(isq::volume[bbl](2) == isq::volume[gal](63)); +static_assert(isq::volume[oil_barrel](3) == isq::volume[bbl](4)); +static_assert(isq::volume[hogshead](2) == isq::volume[oil_barrel](3)); + +// Dry volume +static_assert(isq::volume[dry_qt](1) == isq::volume[dry_pt](2)); +static_assert(isq::volume[dry_gal](1) == isq::volume[dry_qt](4)); +static_assert(isq::volume[pk](1) == isq::volume[dry_gal](2)); +static_assert(isq::volume[bu](1) == isq::volume[pk](4)); +static_assert(isq::volume[dry_bbl](1) == isq::volume[cubic](7056)); + +// Mass +static_assert(isq::mass[gr](7'000) == isq::mass[lb](1)); +static_assert(isq::mass[dr](32) == isq::mass[gr](875)); +static_assert(isq::mass[oz](1) == isq::mass[dr](16)); +static_assert(isq::mass[lb](1) == isq::mass[oz](16)); +static_assert(isq::mass[qr](1) == isq::mass[lb](25)); +static_assert(isq::mass[cwt](1) == isq::mass[qr](4)); +static_assert(isq::mass[t](1) == isq::mass[cwt](20)); +static_assert(isq::mass[dwt](1) == isq::mass[gr](24)); +static_assert(isq::mass[oz_t](1) == isq::mass[dwt](20)); +static_assert(isq::mass[lb_t](1) == isq::mass[oz_t](12)); + +} // namespace