mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-29 18:07:16 +02:00
refactor: the rest of the systems refactored for V2
This commit is contained in:
@ -20,11 +20,11 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/cgs/cgs.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <units/si/cgs/cgs.h>
|
||||
#include <units/si/international/length.h>
|
||||
#include <units/si/unit_symbols.h>
|
||||
#include <units/international/international.h>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
||||
@ -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";
|
||||
|
||||
|
149
example/clcpp_response.cpp
Normal file
149
example/clcpp_response.cpp
Normal file
@ -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 <units/format.h>
|
||||
#include <units/iau/iau.h>
|
||||
#include <units/imperial/imperial.h>
|
||||
#include <units/international/international.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <units/si/si.h>
|
||||
#include <units/typographic/typographic.h>
|
||||
#include <units/usc/usc.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
|
||||
void simple_quantities()
|
||||
{
|
||||
using namespace units;
|
||||
using namespace units::si;
|
||||
using namespace units::international;
|
||||
|
||||
using distance = quantity<isq::distance[kilo<metre>]>;
|
||||
using duration = quantity<isq::duration[second]>;
|
||||
|
||||
constexpr distance km = isq::distance[kilo<metre>](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<metre>](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<isq::length[metre]> 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<isq::area[square<fm>], 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<isq::area[m2], float> 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();
|
||||
}
|
117
example/foot_pound_second.cpp
Normal file
117
example/foot_pound_second.cpp
Normal file
@ -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 <units/format.h>
|
||||
#include <units/imperial/imperial.h>
|
||||
#include <units/international/international.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/si/unit_symbols.h>
|
||||
#include <iostream>
|
||||
#include <string_view>
|
||||
|
||||
using namespace units;
|
||||
using namespace units::international::unit_symbols;
|
||||
using namespace units::si::unit_symbols;
|
||||
|
||||
|
||||
// Some basic specs for the warship
|
||||
struct Ship {
|
||||
quantity<isq::length[ft]> length;
|
||||
quantity<isq::length[ft]> draft;
|
||||
quantity<isq::length[ft]> beam;
|
||||
|
||||
quantity<isq::speed[ft / s]> speed;
|
||||
quantity<isq::mass[lb]> mass;
|
||||
|
||||
quantity<isq::length[in]> mainGuns;
|
||||
quantity<isq::mass[lb]> shellMass;
|
||||
quantity<isq::speed[ft / s]> shellSpeed;
|
||||
quantity<isq::power[ft * pdl / s]> power;
|
||||
};
|
||||
|
||||
// Print 'q' in its current units and print its value cast to the units in each of Us
|
||||
template<Unit auto... Us, Quantity Q>
|
||||
auto fmt_line(const Q& q)
|
||||
{
|
||||
return STD_FMT::format("{:22}", q) + (STD_FMT::format(",{:20}", quantity_cast<Us>(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<ft>](62.4);
|
||||
std::cout << STD_FMT::format("{}\n", description);
|
||||
std::cout << STD_FMT::format("{:20} : {}\n", "length", fmt_line<yd, m>(ship.length))
|
||||
<< STD_FMT::format("{:20} : {}\n", "draft", fmt_line<yd, m>(ship.draft))
|
||||
<< STD_FMT::format("{:20} : {}\n", "beam", fmt_line<yd, m>(ship.beam))
|
||||
<< STD_FMT::format("{:20} : {}\n", "mass", fmt_line<imperial::long_ton, t>(ship.mass))
|
||||
<< STD_FMT::format("{:20} : {}\n", "speed", fmt_line<kt, km / h>(ship.speed))
|
||||
<< STD_FMT::format("{:20} : {}\n", "power", fmt_line<hp, kW>(ship.power))
|
||||
<< STD_FMT::format("{:20} : {}\n", "main guns", fmt_line<in, mm>(ship.mainGuns))
|
||||
<< STD_FMT::format("{:20} : {}\n", "fire shells weighing", fmt_line<imperial::long_ton, kg>(ship.shellMass))
|
||||
<< STD_FMT::format("{:20} : {}\n", "fire shells at", fmt_line<mph, km / h>(ship.shellSpeed))
|
||||
<< STD_FMT::format("{:20} : {}\n", "volume underwater", fmt_line<m3, l>(ship.mass / waterDensity));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using units::international::unit_symbols::ft; // collides with si::femto<si::tonne>
|
||||
|
||||
// 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);
|
||||
}
|
@ -23,8 +23,8 @@
|
||||
#include "glide_computer.h"
|
||||
#include <units/bits/fmt_hacks.h>
|
||||
#include <units/chrono.h>
|
||||
#include <units/international/international.h>
|
||||
#include <units/math.h>
|
||||
#include <units/si/international/length.h>
|
||||
#include <units/si/unit_symbols.h>
|
||||
#include <array>
|
||||
#include <exception>
|
||||
@ -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"
|
||||
|
@ -21,10 +21,9 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/format.h>
|
||||
#include <units/international/international.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <units/si/international/length.h>
|
||||
#include <units/si/international/speed.h>
|
||||
#include <units/si/unit_symbols.h>
|
||||
#include <iostream>
|
||||
|
||||
@ -38,7 +37,7 @@ constexpr quantity_of<isq::speed> auto avg_speed(quantity_of<isq::distance> 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);
|
||||
|
2
src/core/include/units/bits/external/hacks.h
vendored
2
src/core/include/units/bits/external/hacks.h
vendored
@ -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
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <units/bits/algorithm.h>
|
||||
#include <units/bits/expression_template.h>
|
||||
#include <units/bits/external/fixed_string.h>
|
||||
#include <units/bits/external/type_name.h>
|
||||
#include <units/bits/external/type_traits.h>
|
||||
#include <units/bits/magnitude.h>
|
||||
#include <units/bits/ratio.h>
|
||||
@ -523,12 +524,23 @@ template<Unit T, typename... Us>
|
||||
template<Unit Lhs, Unit Rhs>
|
||||
[[nodiscard]] consteval bool less(Lhs, Rhs)
|
||||
{
|
||||
if ((is_derived_from_specialization_of_constant_unit<Lhs> && is_derived_from_specialization_of_constant_unit<Rhs>) ||
|
||||
(!is_derived_from_specialization_of_constant_unit<Lhs> && !is_derived_from_specialization_of_constant_unit<Rhs>))
|
||||
return Lhs::symbol < Rhs::symbol;
|
||||
else
|
||||
if constexpr ((is_derived_from_specialization_of_constant_unit<Lhs> &&
|
||||
is_derived_from_specialization_of_constant_unit<Rhs>) ||
|
||||
(!is_derived_from_specialization_of_constant_unit<Lhs> &&
|
||||
!is_derived_from_specialization_of_constant_unit<Rhs>)) {
|
||||
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<Lhs>() < type_name<Rhs>();
|
||||
} else {
|
||||
// put constants at the front of units list in the expression
|
||||
return is_derived_from_specialization_of_constant_unit<Lhs>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
@ -25,10 +25,10 @@
|
||||
#include <units/si/units.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::si::cgs {
|
||||
namespace units::cgs {
|
||||
|
||||
// clang-format off
|
||||
inline constexpr struct centimetre : si::centi_<si::metre> {} centimetre;
|
||||
inline constexpr struct centimetre : decltype(si::centi<si::metre>) {} 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<second>> {} gal;
|
||||
@ -53,4 +53,4 @@ inline constexpr auto St = stokes;
|
||||
|
||||
} // namespace unit_symbols
|
||||
|
||||
} // namespace units::si::cgs
|
||||
} // namespace units::cgs
|
25
src/systems/hep/CMakeLists.txt
Normal file
25
src/systems/hep/CMakeLists.txt
Normal file
@ -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)
|
91
src/systems/hep/include/units/hep/hep.h
Normal file
91
src/systems/hep/include/units/hep/hep.h
Normal file
@ -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 <units/si/si.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
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<si::metre>> {} barn;
|
||||
|
||||
// mass
|
||||
inline constexpr struct electron_mass : named_unit<"m_e", mag<ratio{9'109'383'701'528, 1'000'000'000'000}> * mag_power<10, -31> * si::kilogram> {} electron_mass;
|
||||
inline constexpr struct proton_mass : named_unit<"m_p", mag<ratio{1'672'621'923'695, 1'000'000'000'000}> * mag_power<10, -27> * si::kilogram> {} proton_mass;
|
||||
inline constexpr struct neutron_mass : named_unit<"m_n", mag<ratio{1'674'927'498'049, 1'000'000'000'000}> * 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<electronvolt>;
|
||||
inline constexpr auto zeV = si::zepto<electronvolt>;
|
||||
inline constexpr auto aeV = si::atto<electronvolt>;
|
||||
inline constexpr auto feV = si::femto<electronvolt>;
|
||||
inline constexpr auto peV = si::pico<electronvolt>;
|
||||
inline constexpr auto neV = si::nano<electronvolt>;
|
||||
inline constexpr auto ueV = si::micro<electronvolt>;
|
||||
inline constexpr auto meV = si::milli<electronvolt>;
|
||||
inline constexpr auto ceV = si::centi<electronvolt>;
|
||||
inline constexpr auto deV = si::deci<electronvolt>;
|
||||
inline constexpr auto daeV = si::deca<electronvolt>;
|
||||
inline constexpr auto heV = si::hecto<electronvolt>;
|
||||
inline constexpr auto keV = si::kilo<electronvolt>;
|
||||
inline constexpr auto MeV = si::mega<electronvolt>;
|
||||
inline constexpr auto GeV = si::giga<electronvolt>;
|
||||
inline constexpr auto TeV = si::tera<electronvolt>;
|
||||
inline constexpr auto PeV = si::peta<electronvolt>;
|
||||
inline constexpr auto EeV = si::exa<electronvolt>;
|
||||
inline constexpr auto ZeV = si::zetta<electronvolt>;
|
||||
inline constexpr auto YeV = si::yotta<electronvolt>;
|
||||
|
||||
inline constexpr auto yb = si::yocto<barn>;
|
||||
inline constexpr auto zb = si::zepto<barn>;
|
||||
inline constexpr auto ab = si::atto<barn>;
|
||||
inline constexpr auto fb = si::femto<barn>;
|
||||
inline constexpr auto pb = si::pico<barn>;
|
||||
inline constexpr auto nb = si::nano<barn>;
|
||||
inline constexpr auto ub = si::micro<barn>;
|
||||
inline constexpr auto mb = si::milli<barn>;
|
||||
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<si::si2019::speed_of_light_in_vacuum_unit>;
|
||||
|
||||
} // namespace unit_symbols
|
||||
|
||||
} // namespace units::hep
|
@ -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
|
||||
)
|
82
src/systems/iau/include/units/iau/iau.h
Normal file
82
src/systems/iau/include/units/iau/iau.h
Normal file
@ -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 <units/si/si.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
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<basic_symbol_text{"M_☉", "M_SUN"}, mag<ratio{198'892, 100'000}> * mag_power<10, 30> * si::kilogram> {} solar_mass;
|
||||
inline constexpr struct Jupiter_mass : named_unit<"M_JUP", mag<ratio{1'898, 1'000}> * mag_power<10, 27> * si::kilogram> {} Jupiter_mass;
|
||||
inline constexpr struct Earth_mass : named_unit<"M_EARTH", mag<ratio{59'742, 10'000}> * 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<si::metre>> {} 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<basic_symbol_text{"Å", "A"}, mag_power<10, -10> * 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
|
@ -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)
|
98
src/systems/imperial/include/units/imperial/imperial.h
Normal file
98
src/systems/imperial/include/units/imperial/imperial.h
Normal file
@ -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 <units/international/international.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
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<ratio{1, 3}> * foot> {} hand;
|
||||
inline constexpr struct barleycorn : named_unit<"Bc", mag<ratio(1, 3)> * inch> {} barleycorn;
|
||||
inline constexpr struct thou : named_unit<"th", mag<ratio{1, 12'000}> * 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<ratio{1, 10}> * nautical_mile> {} cable;
|
||||
inline constexpr struct fathom : named_unit<"ftm", mag<ratio{1, 1000}> * nautical_mile> {} fathom;
|
||||
|
||||
// survey
|
||||
inline constexpr struct link : named_unit<"li", mag<ratio{1, 100}> * 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<rod>) {} 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<ratio{454'609, 100'000}> * si::litre> {} gallon;
|
||||
inline constexpr struct quart : named_unit<"qt", mag<ratio{1, 4}> * gallon> {} quart;
|
||||
inline constexpr struct pint : named_unit<"pt", mag<ratio{1, 2}> * quart> {} pint;
|
||||
inline constexpr struct gill : named_unit<"gi", mag<ratio{1, 4}> * pint> {} gill;
|
||||
inline constexpr struct fluid_ounce : named_unit<"fl oz", mag<ratio{1, 5}> * 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
|
25
src/systems/international/CMakeLists.txt
Normal file
25
src/systems/international/CMakeLists.txt
Normal file
@ -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)
|
@ -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 <units/si/si.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::international {
|
||||
|
||||
// clang-format off
|
||||
// mass
|
||||
inline constexpr struct pound : named_unit<"lb", mag<ratio{45'359'237, 100'000'000}> * si::kilogram> {} pound;
|
||||
inline constexpr struct ounce : named_unit<"oz", mag<ratio(1, 16)> * pound> {} ounce;
|
||||
inline constexpr struct dram : named_unit<"dr", mag<ratio(1, 16)> * ounce> {} dram;
|
||||
inline constexpr struct grain : named_unit<"gr", mag<ratio(1, 7'000)> * pound> {} grain;
|
||||
|
||||
// length
|
||||
inline constexpr struct yard : named_unit<"yd", mag<ratio{9'144, 10'000}> * si::metre> {} yard;
|
||||
inline constexpr struct foot : named_unit<"ft", mag<ratio{1, 3}> * yard> {} foot;
|
||||
inline constexpr struct inch : named_unit<"in", mag<ratio{1, 12}> * foot> {} inch;
|
||||
inline constexpr struct pica : named_unit<"P", mag<ratio{1, 6}> * inch> {} pica;
|
||||
inline constexpr struct point : named_unit<"p", mag<ratio{1, 12}> * pica> {} point;
|
||||
inline constexpr struct mil : named_unit<"mil", mag<ratio{1, 1'000}> * inch> {} mil;
|
||||
inline constexpr struct twip : named_unit<"twip", mag<ratio{1, 20}> * 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<si::second>> {} 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<pound_force>) {} kip;
|
||||
|
||||
// pressure
|
||||
inline constexpr struct psi : named_unit<"psi", pound_force / square<inch>> {} 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
|
@ -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
|
||||
)
|
@ -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 <units/isq/dimensions/acceleration.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/fps/speed.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct foot_per_second_sq : derived_unit<foot_per_second_sq> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, foot_per_second_sq, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
using acceleration = quantity<dim_acceleration, U, Rep>;
|
||||
|
||||
#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<std::int64_t>(l));
|
||||
return acceleration<foot_per_second_sq, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft_per_s2(long double l) { return acceleration<foot_per_second_sq, long double>(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<Representation Rep = double>
|
||||
using ft_per_s2 = units::isq::si::fps::acceleration<units::isq::si::fps::foot_per_second_sq, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline acceleration
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/area.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/fps/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct square_foot : derived_unit<square_foot> {};
|
||||
struct dim_area : isq::dim_area<dim_area, square_foot, dim_length> {};
|
||||
|
||||
|
||||
template<UnitOf<dim_area> U, Representation Rep = double>
|
||||
using area = quantity<dim_area, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ft2
|
||||
constexpr auto operator"" _q_ft2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_foot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft2(long double l) { return area<square_foot, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace area_references {
|
||||
|
||||
inline constexpr auto ft2 = reference<dim_area, square_foot>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using ft2 = units::isq::si::fps::area<units::isq::si::fps::square_foot, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline area
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/density.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/fps/length.h>
|
||||
#include <units/isq/si/fps/mass.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct pound_per_foot_cub : derived_unit<pound_per_foot_cub> {};
|
||||
|
||||
struct dim_density : isq::dim_density<dim_density, pound_per_foot_cub, dim_mass, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_density> U, Representation Rep = double>
|
||||
using density = quantity<dim_density, U, Rep>;
|
||||
|
||||
#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<std::int64_t>(l));
|
||||
return density<pound_per_foot_cub, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_lb_per_ft3(long double l) { return density<pound_per_foot_cub, long double>(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<Representation Rep = double>
|
||||
using lb_per_ft3 = units::isq::si::fps::density<units::isq::si::fps::pound_per_foot_cub, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline density
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/energy.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/fps/force.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot-poundal
|
||||
struct foot_poundal : derived_unit<foot_poundal> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, foot_poundal, dim_length, dim_force> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot-pound_(energy)
|
||||
struct foot_pound_force : derived_scaled_unit<foot_pound_force, dim_energy, foot, pound_force> {};
|
||||
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// foot poundal
|
||||
constexpr auto operator"" _q_ft_pdl(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<foot_poundal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft_pdl(long double l) { return energy<foot_poundal, long double>(l); }
|
||||
|
||||
// foot_pound force
|
||||
constexpr auto operator"" _q_ft_lbf(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<foot_pound_force, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft_lbf(long double l) { return energy<foot_pound_force, long double>(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<Representation Rep = double>
|
||||
using ft_pdl = units::isq::si::fps::energy<units::isq::si::fps::foot_poundal, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using ft_lbf = units::isq::si::fps::energy<units::isq::si::fps::foot_pound_force, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline energy
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/force.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/fps/acceleration.h>
|
||||
#include <units/isq/si/fps/mass.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Poundal
|
||||
struct poundal : named_unit<poundal, "pdl"> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Pound_(force)
|
||||
struct pound_force : named_scaled_unit<pound_force, "lbf", mag<ratio(32'174'049, 1'000'000)>(), poundal> {};
|
||||
|
||||
struct kilopound_force : prefixed_unit<kilopound_force, si::kilo, pound_force> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Kip_(unit),
|
||||
struct kip : alias_unit<kilopound_force, "klbf"> {};
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, poundal, dim_mass, dim_acceleration> {};
|
||||
|
||||
template<UnitOf<dim_force> U, Representation Rep = double>
|
||||
using force = quantity<dim_force, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// poundal
|
||||
constexpr auto operator"" _q_pdl(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return force<poundal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pdl(long double l) { return force<poundal, long double>(l); }
|
||||
|
||||
// pound force
|
||||
constexpr auto operator"" _q_lbf(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return force<pound_force, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_lbf(long double l) { return force<pound_force, long double>(l); }
|
||||
|
||||
// kilopound force
|
||||
constexpr auto operator"" _q_klbf(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return force<kilopound_force, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_klbf(long double l) { return force<kilopound_force, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace force_references {
|
||||
|
||||
inline constexpr auto pdl = reference<dim_force, poundal>{};
|
||||
inline constexpr auto lbf = reference<dim_force, pound_force>{};
|
||||
inline constexpr auto klbf = reference<dim_force, kilopound_force>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using pdl = units::isq::si::fps::force<units::isq::si::fps::poundal, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using lbf = units::isq::si::fps::force<units::isq::si::fps::pound_force, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using klbf = units::isq::si::fps::force<units::isq::si::fps::kilopound_force, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline force
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <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/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>
|
||||
// IWYU pragma: end_exports
|
@ -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 <units/isq/dimensions/length.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
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<thou, "thou"> {};
|
||||
|
||||
struct kiloyard : prefixed_unit<kiloyard, si::kilo, yard> {};
|
||||
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "nmi", mag<2'000>(), yard> {};
|
||||
|
||||
struct dim_length : isq::dim_length<foot> {};
|
||||
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// Thousandth
|
||||
constexpr auto operator"" _q_thou(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<thousandth, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_thou(long double l) { return length<thousandth, long double>(l); }
|
||||
constexpr auto operator"" _q_mil(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<thousandth, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mil(long double l) { return length<thousandth, long double>(l); }
|
||||
|
||||
|
||||
// Inch
|
||||
constexpr auto operator"" _q_in(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<inch, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_in(long double l) { return length<inch, long double>(l); }
|
||||
|
||||
// Foot
|
||||
constexpr auto operator"" _q_ft(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<foot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft(long double l) { return length<foot, long double>(l); }
|
||||
|
||||
// Yard
|
||||
constexpr auto operator"" _q_yd(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<yard, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_yd(long double l) { return length<yard, long double>(l); }
|
||||
|
||||
// Fathom
|
||||
constexpr auto operator"" _q_ftm(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<fathom, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ftm(long double l) { return length<fathom, long double>(l); }
|
||||
|
||||
// Kiloyard
|
||||
constexpr auto operator"" _q_kyd(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<kiloyard, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kyd(long double l) { return length<kiloyard, long double>(l); }
|
||||
|
||||
// Mile
|
||||
constexpr auto operator"" _q_mile(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<mile, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mile(long double l) { return length<mile, long double>(l); }
|
||||
|
||||
// Nautical mile
|
||||
constexpr auto operator"" _q_naut_mi(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<nautical_mile, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_naut_mi(long double l) { return length<nautical_mile, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace length_references {
|
||||
|
||||
inline constexpr auto thou = reference<dim_length, thousandth>{};
|
||||
inline constexpr auto mil = thou;
|
||||
|
||||
inline constexpr auto in = reference<dim_length, inch>{};
|
||||
inline constexpr auto ft = reference<dim_length, foot>{};
|
||||
inline constexpr auto yd = reference<dim_length, yard>{};
|
||||
inline constexpr auto ftm = reference<dim_length, fathom>{};
|
||||
inline constexpr auto kyd = reference<dim_length, kiloyard>{};
|
||||
inline constexpr auto mile = reference<dim_length, fps::mile>{};
|
||||
inline constexpr auto naut_mi = reference<dim_length, nautical_mile>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using thou = units::isq::si::fps::length<units::isq::si::fps::thousandth, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using mil = thou<Rep>;
|
||||
|
||||
template<Representation Rep = double>
|
||||
using in = units::isq::si::fps::length<units::isq::si::fps::inch, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using ft = units::isq::si::fps::length<units::isq::si::fps::foot, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using yd = units::isq::si::fps::length<units::isq::si::fps::yard, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using ftm = units::isq::si::fps::length<units::isq::si::fps::fathom, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using kyd = units::isq::si::fps::length<units::isq::si::fps::kiloyard, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using mile = units::isq::si::fps::length<units::isq::si::fps::mile, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using naut_mi = units::isq::si::fps::length<units::isq::si::fps::nautical_mile, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline length
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/mass.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/mass.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Pound_(mass)
|
||||
struct pound : named_scaled_unit<pound, "lb", mag<ratio(45'359'237, 100'000'000)>(), si::kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<pound> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
struct grain : named_scaled_unit<grain, "gr", mag<ratio(1, 7000)>(), pound> {};
|
||||
|
||||
struct dram : named_scaled_unit<dram, "dr", mag<ratio(1, 256)>(), pound> {};
|
||||
|
||||
struct ounce : named_scaled_unit<ounce, "oz", mag<ratio(1, 16)>(), pound> {};
|
||||
|
||||
struct stone : named_scaled_unit<stone, "st", mag<14>(), pound> {};
|
||||
|
||||
struct quarter : named_scaled_unit<quarter, "qr", mag<28>(), pound> {};
|
||||
|
||||
struct hundredweight : named_scaled_unit<hundredweight, "cwt", mag<112>(), pound> {};
|
||||
|
||||
struct short_ton : named_scaled_unit<short_ton, "ton (short)", mag<2'000>(), pound> {};
|
||||
|
||||
struct long_ton : named_scaled_unit<long_ton, "ton (long)", mag<2'240>(), pound> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// Grain
|
||||
constexpr auto operator"" _q_gr(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<grain, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_gr(long double l) { return mass<grain, long double>(l); }
|
||||
|
||||
// Dram
|
||||
constexpr auto operator"" _q_dr(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<dram, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_dr(long double l) { return mass<dram, long double>(l); }
|
||||
|
||||
// Ounce
|
||||
constexpr auto operator"" _q_oz(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<ounce, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_oz(long double l) { return mass<ounce, long double>(l); }
|
||||
|
||||
// Pound
|
||||
constexpr auto operator"" _q_lb(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<pound, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_lb(long double l) { return mass<pound, long double>(l); }
|
||||
|
||||
// Stone
|
||||
constexpr auto operator"" _q_st(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<stone, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_st(long double l) { return mass<stone, long double>(l); }
|
||||
|
||||
// Quarter
|
||||
constexpr auto operator"" _q_qr(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<quarter, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_qr(long double l) { return mass<quarter, long double>(l); }
|
||||
|
||||
// Hundredweight
|
||||
constexpr auto operator"" _q_cwt(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<hundredweight, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_cwt(long double l) { return mass<hundredweight, long double>(l); }
|
||||
|
||||
// Short ton
|
||||
constexpr auto operator"" _q_ston(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<short_ton, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ston(long double l) { return mass<short_ton, long double>(l); }
|
||||
|
||||
// Long Ton
|
||||
constexpr auto operator"" _q_lton(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<long_ton, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_lton(long double l) { return mass<long_ton, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace mass_references {
|
||||
|
||||
inline constexpr auto gr = reference<dim_mass, grain>{};
|
||||
inline constexpr auto dr = reference<dim_mass, dram>{};
|
||||
inline constexpr auto oz = reference<dim_mass, ounce>{};
|
||||
inline constexpr auto lb = reference<dim_mass, pound>{};
|
||||
inline constexpr auto st = reference<dim_mass, stone>{};
|
||||
inline constexpr auto qr = reference<dim_mass, quarter>{};
|
||||
inline constexpr auto cwt = reference<dim_mass, hundredweight>{};
|
||||
inline constexpr auto ston = reference<dim_mass, short_ton>{};
|
||||
inline constexpr auto lton = reference<dim_mass, long_ton>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using gr = units::isq::si::fps::mass<units::isq::si::fps::grain, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using dr = units::isq::si::fps::mass<units::isq::si::fps::dram, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using oz = units::isq::si::fps::mass<units::isq::si::fps::ounce, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using lb = units::isq::si::fps::mass<units::isq::si::fps::pound, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using st = units::isq::si::fps::mass<units::isq::si::fps::stone, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using qr = units::isq::si::fps::mass<units::isq::si::fps::quarter, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using cwt = units::isq::si::fps::mass<units::isq::si::fps::hundredweight, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using ston = units::isq::si::fps::mass<units::isq::si::fps::short_ton, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using lton = units::isq::si::fps::mass<units::isq::si::fps::long_ton, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline mass
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/power.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/fps/energy.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct foot_poundal_per_second : derived_unit<foot_poundal_per_second> {};
|
||||
|
||||
struct dim_power : isq::dim_power<dim_power, foot_poundal_per_second, dim_length, dim_force, dim_time> {};
|
||||
|
||||
struct foot_pound_force_per_second :
|
||||
derived_scaled_unit<foot_pound_force_per_second, dim_power, foot, pound_force, second> {};
|
||||
|
||||
struct horse_power : named_scaled_unit<horse_power, "hp", mag<550>(), foot_pound_force_per_second> {};
|
||||
|
||||
template<UnitOf<dim_power> U, Representation Rep = double>
|
||||
using power = quantity<dim_power, U, Rep>;
|
||||
|
||||
#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<std::int64_t>(l));
|
||||
return power<foot_poundal_per_second, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft_pdl_per_s(long double l) { return power<foot_poundal_per_second, long double>(l); }
|
||||
|
||||
// foot pound force per second
|
||||
constexpr auto operator"" _q_ft_lbf_per_s(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return power<foot_pound_force_per_second, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft_lbf_per_s(long double l) { return power<foot_pound_force_per_second, long double>(l); }
|
||||
|
||||
// horse power
|
||||
constexpr auto operator"" _q_hp(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return power<horse_power, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_hp(long double l) { return power<horse_power, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace power_references {
|
||||
|
||||
inline constexpr auto hp = reference<dim_power, horse_power>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using ft_pdl_per_s = units::isq::si::fps::power<units::isq::si::fps::foot_poundal_per_second, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using ft_lbf_per_s = units::isq::si::fps::power<units::isq::si::fps::foot_pound_force_per_second, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using hp = units::isq::si::fps::power<units::isq::si::fps::horse_power, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline power
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/pressure.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/fps/area.h>
|
||||
#include <units/isq/si/fps/force.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct poundal_per_foot_sq : derived_unit<poundal_per_foot_sq> {};
|
||||
|
||||
struct dim_pressure : isq::dim_pressure<dim_pressure, poundal_per_foot_sq, dim_force, dim_area> {};
|
||||
|
||||
template<UnitOf<dim_pressure> U, Representation Rep = double>
|
||||
using pressure = quantity<dim_pressure, U, Rep>;
|
||||
|
||||
struct pound_force_per_foot_sq :
|
||||
named_scaled_unit<pound_force_per_foot_sq, "lbf ft2", mag<ratio(32'174'049, 1'000'000)>(), poundal_per_foot_sq> {};
|
||||
|
||||
struct pound_force_per_inch_sq :
|
||||
named_scaled_unit<pound_force_per_inch_sq, "psi", mag<ratio(1, 144)>(), pound_force_per_foot_sq> {};
|
||||
|
||||
struct kilopound_force_per_inch_sq : prefixed_unit<kilopound_force_per_inch_sq, si::kilo, pound_force_per_inch_sq> {};
|
||||
|
||||
#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<std::int64_t>(l));
|
||||
return pressure<poundal_per_foot_sq, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pdl_per_ft2(long double l) { return pressure<poundal_per_foot_sq, long double>(l); }
|
||||
|
||||
// Pounds per square inch
|
||||
constexpr auto operator"" _q_psi(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return pressure<pound_force_per_inch_sq, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_psi(long double l) { return pressure<pound_force_per_inch_sq, long double>(l); }
|
||||
|
||||
// kilopounds per square inch
|
||||
constexpr auto operator"" _q_kpsi(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return pressure<kilopound_force_per_inch_sq, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kpsi(long double l) { return pressure<kilopound_force_per_inch_sq, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace pressure_references {
|
||||
|
||||
inline constexpr auto psi = reference<dim_pressure, pound_force_per_inch_sq>{};
|
||||
inline constexpr auto kpsi = reference<dim_pressure, kilopound_force_per_inch_sq>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using pdl_per_ft2 = units::isq::si::fps::pressure<units::isq::si::fps::poundal_per_foot_sq, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using psi = units::isq::si::fps::pressure<units::isq::si::fps::pound_force_per_inch_sq, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using kpsi = units::isq::si::fps::pressure<units::isq::si::fps::kilopound_force_per_inch_sq, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline pressure
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/speed.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/fps/length.h>
|
||||
#include <units/isq/si/fps/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct foot_per_second : derived_unit<foot_per_second> {};
|
||||
struct dim_speed : isq::dim_speed<dim_speed, foot_per_second, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_speed> U, Representation Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
struct mile_per_hour : derived_scaled_unit<mile_per_hour, dim_speed, mile, hour> {};
|
||||
struct nautical_mile_per_hour : derived_scaled_unit<nautical_mile_per_hour, dim_speed, nautical_mile, hour> {};
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "kn"> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ft/s
|
||||
constexpr auto operator"" _q_ft_per_s(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return speed<foot_per_second, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft_per_s(long double l) { return speed<foot_per_second, long double>(l); }
|
||||
|
||||
// mph
|
||||
constexpr auto operator"" _q_mph(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return speed<mile_per_hour, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mph(long double l) { return speed<mile_per_hour, long double>(l); }
|
||||
|
||||
// kn
|
||||
constexpr auto operator"" _q_kn(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return speed<knot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kn(long double l) { return speed<knot, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace speed_references {
|
||||
|
||||
inline constexpr auto mph = reference<dim_speed, mile_per_hour>{};
|
||||
inline constexpr auto kn = reference<dim_speed, fps::knot>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using ft_per_s = units::isq::si::fps::speed<units::isq::si::fps::foot_per_second, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using mph = units::isq::si::fps::speed<units::isq::si::fps::mile_per_hour, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using kn = units::isq::si::fps::speed<units::isq::si::fps::knot, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline speed
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/time.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
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
|
@ -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 <units/isq/dimensions/volume.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/fps/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
struct cubic_foot : derived_unit<cubic_foot> {};
|
||||
struct dim_volume : isq::dim_volume<dim_volume, cubic_foot, dim_length> {};
|
||||
|
||||
struct cubic_yard : derived_scaled_unit<cubic_yard, dim_volume, yard> {};
|
||||
|
||||
template<UnitOf<dim_volume> U, Representation Rep = double>
|
||||
using volume = quantity<dim_volume, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ft3
|
||||
constexpr auto operator"" _q_ft3(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return volume<cubic_foot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft3(long double l) { return volume<cubic_foot, long double>(l); }
|
||||
|
||||
// yd3
|
||||
constexpr auto operator"" _q_yd3(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return volume<cubic_yard, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_yd3(long double l) { return volume<cubic_yard, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace volume_references {
|
||||
|
||||
inline constexpr auto ft3 = reference<dim_volume, cubic_foot>{};
|
||||
inline constexpr auto yd3 = reference<dim_volume, cubic_yard>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using ft3 = units::isq::si::fps::volume<units::isq::si::fps::cubic_foot, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using yd3 = units::isq::si::fps::volume<units::isq::si::fps::cubic_yard, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::fps::inline volume
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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
|
||||
)
|
@ -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 <units/isq/dimensions/area.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/area.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
// effective cross-sectional area according to EU council directive 80/181/EEC
|
||||
// https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:01980L0181-20090527#page=10
|
||||
// https://www.fedlex.admin.ch/eli/cc/1994/3109_3109_3109/de
|
||||
struct barn : named_scaled_unit<barn, "b", mag_power<10, -28>(), square_metre> {};
|
||||
struct yocto_barn : prefixed_unit<yocto_barn, yocto, barn> {};
|
||||
struct zepto_barn : prefixed_unit<zepto_barn, zepto, barn> {};
|
||||
struct atto_barn : prefixed_unit<atto_barn, atto, barn> {};
|
||||
struct femto_barn : prefixed_unit<femto_barn, femto, barn> {};
|
||||
struct pico_barn : prefixed_unit<pico_barn, pico, barn> {};
|
||||
struct nano_barn : prefixed_unit<nano_barn, nano, barn> {};
|
||||
struct micro_barn : prefixed_unit<micro_barn, micro, barn> {};
|
||||
struct milli_barn : prefixed_unit<milli_barn, milli, barn> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
constexpr auto operator"" _q_yb(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<yocto_barn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_yb(long double l) { return area<yocto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_zb(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<zepto_barn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_zb(long double l) { return area<zepto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_ab(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<atto_barn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ab(long double l) { return area<atto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_fb(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<femto_barn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fb(long double l) { return area<femto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_pb(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<pico_barn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pb(long double l) { return area<pico_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_nb(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<nano_barn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nb(long double l) { return area<nano_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_ub(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<micro_barn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ub(long double l) { return area<micro_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_mb(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<milli_barn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mb(long double l) { return area<milli_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_b(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<barn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_b(long double l) { return area<barn, long double>(l); }
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace area_references {
|
||||
|
||||
inline constexpr auto barn = reference<dim_area, ::units::isq::si::hep::barn>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using barn = units::isq::si::area<units::isq::si::hep::barn, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::hep::inline area
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/energy.h>
|
||||
#include <units/isq/si/energy.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
using units::isq::si::electronvolt;
|
||||
|
||||
struct yeV : prefixed_unit<yeV, yocto, electronvolt> {}; // N.B. very rarely used
|
||||
struct zeV : prefixed_unit<zeV, zepto, electronvolt> {}; // N.B. very rarely used
|
||||
struct aeV : prefixed_unit<aeV, atto, electronvolt> {}; // N.B. very rarely used
|
||||
struct feV : prefixed_unit<feV, femto, electronvolt> {};
|
||||
struct peV : prefixed_unit<peV, pico, electronvolt> {};
|
||||
struct neV : prefixed_unit<neV, nano, electronvolt> {};
|
||||
struct ueV : prefixed_unit<ueV, micro, electronvolt> {};
|
||||
struct meV : prefixed_unit<meV, milli, electronvolt> {};
|
||||
using eV = electronvolt;
|
||||
struct keV : prefixed_unit<keV, kilo, electronvolt> {};
|
||||
struct MeV : prefixed_unit<MeV, mega, electronvolt> {};
|
||||
using GeV = gigaelectronvolt;
|
||||
struct TeV : prefixed_unit<TeV, tera, electronvolt> {};
|
||||
struct PeV : prefixed_unit<PeV, peta, electronvolt> {};
|
||||
struct EeV : prefixed_unit<EeV, exa, electronvolt> {}; // N.B. very rarely used
|
||||
struct ZeV : prefixed_unit<ZeV, zetta, electronvolt> {}; // N.B. very rarely used
|
||||
struct YeV : prefixed_unit<YeV, yotta, electronvolt> {}; // N.B. very rarely used
|
||||
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
constexpr auto operator"" _q_feV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<feV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_feV(long double l) { return energy<feV, long double>(l); }
|
||||
constexpr auto operator"" _q_peV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<peV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_peV(long double l) { return energy<peV, long double>(l); }
|
||||
constexpr auto operator"" _q_neV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<neV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_neV(long double l) { return energy<ueV, long double>(l); }
|
||||
constexpr auto operator"" _q_ueV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<neV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ueV(long double l) { return energy<ueV, long double>(l); }
|
||||
constexpr auto operator"" _q_meV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<meV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_meV(long double l) { return energy<meV, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_eV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<eV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_eV(long double l) { return energy<eV, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_keV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<keV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_keV(long double l) { return energy<keV, long double>(l); }
|
||||
constexpr auto operator"" _q_MeV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<MeV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_MeV(long double l) { return energy<MeV, long double>(l); }
|
||||
constexpr auto operator"" _q_GeV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<GeV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_GeV(long double l) { return energy<GeV, long double>(l); }
|
||||
constexpr auto operator"" _q_TeV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<TeV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_TeV(long double l) { return energy<TeV, long double>(l); }
|
||||
constexpr auto operator"" _q_PeV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<PeV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_PeV(long double l) { return energy<PeV, long double>(l); }
|
||||
constexpr auto operator"" _q_EeV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<EeV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_EeV(long double l) { return energy<EeV, long double>(l); }
|
||||
constexpr auto operator"" _q_ZeV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<ZeV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ZeV(long double l) { return energy<ZeV, long double>(l); }
|
||||
constexpr auto operator"" _q_YeV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<YeV, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_YeV(long double l) { return energy<YeV, long double>(l); }
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace energy_references {
|
||||
|
||||
inline constexpr auto eV = reference<dim_energy, hep::eV>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using yeV = units::isq::si::hep::energy<units::isq::si::hep::yeV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using zeV = units::isq::si::hep::energy<units::isq::si::hep::zeV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using aeV = units::isq::si::hep::energy<units::isq::si::hep::aeV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using feV = units::isq::si::hep::energy<units::isq::si::hep::feV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using peV = units::isq::si::hep::energy<units::isq::si::hep::peV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using neV = units::isq::si::hep::energy<units::isq::si::hep::neV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using ueV = units::isq::si::hep::energy<units::isq::si::hep::ueV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using meV = units::isq::si::hep::energy<units::isq::si::hep::meV, Rep>;
|
||||
|
||||
template<Representation Rep = double>
|
||||
using eV = units::isq::si::hep::energy<units::isq::si::hep::eV, Rep>;
|
||||
|
||||
template<Representation Rep = double>
|
||||
using keV = units::isq::si::hep::energy<units::isq::si::hep::keV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using MeV = units::isq::si::hep::energy<units::isq::si::hep::MeV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using GeV = units::isq::si::hep::energy<units::isq::si::hep::GeV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using TeV = units::isq::si::hep::energy<units::isq::si::hep::TeV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using PeV = units::isq::si::hep::energy<units::isq::si::hep::PeV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using EeV = units::isq::si::hep::energy<units::isq::si::hep::EeV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using ZeV = units::isq::si::hep::energy<units::isq::si::hep::ZeV, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using YeV = units::isq::si::hep::energy<units::isq::si::hep::YeV, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::hep::inline energy
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/mass.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/mass.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
// Necessary to factor `1'672'621'923'695`, which appears in the proton mass.
|
||||
template<>
|
||||
inline constexpr std::optional<std::intmax_t> 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<std::intmax_t> units::known_first_factor<225'653'407'801> = 225'653'407'801;
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
struct eV_per_c2 :
|
||||
named_scaled_unit<eV_per_c2, basic_symbol_text{"eV/c²", "eV/c^2"},
|
||||
mag<ratio(17'826'619'216'279, 1'000'000'000'000)>() * mag_power<10, -35>(), kilogram> {};
|
||||
struct feV_per_c2 : prefixed_unit<feV_per_c2, femto, eV_per_c2> {};
|
||||
struct peV_per_c2 : prefixed_unit<peV_per_c2, pico, eV_per_c2> {};
|
||||
struct neV_per_c2 : prefixed_unit<neV_per_c2, nano, eV_per_c2> {};
|
||||
struct ueV_per_c2 : prefixed_unit<ueV_per_c2, micro, eV_per_c2> {};
|
||||
struct meV_per_c2 :
|
||||
prefixed_unit<meV_per_c2, milli, eV_per_c2> {}; // approximate mass of an electron/positron (0.511 MeV/c2)
|
||||
struct keV_per_c2 : prefixed_unit<keV_per_c2, kilo, eV_per_c2> {};
|
||||
struct MeV_per_c2 : prefixed_unit<MeV_per_c2, mega, eV_per_c2> {};
|
||||
struct GeV_per_c2 :
|
||||
prefixed_unit<GeV_per_c2, giga, eV_per_c2> {}; // approximate mass of a proton (0.938 GeV/c2) or neutron
|
||||
struct TeV_per_c2 : prefixed_unit<TeV_per_c2, tera, eV_per_c2> {};
|
||||
struct PeV_per_c2 : prefixed_unit<PeV_per_c2, peta, eV_per_c2> {};
|
||||
struct EeV_per_c2 : prefixed_unit<EeV_per_c2, exa, eV_per_c2> {};
|
||||
struct YeV_per_c2 : prefixed_unit<YeV_per_c2, yotta, eV_per_c2> {};
|
||||
struct electron_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_e", mag<ratio(9'109'383'701'528, 1'000'000'000'000)>() * mag_power<10, -31>(),
|
||||
kilogram> {};
|
||||
struct proton_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_p", mag<ratio(1'672'621'923'695, 1'000'000'000'000)>() * mag_power<10, -27>(),
|
||||
kilogram> {};
|
||||
struct neutron_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_n", mag<ratio(1'674'927'498'049, 1'000'000'000'000)>() * mag_power<10, -27>(),
|
||||
kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<eV_per_c2> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
constexpr auto operator"" _q_feV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<feV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_feV_per_c2(long double l) { return mass<feV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_peV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<peV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_peV_per_c2(long double l) { return mass<peV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_neV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<neV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_neV_per_c2(long double l) { return mass<neV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_ueV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<ueV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ueV_per_c2(long double l) { return mass<ueV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_meV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<meV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_meV_per_c2(long double l) { return mass<meV_per_c2, long double>(l); }
|
||||
|
||||
// eV_per_c2
|
||||
constexpr auto operator"" _q_eV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<eV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_eV_per_c2(long double l) { return mass<eV_per_c2, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_keV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<keV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_keV_per_c2(long double l) { return mass<keV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_MeV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<MeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_MeV_per_c2(long double l) { return mass<MeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_GeV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<GeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_GeV_per_c2(long double l) { return mass<GeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_TeV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<TeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_TeV_per_c2(long double l) { return mass<TeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_PeV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<PeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_PeV_per_c2(long double l) { return mass<PeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_EeV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<EeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_EeV_per_c2(long double l) { return mass<EeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_YeV_per_c2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<YeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_YeV_per_c2(long double l) { return mass<YeV_per_c2, long double>(l); }
|
||||
|
||||
// special HEP masses
|
||||
constexpr auto operator"" _q_electron_mass(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<electron_mass, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_electron_mass(long double l) { return mass<electron_mass, long double>(l); }
|
||||
constexpr auto operator"" _q_proton_mass(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<proton_mass, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_proton_mass(long double l) { return mass<proton_mass, long double>(l); }
|
||||
constexpr auto operator"" _q_neutron_mass(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<neutron_mass, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_neutron_mass(long double l) { return mass<neutron_mass, long double>(l); }
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace mass_references {
|
||||
|
||||
inline constexpr auto eV_per_c2 = reference<dim_mass, ::units::isq::si::hep::eV_per_c2>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using eV_per_c2g = units::isq::si::hep::mass<units::isq::si::hep::eV_per_c2, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::hep::inline mass
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/momentum.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/mass.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
// Necessary to factor `5'344'285'992'678`, which appears in the value for eV/c.
|
||||
template<>
|
||||
inline constexpr std::optional<std::intmax_t> units::known_first_factor<296'904'777'371> = 157'667;
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
struct kilogram_metre_per_second : derived_unit<kilogram_metre_per_second> {};
|
||||
|
||||
struct eV_per_c :
|
||||
named_scaled_unit<eV_per_c, "eV/c", mag<ratio(5'344'285'992'678, 1'000'000'000'000)>() * mag_power<10, -35>(),
|
||||
kilogram_metre_per_second> {};
|
||||
struct feV_per_c : prefixed_unit<feV_per_c, femto, eV_per_c> {};
|
||||
struct peV_per_c : prefixed_unit<peV_per_c, pico, eV_per_c> {};
|
||||
struct neV_per_c : prefixed_unit<neV_per_c, nano, eV_per_c> {};
|
||||
struct ueV_per_c : prefixed_unit<ueV_per_c, micro, eV_per_c> {};
|
||||
struct meV_per_c : prefixed_unit<meV_per_c, milli, eV_per_c> {};
|
||||
struct keV_per_c : prefixed_unit<keV_per_c, kilo, eV_per_c> {};
|
||||
struct MeV_per_c : prefixed_unit<MeV_per_c, mega, eV_per_c> {};
|
||||
struct GeV_per_c : prefixed_unit<GeV_per_c, giga, eV_per_c> {};
|
||||
struct TeV_per_c : prefixed_unit<TeV_per_c, tera, eV_per_c> {};
|
||||
struct PeV_per_c : prefixed_unit<PeV_per_c, peta, eV_per_c> {};
|
||||
struct EeV_per_c : prefixed_unit<EeV_per_c, exa, eV_per_c> {};
|
||||
struct YeV_per_c : prefixed_unit<YeV_per_c, yotta, eV_per_c> {};
|
||||
|
||||
struct dim_momentum : isq::dim_momentum<dim_momentum, eV_per_c, dim_mass, dim_speed> {};
|
||||
|
||||
template<UnitOf<dim_momentum> U, Representation Rep = double>
|
||||
using momentum = quantity<dim_momentum, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
constexpr auto operator"" _q_feV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<feV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_feV_per_c(long double l) { return momentum<feV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_peV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<peV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_peV_per_c(long double l) { return momentum<peV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_neV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<neV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_neV_per_c(long double l) { return momentum<neV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_ueV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<ueV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ueV_per_c(long double l) { return momentum<ueV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_meV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<meV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_meV_per_c(long double l) { return momentum<meV_per_c, long double>(l); }
|
||||
|
||||
// eV_per_c
|
||||
constexpr auto operator"" _q_eV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<eV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_eV_per_c(long double l) { return momentum<eV_per_c, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_keV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<keV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_keV_per_c(long double l) { return momentum<keV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_MeV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<MeV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_MeV_per_c(long double l) { return momentum<MeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_GeV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<GeV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_GeV_per_c(long double l) { return momentum<GeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_TeV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<TeV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_TeV_per_c(long double l) { return momentum<TeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_PeV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<PeV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_PeV_per_c(long double l) { return momentum<PeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_EeV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<EeV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_EeV_per_c(long double l) { return momentum<EeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_YeV_per_c(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return momentum<YeV_per_c, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_YeV_per_c(long double l) { return momentum<YeV_per_c, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si::hep
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::si::inline momentum {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using eV_per_c = units::isq::si::hep::momentum<units::isq::si::hep::eV_per_c, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::inline momentum
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/si/iau/length.h>
|
||||
// IWYU pragma: end_exports
|
@ -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 <units/isq/dimensions/length.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::iau {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Light-year
|
||||
struct light_year : named_scaled_unit<light_year, "ly", mag<9460730472580800>(), si::metre> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Parsec
|
||||
struct parsec : named_scaled_unit<parsec, "pc", mag<30'856'775'814'913'673>(), si::metre> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Angstrom
|
||||
struct angstrom : named_scaled_unit<angstrom, "angstrom", mag_power<10, -10>(), si::metre> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ly
|
||||
constexpr auto operator"" _q_ly(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<light_year, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ly(long double l) { return si::length<light_year, long double>(l); }
|
||||
|
||||
// pc
|
||||
constexpr auto operator"" _q_pc(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<parsec, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pc(long double l) { return si::length<parsec, long double>(l); }
|
||||
|
||||
// angstrom
|
||||
constexpr auto operator"" _q_angstrom(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<angstrom, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_angstrom(long double l) { return si::length<angstrom, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace length_references {
|
||||
|
||||
inline constexpr auto ly = reference<si::dim_length, light_year>{};
|
||||
inline constexpr auto pc = reference<si::dim_length, parsec>{};
|
||||
inline constexpr auto angstrom = reference<si::dim_length, iau::angstrom>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using ly = units::isq::si::length<units::isq::si::iau::light_year, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using pc = units::isq::si::length<units::isq::si::iau::parsec, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using angstrom = units::isq::si::length<units::isq::si::iau::angstrom, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::iau::inline length
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/si/imperial/length.h>
|
||||
// IWYU pragma: end_exports
|
@ -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 <units/isq/dimensions/length.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::imperial {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Chain_(unit)
|
||||
struct chain : named_scaled_unit<chain, "ch", mag<22>(), si::international::yard> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Rod_(unit)
|
||||
struct rod : named_scaled_unit<rod, "rd", mag<ratio(1, 4)>(), chain> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ch
|
||||
constexpr auto operator"" _q_ch(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<chain, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ch(long double l) { return si::length<chain, long double>(l); }
|
||||
|
||||
// rd
|
||||
constexpr auto operator"" _q_rd(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<rod, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_rd(long double l) { return si::length<rod, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace length_references {
|
||||
|
||||
inline constexpr auto ch = reference<si::dim_length, chain>{};
|
||||
inline constexpr auto rd = reference<si::dim_length, rod>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using ch = units::isq::si::length<units::isq::si::imperial::chain, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using rd = units::isq::si::length<units::isq::si::imperial::rod, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::imperial::inline length
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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
|
||||
)
|
@ -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 <units/isq/dimensions/area.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/area.h>
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::international {
|
||||
|
||||
struct square_foot : derived_scaled_unit<square_foot, si::dim_area, si::international::foot> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ft2
|
||||
constexpr auto operator"" _q_ft2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::area<square_foot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft2(long double l) { return si::area<square_foot, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace area_references {
|
||||
|
||||
inline constexpr auto ft2 = reference<si::dim_area, square_foot>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using ft2 = units::isq::si::area<units::isq::si::international::square_foot, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::international::inline area
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/si/international/area.h>
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/isq/si/international/speed.h>
|
||||
#include <units/isq/si/international/volume.h>
|
||||
// IWYU pragma: end_exports
|
@ -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 <units/isq/dimensions/length.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::international {
|
||||
|
||||
// si::international yard
|
||||
// https://en.wikipedia.org/wiki/International_yard_and_pound
|
||||
struct yard : named_scaled_unit<yard, "yd", mag<ratio{9'144, 10'000}>(), si::metre> {};
|
||||
|
||||
// si::international foot
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)#International_foot
|
||||
struct foot : named_scaled_unit<foot, "ft", mag<ratio(1, 3)>(), yard> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Fathom#International_fathom
|
||||
struct fathom : named_scaled_unit<fathom, "fathom", mag<2>(), yard> {};
|
||||
|
||||
// si::international inch
|
||||
// https://en.wikipedia.org/wiki/Inch#Equivalences
|
||||
struct inch : named_scaled_unit<inch, "in", mag<ratio(1, 36)>(), yard> {};
|
||||
|
||||
// intrnational mile
|
||||
// https://en.wikipedia.org/wiki/Mile#International_mile
|
||||
struct mile : named_scaled_unit<mile, "mi", mag<ratio(25'146, 15'625)>(), si::kilometre> {};
|
||||
|
||||
// si::international nautical mile
|
||||
// https://en.wikipedia.org/wiki/Nautical_mile
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", mag<1852>(), si::metre> {};
|
||||
|
||||
// thou
|
||||
// https://en.wikipedia.org/wiki/Thousandth_of_an_inch
|
||||
struct thou : named_scaled_unit<thou, "thou", mag<ratio(1, 1000)>(), 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<std::int64_t>(l));
|
||||
return si::length<yard, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_yd(long double l) { return si::length<yard, long double>(l); }
|
||||
|
||||
// ft
|
||||
constexpr auto operator"" _q_ft(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<foot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft(long double l) { return si::length<foot, long double>(l); }
|
||||
|
||||
// fathom
|
||||
constexpr auto operator"" _q_fathom(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<fathom, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fathom(long double l) { return si::length<fathom, long double>(l); }
|
||||
|
||||
// in
|
||||
constexpr auto operator"" _q_in(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<inch, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_in(long double l) { return si::length<inch, long double>(l); }
|
||||
|
||||
// mi
|
||||
constexpr auto operator"" _q_mi(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<mile, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mi(long double l) { return si::length<mile, long double>(l); }
|
||||
|
||||
// mi_naut
|
||||
constexpr auto operator"" _q_naut_mi(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<nautical_mile, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_naut_mi(long double l) { return si::length<nautical_mile, long double>(l); }
|
||||
|
||||
// thou
|
||||
constexpr auto operator"" _q_thou(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<thou, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_thou(long double l) { return si::length<thou, long double>(l); }
|
||||
|
||||
// mil
|
||||
constexpr auto operator"" _q_mil(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<mil, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mil(long double l) { return si::length<mil, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace length_references {
|
||||
|
||||
inline constexpr auto yd = reference<si::dim_length, yard>{};
|
||||
inline constexpr auto ft = reference<si::dim_length, foot>{};
|
||||
inline constexpr auto fathom = reference<si::dim_length, international::fathom>{};
|
||||
inline constexpr auto in = reference<si::dim_length, inch>{};
|
||||
inline constexpr auto mi = reference<si::dim_length, mile>{};
|
||||
inline constexpr auto mi_naut = reference<si::dim_length, nautical_mile>{};
|
||||
inline constexpr auto thou = reference<si::dim_length, international::thou>{};
|
||||
inline constexpr auto mil = reference<si::dim_length, international::mil>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using yd = units::isq::si::length<units::isq::si::international::yard, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using ft = units::isq::si::length<units::isq::si::international::foot, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using fathom = units::isq::si::length<units::isq::si::international::fathom, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using in = units::isq::si::length<units::isq::si::international::inch, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using mi = units::isq::si::length<units::isq::si::international::mile, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using mi_naut = units::isq::si::length<units::isq::si::international::nautical_mile, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using thou = units::isq::si::length<units::isq::si::international::thou, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using mil = units::isq::si::length<units::isq::si::international::mil, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::international::inline length
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/speed.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::international {
|
||||
|
||||
struct mile_per_hour : derived_scaled_unit<mile_per_hour, si::dim_speed, si::international::mile, si::hour> {};
|
||||
struct nautical_mile_per_hour :
|
||||
derived_scaled_unit<nautical_mile_per_hour, si::dim_speed, si::international::nautical_mile, si::hour> {};
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "kn"> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// mi/h
|
||||
constexpr auto operator"" _q_mi_per_h(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::speed<mile_per_hour, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mi_per_h(long double l) { return si::speed<mile_per_hour, long double>(l); }
|
||||
|
||||
// nmi/h
|
||||
constexpr auto operator"" _q_nmi_per_h(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::speed<nautical_mile_per_hour, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nmi_per_h(long double l) { return si::speed<nautical_mile_per_hour, long double>(l); }
|
||||
|
||||
// kn
|
||||
constexpr auto operator"" _q_kn(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::speed<knot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kn(long double l) { return si::speed<knot, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace speed_references {
|
||||
|
||||
inline constexpr auto kn = reference<si::dim_speed, knot>{};
|
||||
|
||||
} // namespace speed_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace speed_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::international
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::si::international::inline speed {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using mi_per_h = units::isq::si::speed<units::isq::si::international::mile_per_hour, Rep>;
|
||||
|
||||
template<Representation Rep = double>
|
||||
using nmi_per_h = units::isq::si::speed<units::isq::si::international::nautical_mile_per_hour, Rep>;
|
||||
|
||||
template<Representation Rep = double>
|
||||
using kn = units::isq::si::speed<units::isq::si::international::knot, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::international::inline speed
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/volume.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/isq/si/volume.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::international {
|
||||
|
||||
struct cubic_foot : derived_scaled_unit<cubic_foot, si::dim_volume, si::international::foot> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ft3
|
||||
constexpr auto operator"" _q_ft3(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::volume<cubic_foot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft3(long double l) { return si::volume<cubic_foot, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace volume_references {
|
||||
|
||||
inline constexpr auto ft3 = reference<si::dim_volume, cubic_foot>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using ft3 = units::isq::si::volume<units::isq::si::international::cubic_foot, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::international::inline volume
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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
|
||||
)
|
@ -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 <units/isq/dimensions/length.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::typographic {
|
||||
|
||||
// TODO Conflicts with (https://en.wikipedia.org/wiki/Pica_(typography)), verify correctness of below conversion factors
|
||||
// and provide hyperlinks to definitions
|
||||
struct pica_comp : named_scaled_unit<pica_comp, "pica(comp)", mag<4'233'333>() * mag_power<10, -9>(), si::metre> {};
|
||||
struct pica_prn :
|
||||
named_scaled_unit<pica_prn, "pica(prn)", mag<ratio(2108759, 500000)>() * mag_power<10, -3>(), si::metre> {};
|
||||
struct point_comp :
|
||||
named_scaled_unit<point_comp, "point(comp)", mag<ratio(1763889, 500000)>() * mag_power<10, -4>(), si::metre> {};
|
||||
struct point_prn :
|
||||
named_scaled_unit<point_prn, "point(prn)", mag<ratio(1757299, 500000)>() * 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<std::int64_t>(l));
|
||||
return si::length<pica_comp, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pica_comp(long double l) { return si::length<pica_comp, long double>(l); }
|
||||
|
||||
// pica prn
|
||||
constexpr auto operator"" _q_pica_prn(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<pica_prn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pica_prn(long double l) { return si::length<pica_prn, long double>(l); }
|
||||
|
||||
// point comp
|
||||
constexpr auto operator"" _q_point_comp(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<point_comp, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_point_comp(long double l) { return si::length<point_comp, long double>(l); }
|
||||
|
||||
// point prn
|
||||
constexpr auto operator"" _q_point_prn(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<point_prn, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_point_prn(long double l) { return si::length<point_prn, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace length_references {
|
||||
|
||||
inline constexpr auto pica_comp = reference<si::dim_length, typographic::pica_comp>{};
|
||||
inline constexpr auto pica_prn = reference<si::dim_length, typographic::pica_prn>{};
|
||||
inline constexpr auto point_comp = reference<si::dim_length, typographic::point_comp>{};
|
||||
inline constexpr auto point_prn = reference<si::dim_length, typographic::point_prn>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using pica_comp = units::isq::si::length<units::isq::si::typographic::pica_comp, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using pica_prn = units::isq::si::length<units::isq::si::typographic::pica_prn, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using point_comp = units::isq::si::length<units::isq::si::typographic::point_comp, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using point_prn = units::isq::si::length<units::isq::si::typographic::point_prn, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::typographic::inline length
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/dimensions/length.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::uscs {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)#US_survey_foot
|
||||
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
|
||||
struct foot : named_scaled_unit<foot, "ft(us)", mag<ratio(1'200, 3'937)>(), si::metre> {};
|
||||
|
||||
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
|
||||
struct fathom : named_scaled_unit<fathom, "fathom(us)", mag<6>(), foot> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Mile#U.S._survey_mile
|
||||
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
|
||||
struct mile : named_scaled_unit<mile, "mi(us)", mag<5280>(), foot> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ft
|
||||
constexpr auto operator"" _q_ft_us(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<units::isq::si::uscs::foot, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ft_us(long double l) { return si::length<units::isq::si::uscs::foot, long double>(l); }
|
||||
|
||||
// fathom
|
||||
constexpr auto operator"" _q_fathom_us(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<units::isq::si::uscs::fathom, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fathom_us(long double l)
|
||||
{
|
||||
return si::length<units::isq::si::uscs::fathom, long double>(l);
|
||||
}
|
||||
|
||||
// mi
|
||||
constexpr auto operator"" _q_mi_us(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return si::length<units::isq::si::uscs::mile, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mi_us(long double l) { return si::length<units::isq::si::uscs::mile, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace length_references {
|
||||
|
||||
inline constexpr auto ft = reference<si::dim_length, uscs::foot>{};
|
||||
inline constexpr auto fathom = reference<si::dim_length, uscs::fathom>{};
|
||||
inline constexpr auto mi = reference<si::dim_length, uscs::mile>{};
|
||||
|
||||
} // 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<Representation Rep = double>
|
||||
using ft = units::isq::si::length<units::isq::si::uscs::foot, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using fathom = units::isq::si::length<units::isq::si::uscs::fathom, Rep>;
|
||||
template<Representation Rep = double>
|
||||
using mi = units::isq::si::length<units::isq::si::uscs::mile, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::uscs::inline length
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -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 <units/isq/si/uscs/length.h>
|
||||
// IWYU pragma: end_exports
|
@ -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
|
||||
)
|
@ -22,6 +22,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/si/typographic/length.h>
|
||||
// IWYU pragma: end_exports
|
||||
#include <units/unit.h>
|
||||
#include <units/usc/usc.h>
|
||||
|
||||
namespace units::typographic {
|
||||
|
||||
// clang-format off
|
||||
// https://en.wikipedia.org/wiki/Point_(typography)
|
||||
inline constexpr struct pica_us : named_unit<"pica(us)", mag<ratio{166'044, 1'000'000}> * usc::inch> {} pica_us;
|
||||
inline constexpr struct point_us : named_unit<"point(us)", mag<ratio{1, 12}> * pica_us> {} point_us;
|
||||
|
||||
inline constexpr struct point_dtp : named_unit<"point(dtp)", mag<ratio{1, 72}> * 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
|
25
src/systems/usc/CMakeLists.txt
Normal file
25
src/systems/usc/CMakeLists.txt
Normal file
@ -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)
|
163
src/systems/usc/include/units/usc/usc.h
Normal file
163
src/systems/usc/include/units/usc/usc.h
Normal file
@ -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 <units/international/international.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
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<ratio{1'200, 3'937}> * 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<ratio{33, 50}> * 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<ratio{1'200, 3'937}> * si::metre> {} us_survey_foot;
|
||||
inline constexpr struct link : named_unit<"li", mag<ratio{33, 50}> * 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<survey1893::chain>> {} 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<inch>> {} gallon;
|
||||
inline constexpr struct pottle : named_unit<"pot", mag<ratio{1, 2}> * gallon> {} pottle;
|
||||
inline constexpr struct quart : named_unit<"qt", mag<ratio{1, 2}> * pottle> {} quart;
|
||||
inline constexpr struct pint : named_unit<"pt", mag<ratio{1, 2}> * quart> {} pint;
|
||||
inline constexpr struct cup : named_unit<"c", mag<ratio{1, 2}> * pint> {} cup;
|
||||
inline constexpr struct gill : named_unit<"gi", mag<ratio{1, 2}> * cup> {} gill;
|
||||
inline constexpr struct fluid_ounce : named_unit<"fl oz", mag<ratio{1, 4}> * gill> {} fluid_ounce;
|
||||
inline constexpr struct tablespoon : named_unit<"tbsp", mag<ratio{1, 2}> * fluid_ounce> {} tablespoon;
|
||||
inline constexpr struct shot : named_unit<"jig", mag<3> * tablespoon> {} shot;
|
||||
inline constexpr struct teaspoon : named_unit<"tsp", mag<ratio{1, 3}> * tablespoon> {} teaspoon;
|
||||
inline constexpr struct minim : named_unit<"min", mag<ratio{1, 80}> * teaspoon> {} minim;
|
||||
inline constexpr struct fluid_dram : named_unit<"fl dr", mag<60> * minim> {} fluid_dram;
|
||||
inline constexpr struct barrel : named_unit<"bbl", mag<ratio{315, 10}> * gallon> {} barrel;
|
||||
inline constexpr struct oil_barrel : named_unit<"bbl", mag<ratio{4, 3}> * 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<inch>> {} dry_barrel;
|
||||
inline constexpr struct bushel : named_unit<"bu", mag<ratio{3'523'907'016'688, 100'000'000'000}> * si::litre> {} bushel;
|
||||
inline constexpr struct peck : named_unit<"pk", mag<ratio{1, 4}> * bushel> {} peck;
|
||||
inline constexpr struct dry_gallon : named_unit<"gal", mag<ratio{1, 2}> * peck> {} dry_gallon;
|
||||
inline constexpr struct dry_quart : named_unit<"qt", mag<ratio{1, 4}> * dry_gallon> {} dry_quart;
|
||||
inline constexpr struct dry_pint : named_unit<"pt", mag<ratio{1, 2}> * 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<basic_symbol_text{"°F", "`F"}, mag<ratio{9, 5}> * 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
|
@ -22,12 +22,12 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/matchers/catch_matchers_exception.hpp>
|
||||
#include <units/cgs/cgs.h>
|
||||
#include <units/customization_points.h>
|
||||
#include <units/format.h>
|
||||
#include <units/isq/mechanics.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <units/si/cgs/cgs.h>
|
||||
#include <units/si/si.h>
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
|
@ -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)
|
||||
|
@ -20,11 +20,28 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <units/hep/hep.h>
|
||||
#include <units/isq/mechanics.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/si/si.h>
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/si/hep/area.h>
|
||||
#include <units/isq/si/hep/energy.h>
|
||||
#include <units/isq/si/hep/mass.h>
|
||||
#include <units/isq/si/hep/momentum.h>
|
||||
// IWYU pragma: end_exports
|
||||
template<class T>
|
||||
requires units::is_scalar<T>
|
||||
inline constexpr bool units::is_vector<T> = 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
|
80
test/unit_test/static/imperial_test.cpp
Normal file
80
test/unit_test/static/imperial_test.cpp
Normal file
@ -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 <units/imperial/imperial.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/si/unit_symbols.h>
|
||||
|
||||
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
|
@ -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 <units/isq/si/area.h>
|
||||
#include <units/isq/si/hep/area.h>
|
||||
#include <units/isq/si/hep/energy.h>
|
||||
#include <units/isq/si/hep/mass.h>
|
||||
#include <units/isq/si/hep/momentum.h>
|
||||
#include <units/isq/si/length.h>
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace units::isq;
|
||||
|
||||
template<units::Quantity Q>
|
||||
inline constexpr units::ratio quantity_ratio = units::as_ratio(units::detail::quantity_magnitude<Q>);
|
||||
|
||||
static_assert(quantity_ratio<si::length<si::metre>> == units::ratio(1));
|
||||
|
||||
// mass
|
||||
static_assert(si::hep::mass<si::hep::eV_per_c2>(1'000) == si::hep::mass<si::hep::keV_per_c2>(1));
|
||||
static_assert(si::hep::mass<si::hep::eV_per_c2>(1'000) == si::mass<si::hep::keV_per_c2>(1));
|
||||
static_assert(si::mass<si::hep::eV_per_c2>(1'000) == si::hep::mass<si::hep::keV_per_c2>(1));
|
||||
|
||||
// momentum
|
||||
static_assert(si::hep::momentum<si::hep::eV_per_c>(1'000'000) == si::hep::momentum<si::hep::MeV_per_c>(1));
|
||||
|
||||
// area
|
||||
static_assert(si::area<si::hep::barn>(1e28) == si::area<si::square_metre>(1));
|
||||
// static_assert(si::area<si::hep::barn>(1) == si::area<si::square_metre>(1e-28)); // numeric rounding issues on some
|
||||
// platforms
|
||||
|
||||
|
||||
namespace hep_literal_test {
|
||||
|
||||
using namespace units::isq::si::hep::literals;
|
||||
|
||||
static_assert(si::hep::energy<si::hep::eV>(1'000) == 1_q_keV);
|
||||
static_assert(si::hep::energy<si::hep::eV>(1'000'000) == 1_q_MeV);
|
||||
|
||||
static_assert(si::hep::mass<si::hep::eV_per_c2>(1'000) == 1_q_keV_per_c2);
|
||||
static_assert(si::hep::mass<si::hep::eV_per_c2>(1'000'000) == 1_q_MeV_per_c2);
|
||||
|
||||
static_assert(si::hep::momentum<si::hep::eV_per_c>(1'000) == 1_q_keV_per_c);
|
||||
static_assert(si::hep::momentum<si::hep::eV_per_c>(1'000'000) == 1_q_MeV_per_c);
|
||||
|
||||
// static_assert(si::area<si::square_metre, long double>(1e-28L) == 1_q_b); // numeric rounding issues on some platforms
|
||||
// static_assert(si::hep::area<si::square_yoctometre, long double>(1e-4L) == 1_q_b); // numeric rounding issues on some
|
||||
// platforms
|
||||
static_assert(si::area<si::square_metre>(1e-43) == 1_q_fb);
|
||||
|
||||
} // namespace hep_literal_test
|
||||
|
||||
} // namespace
|
@ -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 <units/isq/si/international/length.h>
|
||||
#include <units/isq/si/international/speed.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
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
|
121
test/unit_test/static/usc_test.cpp
Normal file
121
test/unit_test/static/usc_test.cpp
Normal file
@ -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 <units/isq/space_and_time.h>
|
||||
#include <units/si/unit_symbols.h>
|
||||
#include <units/usc/usc.h>
|
||||
|
||||
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<si::metre>](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<survey1893::us_survey_foot>](1) == isq::area[square<inch>](144));
|
||||
static_assert(isq::area[square<survey1893::chain>](1) == isq::area[square<survey1893::us_survey_foot>](4356));
|
||||
static_assert(isq::area[acre](1) == isq::area[square<survey1893::us_survey_foot>](43560));
|
||||
static_assert(isq::area[section](1) == isq::area[square<survey1893::us_survey_mile>](1));
|
||||
|
||||
// Volume
|
||||
static_assert(isq::volume[cubic<foot>](1) == isq::volume[cubic<inch>](1'728));
|
||||
static_assert(isq::volume[cubic<yard>](1) == isq::volume[cubic<foot>](27));
|
||||
static_assert(isq::volume[acre * survey1893::us_survey_foot](1) ==
|
||||
isq::volume[cubic<survey1893::us_survey_foot>](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<inch>](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
|
Reference in New Issue
Block a user