feat: quantity aliases support addded

This commit is contained in:
Mateusz Pusz
2021-04-15 19:13:25 +02:00
parent 813197021f
commit 70bff31d06
116 changed files with 2956 additions and 742 deletions

View File

@ -12,6 +12,7 @@
- refactor: `abs()` definition refactored to be more explicit about the return type - refactor: `abs()` definition refactored to be more explicit about the return type
- feat: quantity (point) kind support added (thanks [@johelegp](https://github.com/johelegp)) - feat: quantity (point) kind support added (thanks [@johelegp](https://github.com/johelegp))
- feat: quantity references support added (thanks [@johelegp](https://github.com/johelegp)) - feat: quantity references support added (thanks [@johelegp](https://github.com/johelegp))
- feat: quantity aliases support addded
- feat: interoperability with `std::chrono::duration` and other units libraries - feat: interoperability with `std::chrono::duration` and other units libraries
- feat: CTAD for dimensionless quantity added - feat: CTAD for dimensionless quantity added
- feat: `modulation_rate` support added (thanks [@go2sh](https://github.com/go2sh)) - feat: `modulation_rate` support added (thanks [@go2sh](https://github.com/go2sh))

View File

@ -101,4 +101,5 @@ QUIET = YES
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = UNITS_REFERENCES \ PREDEFINED = UNITS_REFERENCES \
UNITS_LITERALS UNITS_LITERALS \
UNITS_ALIASES

View File

@ -39,7 +39,7 @@ if(NOT UNITS_LIBCXX)
add_subdirectory(glide_computer) add_subdirectory(glide_computer)
endif() endif()
add_subdirectory(alternative_namespaces) add_subdirectory(aliases)
add_subdirectory(kalman_filter) add_subdirectory(kalman_filter)
add_subdirectory(literals) add_subdirectory(literals)
add_subdirectory(references) add_subdirectory(references)

View File

@ -0,0 +1,51 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.2)
#
# add_example(target <depependencies>...)
#
function(add_example target)
add_executable(${target}-aliases ${target}.cpp)
target_link_libraries(${target}-aliases PRIVATE ${ARGN})
target_compile_definitions(${target}-aliases PRIVATE UNITS_ALIASES)
endfunction()
add_example(avg_speed mp-units::core-io mp-units::si mp-units::si-cgs mp-units::si-international)
add_example(box_example mp-units::core-fmt mp-units::si)
add_example(capacitor_time_curve mp-units::core-io mp-units::si)
add_example(clcpp_response mp-units::core-fmt mp-units::core-io mp-units::si mp-units::si-iau mp-units::si-imperial mp-units::si-international mp-units::si-typographic mp-units::si-us)
add_example(experimental_angle mp-units::core-fmt mp-units::core-io mp-units::si)
add_example(foot_pound_second mp-units::core-fmt mp-units::si-fps)
add_example(measurement mp-units::core-io mp-units::si)
add_example(total_energy mp-units::core-io mp-units::si mp-units::isq-natural)
add_example(unknown_dimension mp-units::core-io mp-units::si)
if(NOT UNITS_LIBCXX)
add_example(glide_computer_example mp-units::core-fmt mp-units::si-international glide_computer)
target_compile_definitions(glide_computer_example-aliases PRIVATE UNITS_REFERENCES)
find_package(linear_algebra CONFIG REQUIRED)
add_example(linear_algebra mp-units::core-fmt mp-units::core-io mp-units::si)
target_link_libraries(linear_algebra-aliases PRIVATE linear_algebra::linear_algebra)
endif()

View File

@ -0,0 +1,197 @@
// 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/cgs/length.h>
#include <units/isq/si/cgs/speed.h> // IWYU pragma: keep
#include <units/isq/si/international/length.h>
#include <units/isq/si/international/speed.h> // IWYU pragma: keep
#include <units/isq/si/length.h> // IWYU pragma: keep
#include <units/isq/si/time.h>
#include <units/isq/si/speed.h>
#include <units/quantity_io.h>
#include <exception>
#include <iostream>
namespace {
using namespace units::isq;
constexpr si::speed<si::metre_per_second, int>
fixed_int_si_avg_speed(si::length<si::metre, int> d,
si::time<si::second, int> t)
{
return d / t;
}
constexpr si::speed<si::metre_per_second>
fixed_double_si_avg_speed(si::length<si::metre> d,
si::time<si::second> t)
{
return d / t;
}
template<typename U1, typename R1, typename U2, typename R2>
constexpr Speed auto si_avg_speed(si::length<U1, R1> d,
si::time<U2, R2> t)
{
return d / t;
}
constexpr Speed auto avg_speed(Length auto d, Time auto t)
{
return d / t;
}
template<Length D, Time T, Speed V>
void print_result(D distance, T duration, V speed)
{
const auto result_in_kmph = units::quantity_cast<si::speed<si::kilometre_per_hour>>(speed);
std::cout << "Average speed of a car that makes " << distance << " in "
<< duration << " is " << result_in_kmph << ".\n";
}
void example()
{
// SI (int)
{
using namespace units::aliases::isq::si;
constexpr auto distance = km<int>(220);
constexpr auto duration = h<int>(2);
std::cout << "SI units with 'int' as representation\n";
print_result(distance, duration, fixed_int_si_avg_speed(distance, duration));
print_result(distance, duration, fixed_double_si_avg_speed(distance, duration));
print_result(distance, duration, si_avg_speed(distance, duration));
print_result(distance, duration, avg_speed(distance, duration));
}
// SI (double)
{
using namespace units::aliases::isq::si;
constexpr auto distance = km<double>(220.);
constexpr auto duration = h<double>(2.);
std::cout << "\nSI units with 'double' as representation\n";
// conversion from a floating-point to an integral type is a truncating one so an explicit cast is needed
print_result(distance, duration, fixed_int_si_avg_speed(quantity_cast<int>(distance), quantity_cast<int>(duration)));
print_result(distance, duration, fixed_double_si_avg_speed(distance, duration));
print_result(distance, duration, si_avg_speed(distance, duration));
print_result(distance, duration, avg_speed(distance, duration));
}
// Customary Units (int)
{
using namespace units::aliases::isq::si::international;
using namespace units::aliases::isq::si;
constexpr auto distance = mi<int>(140);
constexpr auto duration = h<int>(2);
std::cout << "\nUS Customary Units with 'int' as representation\n";
// it is not possible to make a lossless conversion of miles to meters on an integral type
// (explicit cast needed)
print_result(distance, duration, fixed_int_si_avg_speed(quantity_cast<si::metre>(distance), duration));
print_result(distance, duration, fixed_double_si_avg_speed(distance, duration));
print_result(distance, duration, si_avg_speed(distance, duration));
print_result(distance, duration, avg_speed(distance, duration));
}
// Customary Units (double)
{
using namespace units::aliases::isq::si::international;
using namespace units::aliases::isq::si;
constexpr auto distance = mi<double>(140.);
constexpr auto duration = h<double>(2.);
std::cout << "\nUS Customary Units with 'double' as representation\n";
// conversion from a floating-point to an integral type is a truncating one so an explicit cast is needed
// also it is not possible to make a lossless conversion of miles to meters on an integral type
// (explicit cast needed)
print_result(distance, duration, fixed_int_si_avg_speed(quantity_cast<si::length<si::metre, int>>(distance), quantity_cast<int>(duration)));
print_result(distance, duration, fixed_double_si_avg_speed(distance, duration));
print_result(distance, duration, si_avg_speed(distance, duration));
print_result(distance, duration, avg_speed(distance, duration));
}
// CGS (int)
{
using namespace units::aliases::isq::si::cgs;
using namespace units::aliases::isq::si::time;
constexpr auto distance = cm<int>(22'000'000);
constexpr auto duration = h<int>(2);
std::cout << "\nCGS units with 'int' as representation\n";
// it is not possible to make a lossless conversion of centimeters to meters on an integral type
// (explicit cast needed)
print_result(distance, duration, fixed_int_si_avg_speed(quantity_cast<si::metre>(distance), duration));
print_result(distance, duration, fixed_double_si_avg_speed(distance, duration));
// not possible to convert both a dimension and a unit with implicit cast
print_result(distance, duration, si_avg_speed(quantity_cast<si::dim_length>(distance), duration));
print_result(distance, duration, avg_speed(distance, duration));
}
// CGS (double)
{
using namespace units::aliases::isq::si::cgs;
using namespace units::aliases::isq::si::time;
constexpr auto distance = cm<double>(22'000'000.);
constexpr auto duration = h<double>(2.);
std::cout << "\nCGS units with 'double' as representation\n";
// conversion from a floating-point to an integral type is a truncating one so an explicit cast is needed
// it is not possible to make a lossless conversion of centimeters to meters on an integral type
// (explicit cast needed)
print_result(distance, duration, fixed_int_si_avg_speed(quantity_cast<si::length<si::metre, int>>(distance), quantity_cast<int>(duration)));
print_result(distance, duration, fixed_double_si_avg_speed(distance, duration));
// not possible to convert both a dimension and a unit with implicit cast
print_result(distance, duration, si_avg_speed(quantity_cast<si::dim_length>(distance), duration));
print_result(distance, duration, avg_speed(distance, duration));
}
}
} // namespace
int main()
{
try {
example();
}
catch (const std::exception& ex) {
std::cerr << "Unhandled std exception caught: " << ex.what() << '\n';
}
catch (...) {
std::cerr << "Unhandled unknown exception caught\n";
}
}

View File

@ -0,0 +1,105 @@
// 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/generic/dimensionless.h>
#include <units/isq/si/amount_of_substance.h>
#include <units/isq/si/area.h>
#include <units/isq/si/constants.h>
#include <units/isq/si/density.h>
#include <units/isq/si/force.h>
#include <units/isq/si/length.h>
#include <units/isq/si/mass.h>
#include <units/isq/si/speed.h> // IWYU pragma: keep
#include <units/isq/si/time.h>
#include <units/isq/si/volume.h>
#include <cassert>
#include <iostream>
#include <utility>
namespace {
using namespace units::aliases::isq::si;
inline constexpr auto g = units::isq::si::si2019::standard_gravity<>;
inline constexpr auto air_density = kg_per_m3<>(1.225);
class Box {
area::m2<> base_;
length::m<> height_;
density::kg_per_m3<> density_ = air_density;
public:
constexpr Box(const length::m<>& length, const length::m<>& width, length::m<> height): base_(length * width), height_(std::move(height)) {}
[[nodiscard]] constexpr force::N<> filled_weight() const
{
const volume::m3<> volume = base_ * height_;
const mass::kg<> mass = density_ * volume;
return mass * g;
}
[[nodiscard]] constexpr length::m<> fill_level(const mass::kg<>& measured_mass) const
{
return height_ * measured_mass * g / filled_weight();
}
[[nodiscard]] constexpr volume::m3<> spare_capacity(const mass::kg<>& measured_mass) const
{
return (height_ - fill_level(measured_mass)) * base_;
}
constexpr void set_contents_density(const density::kg_per_m3<>& density_in)
{
assert(density_in > air_density);
density_ = density_in;
}
};
} // namespace
int main()
{
using namespace units;
using namespace units::isq;
const length::m<> height(mm<>(200.0));
auto box = Box(mm<>(1000.0), mm<>(500.0), height);
box.set_contents_density(kg_per_m3<>(1000.0));
const auto fill_time = s<>(200.0); // time since starting fill
const auto measured_mass = kg<>(20.0); // measured mass at fill_time
const Length auto fill_level = box.fill_level(measured_mass);
const Dimensionless auto fill_percent = quantity_cast<percent>(fill_level / height);
const Volume auto spare_capacity = box.spare_capacity(measured_mass);
const auto input_flow_rate = measured_mass / fill_time; // unknown dimension
const Speed auto float_rise_rate = fill_level / fill_time;
const Time auto fill_time_left = (height / fill_level - 1) * fill_time;
std::cout << "mp-units box example...\n";
std::cout << fmt::format("fill height at {} = {} ({} full)\n", fill_time, fill_level, fill_percent);
std::cout << fmt::format("spare_capacity at {} = {}\n", fill_time, spare_capacity);
std::cout << fmt::format("input flow rate after {} = {}\n", fill_time, input_flow_rate);
std::cout << fmt::format("float rise rate = {}\n", float_rise_rate);
std::cout << fmt::format("box full E.T.A. at current flow rate = {}\n", fill_time_left);
}

View File

@ -20,42 +20,44 @@
physical_quantities physical_quantities
*/ */
#include <units/generic/dimensionless.h>
#include <units/isq/dimensions/electric_current.h>
#include <units/isq/si/capacitance.h> #include <units/isq/si/capacitance.h>
#include <units/isq/si/resistance.h> #include <units/isq/si/resistance.h>
#include <units/isq/si/time.h> #include <units/isq/si/time.h>
#include <units/math.h> #include <units/isq/si/voltage.h>
#include <units/math.h> // IWYU pragma: keep
#include <units/quantity_io.h> #include <units/quantity_io.h>
#include "./voltage.h"
#include <iostream> #include <iostream>
using namespace units::experimental;
using namespace units::isq::si::literals;
int main() int main()
{ {
std::cout << "mpusz/units capacitor time curve example...\n"; using namespace units::isq;
using namespace units::aliases::isq::si;
std::cout << "mp-units capacitor time curve example...\n";
std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield); std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
std::cout.precision(3); std::cout.precision(3);
constexpr auto C = 0.47_q_uF; constexpr auto C = capacitance::uF<>(0.47);
constexpr auto V0 = 5.0_q_V; constexpr auto V0 = voltage::V<>(5.0);
constexpr auto R = 4.7_q_kR; constexpr auto R = resistance::kR<>(4.7);
for (auto t = 0_q_ms; t <= 50_q_ms; ++t) { for (auto t = ms<int>(0); t <= ms<int>(50); ++t) {
const auto Vt = V0 * units::exp(-t / (R * C)); const Voltage auto Vt = V0 * units::exp(-t / (R * C));
std::cout << "at " << t << " voltage is "; std::cout << "at " << t << " voltage is ";
if (Vt >= 1_q_V) if (Vt >= V<>(1))
std::cout << Vt; std::cout << Vt;
else if (Vt >= 1_q_mV) else if (Vt >= mV<>(1))
std::cout << voltage::mV<>{Vt}; std::cout << mV<>(Vt);
else if (Vt >= 1_q_uV) else if (Vt >= uV<>(1))
std::cout << voltage::uV<>{Vt}; std::cout << uV<>(Vt);
else if (Vt >= 1_q_nV) else if (Vt >= nV<>(1))
std::cout << voltage::nV<>{Vt}; std::cout << nV<>(Vt);
else else
std::cout << voltage::pV<>{Vt}; std::cout << pV<>(Vt);
std::cout << "\n"; std::cout << "\n";
} }
} }

View File

@ -0,0 +1,151 @@
/*
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/isq/si/area.h>
#include <units/isq/si/iau/length.h>
#include <units/isq/si/imperial/length.h>
#include <units/isq/si/international/length.h>
#include <units/isq/si/length.h>
#include <units/isq/si/time.h>
#include <units/isq/si/typographic/length.h>
#include <units/isq/si/us/length.h>
#include <units/quantity_io.h>
#include <iostream>
namespace {
using namespace units;
void simple_quantities()
{
using namespace units::aliases::isq;
using namespace units::aliases::isq::si;
using namespace units::aliases::isq::si::international;
using distance = si::length::m<>;
using duration = time::s<>;
constexpr distance km = si::length::km<>(1.0);
constexpr distance miles = mi<>(1.0);
constexpr duration sec = s<>(1);
constexpr duration min = time::min<>(1);
constexpr duration hr = h<>(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::aliases::isq;
using namespace units::aliases::isq::si;
using namespace units::aliases::isq::si::international;
constexpr si::length::km<> km = si::km<>(1.0);
constexpr si::international::length::mi<> miles = mi<>(1.0);
std::cout.precision(6);
constexpr time::s<> sec = s<>(1);
constexpr time::min<> min = si::min<>(1);
constexpr time::h<> hr = h<>(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 si::length::m<> meter = m<>(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 << " = " << au<>(meter) << '\n';
std::cout << " = " << iau::angstrom<>(meter) << '\n';
std::cout << " = " << imperial::ch<>(meter) << '\n';
std::cout << " = " << international::fathom<>(meter) << '\n';
std::cout << " = " << quantity_cast<units::isq::si::us::fathom>(meter) << '\n'; // `us` system namespace collides with a microsecond (si::time::us)
std::cout << " = " << international::ft<>(meter) << '\n';
std::cout << " = " << quantity_cast<units::isq::si::us::foot>(meter) << '\n'; // `us` system namespace collides with a microsecond (si::time::us)
std::cout << " = " << international::in<>(meter) << '\n';
std::cout << " = " << iau::ly<>(meter) << '\n';
std::cout << " = " << international::mi<>(meter) << '\n';
std::cout << " = " << international::mi_naut<>(meter) << '\n';
std::cout << " = " << iau::pc<>(meter) << '\n';
std::cout << " = " << typographic::pica_comp<>(meter) << '\n';
std::cout << " = " << typographic::pica_prn<>(meter) << '\n';
std::cout << " = " << typographic::point_comp<>(meter) << '\n';
std::cout << " = " << typographic::point_prn<>(meter) << '\n';
std::cout << " = " << imperial::rd<>(meter) << '\n';
std::cout << " = " << international::yd<>(meter) << '\n';
}
void calcs_comparison()
{
using namespace units::aliases::isq::si;
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";
length::fm<float> L1A = fm<>(2.f);
length::fm<float> L2A = fm<>(3.f);
length::fm<float> LrA = L1A + L2A;
fmt::print("{:%.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";
length::m<float> L1B = L1A;
length::m<float> L2B = L2A;
length::m<float> LrB = L1B + L2B;
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, LrB);
std::cout << "In multiplication and division:\n\n";
area::fm2<float> ArA = L1A * L2A;
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, ArA);
std::cout << "similar problems arise\n\n";
area::m2<float> ArB = L1B * L2B;
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %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 << "http://compgroups.net/comp.lang.c++.moderated/dimensional-analysis-units/51712\n";
std::cout << "Here converted to use mp-units library.\n\n";
simple_quantities();
quantities_with_typed_units();
calcs_comparison();
}

View File

@ -0,0 +1,40 @@
// 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/generic/angle.h>
#include <units/isq/si/energy.h>
#include <units/isq/si/torque.h>
#include <units/quantity_io.h>
#include <iostream>
int main()
{
using namespace units::isq;
using namespace units::aliases::isq::si;
const auto torque = N_m_per_rad<>(20.0);
const auto energy = J<>(20.0);
units::Angle auto angle = energy / torque;
std::cout << angle << '\n';
}

View 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.
#include <units/format.h>
#include <units/isq/si/fps/density.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/speed.h>
#include <units/isq/si/length.h>
#include <units/isq/si/mass.h>
#include <units/isq/si/power.h>
#include <units/isq/si/speed.h>
#include <units/isq/si/volume.h>
#include <iostream>
#include <string_view>
using namespace units::aliases::isq;
// Some basic specs for the warship
struct Ship {
si::fps::length::ft<> length;
si::fps::length::ft<> draft;
si::fps::length::ft<> beam;
si::fps::speed::ft_per_s<> speed;
si::fps::mass::lb<> mass;
si::fps::length::in<> mainGuns;
si::fps::mass::lb<> shellMass;
si::fps::speed::ft_per_s<> shellSpeed;
si::fps::power::ft_pdl_per_s<> power;
};
// Print 'a' in its current units and print its value cast to the units in each of Args
template<class ...Args, units::Quantity Q>
auto fmt_line(const Q a)
{
return fmt::format("{:22}", a) + (fmt::format(",{:20}", units::quantity_cast<Args>(a)) + ...);
}
// 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 = si::fps::density::lb_per_ft3<>(62.4);
std::cout << fmt::format("{}\n", description);
std::cout << fmt::format("{:20} : {}\n", "length", fmt_line<si::fps::length::yd<>, si::length::m<>>(ship.length))
<< fmt::format("{:20} : {}\n", "draft", fmt_line<si::fps::length::yd<>, si::length::m<>>(ship.draft))
<< fmt::format("{:20} : {}\n", "beam", fmt_line<si::fps::length::yd<>, si::length::m<>>(ship.beam))
<< fmt::format("{:20} : {}\n", "mass", fmt_line<si::fps::mass::lton<>, si::mass::t<>>(ship.mass))
<< fmt::format("{:20} : {}\n", "speed", fmt_line<si::fps::speed::knot<>, si::speed::km_per_h<>>(ship.speed))
<< fmt::format("{:20} : {}\n", "power", fmt_line<si::fps::power::hp<>, si::power::kW<>>(ship.power))
<< fmt::format("{:20} : {}\n", "main guns", fmt_line<si::fps::length::in<>, si::length::mm<>>(ship.mainGuns))
<< fmt::format("{:20} : {}\n", "fire shells weighing",fmt_line<si::fps::mass::lton<>, si::mass::kg<>>(ship.shellMass))
<< fmt::format("{:20} : {}\n", "fire shells at",fmt_line<si::fps::speed::mph<>, si::speed::km_per_h<>>(ship.shellSpeed))
<< fmt::format("{:20} : {}\n", "volume underwater", fmt_line<si::volume::m3<>, si::volume::l<>>(ship.mass / waterDensity));
}
int main()
{
using namespace units::aliases::isq::si;
using namespace units::aliases::isq::si::fps;
using units::aliases::isq::si::fps::length::ft; // to disambiguate from si::femptotonne
// KMS Bismark, using the units the Germans would use, taken from Wiki
auto bismark = Ship{.length{m<>(251.)}, .draft{m<>(9.3)}, .beam{m<>(36)}, .speed{km_per_h<>(56)}, .mass{t<>(50'300)}, .mainGuns{mm<>(380)}, .shellMass{kg<>(800)}, .shellSpeed{m_per_s<>(820.)}, .power{kW<>(110.45)}};
// USS Iowa, using units from the foot-pound-second system
auto iowa = Ship{.length{ft<>(860.)}, .draft{ft<>(37.) + in<>(2.)}, .beam{ft<>(108.) + in<>(2.)}, .speed{knot<>(33)}, .mass{lton<>(57'540)}, .mainGuns{in<>(16)}, .shellMass{lb<>(2700)}, .shellSpeed{ft_per_s<>(2690.)}, .power{hp<>(212'000)}};
// HMS King George V, using units from the foot-pound-second system
auto kgv = Ship{.length{ft<>(745.1)}, .draft{ft<>(33.) + in<>(7.5)}, .beam{ft<>(103.2) + in<>(2.5)}, .speed{knot<>(28.3)}, .mass{lton<>(42'245)}, .mainGuns{in<>(14)}, .shellMass{lb<>(1'590)}, .shellSpeed{ft_per_s<>(2483)}, .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);
}

View File

@ -0,0 +1,202 @@
// 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 "glide_computer.h"
#include <units/bits/external/hacks.h>
#include <units/chrono.h>
#include <units/generic/dimensionless.h>
#include <units/isq/si/international/length.h>
UNITS_DIAGNOSTIC_PUSH
UNITS_DIAGNOSTIC_IGNORE_UNREACHABLE
#include <fmt/format.h>
UNITS_DIAGNOSTIC_POP
#include <array>
#include <exception>
#include <iostream>
#include <iterator>
#include <string>
#include <utility>
#include <vector>
namespace {
using namespace glide_computer;
using namespace units::isq;
auto get_gliders()
{
using namespace units::aliases::isq::si;
UNITS_DIAGNOSTIC_PUSH
UNITS_DIAGNOSTIC_IGNORE_MISSING_BRACES
static const std::array gliders = {
glider{"SZD-30 Pirat", {velocity(km_per_h<>(83)), rate_of_climb(m_per_s<>(-0.7389))}},
glider{"SZD-51 Junior", {velocity(km_per_h<>(80)), rate_of_climb(m_per_s<>(-0.6349))}},
glider{"SZD-48 Jantar Std 3", {velocity(km_per_h<>(110)), rate_of_climb(m_per_s<>(-0.77355))}},
glider{"SZD-56 Diana", {velocity(km_per_h<>(110)), rate_of_climb(m_per_s<>(-0.63657))}}};
UNITS_DIAGNOSTIC_POP
return gliders;
}
auto get_weather_conditions()
{
using namespace units::aliases::isq::si;
static const std::array weather_conditions = {
std::pair("Good", weather{height(m<>(1900)), rate_of_climb(m_per_s<>(4.3))}),
std::pair("Medium", weather{height(m<>(1550)), rate_of_climb(m_per_s<>(2.8))}),
std::pair("Bad", weather{height(m<>(850)), rate_of_climb(m_per_s<>(1.8))})};
return weather_conditions;
}
auto get_waypoints()
{
using namespace geographic::literals;
using namespace units::aliases::isq::si::international;
static const std::array waypoints = {
waypoint{"EPPR", {54.24772_N, 18.6745_E}, altitude(ft<>(16))}, // N54°14'51.8" E18°40'28.2"
waypoint{"EPGI", {53.52442_N, 18.84947_E}, altitude(ft<>(115))} // N53°31'27.9" E18°50'58.1"
};
return waypoints;
}
template<std::ranges::forward_range R>
requires std::same_as<std::ranges::range_value_t<R>, glider>
void print(const R& gliders)
{
std::cout << "Gliders:\n";
std::cout << "========\n";
for (const auto& g : gliders) {
std::cout << "- Name: " << g.name << "\n";
std::cout << "- Polar:\n";
for (const auto& p : g.polar)
fmt::print(" * {:%.4Q %q} @ {:%.1Q %q} -> {:%.1Q %q}\n", p.climb, p.v, units::quantity_cast<units::one>(glide_ratio(g.polar[0])));
std::cout << "\n";
}
}
template<std::ranges::forward_range R>
requires std::same_as<std::ranges::range_value_t<R>, std::pair<const char*, weather>>
void print(const R& conditions)
{
std::cout << "Weather:\n";
std::cout << "========\n";
for (const auto& c : conditions) {
std::cout << "- " << c.first << "\n";
const auto& w = c.second;
std::cout << " * Cloud base: " << fmt::format("{:%.0Q %q}", w.cloud_base) << " AGL\n";
std::cout << " * Thermals strength: " << fmt::format("{:%.1Q %q}", w.thermal_strength) << "\n";
std::cout << "\n";
}
}
template<std::ranges::forward_range R>
requires std::same_as<std::ranges::range_value_t<R>, waypoint>
void print(const R& waypoints)
{
std::cout << "Waypoints:\n";
std::cout << "==========\n";
for (const auto& w : waypoints)
std::cout << fmt::format("- {}: {} {}, {:%.1Q %q}\n", w.name, w.pos.lat, w.pos.lon, w.alt);
std::cout << "\n";
}
void print(const task& t)
{
std::cout << "Task:\n";
std::cout << "=====\n";
std::cout << "- Start: " << t.get_start().name << "\n";
std::cout << "- Finish: " << t.get_finish().name << "\n";
std::cout << "- Length: " << fmt::format("{:%.1Q %q}", t.get_length()) << "\n";
std::cout << "- Legs: " << "\n";
for (const auto& l : t.get_legs())
std::cout << fmt::format(" * {} -> {} ({:%.1Q %q})\n", l.begin().name, l.end().name, l.get_length());
std::cout << "\n";
}
void print(const safety& s)
{
std::cout << "Safety:\n";
std::cout << "=======\n";
std::cout << "- Min AGL separation: " << fmt::format("{:%.0Q %q}", s.min_agl_height) << "\n";
std::cout << "\n";
}
void print(const aircraft_tow& tow)
{
std::cout << "Tow:\n";
std::cout << "====\n";
std::cout << "- Type: aircraft\n";
std::cout << "- Height: " << fmt::format("{:%.0Q %q}", tow.height_agl) << "\n";
std::cout << "- Performance: " << fmt::format("{:%.1Q %q}", tow.performance) << "\n";
std::cout << "\n";
}
void example()
{
using namespace units::aliases::isq::si;
const safety sfty = {height(m<>(300))};
const auto gliders = get_gliders();
const auto waypoints = get_waypoints();
const auto weather_conditions = get_weather_conditions();
const task t = {waypoints[0], waypoints[1], waypoints[0]};
const aircraft_tow tow = {height(m<>(400)), rate_of_climb(m_per_s<>(1.6))};
// TODO use C++20 date library when available
// set `start_time` to 11:00 am today
const timestamp start_time(std::chrono::system_clock::now());
print(sfty);
print(gliders);
print(waypoints);
print(weather_conditions);
print(t);
print(tow);
for (const auto& g : gliders) {
for (const auto& c : weather_conditions) {
std::string txt = "Scenario: Glider = " + g.name + ", Weather = " + c.first;
std::cout << txt << "\n";
fmt::print("{0:=^{1}}\n\n", "", txt.size());
estimate(start_time, g, c.second, t, sfty, tow);
std::cout << "\n\n";
}
}
}
} // namespace
int main()
{
try {
example();
} catch (const std::exception& ex) {
std::cerr << "Unhandled std exception caught: " << ex.what() << '\n';
} catch (...) {
std::cerr << "Unhandled unknown exception caught\n";
}
}

View File

@ -0,0 +1,362 @@
// 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/energy.h> // IWYU pragma: keep
#include <units/isq/si/force.h>
#include <units/isq/si/length.h>
#include <units/isq/si/speed.h> // IWYU pragma: keep
#include <units/format.h>
#include <units/quantity_io.h>
#include <linear_algebra.hpp>
#include <iostream>
namespace STD_LA {
template<class ET, class OT>
std::ostream& operator<<(std::ostream& os, const vector<ET, OT>& v)
{
os << "|";
for (auto i = 0U; i < v.size(); ++i) {
os << fmt::format(" {:>9}", v(i));
}
os << " |";
return os;
}
template<class ET, class OT>
std::ostream& operator<<(std::ostream& os, const matrix<ET, OT>& v)
{
for (auto i = 0U; i < v.rows(); ++i) {
os << "|";
for (auto j = 0U; j < v.columns(); ++j) {
os << fmt::format(" {:>9}", v(i, j));
}
os << (i != v.rows() - 1U ? " |\n" : " |");
}
return os;
}
} // namespace STD_LA
namespace {
using namespace units::aliases::isq::si;
template<typename Rep = double>
using vector = std::math::fs_vector<Rep, 3>;
template<typename Rep = double>
using matrix = std::math::fs_matrix<Rep, 3, 3>;
void vector_of_quantity_add()
{
std::cout << "\nvector_of_quantity_add:\n";
vector<length::m<>> v = { m<>(1), m<>(2), m<>(3) };
vector<length::m<>> u = { m<>(3), m<>(2), m<>(1) };
vector<length::km<>> t = { km<>(3), km<>(2), km<>(1) };
std::cout << "v = " << v << "\n";
std::cout << "u = " << u << "\n";
std::cout << "t = " << t << "\n";
std::cout << "v + u = " << v + u << "\n";
std::cout << "v + t = " << v + t << "\n";
std::cout << "t[m] = " << vector<length::m<>>(t) << "\n";
}
void vector_of_quantity_multiply_same()
{
std::cout << "\nvector_of_quantity_multiply_same:\n";
vector<length::m<>> v = { m<>(1), m<>(2), m<>(3) };
vector<length::m<>> u = { m<>(3), m<>(2), m<>(1) };
std::cout << "v = " << v << "\n";
std::cout << "u = " << u << "\n";
std::cout << "v * u = " << v * u << "\n";
std::cout << "m<>(2) * v = " << m<>(2.) * v << "\n";
}
void vector_of_quantity_multiply_different()
{
std::cout << "\nvector_of_quantity_multiply_different:\n";
vector<force::N<>> v = { N<>(1), N<>(2), N<>(3) };
vector<length::m<>> u = { m<>(3), m<>(2), m<>(1) };
std::cout << "v = " << v << "\n";
std::cout << "u = " << u << "\n";
std::cout << "v * u = " << v * u << "\n";
std::cout << "N<>(2) * u = " << N<>(2.) * u << "\n";
std::cout << "2 * u = " << 2 * u << "\n";
}
void vector_of_quantity_divide_by_scalar()
{
std::cout << "\nvector_of_quantity_divide_by_scalar:\n";
vector<length::m<>> v = { m<>(4), m<>(8), m<>(12) };
std::cout << "v = " << v << "\n";
// TODO Uncomment when bug in the LA is fixed
// std::cout << "v / s<>(2) = " << v / s<>(2) << "\n";
// std::cout << "v / 2 = " << v / 2 << "\n";
}
void vector_of_quantity_tests()
{
vector_of_quantity_add();
vector_of_quantity_multiply_same();
vector_of_quantity_multiply_different();
vector_of_quantity_divide_by_scalar();
}
void matrix_of_quantity_add()
{
std::cout << "\nmatrix_of_quantity_add:\n";
matrix<length::m<>> v = {{ m<>(1), m<>(2), m<>(3) }, { m<>(4), m<>(5), m<>(6) }, { m<>(7), m<>(8), m<>(9) }};
matrix<length::m<>> u = {{ m<>(3), m<>(2), m<>(1) }, { m<>(3), m<>(2), m<>(1) }, { m<>(3), m<>(2), m<>(1) }};
matrix<length::mm<>> t = {{ mm<>(3), mm<>(2), mm<>(1) }, { mm<>(3), mm<>(2), mm<>(1) }, { mm<>(3), mm<>(2), mm<>(1) }};
std::cout << "v =\n" << v << "\n";
std::cout << "u =\n" << u << "\n";
std::cout << "t =\n" << t << "\n";
std::cout << "v + u =\n" << v + u << "\n";
std::cout << "v + t =\n" << v + t << "\n";
// TODO Uncomment when fixed in the LA lib
// std::cout << "v[mm] =\n" << matrix<length::mm<>>(v) << "\n";
}
void matrix_of_quantity_multiply_same()
{
std::cout << "\nmatrix_of_quantity_multiply_same:\n";
matrix<length::m<>> v = {{ m<>(1), m<>(2), m<>(3) }, { m<>(4), m<>(5), m<>(6) }, { m<>(7), m<>(8), m<>(9) }};
vector<length::m<>> u = { m<>(3), m<>(2), m<>(1) };
std::cout << "v =\n" << v << "\n";
std::cout << "u =\n" << u << "\n";
std::cout << "v * u =\n" << v * u << "\n";
std::cout << "m<>(2) * u =\n" << m<>(2.) * u << "\n";
}
void matrix_of_quantity_multiply_different()
{
std::cout << "\nmatrix_of_quantity_multiply_different:\n";
vector<force::N<>> v = { N<>(1), N<>(2), N<>(3) };
matrix<length::m<>> u = {{ m<>(1), m<>(2), m<>(3) }, { m<>(4), m<>(5), m<>(6) }, { m<>(7), m<>(8), m<>(9) }};
std::cout << "v =\n" << v << "\n";
std::cout << "u =\n" << u << "\n";
std::cout << "v * u =\n" << v * u << "\n";
std::cout << "N<>(2) * u =\n" << N<>(2.) * u << "\n";
std::cout << "2 * u =\n" << 2 * u << "\n";
}
void matrix_of_quantity_divide_by_scalar()
{
std::cout << "\nmatrix_of_quantity_divide_by_scalar:\n";
matrix<length::m<>> v = {{ m<>(2), m<>(4), m<>(6) }, { m<>(4), m<>(6), m<>(8) }, { m<>(8), m<>(4), m<>(2) }};
std::cout << "v =\n" << v << "\n";
// TODO Uncomment when bug in the LA is fixed
// std::cout << "v / s<>(2) =\n" << v / s<>(2) << "\n";
// std::cout << "v / 2 =\n" << v / 2 << "\n";
}
void matrix_of_quantity_tests()
{
matrix_of_quantity_add();
matrix_of_quantity_multiply_same();
matrix_of_quantity_multiply_different();
matrix_of_quantity_divide_by_scalar();
}
using namespace units::isq;
template<units::Unit U = si::metre, units::Representation Rep = double>
using length_v = si::length<U, vector<Rep>>;
template<units::Unit U = si::newton, units::Representation Rep = double>
using force_v = si::force<U, vector<Rep>>;
void quantity_of_vector_add()
{
std::cout << "\nquantity_of_vector_add:\n";
length_v<> v(vector<>{ 1, 2, 3 });
length_v<> u(vector<>{ 3, 2, 1 });
length_v<si::kilometre> t(vector<>{ 3, 2, 1 });
std::cout << "v = " << v << "\n";
std::cout << "u = " << u << "\n";
std::cout << "t = " << t << "\n";
std::cout << "v + u = " << v + u << "\n";
std::cout << "v + t = " << v + t << "\n";
std::cout << "t[m] = " << quantity_cast<si::metre>(t) << "\n";
}
void quantity_of_vector_multiply_same()
{
std::cout << "\nquantity_of_vector_multiply_same:\n";
length_v<> v(vector<>{ 1, 2, 3 });
length_v<> u(vector<>{ 3, 2, 1 });
std::cout << "v = " << v << "\n";
std::cout << "u = " << u << "\n";
std::cout << "v * u = " << v * u << "\n";
std::cout << "m<>(2) * v = " << m<>(2.) * v << "\n";
}
void quantity_of_vector_multiply_different()
{
std::cout << "\nquantity_of_vector_multiply_different:\n";
force_v<> v(vector<>{ 1, 2, 3 });
length_v<> u(vector<>{ 3, 2, 1 });
std::cout << "v = " << v << "\n";
std::cout << "u = " << u << "\n";
std::cout << "v * u = " << v * u << "\n";
std::cout << "N<>(2) * u = " << N<>(2.) * u << "\n";
std::cout << "2 * u = " << 2 * u << "\n";
}
void quantity_of_vector_divide_by_scalar()
{
std::cout << "\nquantity_of_vector_divide_by_scalar:\n";
length_v<> v(vector<>{ 4, 8, 12 });
std::cout << "v = " << v << "\n";
// TODO Uncomment when bug in the LA is fixed
// std::cout << "v / s<>(2) = " << v / s<>(2) << "\n";
// std::cout << "v / 2 = " << v / 2 << "\n";
}
void quantity_of_vector_tests()
{
quantity_of_vector_add();
quantity_of_vector_multiply_same();
quantity_of_vector_multiply_different();
quantity_of_vector_divide_by_scalar();
}
template<units::Unit U = si::metre, units::Representation Rep = double>
using length_m = si::length<U, matrix<Rep>>;
void quantity_of_matrix_add()
{
std::cout << "\nquantity_of_matrix_add:\n";
length_m<> v(matrix<>{{ 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }});
length_m<> u(matrix<>{{ 3, 2, 1 }, { 3, 2, 1 }, { 3, 2, 1 }});
length_m<si::kilometre> t(matrix<>{{ 3, 2, 1 }, { 3, 2, 1 }, { 3, 2, 1 }});
std::cout << "v =\n" << v << "\n";
std::cout << "u =\n" << u << "\n";
std::cout << "t =\n" << t << "\n";
std::cout << "v + u =\n" << v + u << "\n";
std::cout << "v + t =\n" << v + t << "\n";
// TODO Uncomment when fixed in the LA lib
// std::cout << "v[mm] =\n" << matrix<length::mm<>>(v) << "\n";
}
void quantity_of_matrix_multiply_same()
{
std::cout << "\nquantity_of_matrix_multiply_same:\n";
length_m<> v(matrix<>{{ 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }});
length_v<> u(vector<>{ 3, 2, 1 });
std::cout << "v =\n" << v << "\n";
std::cout << "u =\n" << u << "\n";
std::cout << "v * u =\n" << v * u << "\n";
std::cout << "m<>(2) * u =\n" << m<>(2.) * u << "\n";
}
void quantity_of_matrix_multiply_different()
{
std::cout << "\nquantity_of_matrix_multiply_different:\n";
force_v<> v(vector<>{ 1, 2, 3 });
length_m<> u(matrix<>{{ 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }});
std::cout << "v =\n" << v << "\n";
std::cout << "u =\n" << u << "\n";
std::cout << "v * u =\n" << v * u << "\n";
std::cout << "N<>(2) * u =\n" << N<>(2.) * u << "\n";
std::cout << "2 * u =\n" << 2 * u << "\n";
}
void quantity_of_matrix_divide_by_scalar()
{
std::cout << "\nquantity_of_matrix_divide_by_scalar:\n";
length_m<> v(matrix<>{{ 2, 4, 6 }, { 4, 6, 8 }, { 8, 4, 2 }});
std::cout << "v =\n" << v << "\n";
// TODO Uncomment when bug in the LA is fixed
// std::cout << "v / s<>(2) =\n" << v / s<>(2) << "\n";
// std::cout << "v / 2 =\n" << v / 2 << "\n";
}
void quantity_of_matrix_tests()
{
quantity_of_matrix_add();
quantity_of_matrix_multiply_same();
quantity_of_matrix_multiply_different();
quantity_of_matrix_divide_by_scalar();
}
} // namespace
int main()
{
vector_of_quantity_tests();
matrix_of_quantity_tests();
quantity_of_vector_tests();
quantity_of_matrix_tests();
}

View File

@ -0,0 +1,157 @@
// 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/acceleration.h>
#include <units/isq/si/length.h>
#include <units/isq/si/speed.h>
#include <units/isq/si/time.h>
#include <units/quantity_io.h>
#include <cmath>
#include <exception>
#include <iostream>
namespace {
template<class T>
class measurement {
public:
using value_type = T;
measurement() = default;
constexpr explicit measurement(const value_type& val, const value_type& err = {}) :
value_(val)
{
// it sucks that using declaration cannot be provided for a constructor initializer list
using namespace std;
uncertainty_ = abs(err);
}
constexpr const value_type& value() const { return value_; }
constexpr const value_type& uncertainty() const { return uncertainty_; }
constexpr value_type relative_uncertainty() const { return uncertainty() / value(); }
constexpr value_type lower_bound() const { return value() - uncertainty(); }
constexpr value_type upper_bound() const { return value() + uncertainty(); }
[[nodiscard]] constexpr measurement operator-() const { return measurement(-value(), uncertainty()); }
[[nodiscard]] friend constexpr measurement operator+(const measurement& lhs, const measurement& rhs)
{
using namespace std;
return measurement(lhs.value() + rhs.value(), hypot(lhs.uncertainty(), rhs.uncertainty()));
}
[[nodiscard]] friend constexpr measurement operator-(const measurement& lhs, const measurement& rhs)
{
using namespace std;
return measurement(lhs.value() - rhs.value(), hypot(lhs.uncertainty(), rhs.uncertainty()));
}
[[nodiscard]] friend constexpr measurement operator*(const measurement& lhs, const measurement& rhs)
{
const auto val = lhs.value() * rhs.value();
using namespace std;
return measurement(val, val * hypot(lhs.relative_uncertainty(), rhs.relative_uncertainty()));
}
[[nodiscard]] friend constexpr measurement operator*(const measurement& lhs, const value_type& value)
{
const auto val = lhs.value() * value;
return measurement(val, val * lhs.relative_uncertainty());
}
[[nodiscard]] friend constexpr measurement operator*(const value_type& value, const measurement& rhs)
{
const auto val = rhs.value() * value;
return measurement(val, val * rhs.relative_uncertainty());
}
[[nodiscard]] friend constexpr measurement operator/(const measurement& lhs, const measurement& rhs)
{
const auto val = lhs.value() / rhs.value();
using namespace std;
return measurement(val, val * hypot(lhs.relative_uncertainty(), rhs.relative_uncertainty()));
}
[[nodiscard]] friend constexpr measurement operator/(const measurement& lhs, const value_type& value)
{
const auto val = lhs.value() / value;
return measurement(val, val * lhs.relative_uncertainty());
}
[[nodiscard]] friend constexpr measurement operator/(const value_type& value, const measurement& rhs)
{
const auto val = value / rhs.value();
return measurement(val, val * rhs.relative_uncertainty());
}
[[nodiscard]] constexpr auto operator<=>(const measurement&) const = default;
friend std::ostream& operator<<(std::ostream& os, const measurement& v)
{
return os << v.value() << " ± " << v.uncertainty();
}
private:
value_type value_{};
value_type uncertainty_{};
};
} // namespace
namespace {
static_assert(units::Representation<measurement<double>>);
void example()
{
using namespace units::isq;
using namespace units::aliases::isq::si;
const auto a = acceleration::m_per_s2<measurement<double>>(measurement(9.8, 0.1));
const auto t = time::s<measurement<double>>(measurement(1.2, 0.1));
const Speed auto v1 = a * t;
#if UNITS_DOWNCAST_MODE == 0
std::cout << a << " * " << t << " = " << v1 << " = " << km_per_h<measurement<double>>(v1) << '\n';
#else
std::cout << a << " * " << t << " = " << v1 << " = " << km_per_h<measurement<double>>(v1) << '\n';
#endif
length::m<measurement<double>> length(measurement(123., 1.));
std::cout << "10 * " << length << " = " << 10 * length << '\n';
}
} // namespace
int main()
{
try {
example();
} catch (const std::exception& ex) {
std::cerr << "Unhandled std exception caught: " << ex.what() << '\n';
} catch (...) {
std::cerr << "Unhandled unknown exception caught\n";
}
}

View File

@ -0,0 +1,102 @@
// 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/natural/natural.h>
#include <units/isq/si/energy.h>
#include <units/isq/si/mass.h>
#include <units/isq/si/momentum.h>
#include <units/isq/si/speed.h> // IWYU pragma: keep
#include <units/isq/si/constants.h>
#include <units/math.h>
#include <units/quantity_io.h>
#include <exception>
#include <iostream>
namespace {
using namespace units::isq;
Energy auto total_energy(Momentum auto p, Mass auto m, Speed auto c)
{
return sqrt(pow<2>(p * c) + pow<2>(m * pow<2>(c)));
}
void si_example()
{
using namespace units::aliases::isq::si;
constexpr Speed auto c = units::isq::si::si2019::speed_of_light<>;
std::cout << "\n*** SI units (c = " << c << ") ***\n";
const Momentum auto p = GeV<>(4.) / c;
const Mass auto m = GeV<>(3.) / pow<2>(c);
const Energy auto E = total_energy(p, m, c);
std::cout << "[in GeV]\n"
<< "p = " << p << "\n"
<< "m = " << m << "\n"
<< "E = " << E << "\n";
const momentum::kg_m_per_s<> p_si = p;
const mass::kg<> m_si = m;
const energy::J<> E_si = total_energy(p_si, m_si, c);
std::cout << "\n[in SI units]\n"
<< "p = " << p_si << "\n"
<< "m = " << m_si << "\n"
<< "E = " << E_si << "\n";
std::cout << "\n[converted from SI units back to GeV]\n"
<< "E = " << GeV<>(E_si) << "\n";
}
void natural_example()
{
using namespace units::aliases::isq::natural;
constexpr Speed auto c = units::isq::natural::speed_of_light<>;
const momentum::GeV<> p(4);
const mass::GeV<> m(3);
const Energy auto E = total_energy(p, m, c);
std::cout << "\n*** Natural units (c = " << c << ") ***\n"
<< "p = " << p << "\n"
<< "m = " << m << "\n"
<< "E = " << E << "\n";
}
} // namespace
int main()
{
try {
si_example();
natural_example();
}
catch (const std::exception& ex) {
std::cerr << "Unhandled std exception caught: " << ex.what() << '\n';
}
catch (...) {
std::cerr << "Unhandled unknown exception caught\n";
}
}

View File

@ -0,0 +1,72 @@
// 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/length.h>
#include <units/isq/si/speed.h> // IWYU pragma: keep
#include <units/isq/si/time.h>
#include <units/quantity_io.h>
#include <exception>
#include <iostream>
namespace {
template<units::isq::Length D, units::isq::Time T>
constexpr units::isq::Speed auto avg_speed(D d, T t)
{
return d / t;
}
void example()
{
using namespace units::isq;
using namespace units::aliases::isq::si;
Length auto d1 = m<>(123);
Time auto t1 = s<>(10);
Speed auto v1 = avg_speed(d1, t1);
auto temp1 = v1 * m<>(50); // produces intermediate unknown dimension with 'unknown_coherent_unit' as its 'coherent_unit'
Speed auto v2 = temp1 / m<>(100); // back to known dimensions again
Length auto d2 = v2 * s<>(60);
std::cout << "d1 = " << d1 << '\n';
std::cout << "t1 = " << t1 << '\n';
std::cout << "v1 = " << v1 << '\n';
std::cout << "temp1 = " << temp1 << '\n';
std::cout << "v2 = " << v2 << '\n';
std::cout << "d2 = " << d2 << '\n';
}
} // namespace
int main()
{
try {
example();
}
catch (const std::exception& ex) {
std::cerr << "Unhandled std exception caught: " << ex.what() << '\n';
}
catch (...) {
std::cerr << "Unhandled unknown exception caught\n";
}
}

View File

@ -1,35 +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.2)
function(add_example target)
add_executable(${target}_alt ${target}.cpp)
target_link_libraries(${target}_alt PRIVATE mp-units::mp-units)
target_compile_definitions(${target}_alt PRIVATE UNITS_LITERALS)
endfunction()
add_example(box_example mp-units::si)
add_example(capacitor_time_curve mp-units::si)
add_example(clcpp_response mp-units::si)
add_example(conversion_factor mp-units::si)
add_example(timer mp-units::si)

View File

@ -1,19 +0,0 @@
#pragma once
#include <units/isq/si/acceleration.h>
namespace units{
namespace experimental{
namespace acceleration {
template<typename Rep = double>
using m_per_s2 = units::isq::si::acceleration<units::isq::si::metre_per_second_sq, Rep>;
template<typename Rep = double>
constexpr m_per_s2<Rep> g{static_cast<Rep>(9.80665)};
} // namespace acceleration
}} // units::experimental

View File

@ -1,14 +0,0 @@
#pragma once
#include <units/isq/si/area.h>
namespace area {
template<typename Rep = double>
using m2 = units::isq::si::area<units::isq::si::square_metre, Rep>;
template<typename Rep = double>
using fm2 = units::isq::si::area<units::isq::si::square_femtometre, Rep>;
} // namespace area

View File

@ -1,74 +0,0 @@
#include <units/quantity_io.h>
#include "./length.h"
#include "./acceleration.h"
#include "./density.h"
#include "./force.h"
#include "./mass.h"
#include "./time.h"
#include "./volume.h"
#include <cassert>
using namespace units::experimental;
struct Box {
static constexpr auto air_density = density::kg_per_m3<>{1.225};
length::m<> length;
length::m<> width;
length::m<> height;
constexpr Box(const length::m<>& l, const length::m<>& w, const length::m<>& h) : length{l}, width{w}, height{h} {}
struct contents {
density::kg_per_m3<> density = air_density;
} contents;
constexpr force::N<> filled_weight() const
{
const volume::m3<> volume = length * width * height;
const mass::kg<> mass = contents.density * volume;
return mass * acceleration::g<>;
}
constexpr length::m<> fill_level(const mass::kg<>& measured_mass) const
{
return height * (measured_mass * acceleration::g<>) / filled_weight();
}
constexpr volume::m3<> spare_capacity(const mass::kg<>& measured_mass) const
{
return (height - fill_level(measured_mass)) * width * length;
}
constexpr void set_contents_density(const density::kg_per_m3<>& density_in)
{
assert(density_in > air_density);
contents.density = density_in;
}
};
#include <iostream>
using namespace units::isq::si::literals;
int main()
{
auto box = Box{1000.0_q_mm, 500.0_q_mm, 200.0_q_mm};
box.set_contents_density(1000.0_q_kg_per_m3);
auto fill_time = 200.0_q_s; // time since starting fill
auto measured_mass = 20.0_q_kg; // measured mass at fill_time
std::cout << "mpusz/units box example ( using experimental alternative syntax for defining quantities) ...\n";
std::cout << "fill height at " << fill_time << " = " << box.fill_level(measured_mass) << " ("
<< (box.fill_level(measured_mass) / box.height) * 100 << "% full)\n";
std::cout << "spare_capacity at " << fill_time << " = " << box.spare_capacity(measured_mass) << '\n';
std::cout << "input flow rate after " << fill_time << " = " << measured_mass / fill_time << '\n';
std::cout << "float rise rate = " << box.fill_level(measured_mass) / fill_time << '\n';
auto fill_time_left = (box.height / box.fill_level(measured_mass) - 1) * fill_time;
std::cout << "box full E.T.A. at current flow rate = " << fill_time_left << '\n';
}

View File

@ -1,135 +0,0 @@
/*
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 <iostream>
#include <units/format.h>
#include <units/quantity_io.h>
#include "./length.h"
#include "./volume.h"
#include "./time.h"
#include "./area.h"
#include "./units_str.h"
using namespace units::isq::si::literals;
using namespace units::isq::si::international;
using namespace units::experimental;
void simple_quantities()
{
using distance = length::m<>;
using q_time = q_time::s<>;
constexpr distance km = 1.0_q_km;
constexpr distance miles = 1.0_q_mi;
constexpr q_time sec = 1_q_s;
constexpr q_time min = 1_q_min;
constexpr q_time hr = 1_q_h;
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()
{
constexpr length::km<> km = 1.0_q_km;
constexpr length::mi<> miles = 1.0_q_mi;
constexpr q_time::s<> sec = 1_q_s;
constexpr q_time::min<> min = 1_q_min;
constexpr q_time::h<> hr = 1_q_h;
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 length::m<> meter = 1_q_m;
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 << " = " << length::AU<>(meter) << '\n';
std::cout << " = " << length::angstrom<>(meter) << '\n';
std::cout << " = " << length::ch<>(meter) << '\n';
std::cout << " = " << length::fathom<>(meter) << '\n';
std::cout << " = " << length::fathom_us<>(meter) << '\n';
std::cout << " = " << length::ft<>(meter) << '\n';
std::cout << " = " << length::ft_us<>(meter) << '\n';
std::cout << " = " << length::in<>(meter) << '\n';
std::cout << " = " << length::ly<>(meter) << '\n';
std::cout << " = " << length::mi<>(meter) << '\n';
std::cout << " = " << length::mi_naut<>(meter) << '\n';
std::cout << " = " << length::pc<>(meter) << '\n';
std::cout << " = " << length::pica_comp<>(meter) << '\n';
std::cout << " = " << length::pica_prn<>(meter) << '\n';
std::cout << " = " << length::point_comp<>(meter) << '\n';
std::cout << " = " << length::point_prn<>(meter) << '\n';
std::cout << " = " << length::rd<>(meter) << '\n';
std::cout << " = " << length::yd<>(meter) << '\n';
}
void calcs_comparison()
{
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";
length::fm<float> L1A = 2._q_fm;
length::fm<float> L2A = 3._q_fm;
length::fm<float> LrA = L1A + L2A;
fmt::print("{:%.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";
length::m<float> L1B = L1A;
length::m<float> L2B = L2A;
length::m<float> LrB = L1B + L2B;
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n",L1B,L2B,LrB);
std::cout << "In multiplication and division:\n\n";
area::fm2<float> ArA = L1A * L2A;
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n",L1A,L2A,ArA);
std::cout << "similar problems arise\n\n";
area::m2<float> ArB = L1B * L2B;
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n",L1B,L2B,ArB);
}
int main()
{
std::cout << "This demo was originally posted on comp.lang.c++.moderated in 2006\n";
std::cout << "http://compgroups.net/comp.lang.c++.moderated/dimensional-analysis-units/51712\n";
std::cout << "Here converted to use mpusz/units library.\n\n";
simple_quantities();
quantities_with_typed_units();
calcs_comparison();
}

View File

@ -1,63 +0,0 @@
/*
Copyright (c) 2003-2020 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_str.h"
#include "./length.h"
#include <units/quantity_io.h>
#include <iostream>
/*
get conversion factor from one dimensionally equivalent
quantity type to another
*/
namespace {
template<units::Quantity Target, units::Quantity Source>
requires units::equivalent<typename Source::dimension, typename Target::dimension>
inline constexpr std::common_type_t<typename Target::rep, typename Source::rep> conversion_factor(Target, Source)
{
// get quantities looking like inputs but with Q::rep that doesn't have narrowing conversion
typedef std::common_type_t<typename Target::rep, typename Source::rep> rep;
typedef units::quantity<typename Source::dimension, typename Source::unit, rep> source;
typedef units::quantity<typename Target::dimension, typename Target::unit, rep> target;
return target{source{1}}.number();
}
} // namespace
using namespace units::isq::si::literals;
using namespace units::experimental;
int main()
{
std::cout << "conversion factor in mpusz/units...\n\n";
constexpr length::m<> lengthA = 2.0_q_m;
constexpr length::mm<> lengthB = lengthA;
std::cout << "lengthA( " << lengthA << " ) and lengthB( " << lengthB << " )\n"
<< "represent the same length in different units.\n\n";
std::cout << "therefore ratio lengthA / lengthB == " << lengthA / lengthB << "\n\n";
std::cout << "conversion factor from lengthA::unit of "
<< units_str(lengthA).standard() << " to lengthB::unit of " << units_str(lengthB).standard() << " :\n\n"
<< "lengthB.number( " << lengthB.number() << " ) == lengthA.number( " << lengthA.number()
<< " ) * conversion_factor( " << conversion_factor(lengthB, lengthA) << " )\n";
}

View File

@ -1,19 +0,0 @@
#pragma once
#include <units/isq/si/density.h>
namespace units{
namespace experimental{
namespace density {
template<typename Rep = double>
using kg_per_m3 = units::isq::si::density<units::isq::si::kilogram_per_metre_cub, Rep>;
}
}} // units::experimental

View File

@ -1,16 +0,0 @@
#pragma once
#include <units/isq/si/force.h>
namespace units{
namespace experimental{
namespace force {
template<typename Rep = double>
using N = units::isq::si::force<units::isq::si::newton, Rep>;
}
}} // units::experimental

View File

@ -1,88 +0,0 @@
#pragma once
#include <units/isq/si/length.h>
#include <units/isq/si/imperial/length.h>
#include <units/isq/si/international/length.h>
#include <units/isq/si/typographic/length.h>
#include <units/isq/si/us/length.h>
#include <units/isq/si/iau/length.h>
namespace units{
namespace experimental{
namespace length {
template<typename Rep = double>
using m = units::isq::si::length<units::isq::si::metre, Rep>;
template<typename Rep = double>
using mm = units::isq::si::length<units::isq::si::millimetre, Rep>;
template<typename Rep = double>
using fm = units::isq::si::length<units::isq::si::femtometre, Rep>;
template<typename Rep = double>
using km = units::isq::si::length<units::isq::si::kilometre, Rep>;
template<typename Rep = double>
using AU = units::isq::si::length<units::isq::si::astronomical_unit, Rep>;
template<typename Rep = double>
using in = units::isq::si::length<units::isq::si::international::inch, Rep>;
template<typename Rep = double>
using angstrom = units::isq::si::length<units::isq::si::iau::angstrom, Rep>;
template<typename Rep = double>
using ch = units::isq::si::length<units::isq::si::imperial::chain, Rep>;
template<typename Rep = double>
using fathom = units::isq::si::length<units::isq::si::international::fathom, Rep>;
template<typename Rep = double>
using fathom_us = units::isq::si::length<units::isq::si::us::fathom, Rep>;
template<typename Rep = double>
using ft = units::isq::si::length<units::isq::si::international::foot, Rep>;
template<typename Rep = double>
using ft_us = units::isq::si::length<units::isq::si::us::foot, Rep>;
template<typename Rep = double>
using ly = units::isq::si::length<units::isq::si::iau::light_year, Rep>;
template<typename Rep = double>
using mi = units::isq::si::length<units::isq::si::international::mile, Rep>;
template<typename Rep = double>
using mi_naut = units::isq::si::length<units::isq::si::international::nautical_mile, Rep>;
template<typename Rep = double>
using pc = units::isq::si::length<units::isq::si::iau::parsec, Rep>;
template<typename Rep = double>
using pica_comp = units::isq::si::length<units::isq::si::typographic::pica_comp, Rep>;
template<typename Rep = double>
using pica_prn = units::isq::si::length<units::isq::si::typographic::pica_prn, Rep>;
template<typename Rep = double>
using point_comp = units::isq::si::length<units::isq::si::typographic::point_comp, Rep>;
template<typename Rep = double>
using point_prn = units::isq::si::length<units::isq::si::typographic::point_prn, Rep>;
template<typename Rep = double>
using rd = units::isq::si::length<units::isq::si::imperial::rod, Rep>;
template<typename Rep = double>
using yd = units::isq::si::length<units::isq::si::international::yard, Rep>;
} // namespace length
}} // units::experimental

View File

@ -1,19 +0,0 @@
#pragma once
#include <units/isq/si/mass.h>
namespace units{
namespace experimental{
namespace mass {
template<typename Rep = double>
using kg = units::isq::si::mass<units::isq::si::kilogram, Rep>;
}
}} // units::experimental

View File

@ -1,21 +0,0 @@
#pragma once
#include <units/isq/si/time.h>
// named qtime due to conflict with time_t time(time_t*)
namespace q_time {
template<typename Rep = double>
using s = units::isq::si::time<units::isq::si::second, Rep>;
template<typename Rep = double>
using ms = units::isq::si::time<units::isq::si::millisecond, Rep>;
template<typename Rep = double>
using min = units::isq::si::time<units::isq::si::minute, Rep>;
template<typename Rep = double>
using h = units::isq::si::time<units::isq::si::hour, Rep>;
} // namespace time

View File

@ -1,36 +0,0 @@
#include <units/quantity_io.h>
#include <iostream>
#include "./timer.h"
/*
simple timer, useful for perf timing etc
*/
using namespace units::experimental;
using namespace units::isq::si::literals;
int main()
{
std::cout << "Simple timer using mpusz/units ...\n";
auto const period = 0.5_q_s;
auto const duration = 10 * period;
timer t;
auto const start_time = t();
std::cout << "Started at " << start_time <<'\n';
auto prev = start_time;
for (auto now = t(); (now - start_time) < duration; now = t() ) {
if ( (now - prev ) >= period ){
prev = now;
std::cout << "tick (" << now << ")\n";;
}
}
t.stop();
std::cout << "finished at " << t() << '\n';
}

View File

@ -1,64 +0,0 @@
#pragma once
/*
Copyright (c) 2003-2020 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 "./time.h"
#include <ctime>
namespace units{ namespace experimental{
class timer{
public:
timer(): running(true)
{
start_time = std::clock();
}
void restart()
{
running = true;
start_time = std::clock();
}
void stop()
{
if (running){
stop_time = std::clock();
running = false;
}
}
q_time::ms<> operator ()()const
{
std::clock_t const wanted = running ? std::clock() : stop_time;
static constexpr auto divider = 1000.0 / CLOCKS_PER_SEC;
return q_time::ms<>(
static_cast<double>(wanted - start_time)
) * divider;
}
bool is_running() const {return running;}
bool is_stopped() const {return !running;}
private:
bool running;
std::clock_t start_time,stop_time;
};
} }//units::experimental

View File

@ -1,12 +0,0 @@
#pragma once
#include <units/bits/unit_text.h>
#include <units/isq/si/prefixes.h>
#include <units/quantity.h>
// get at the units text of the quantity, without its numeric value
inline auto constexpr units_str(const units::Quantity auto& q)
{
typedef std::remove_cvref_t<decltype(q)> qtype;
return units::detail::unit_text<typename qtype::dimension, typename qtype::unit>();
}

View File

@ -1,31 +0,0 @@
#pragma once
#include <units/isq/si/voltage.h>
namespace units{
namespace experimental{
namespace voltage {
template<typename Rep = double>
using V = units::isq::si::voltage<units::isq::si::volt, Rep>;
template<typename Rep = double>
using mV = units::isq::si::voltage<units::isq::si::millivolt, Rep>;
template<typename Rep = double>
using uV = units::isq::si::voltage<units::isq::si::microvolt, Rep>;
template<typename Rep = double>
using nV = units::isq::si::voltage<units::isq::si::nanovolt, Rep>;
template<typename Rep = double>
using pV = units::isq::si::voltage<units::isq::si::picovolt, Rep>;
} // namespace voltage
}} // units::experimental

View File

@ -1,18 +0,0 @@
#pragma once
#include <units/isq/si/volume.h>
namespace units{
namespace experimental{
namespace volume {
template<typename Rep = double>
using m3 = units::isq::si::volume<units::isq::si::cubic_metre, Rep>;
}
}} // units::experimental

View File

@ -20,8 +20,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
#define UNITS_REFERENCES #define UNITS_ALIASES
#define UNITS_LITERALS #define UNITS_LITERALS
#define UNITS_REFERENCES
#include <units/format.h> #include <units/format.h>
#include <units/isq/si/international/length.h> #include <units/isq/si/international/length.h>
@ -43,23 +44,26 @@ int main()
{ {
using namespace units::isq::si::literals; using namespace units::isq::si::literals;
using namespace units::isq::si::references; using namespace units::isq::si::references;
using namespace units::aliases::isq::si::international;
constexpr Speed auto v1 = 110 * (km / h); constexpr Speed auto v1 = 110 * (km / h);
constexpr Speed auto v2 = avg_speed(220_q_km, 2_q_h); constexpr Speed auto v2 = mi_per_h<>(70.);
constexpr Speed auto v3 = avg_speed(si::length<si::international::mile>(140), si::time<si::hour>(2)); constexpr Speed auto v3 = avg_speed(220_q_km, 2_q_h);
constexpr Speed auto v4 = avg_speed(si::length<si::international::mile>(140), si::time<si::hour>(2));
#if UNITS_DOWNCAST_MODE == 0 #if UNITS_DOWNCAST_MODE == 0
constexpr Speed auto v4 = quantity_cast<si::speed<si::metre_per_second>>(v2); constexpr Speed auto v5 = quantity_cast<si::speed<si::metre_per_second>>(v3);
constexpr Speed auto v5 = quantity_cast<si::dim_speed, si::metre_per_second>(v3); constexpr Speed auto v6 = quantity_cast<si::dim_speed, si::metre_per_second>(v4);
#else #else
constexpr Speed auto v4 = quantity_cast<si::speed<si::metre_per_second>>(v2); constexpr Speed auto v5 = quantity_cast<si::speed<si::metre_per_second>>(v3);
constexpr Speed auto v5 = quantity_cast<si::metre_per_second>(v3); constexpr Speed auto v6 = quantity_cast<si::metre_per_second>(v4);
#endif #endif
constexpr Speed auto v6 = quantity_cast<int>(v5); constexpr Speed auto v7 = quantity_cast<int>(v6);
std::cout << v1 << '\n'; // 110 km/h std::cout << v1 << '\n'; // 110 km/h
std::cout << fmt::format("{}", v2) << '\n'; // 110 km/h std::cout << v2 << '\n'; // 70 mi/h
std::cout << fmt::format("{:*^14}", v3) << '\n'; // ***70 mi/h**** std::cout << fmt::format("{}", v3) << '\n'; // 110 km/h
std::cout << fmt::format("{:%Q in %q}", v4) << '\n'; // 30.5556 in m/s std::cout << fmt::format("{:*^14}", v4) << '\n'; // ***70 mi/h****
std::cout << fmt::format("{0:%Q} in {0:%q}", v5) << '\n'; // 31.2928 in m/s std::cout << fmt::format("{:%Q in %q}", v5) << '\n'; // 30.5556 in m/s
std::cout << fmt::format("{:%Q}", v6) << '\n'; // 31 std::cout << fmt::format("{0:%Q} in {0:%q}", v6) << '\n'; // 31.2928 in m/s
std::cout << fmt::format("{:%Q}", v7) << '\n'; // 31
} }

View File

@ -111,28 +111,28 @@ void calcs_comparison()
"when adding two values of the same very big\n" "when adding two values of the same very big\n"
"or very small type:\n\n"; "or very small type:\n\n";
length<femtometre, float> L1A = 2._q_fm; const length<femtometre, float> L1A = 2._q_fm;
length<femtometre, float> L2A = 3._q_fm; const length<femtometre, float> L2A = 3._q_fm;
length<femtometre, float> LrA = L1A + L2A; const length<femtometre, float> LrA = L1A + L2A;
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, LrA); fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, LrA);
std::cout << "The single unit method must convert large\n" std::cout << "The single unit method must convert large\n"
"or small values in other units to the base unit.\n" "or small values in other units to the base unit.\n"
"This is both inefficient and inaccurate\n\n"; "This is both inefficient and inaccurate\n\n";
length<metre, float> L1B = L1A; const length<metre, float> L1B = L1A;
length<metre, float> L2B = L2A; const length<metre, float> L2B = L2A;
length<metre, float> LrB = L1B + L2B; const length<metre, float> LrB = L1B + L2B;
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, LrB); fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, LrB);
std::cout << "In multiplication and division:\n\n"; std::cout << "In multiplication and division:\n\n";
area<square_femtometre, float> ArA = L1A * L2A; const area<square_femtometre, float> ArA = L1A * L2A;
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, ArA); fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, ArA);
std::cout << "similar problems arise\n\n"; std::cout << "similar problems arise\n\n";
area<square_metre, float> ArB = L1B * L2B; const area<square_metre, float> ArB = L1B * L2B;
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, ArB); fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, ArB);
} }

View File

@ -43,7 +43,6 @@ Energy auto total_energy(Momentum auto p, Mass auto m, Speed auto c)
void si_example() void si_example()
{ {
using namespace units::isq::si; using namespace units::isq::si;
using GeV = gigaelectronvolt;
constexpr Speed auto c = si2019::speed_of_light<>; constexpr Speed auto c = si2019::speed_of_light<>;
@ -68,17 +67,19 @@ void si_example()
<< "E = " << E_si << "\n"; << "E = " << E_si << "\n";
std::cout << "\n[converted from SI units back to GeV]\n" std::cout << "\n[converted from SI units back to GeV]\n"
<< "E = " << quantity_cast<GeV>(E_si) << "\n"; << "E = " << quantity_cast<gigaelectronvolt>(E_si) << "\n";
} }
void natural_example() void natural_example()
{ {
using namespace units::isq::natural; using namespace units::isq::natural;
using GeV = gigaelectronvolt;
// TODO Typical UDLs will not work here as the same units are reused by many quantities.
// Should we define some strange ones (i.e. _q_mass_GeV)?
constexpr Speed auto c = speed_of_light<>; constexpr Speed auto c = speed_of_light<>;
const momentum<GeV> p(4); const momentum<gigaelectronvolt> p(4);
const mass<GeV> m(3); const mass<gigaelectronvolt> m(3);
const Energy auto E = total_energy(p, m, c); const Energy auto E = total_energy(p, m, c);
std::cout << "\n*** Natural units (c = " << c << ") ***\n" std::cout << "\n*** Natural units (c = " << c << ") ***\n"

View File

@ -32,49 +32,52 @@ namespace {
void simple_quantities() void simple_quantities()
{ {
using namespace units::isq; using namespace units::isq;
using namespace units::isq::si;
using namespace units::isq::si::references; using namespace units::isq::si::references;
using namespace units::isq::si::international::references; using namespace units::isq::si::international::references;
using distance = si::length<si::metre>; using distance = si::length<si::metre>;
using duration = si::time<si::second>; using duration = si::time<si::second>;
constexpr distance kilometers = 1.0 * km; constexpr distance km = 1.0 * references::km;
constexpr distance miles = 1.0 * mi; constexpr distance miles = 1.0 * mi;
constexpr duration seconds = 1 * s; constexpr duration sec = 1 * s;
constexpr duration minutes = 1 * min; constexpr duration min = 1 * references::min;
constexpr duration hours = 1 * h; constexpr duration hr = 1 * h;
std::cout << "A physical quantities library can choose the simple\n"; 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 << "option to provide output using a single type for each base unit:\n\n";
std::cout << kilometers << '\n'; std::cout << km << '\n';
std::cout << miles << '\n'; std::cout << miles << '\n';
std::cout << seconds << '\n'; std::cout << sec << '\n';
std::cout << minutes << '\n'; std::cout << min << '\n';
std::cout << hours << "\n\n"; std::cout << hr << "\n\n";
} }
void quantities_with_typed_units() void quantities_with_typed_units()
{ {
using namespace units::isq; using namespace units::isq;
using namespace units::isq::si;
using namespace units::isq::si::references; using namespace units::isq::si::references;
using namespace units::isq::si::international;
using namespace units::isq::si::international::references; using namespace units::isq::si::international::references;
constexpr auto kilometers = 1.0 * km; constexpr length<kilometre> km = 1.0 * si::references::km;
constexpr auto miles = 1.0 * mi; constexpr length<mile> miles = 1.0 * mi;
std::cout.precision(6); std::cout.precision(6);
constexpr auto seconds = 1 * s; constexpr si::time<second> sec = 1 * s;
constexpr auto minutes = 1 * min; constexpr si::time<minute> min = 1 * si::references::min;
constexpr auto hours = 1 * h; constexpr si::time<hour> hr = 1 * h;
std::cout << "A more flexible option is to provide separate types for each unit,\n\n"; std::cout << "A more flexible option is to provide separate types for each unit,\n\n";
std::cout << kilometers << '\n'; std::cout << km << '\n';
std::cout << miles << '\n'; std::cout << miles << '\n';
std::cout << seconds << '\n'; std::cout << sec << '\n';
std::cout << minutes << '\n'; std::cout << min << '\n';
std::cout << hours << "\n\n"; std::cout << hr << "\n\n";
constexpr auto meter = 1 * m; constexpr auto meter = 1 * m;
std::cout << "then a wide range of pre-defined units can be defined and converted,\n" std::cout << "then a wide range of pre-defined units can be defined and converted,\n"
@ -104,35 +107,35 @@ void quantities_with_typed_units()
void calcs_comparison() void calcs_comparison()
{ {
using namespace units::isq; using namespace units::isq::si;
using namespace units::isq::si::references; using namespace units::isq::si::references;
std::cout << "\nA distinct unit for each type is efficient and accurate\n" std::cout << "\nA distinct unit for each type is efficient and accurate\n"
"when adding two values of the same very big\n" "when adding two values of the same very big\n"
"or very small type:\n\n"; "or very small type:\n\n";
const auto L1A = 2.f * fm; const length<femtometre, float> L1A = 2.f * fm;
const auto L2A = 3.f * fm; const length<femtometre, float> L2A = 3.f * fm;
const Length auto LrA = L1A + L2A; const length<femtometre, float> LrA = L1A + L2A;
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, LrA); fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, LrA);
std::cout << "The single unit method must convert large\n" std::cout << "The single unit method must convert large\n"
"or small values in other units to the base unit.\n" "or small values in other units to the base unit.\n"
"This is both inefficient and inaccurate\n\n"; "This is both inefficient and inaccurate\n\n";
const auto L1B = quantity_cast<si::metre>(L1A); const length<metre, float> L1B = L1A;
const auto L2B = quantity_cast<si::metre>(L2A); const length<metre, float> L2B = L2A;
const Length auto LrB = L1B + L2B; const length<metre, float> LrB = L1B + L2B;
fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, LrB); fmt::print("{:%.30Q %q}\n + {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, LrB);
std::cout << "In multiplication and division:\n\n"; std::cout << "In multiplication and division:\n\n";
const Area auto ArA = L1A * L2A; const area<square_femtometre, float> ArA = L1A * L2A;
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, ArA); fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1A, L2A, ArA);
std::cout << "similar problems arise\n\n"; std::cout << "similar problems arise\n\n";
const Area auto ArB = L1B * L2B; const area<square_metre, float> ArB = L1B * L2B;
fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, ArB); fmt::print("{:%.30Q %q}\n * {:%.30Q %q}\n = {:%.30Q %q}\n\n", L1B, L2B, ArB);
} }

View File

@ -74,10 +74,11 @@ void si_example()
void natural_example() void natural_example()
{ {
using namespace units::isq::natural; using namespace units::isq::natural;
using namespace units::isq::natural::references;
constexpr Speed auto c = speed_of_light<>; constexpr Speed auto c = speed_of_light<>;
const momentum<gigaelectronvolt> p(4); const auto p = 4. * momentum_references::GeV;
const mass<gigaelectronvolt> m(3); const auto m = 3. * mass_references::GeV;
const Energy auto E = total_energy(p, m, c); const Energy auto E = total_energy(p, m, c);
std::cout << "\n*** Natural units (c = " << c << ") ***\n" std::cout << "\n*** Natural units (c = " << c << ") ***\n"

View File

@ -93,3 +93,21 @@ using namespace modulation_rate_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::iec80000 } // namespace units::isq::iec80000
#ifdef UNITS_ALIASES
namespace units::aliases::isq::iec80000::inline modulation_rate {
template<Representation Rep = double> using Bd = units::isq::iec80000::modulation_rate<units::isq::iec80000::baud, Rep>;
template<Representation Rep = double> using kBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::kilobaud, Rep>;
template<Representation Rep = double> using MBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::megabaud, Rep>;
template<Representation Rep = double> using GBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::gigabaud, Rep>;
template<Representation Rep = double> using TBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::terabaud, Rep>;
template<Representation Rep = double> using PBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::petabaud, Rep>;
template<Representation Rep = double> using EBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::exabaud, Rep>;
template<Representation Rep = double> using ZBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::zettabaud, Rep>;
template<Representation Rep = double> using YBd = units::isq::iec80000::modulation_rate<units::isq::iec80000::yottabaud, Rep>;
} // namespace units::aliases::isq::iec80000::inline modulation_rate
#endif // UNITS_ALIASES

View File

@ -178,3 +178,49 @@ using namespace storage_capacity_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::iec80000 } // namespace units::isq::iec80000
#ifdef UNITS_ALIASES
namespace units::aliases::isq::iec80000::inline storage_capacity {
// bits
template<Representation Rep = double> using bit = units::isq::iec80000::storage_capacity<units::isq::iec80000::bit, Rep>;
template<Representation Rep = double> using kbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::kilobit, Rep>;
template<Representation Rep = double> using Mbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::megabit, Rep>;
template<Representation Rep = double> using Gbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::gigabit, Rep>;
template<Representation Rep = double> using Tbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::terabit, Rep>;
template<Representation Rep = double> using Pbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::petabit, Rep>;
template<Representation Rep = double> using Ebit = units::isq::iec80000::storage_capacity<units::isq::iec80000::exabit, Rep>;
template<Representation Rep = double> using Zbit = units::isq::iec80000::storage_capacity<units::isq::iec80000::zettabit, Rep>;
template<Representation Rep = double> using Ybit = units::isq::iec80000::storage_capacity<units::isq::iec80000::yottabit, Rep>;
template<Representation Rep = double> using Kibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::kibibit, Rep>;
template<Representation Rep = double> using Mibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::mebibit, Rep>;
template<Representation Rep = double> using Gibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::gibibit, Rep>;
template<Representation Rep = double> using Tibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::tebibit, Rep>;
template<Representation Rep = double> using Pibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::pebibit, Rep>;
template<Representation Rep = double> using Eibit = units::isq::iec80000::storage_capacity<units::isq::iec80000::exbibit, Rep>;
// bytes
template<Representation Rep = double> using B = units::isq::iec80000::storage_capacity<units::isq::iec80000::byte, Rep>;
template<Representation Rep = double> using kB = units::isq::iec80000::storage_capacity<units::isq::iec80000::kilobyte, Rep>;
template<Representation Rep = double> using MB = units::isq::iec80000::storage_capacity<units::isq::iec80000::megabyte, Rep>;
template<Representation Rep = double> using GB = units::isq::iec80000::storage_capacity<units::isq::iec80000::gigabyte, Rep>;
template<Representation Rep = double> using TB = units::isq::iec80000::storage_capacity<units::isq::iec80000::terabyte, Rep>;
template<Representation Rep = double> using PB = units::isq::iec80000::storage_capacity<units::isq::iec80000::petabyte, Rep>;
template<Representation Rep = double> using EB = units::isq::iec80000::storage_capacity<units::isq::iec80000::exabyte, Rep>;
template<Representation Rep = double> using ZB = units::isq::iec80000::storage_capacity<units::isq::iec80000::zettabyte, Rep>;
template<Representation Rep = double> using YB = units::isq::iec80000::storage_capacity<units::isq::iec80000::yottabyte, Rep>;
template<Representation Rep = double> using KiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::kibibyte, Rep>;
template<Representation Rep = double> using MiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::mebibyte, Rep>;
template<Representation Rep = double> using GiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::gibibyte, Rep>;
template<Representation Rep = double> using TiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::tebibyte, Rep>;
template<Representation Rep = double> using PiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::pebibyte, Rep>;
// template<Representation Rep = double> using EiB = units::isq::iec80000::storage_capacity<units::isq::iec80000::exbibyte, Rep>;
} // namespace units::aliases::isq::iec80000::inline storage_capacity
#endif // UNITS_ALIASES

View File

@ -70,3 +70,13 @@ using namespace traffic_intensity_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::iec80000 } // namespace units::isq::iec80000
#ifdef UNITS_ALIASES
namespace units::aliases::isq::iec80000::inline traffic_intensity {
template<Representation Rep = double> using E = units::isq::iec80000::traffic_intensity<units::isq::iec80000::erlang, Rep>;
} // namespace units::aliases::isq::iec80000::inline traffic_intensity
#endif // UNITS_ALIASES

View File

@ -71,3 +71,21 @@ constexpr auto operator"" _q_YB_per_s(unsigned long long l) { gsl_ExpectsAudit(s
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::iec80000 } // namespace units::isq::iec80000
#ifdef UNITS_ALIASES
namespace units::aliases::isq::iec80000::inline transfer_rate {
template<Representation Rep = double> using B_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::byte_per_second, Rep>;
template<Representation Rep = double> using kB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::kilobyte_per_second, Rep>;
template<Representation Rep = double> using MB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::megabyte_per_second, Rep>;
template<Representation Rep = double> using GB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::gigabyte_per_second, Rep>;
template<Representation Rep = double> using TB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::terabyte_per_second, Rep>;
template<Representation Rep = double> using PB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::petabyte_per_second, Rep>;
template<Representation Rep = double> using EB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::exabyte_per_second, Rep>;
template<Representation Rep = double> using ZB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::zettabyte_per_second, Rep>;
template<Representation Rep = double> using YB_per_s = units::isq::iec80000::transfer_rate<units::isq::iec80000::yottabyte_per_second, Rep>;
} // namespace units::aliases::isq::iec80000::inline transfer_rate
#endif // UNITS_ALIASES

View File

@ -69,3 +69,13 @@ using namespace acceleration_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline acceleration {
template<Representation Rep = double> using Gal = units::isq::si::cgs::acceleration<units::isq::si::cgs::gal, Rep>;
} // namespace units::aliases::isq::si::cgs::inline acceleration
#endif // UNITS_ALIASES

View File

@ -71,3 +71,13 @@ using namespace area_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline area {
template<Representation Rep = double> using cm2 = units::isq::si::cgs::area<units::isq::si::cgs::square_centimetre, Rep>;
} // namespace units::aliases::isq::si::cgs::inline area
#endif // UNITS_ALIASES

View File

@ -71,3 +71,13 @@ using namespace energy_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline energy {
template<Representation Rep = double> using erg = units::isq::si::cgs::energy<units::isq::si::cgs::erg, Rep>;
} // namespace units::aliases::isq::si::cgs::inline energy
#endif // UNITS_ALIASES

View File

@ -72,3 +72,13 @@ using namespace force_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline force {
template<Representation Rep = double> using dyn = units::isq::si::cgs::force<units::isq::si::cgs::dyne, Rep>;
} // namespace units::aliases::isq::si::cgs::inline force
#endif // UNITS_ALIASES

View File

@ -70,3 +70,13 @@ using namespace length_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline length {
template<Representation Rep = double> using cm = units::isq::si::cgs::length<units::isq::si::cgs::centimetre, Rep>;
} // namespace units::aliases::isq::si::cgs::inline length
#endif // UNITS_ALIASES

View File

@ -70,3 +70,13 @@ using namespace mass_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline mass {
template<Representation Rep = double> using g = units::isq::si::cgs::mass<units::isq::si::cgs::gram, Rep>;
} // namespace units::aliases::isq::si::cgs::inline mass
#endif // UNITS_ALIASES

View File

@ -54,3 +54,13 @@ constexpr auto operator"" _q_erg_per_s(long double l) { return power<erg_per_sec
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline power {
template<Representation Rep = double> using erg_per_s = units::isq::si::cgs::power<units::isq::si::cgs::erg_per_second, Rep>;
} // namespace units::aliases::isq::si::cgs::inline power
#endif // UNITS_ALIASES

View File

@ -72,3 +72,13 @@ using namespace pressure_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline pressure {
template<Representation Rep = double> using Ba = units::isq::si::cgs::pressure<units::isq::si::cgs::barye, Rep>;
} // namespace units::aliases::isq::si::cgs::inline pressure
#endif // UNITS_ALIASES

View File

@ -53,3 +53,13 @@ constexpr auto operator"" _q_cm_per_s(long double l) { return speed<centimetre_p
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline speed {
template<Representation Rep = double> using cm_per_s = units::isq::si::cgs::speed<units::isq::si::cgs::centimetre_per_second, Rep>;
} // namespace units::aliases::isq::si::cgs::inline speed
#endif // UNITS_ALIASES

View File

@ -64,3 +64,13 @@ using namespace time_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::cgs } // namespace units::isq::si::cgs
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::cgs::inline time {
using namespace units::aliases::isq::si::time;
} // namespace units::aliases::isq::si::cgs::inline time
#endif // UNITS_ALIASES

View File

@ -52,3 +52,13 @@ constexpr auto operator"" _q_ft_per_s2(long double l) { return acceleration<foot
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -70,3 +70,13 @@ using namespace area_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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::inlipne area
#endif // UNITS_ALIASES

View File

@ -54,3 +54,13 @@ constexpr auto operator"" _q_lb_per_ft3(long double l) { return density<pound_pe
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -62,3 +62,14 @@ constexpr auto operator"" _q_ft_lbf(long double l) { return energy<foot_pound_fo
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -91,3 +91,15 @@ using namespace force_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -128,3 +128,22 @@ using namespace length_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -127,3 +127,21 @@ using namespace mass_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -83,3 +83,15 @@ using namespace power_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -87,3 +87,15 @@ using namespace pressure_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -47,7 +47,6 @@ struct nautical_mile_per_hour : named_deduced_unit<nautical_mile_per_hour, dim_s
struct knot : alias_unit<nautical_mile_per_hour, "knot", no_prefix> {}; struct knot : alias_unit<nautical_mile_per_hour, "knot", no_prefix> {};
#ifdef UNITS_LITERALS #ifdef UNITS_LITERALS
inline namespace literals { inline namespace literals {
@ -86,3 +85,15 @@ using namespace speed_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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 knot = units::isq::si::fps::speed<units::isq::si::fps::knot, Rep>;
} // namespace units::aliases::isq::si::fps::inline speed
#endif // UNITS_ALIASES

View File

@ -68,3 +68,13 @@ using namespace time_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -76,3 +76,14 @@ using namespace volume_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::fps } // namespace units::isq::si::fps
#ifdef UNITS_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_ALIASES

View File

@ -83,3 +83,15 @@ using namespace length_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::iau } // namespace units::isq::si::iau
#ifdef UNITS_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
#endif // UNITS_ALIASES

View File

@ -74,3 +74,14 @@ using namespace length_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::imperial } // namespace units::isq::si::imperial
#ifdef UNITS_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_ALIASES

View File

@ -66,3 +66,13 @@ using namespace area_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::international } // namespace units::isq::si::international
#ifdef UNITS_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_ALIASES

View File

@ -130,3 +130,20 @@ using namespace length_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::international } // namespace units::isq::si::international
#ifdef UNITS_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_ALIASES

View File

@ -49,3 +49,13 @@ constexpr auto operator"" _q_mi_per_h(long double l) { return si::speed<mile_per
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si::international } // namespace units::isq::si::international
#ifdef UNITS_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>;
} // namespace units::aliases::isq::si::international::inline speed
#endif // UNITS_ALIASES

View File

@ -66,3 +66,13 @@ using namespace volume_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::international } // namespace units::isq::si::international
#ifdef UNITS_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_ALIASES

View File

@ -85,3 +85,16 @@ using namespace length_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::typographic } // namespace units::isq::si::typographic
#ifdef UNITS_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_ALIASES

View File

@ -84,3 +84,15 @@ using namespace length_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si::us } // namespace units::isq::si::us
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::us::inline length {
template<Representation Rep = double> using ft = units::isq::si::length<units::isq::si::us::foot, Rep>;
template<Representation Rep = double> using fathom = units::isq::si::length<units::isq::si::us::fathom, Rep>;
template<Representation Rep = double> using mi = units::isq::si::length<units::isq::si::us::mile, Rep>;
} // namespace units::aliases::isq::si::us::inline length
#endif // UNITS_ALIASES

View File

@ -191,3 +191,33 @@ using namespace absorbed_dose_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline absorbed_dose {
template<Representation Rep = double> using Gy = units::isq::si::absorbed_dose<units::isq::si::gray, Rep>;
template<Representation Rep = double> using yGy = units::isq::si::absorbed_dose<units::isq::si::yoctogray, Rep>;
template<Representation Rep = double> using zGy = units::isq::si::absorbed_dose<units::isq::si::zeptogray, Rep>;
template<Representation Rep = double> using aGy = units::isq::si::absorbed_dose<units::isq::si::attogray, Rep>;
template<Representation Rep = double> using fGy = units::isq::si::absorbed_dose<units::isq::si::femtogray, Rep>;
template<Representation Rep = double> using pGy = units::isq::si::absorbed_dose<units::isq::si::picogray, Rep>;
template<Representation Rep = double> using nGy = units::isq::si::absorbed_dose<units::isq::si::nanogray, Rep>;
template<Representation Rep = double> using uGy = units::isq::si::absorbed_dose<units::isq::si::microgray, Rep>;
template<Representation Rep = double> using mGy = units::isq::si::absorbed_dose<units::isq::si::milligray, Rep>;
template<Representation Rep = double> using cGy = units::isq::si::absorbed_dose<units::isq::si::centigray, Rep>;
template<Representation Rep = double> using dGy = units::isq::si::absorbed_dose<units::isq::si::decigray, Rep>;
template<Representation Rep = double> using daGy = units::isq::si::absorbed_dose<units::isq::si::decagray, Rep>;
template<Representation Rep = double> using hGy = units::isq::si::absorbed_dose<units::isq::si::hectogray, Rep>;
template<Representation Rep = double> using kGy = units::isq::si::absorbed_dose<units::isq::si::kilogray, Rep>;
template<Representation Rep = double> using MGy = units::isq::si::absorbed_dose<units::isq::si::megagray, Rep>;
template<Representation Rep = double> using GGy = units::isq::si::absorbed_dose<units::isq::si::gigagray, Rep>;
template<Representation Rep = double> using TGy = units::isq::si::absorbed_dose<units::isq::si::teragray, Rep>;
template<Representation Rep = double> using PGy = units::isq::si::absorbed_dose<units::isq::si::petagray, Rep>;
template<Representation Rep = double> using EGy = units::isq::si::absorbed_dose<units::isq::si::exagray, Rep>;
template<Representation Rep = double> using ZGy = units::isq::si::absorbed_dose<units::isq::si::zettagray, Rep>;
template<Representation Rep = double> using YGy = units::isq::si::absorbed_dose<units::isq::si::yottagray, Rep>;
} // namespace units::aliases::isq::si::inline absorbed_dose
#endif // UNITS_ALIASES

View File

@ -52,3 +52,13 @@ constexpr auto operator"" _q_m_per_s2(long double l) { return acceleration<metre
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline acceleration {
template<Representation Rep = double> using m_per_s2 = units::isq::si::acceleration<units::isq::si::metre_per_second_sq, Rep>;
} // namespace units::aliases::isq::si::inline acceleration
#endif // UNITS_ALIASES

View File

@ -70,3 +70,13 @@ using namespace amount_of_substance_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline amount_of_substance {
template<Representation Rep = double> using mol = units::isq::si::amount_of_substance<units::isq::si::mole, Rep>;
} // namespace units::aliases::isq::si::inline amount_of_substance
#endif // UNITS_ALIASES

View File

@ -54,3 +54,13 @@ constexpr auto operator"" _q_rad_per_s(long double l) { return angular_velocity<
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline angular_velocity {
template<Representation Rep = double> using rad_per_s = units::isq::si::angular_velocity<units::isq::si::radian_per_second, Rep>;
} // namespace units::aliases::isq::si::inline angular_velocity
#endif // UNITS_ALIASES

View File

@ -184,6 +184,7 @@ inline constexpr auto Pm2 = reference<dim_area, square_petametre>{};
inline constexpr auto Em2 = reference<dim_area, square_exametre>{}; inline constexpr auto Em2 = reference<dim_area, square_exametre>{};
inline constexpr auto Zm2 = reference<dim_area, square_zettametre>{}; inline constexpr auto Zm2 = reference<dim_area, square_zettametre>{};
inline constexpr auto Ym2 = reference<dim_area, square_yottametre>{}; inline constexpr auto Ym2 = reference<dim_area, square_yottametre>{};
inline constexpr auto ha = reference<dim_area, hectare>{}; inline constexpr auto ha = reference<dim_area, hectare>{};
} // namespace area_references } // namespace area_references
@ -197,3 +198,35 @@ using namespace area_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline area {
template<Representation Rep = double> using m2 = units::isq::si::area<units::isq::si::square_metre, Rep>;
template<Representation Rep = double> using ym2 = units::isq::si::area<units::isq::si::square_yoctometre, Rep>;
template<Representation Rep = double> using zm2 = units::isq::si::area<units::isq::si::square_zeptometre, Rep>;
template<Representation Rep = double> using am2 = units::isq::si::area<units::isq::si::square_attometre, Rep>;
template<Representation Rep = double> using fm2 = units::isq::si::area<units::isq::si::square_femtometre, Rep>;
template<Representation Rep = double> using pm2 = units::isq::si::area<units::isq::si::square_picometre, Rep>;
template<Representation Rep = double> using nm2 = units::isq::si::area<units::isq::si::square_nanometre, Rep>;
template<Representation Rep = double> using um2 = units::isq::si::area<units::isq::si::square_micrometre, Rep>;
template<Representation Rep = double> using mm2 = units::isq::si::area<units::isq::si::square_millimetre, Rep>;
template<Representation Rep = double> using cm2 = units::isq::si::area<units::isq::si::square_centimetre, Rep>;
template<Representation Rep = double> using dm2 = units::isq::si::area<units::isq::si::square_decimetre, Rep>;
template<Representation Rep = double> using dam2 = units::isq::si::area<units::isq::si::square_decametre, Rep>;
template<Representation Rep = double> using hm2 = units::isq::si::area<units::isq::si::square_hectometre, Rep>;
template<Representation Rep = double> using km2 = units::isq::si::area<units::isq::si::square_kilometre, Rep>;
template<Representation Rep = double> using Mm2 = units::isq::si::area<units::isq::si::square_megametre, Rep>;
template<Representation Rep = double> using Gm2 = units::isq::si::area<units::isq::si::square_gigametre, Rep>;
template<Representation Rep = double> using Tm2 = units::isq::si::area<units::isq::si::square_terametre, Rep>;
template<Representation Rep = double> using Pm2 = units::isq::si::area<units::isq::si::square_petametre, Rep>;
template<Representation Rep = double> using Em2 = units::isq::si::area<units::isq::si::square_exametre, Rep>;
template<Representation Rep = double> using Zm2 = units::isq::si::area<units::isq::si::square_zettametre, Rep>;
template<Representation Rep = double> using Ym2 = units::isq::si::area<units::isq::si::square_yottametre, Rep>;
template<Representation Rep = double> using ha = units::isq::si::area<units::isq::si::hectare, Rep>;
} // namespace units::aliases::isq::si::inline area
#endif // UNITS_ALIASES

View File

@ -192,3 +192,33 @@ using namespace capacitance_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline capacitance {
template<Representation Rep = double> using F = units::isq::si::capacitance<units::isq::si::farad, Rep>;
template<Representation Rep = double> using yF = units::isq::si::capacitance<units::isq::si::yoctofarad, Rep>;
template<Representation Rep = double> using zF = units::isq::si::capacitance<units::isq::si::zeptofarad, Rep>;
template<Representation Rep = double> using aF = units::isq::si::capacitance<units::isq::si::attofarad, Rep>;
template<Representation Rep = double> using fF = units::isq::si::capacitance<units::isq::si::femtofarad, Rep>;
template<Representation Rep = double> using pF = units::isq::si::capacitance<units::isq::si::picofarad, Rep>;
template<Representation Rep = double> using nF = units::isq::si::capacitance<units::isq::si::nanofarad, Rep>;
template<Representation Rep = double> using uF = units::isq::si::capacitance<units::isq::si::microfarad, Rep>;
template<Representation Rep = double> using mF = units::isq::si::capacitance<units::isq::si::millifarad, Rep>;
template<Representation Rep = double> using cF = units::isq::si::capacitance<units::isq::si::centifarad, Rep>;
template<Representation Rep = double> using dF = units::isq::si::capacitance<units::isq::si::decifarad, Rep>;
template<Representation Rep = double> using daF = units::isq::si::capacitance<units::isq::si::decafarad, Rep>;
template<Representation Rep = double> using hF = units::isq::si::capacitance<units::isq::si::hectofarad, Rep>;
template<Representation Rep = double> using kF = units::isq::si::capacitance<units::isq::si::kilofarad, Rep>;
template<Representation Rep = double> using MF = units::isq::si::capacitance<units::isq::si::megafarad, Rep>;
template<Representation Rep = double> using GF = units::isq::si::capacitance<units::isq::si::gigafarad, Rep>;
template<Representation Rep = double> using TF = units::isq::si::capacitance<units::isq::si::terafarad, Rep>;
template<Representation Rep = double> using PF = units::isq::si::capacitance<units::isq::si::petafarad, Rep>;
template<Representation Rep = double> using EF = units::isq::si::capacitance<units::isq::si::exafarad, Rep>;
template<Representation Rep = double> using ZF = units::isq::si::capacitance<units::isq::si::zettafarad, Rep>;
template<Representation Rep = double> using YF = units::isq::si::capacitance<units::isq::si::yottafarad, Rep>;
} // namespace units::aliases::isq::si::inline capacitance
#endif // UNITS_ALIASES

View File

@ -188,7 +188,7 @@ inline constexpr auto Zkat = reference<dim_catalytic_activity, zettakatal>{};
inline constexpr auto Ykat = reference<dim_catalytic_activity, yottakatal>{}; inline constexpr auto Ykat = reference<dim_catalytic_activity, yottakatal>{};
inline constexpr auto U = reference<dim_catalytic_activity, enzyme_unit>{}; inline constexpr auto U = reference<dim_catalytic_activity, enzyme_unit>{};
} } // namespace catalytic_activity_references
namespace references { namespace references {
@ -199,3 +199,34 @@ using namespace catalytic_activity_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline catalytic_activity {
template<Representation Rep = double> using kat = units::isq::si::catalytic_activity<units::isq::si::katal, Rep>;
template<Representation Rep = double> using ykat = units::isq::si::catalytic_activity<units::isq::si::yoctokatal, Rep>;
template<Representation Rep = double> using zkat = units::isq::si::catalytic_activity<units::isq::si::zeptokatal, Rep>;
template<Representation Rep = double> using akat = units::isq::si::catalytic_activity<units::isq::si::attokatal, Rep>;
template<Representation Rep = double> using fkat = units::isq::si::catalytic_activity<units::isq::si::femtokatal, Rep>;
template<Representation Rep = double> using pkat = units::isq::si::catalytic_activity<units::isq::si::picokatal, Rep>;
template<Representation Rep = double> using nkat = units::isq::si::catalytic_activity<units::isq::si::nanokatal, Rep>;
template<Representation Rep = double> using ukat = units::isq::si::catalytic_activity<units::isq::si::microkatal, Rep>;
template<Representation Rep = double> using mkat = units::isq::si::catalytic_activity<units::isq::si::millikatal, Rep>;
template<Representation Rep = double> using ckat = units::isq::si::catalytic_activity<units::isq::si::centikatal, Rep>;
template<Representation Rep = double> using dkat = units::isq::si::catalytic_activity<units::isq::si::decikatal, Rep>;
template<Representation Rep = double> using dakat = units::isq::si::catalytic_activity<units::isq::si::decakatal, Rep>;
template<Representation Rep = double> using hkat = units::isq::si::catalytic_activity<units::isq::si::hectokatal, Rep>;
template<Representation Rep = double> using kkat = units::isq::si::catalytic_activity<units::isq::si::kilokatal, Rep>;
template<Representation Rep = double> using Mkat = units::isq::si::catalytic_activity<units::isq::si::megakatal, Rep>;
template<Representation Rep = double> using Gkat = units::isq::si::catalytic_activity<units::isq::si::gigakatal, Rep>;
template<Representation Rep = double> using Tkat = units::isq::si::catalytic_activity<units::isq::si::terakatal, Rep>;
template<Representation Rep = double> using Pkat = units::isq::si::catalytic_activity<units::isq::si::petakatal, Rep>;
template<Representation Rep = double> using Ekat = units::isq::si::catalytic_activity<units::isq::si::exakatal, Rep>;
template<Representation Rep = double> using Zkat = units::isq::si::catalytic_activity<units::isq::si::zettakatal, Rep>;
template<Representation Rep = double> using Ykat = units::isq::si::catalytic_activity<units::isq::si::yottakatal, Rep>;
template<Representation Rep = double> using U = units::isq::si::catalytic_activity<units::isq::si::enzyme_unit, Rep>;
} // namespace units::aliases::isq::si::inline catalytic_activity
#endif // UNITS_ALIASES

View File

@ -64,3 +64,14 @@ constexpr auto operator"" _q_C_per_m2(long double l) { return surface_charge_den
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline charge_density {
template<Representation Rep = double> using C_per_m3 = units::isq::si::charge_density<units::isq::si::coulomb_per_metre_cub, Rep>;
template<Representation Rep = double> using C_per_m2 = units::isq::si::surface_charge_density<units::isq::si::coulomb_per_metre_sq, Rep>;
} // namespace units::aliases::isq::si::inline charge_density
#endif // UNITS_ALIASES

View File

@ -54,3 +54,12 @@ constexpr auto operator"" _q_mol_per_m3(long double l) { return concentration<mo
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline concentration {
template<Representation Rep = double> using mol_per_m3 = units::isq::si::concentration<units::isq::si::mol_per_metre_cub, Rep>;
} // namespace units::aliases::isq::si::inline concentration
#endif // UNITS_ALIASES

View File

@ -168,3 +168,28 @@ using namespace conductance_references;
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline conductance {
template<Representation Rep = double> using S = units::isq::si::conductance<units::isq::si::siemens, Rep>;
template<Representation Rep = double> using yS = units::isq::si::conductance<units::isq::si::yoctosiemens, Rep>;
template<Representation Rep = double> using zS = units::isq::si::conductance<units::isq::si::zeptosiemens, Rep>;
template<Representation Rep = double> using aS = units::isq::si::conductance<units::isq::si::attosiemens, Rep>;
template<Representation Rep = double> using fS = units::isq::si::conductance<units::isq::si::femtosiemens, Rep>;
template<Representation Rep = double> using pS = units::isq::si::conductance<units::isq::si::picosiemens, Rep>;
template<Representation Rep = double> using nS = units::isq::si::conductance<units::isq::si::nanosiemens, Rep>;
template<Representation Rep = double> using uS = units::isq::si::conductance<units::isq::si::microsiemens, Rep>;
template<Representation Rep = double> using mS = units::isq::si::conductance<units::isq::si::millisiemens, Rep>;
template<Representation Rep = double> using kS = units::isq::si::conductance<units::isq::si::kilosiemens, Rep>;
template<Representation Rep = double> using MS = units::isq::si::conductance<units::isq::si::megasiemens, Rep>;
template<Representation Rep = double> using GS = units::isq::si::conductance<units::isq::si::gigasiemens, Rep>;
template<Representation Rep = double> using TS = units::isq::si::conductance<units::isq::si::terasiemens, Rep>;
template<Representation Rep = double> using PS = units::isq::si::conductance<units::isq::si::petasiemens, Rep>;
template<Representation Rep = double> using ES = units::isq::si::conductance<units::isq::si::exasiemens, Rep>;
template<Representation Rep = double> using ZS = units::isq::si::conductance<units::isq::si::zettasiemens, Rep>;
template<Representation Rep = double> using YS = units::isq::si::conductance<units::isq::si::yottasiemens, Rep>;
} // namespace units::aliases::isq::si::inline conductance
#endif // UNITS_ALIASES

View File

@ -55,3 +55,13 @@ constexpr auto operator"" _q_A_per_m2(long double l) { return current_density<am
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline current_density {
template<Representation Rep = double> using A_per_m2 = units::isq::si::current_density<units::isq::si::ampere_per_metre_sq, Rep>;
} // namespace units::aliases::isq::si::inline current_density
#endif // UNITS_ALIASES

View File

@ -55,3 +55,13 @@ constexpr auto operator"" _q_kg_per_m3(long double l) { return density<kilogram_
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline density {
template<Representation Rep = double> using kg_per_m3 = units::isq::si::density<units::isq::si::kilogram_per_metre_cub, Rep>;
} // namespace units::aliases::isq::si::inline density
#endif // UNITS_ALIASES

View File

@ -54,3 +54,12 @@ constexpr auto operator"" _q_Pa_s(long double l) { return dynamic_viscosity<pasc
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline dynamic_viscosity {
template<Representation Rep = double> using Pa_s = units::isq::si::dynamic_viscosity<units::isq::si::pascal_second, Rep>;
} // namespace units::aliases::isq::si::inline dynamic_viscosity
#endif // UNITS_ALIASES

View File

@ -71,3 +71,13 @@ using namespace electric_charge_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline electric_charge {
template<Representation Rep = double> using C = units::isq::si::electric_charge<units::isq::si::coulomb, Rep>;
} // namespace units::aliases::isq::si::inline electric_charge
#endif // UNITS_ALIASES

View File

@ -190,3 +190,33 @@ using namespace electric_current_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline electric_current {
template<Representation Rep = double> using A = units::isq::si::electric_current<units::isq::si::ampere, Rep>;
template<Representation Rep = double> using yA = units::isq::si::electric_current<units::isq::si::yoctoampere, Rep>;
template<Representation Rep = double> using zA = units::isq::si::electric_current<units::isq::si::zeptoampere, Rep>;
template<Representation Rep = double> using aA = units::isq::si::electric_current<units::isq::si::attoampere, Rep>;
template<Representation Rep = double> using fA = units::isq::si::electric_current<units::isq::si::femtoampere, Rep>;
template<Representation Rep = double> using pA = units::isq::si::electric_current<units::isq::si::picoampere, Rep>;
template<Representation Rep = double> using nA = units::isq::si::electric_current<units::isq::si::nanoampere, Rep>;
template<Representation Rep = double> using uA = units::isq::si::electric_current<units::isq::si::microampere, Rep>;
template<Representation Rep = double> using mA = units::isq::si::electric_current<units::isq::si::milliampere, Rep>;
template<Representation Rep = double> using cA = units::isq::si::electric_current<units::isq::si::centiampere, Rep>;
template<Representation Rep = double> using dA = units::isq::si::electric_current<units::isq::si::deciampere, Rep>;
template<Representation Rep = double> using daA = units::isq::si::electric_current<units::isq::si::decaampere, Rep>;
template<Representation Rep = double> using hA = units::isq::si::electric_current<units::isq::si::hectoampere, Rep>;
template<Representation Rep = double> using kA = units::isq::si::electric_current<units::isq::si::kiloampere, Rep>;
template<Representation Rep = double> using MA = units::isq::si::electric_current<units::isq::si::megaampere, Rep>;
template<Representation Rep = double> using GA = units::isq::si::electric_current<units::isq::si::gigaampere, Rep>;
template<Representation Rep = double> using TA = units::isq::si::electric_current<units::isq::si::teraampere, Rep>;
template<Representation Rep = double> using PA = units::isq::si::electric_current<units::isq::si::petaampere, Rep>;
template<Representation Rep = double> using EA = units::isq::si::electric_current<units::isq::si::exaampere, Rep>;
template<Representation Rep = double> using ZA = units::isq::si::electric_current<units::isq::si::zettaampere, Rep>;
template<Representation Rep = double> using YA = units::isq::si::electric_current<units::isq::si::yottaampere, Rep>;
} // namespace units::aliases::isq::si::inline electric_current
#endif // UNITS_ALIASES

View File

@ -52,3 +52,13 @@ constexpr auto operator"" _q_V_per_m(long double l) { return electric_field_stre
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline electric_field_strength {
template<Representation Rep = double> using V_per_m = units::isq::si::electric_field_strength<units::isq::si::volt_per_metre, Rep>;
} // namespace units::aliases::isq::si::inline electric_field_strength
#endif // UNITS_ALIASES

View File

@ -181,3 +181,32 @@ using namespace energy_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline energy {
template<Representation Rep = double> using J = units::isq::si::energy<units::isq::si::joule, Rep>;
template<Representation Rep = double> using yJ = units::isq::si::energy<units::isq::si::yoctojoule, Rep>;
template<Representation Rep = double> using zJ = units::isq::si::energy<units::isq::si::zeptojoule, Rep>;
template<Representation Rep = double> using aJ = units::isq::si::energy<units::isq::si::attojoule, Rep>;
template<Representation Rep = double> using fJ = units::isq::si::energy<units::isq::si::femtojoule, Rep>;
template<Representation Rep = double> using pJ = units::isq::si::energy<units::isq::si::picojoule, Rep>;
template<Representation Rep = double> using nJ = units::isq::si::energy<units::isq::si::nanojoule, Rep>;
template<Representation Rep = double> using uJ = units::isq::si::energy<units::isq::si::microjoule, Rep>;
template<Representation Rep = double> using mJ = units::isq::si::energy<units::isq::si::millijoule, Rep>;
template<Representation Rep = double> using kJ = units::isq::si::energy<units::isq::si::kilojoule, Rep>;
template<Representation Rep = double> using MJ = units::isq::si::energy<units::isq::si::megajoule, Rep>;
template<Representation Rep = double> using GJ = units::isq::si::energy<units::isq::si::gigajoule, Rep>;
template<Representation Rep = double> using TJ = units::isq::si::energy<units::isq::si::terajoule, Rep>;
template<Representation Rep = double> using PJ = units::isq::si::energy<units::isq::si::petajoule, Rep>;
template<Representation Rep = double> using EJ = units::isq::si::energy<units::isq::si::exajoule, Rep>;
template<Representation Rep = double> using ZJ = units::isq::si::energy<units::isq::si::zettajoule, Rep>;
template<Representation Rep = double> using YJ = units::isq::si::energy<units::isq::si::yottajoule, Rep>;
template<Representation Rep = double> using eV = units::isq::si::energy<units::isq::si::electronvolt, Rep>;
template<Representation Rep = double> using GeV = units::isq::si::energy<units::isq::si::gigaelectronvolt, Rep>;
} // namespace units::aliases::isq::si::inline energy
#endif // UNITS_ALIASES

View File

@ -53,3 +53,13 @@ constexpr auto operator"" _q_J_per_m3(long double l) { return energy_density<jou
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline energy_density {
template<Representation Rep = double> using J_per_m3 = units::isq::si::energy_density<units::isq::si::joule_per_metre_cub, Rep>;
} // namespace units::aliases::isq::si::inline energy_density
#endif // UNITS_ALIASES

View File

@ -192,3 +192,33 @@ using namespace force_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline force {
template<Representation Rep = double> using N = units::isq::si::force<units::isq::si::newton, Rep>;
template<Representation Rep = double> using yN = units::isq::si::force<units::isq::si::yoctonewton, Rep>;
template<Representation Rep = double> using zN = units::isq::si::force<units::isq::si::zeptonewton, Rep>;
template<Representation Rep = double> using aN = units::isq::si::force<units::isq::si::attonewton, Rep>;
template<Representation Rep = double> using fN = units::isq::si::force<units::isq::si::femtonewton, Rep>;
template<Representation Rep = double> using pN = units::isq::si::force<units::isq::si::piconewton, Rep>;
template<Representation Rep = double> using nN = units::isq::si::force<units::isq::si::nanonewton, Rep>;
template<Representation Rep = double> using uN = units::isq::si::force<units::isq::si::micronewton, Rep>;
template<Representation Rep = double> using mN = units::isq::si::force<units::isq::si::millinewton, Rep>;
template<Representation Rep = double> using cN = units::isq::si::force<units::isq::si::centinewton, Rep>;
template<Representation Rep = double> using dN = units::isq::si::force<units::isq::si::decinewton, Rep>;
template<Representation Rep = double> using daN = units::isq::si::force<units::isq::si::decanewton, Rep>;
template<Representation Rep = double> using hN = units::isq::si::force<units::isq::si::hectonewton, Rep>;
template<Representation Rep = double> using kN = units::isq::si::force<units::isq::si::kilonewton, Rep>;
template<Representation Rep = double> using MN = units::isq::si::force<units::isq::si::meganewton, Rep>;
template<Representation Rep = double> using GN = units::isq::si::force<units::isq::si::giganewton, Rep>;
template<Representation Rep = double> using TN = units::isq::si::force<units::isq::si::teranewton, Rep>;
template<Representation Rep = double> using PN = units::isq::si::force<units::isq::si::petanewton, Rep>;
template<Representation Rep = double> using EN = units::isq::si::force<units::isq::si::exanewton, Rep>;
template<Representation Rep = double> using ZN = units::isq::si::force<units::isq::si::zettanewton, Rep>;
template<Representation Rep = double> using YN = units::isq::si::force<units::isq::si::yottanewton, Rep>;
} // namespace units::aliases::isq::si::inline force
#endif // UNITS_ALIASES

View File

@ -166,3 +166,29 @@ using namespace frequency_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline frequency {
template<Representation Rep = double> using Hz = units::isq::si::frequency<units::isq::si::hertz, Rep>;
template<Representation Rep = double> using yHz = units::isq::si::frequency<units::isq::si::yoctohertz, Rep>;
template<Representation Rep = double> using zHz = units::isq::si::frequency<units::isq::si::zeptohertz, Rep>;
template<Representation Rep = double> using aHz = units::isq::si::frequency<units::isq::si::attohertz, Rep>;
template<Representation Rep = double> using fHz = units::isq::si::frequency<units::isq::si::femtohertz, Rep>;
template<Representation Rep = double> using pHz = units::isq::si::frequency<units::isq::si::picohertz, Rep>;
template<Representation Rep = double> using nHz = units::isq::si::frequency<units::isq::si::nanohertz, Rep>;
template<Representation Rep = double> using uHz = units::isq::si::frequency<units::isq::si::microhertz, Rep>;
template<Representation Rep = double> using mHz = units::isq::si::frequency<units::isq::si::millihertz, Rep>;
template<Representation Rep = double> using kHz = units::isq::si::frequency<units::isq::si::kilohertz, Rep>;
template<Representation Rep = double> using MHz = units::isq::si::frequency<units::isq::si::megahertz, Rep>;
template<Representation Rep = double> using GHz = units::isq::si::frequency<units::isq::si::gigahertz, Rep>;
template<Representation Rep = double> using THz = units::isq::si::frequency<units::isq::si::terahertz, Rep>;
template<Representation Rep = double> using PHz = units::isq::si::frequency<units::isq::si::petahertz, Rep>;
template<Representation Rep = double> using EHz = units::isq::si::frequency<units::isq::si::exahertz, Rep>;
template<Representation Rep = double> using ZHz = units::isq::si::frequency<units::isq::si::zettahertz, Rep>;
template<Representation Rep = double> using YHz = units::isq::si::frequency<units::isq::si::yottahertz, Rep>;
} // namespace units::aliases::isq::si::inline frequency
#endif // UNITS_ALIASES

View File

@ -75,3 +75,14 @@ constexpr auto operator"" _q_J_per_mol_K(long double l) { return molar_heat_capa
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::heat_capacity {
template<Representation Rep = double> using J_per_K = units::isq::si::heat_capacity<units::isq::si::joule_per_kelvin, Rep>;
template<Representation Rep = double> using J_per_kg_K = units::isq::si::specific_heat_capacity<units::isq::si::joule_per_kilogram_kelvin, Rep>;
template<Representation Rep = double> using J_per_mol_K = units::isq::si::molar_heat_capacity<units::isq::si::joule_per_mole_kelvin, Rep>;
} // namespace units::aliases::isq::si::heat_capacity
#endif // UNITS_ALIASES

View File

@ -168,3 +168,29 @@ using namespace inductance_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline inductance {
template<Representation Rep = double> using H = units::isq::si::inductance<units::isq::si::henry, Rep>;
template<Representation Rep = double> using yH = units::isq::si::inductance<units::isq::si::yoctohenry, Rep>;
template<Representation Rep = double> using zH = units::isq::si::inductance<units::isq::si::zeptohenry, Rep>;
template<Representation Rep = double> using aH = units::isq::si::inductance<units::isq::si::attohenry, Rep>;
template<Representation Rep = double> using fH = units::isq::si::inductance<units::isq::si::femtohenry, Rep>;
template<Representation Rep = double> using pH = units::isq::si::inductance<units::isq::si::picohenry, Rep>;
template<Representation Rep = double> using nH = units::isq::si::inductance<units::isq::si::nanohenry, Rep>;
template<Representation Rep = double> using uH = units::isq::si::inductance<units::isq::si::microhenry, Rep>;
template<Representation Rep = double> using mH = units::isq::si::inductance<units::isq::si::millihenry, Rep>;
template<Representation Rep = double> using kH = units::isq::si::inductance<units::isq::si::kilohenry, Rep>;
template<Representation Rep = double> using MH = units::isq::si::inductance<units::isq::si::megahenry, Rep>;
template<Representation Rep = double> using GH = units::isq::si::inductance<units::isq::si::gigahenry, Rep>;
template<Representation Rep = double> using TH = units::isq::si::inductance<units::isq::si::terahenry, Rep>;
template<Representation Rep = double> using PH = units::isq::si::inductance<units::isq::si::petahenry, Rep>;
template<Representation Rep = double> using EH = units::isq::si::inductance<units::isq::si::exahenry, Rep>;
template<Representation Rep = double> using ZH = units::isq::si::inductance<units::isq::si::zettahenry, Rep>;
template<Representation Rep = double> using YH = units::isq::si::inductance<units::isq::si::yottahenry, Rep>;
} // namespace units::aliases::isq::si::inline inductance
#endif // UNITS_ALIASES

View File

@ -197,3 +197,34 @@ using namespace length_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline length {
template<Representation Rep = double> using m = units::isq::si::length<units::isq::si::metre, Rep>;
template<Representation Rep = double> using ym = units::isq::si::length<units::isq::si::yoctometre, Rep>;
template<Representation Rep = double> using zm = units::isq::si::length<units::isq::si::zeptometre, Rep>;
template<Representation Rep = double> using am = units::isq::si::length<units::isq::si::attometre, Rep>;
template<Representation Rep = double> using fm = units::isq::si::length<units::isq::si::femtometre, Rep>;
template<Representation Rep = double> using pm = units::isq::si::length<units::isq::si::picometre, Rep>;
template<Representation Rep = double> using nm = units::isq::si::length<units::isq::si::nanometre, Rep>;
template<Representation Rep = double> using um = units::isq::si::length<units::isq::si::micrometre, Rep>;
template<Representation Rep = double> using mm = units::isq::si::length<units::isq::si::millimetre, Rep>;
template<Representation Rep = double> using cm = units::isq::si::length<units::isq::si::centimetre, Rep>;
template<Representation Rep = double> using dm = units::isq::si::length<units::isq::si::decimetre, Rep>;
template<Representation Rep = double> using dam = units::isq::si::length<units::isq::si::decametre, Rep>;
template<Representation Rep = double> using hm = units::isq::si::length<units::isq::si::hectometre, Rep>;
template<Representation Rep = double> using km = units::isq::si::length<units::isq::si::kilometre, Rep>;
template<Representation Rep = double> using Mm = units::isq::si::length<units::isq::si::megametre, Rep>;
template<Representation Rep = double> using Gm = units::isq::si::length<units::isq::si::gigametre, Rep>;
template<Representation Rep = double> using Tm = units::isq::si::length<units::isq::si::terametre, Rep>;
template<Representation Rep = double> using Pm = units::isq::si::length<units::isq::si::petametre, Rep>;
template<Representation Rep = double> using Em = units::isq::si::length<units::isq::si::exametre, Rep>;
template<Representation Rep = double> using Zm = units::isq::si::length<units::isq::si::zettametre, Rep>;
template<Representation Rep = double> using Ym = units::isq::si::length<units::isq::si::yottametre, Rep>;
template<Representation Rep = double> using au = units::isq::si::length<units::isq::si::astronomical_unit, Rep>;
} // namespace units::aliases::isq::si::inline length
#endif // UNITS_ALIASES

View File

@ -54,3 +54,12 @@ constexpr auto operator"" _q_cd_per_m2(long double l) { return luminance<candela
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline luminance {
template<Representation Rep = double> using cd_per_m2 = units::isq::si::luminance<units::isq::si::candela_per_metre_sq, Rep>;
} // namespace units::aliases::isq::si::inline luminance
#endif // UNITS_ALIASES

View File

@ -190,3 +190,33 @@ using namespace luminous_intensity_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::luminous_intensity {
template<Representation Rep = double> using cd = units::isq::si::luminous_intensity<units::isq::si::candela, Rep>;
template<Representation Rep = double> using ycd = units::isq::si::luminous_intensity<units::isq::si::yoctocandela, Rep>;
template<Representation Rep = double> using zcd = units::isq::si::luminous_intensity<units::isq::si::zeptocandela, Rep>;
template<Representation Rep = double> using acd = units::isq::si::luminous_intensity<units::isq::si::attocandela, Rep>;
template<Representation Rep = double> using fcd = units::isq::si::luminous_intensity<units::isq::si::femtocandela, Rep>;
template<Representation Rep = double> using pcd = units::isq::si::luminous_intensity<units::isq::si::picocandela, Rep>;
template<Representation Rep = double> using ncd = units::isq::si::luminous_intensity<units::isq::si::nanocandela, Rep>;
template<Representation Rep = double> using ucd = units::isq::si::luminous_intensity<units::isq::si::microcandela, Rep>;
template<Representation Rep = double> using mcd = units::isq::si::luminous_intensity<units::isq::si::millicandela, Rep>;
template<Representation Rep = double> using ccd = units::isq::si::luminous_intensity<units::isq::si::centicandela, Rep>;
template<Representation Rep = double> using dcd = units::isq::si::luminous_intensity<units::isq::si::decicandela, Rep>;
template<Representation Rep = double> using dacd = units::isq::si::luminous_intensity<units::isq::si::decacandela, Rep>;
template<Representation Rep = double> using hcd = units::isq::si::luminous_intensity<units::isq::si::hectocandela, Rep>;
template<Representation Rep = double> using kcd = units::isq::si::luminous_intensity<units::isq::si::kilocandela, Rep>;
template<Representation Rep = double> using Mcd = units::isq::si::luminous_intensity<units::isq::si::megacandela, Rep>;
template<Representation Rep = double> using Gcd = units::isq::si::luminous_intensity<units::isq::si::gigacandela, Rep>;
template<Representation Rep = double> using Tcd = units::isq::si::luminous_intensity<units::isq::si::teracandela, Rep>;
template<Representation Rep = double> using Pcd = units::isq::si::luminous_intensity<units::isq::si::petacandela, Rep>;
template<Representation Rep = double> using Ecd = units::isq::si::luminous_intensity<units::isq::si::exacandela, Rep>;
template<Representation Rep = double> using Zcd = units::isq::si::luminous_intensity<units::isq::si::zettacandela, Rep>;
template<Representation Rep = double> using Ycd = units::isq::si::luminous_intensity<units::isq::si::yottacandela, Rep>;
} // namespace units::aliases::isq::si::luminous_intensity
#endif // UNITS_ALIASES

View File

@ -168,3 +168,29 @@ using namespace magnetic_flux_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline magnetic_flux {
template<Representation Rep = double> using Wb = units::isq::si::magnetic_flux<units::isq::si::weber, Rep>;
template<Representation Rep = double> using yWb = units::isq::si::magnetic_flux<units::isq::si::yoctoweber, Rep>;
template<Representation Rep = double> using zWb = units::isq::si::magnetic_flux<units::isq::si::zeptoweber, Rep>;
template<Representation Rep = double> using aWb = units::isq::si::magnetic_flux<units::isq::si::attoweber, Rep>;
template<Representation Rep = double> using fWb = units::isq::si::magnetic_flux<units::isq::si::femtoweber, Rep>;
template<Representation Rep = double> using pWb = units::isq::si::magnetic_flux<units::isq::si::picoweber, Rep>;
template<Representation Rep = double> using nWb = units::isq::si::magnetic_flux<units::isq::si::nanoweber, Rep>;
template<Representation Rep = double> using uWb = units::isq::si::magnetic_flux<units::isq::si::microweber, Rep>;
template<Representation Rep = double> using mWb = units::isq::si::magnetic_flux<units::isq::si::milliweber, Rep>;
template<Representation Rep = double> using kWb = units::isq::si::magnetic_flux<units::isq::si::kiloweber, Rep>;
template<Representation Rep = double> using MWb = units::isq::si::magnetic_flux<units::isq::si::megaweber, Rep>;
template<Representation Rep = double> using GWb = units::isq::si::magnetic_flux<units::isq::si::gigaweber, Rep>;
template<Representation Rep = double> using TWb = units::isq::si::magnetic_flux<units::isq::si::teraweber, Rep>;
template<Representation Rep = double> using PWb = units::isq::si::magnetic_flux<units::isq::si::petaweber, Rep>;
template<Representation Rep = double> using EWb = units::isq::si::magnetic_flux<units::isq::si::exaweber, Rep>;
template<Representation Rep = double> using ZWb = units::isq::si::magnetic_flux<units::isq::si::zettaweber, Rep>;
template<Representation Rep = double> using YWb = units::isq::si::magnetic_flux<units::isq::si::yottaweber, Rep>;
} // namespace units::aliases::isq::si::inline magnetic_flux
#endif // UNITS_ALIASES

View File

@ -176,4 +176,31 @@ using namespace magnetic_induction_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline magnetic_induction {
template<Representation Rep = double> using T = units::isq::si::magnetic_induction<units::isq::si::tesla, Rep>;
template<Representation Rep = double> using yT = units::isq::si::magnetic_induction<units::isq::si::yoctotesla, Rep>;
template<Representation Rep = double> using zT = units::isq::si::magnetic_induction<units::isq::si::zeptotesla, Rep>;
template<Representation Rep = double> using aT = units::isq::si::magnetic_induction<units::isq::si::attotesla, Rep>;
template<Representation Rep = double> using fT = units::isq::si::magnetic_induction<units::isq::si::femtotesla, Rep>;
template<Representation Rep = double> using pT = units::isq::si::magnetic_induction<units::isq::si::picotesla, Rep>;
template<Representation Rep = double> using nT = units::isq::si::magnetic_induction<units::isq::si::nanotesla, Rep>;
template<Representation Rep = double> using uT = units::isq::si::magnetic_induction<units::isq::si::microtesla, Rep>;
template<Representation Rep = double> using mT = units::isq::si::magnetic_induction<units::isq::si::millitesla, Rep>;
template<Representation Rep = double> using kT = units::isq::si::magnetic_induction<units::isq::si::kilotesla, Rep>;
template<Representation Rep = double> using MT = units::isq::si::magnetic_induction<units::isq::si::megatesla, Rep>;
template<Representation Rep = double> using GT = units::isq::si::magnetic_induction<units::isq::si::gigatesla, Rep>;
template<Representation Rep = double> using TT = units::isq::si::magnetic_induction<units::isq::si::teratesla, Rep>;
template<Representation Rep = double> using PT = units::isq::si::magnetic_induction<units::isq::si::petatesla, Rep>;
template<Representation Rep = double> using ET = units::isq::si::magnetic_induction<units::isq::si::exatesla, Rep>;
template<Representation Rep = double> using ZT = units::isq::si::magnetic_induction<units::isq::si::zettatesla, Rep>;
template<Representation Rep = double> using YT = units::isq::si::magnetic_induction<units::isq::si::yottatesla, Rep>;
template<Representation Rep = double> using G = units::isq::si::magnetic_induction<units::isq::si::gauss, Rep>;
} // namespace units::aliases::isq::si::inline magnetic_induction
#endif // UNITS_ALIASES

View File

@ -291,6 +291,7 @@ inline constexpr auto Pg = reference<dim_mass, petagram>{};
inline constexpr auto Eg = reference<dim_mass, exagram>{}; inline constexpr auto Eg = reference<dim_mass, exagram>{};
inline constexpr auto Zg = reference<dim_mass, zettagram>{}; inline constexpr auto Zg = reference<dim_mass, zettagram>{};
inline constexpr auto Yg = reference<dim_mass, yottagram>{}; inline constexpr auto Yg = reference<dim_mass, yottagram>{};
inline constexpr auto t = reference<dim_mass, tonne>{}; inline constexpr auto t = reference<dim_mass, tonne>{};
inline constexpr auto yt = reference<dim_mass, yoctotonne>{}; inline constexpr auto yt = reference<dim_mass, yoctotonne>{};
inline constexpr auto zt = reference<dim_mass, zeptotonne>{}; inline constexpr auto zt = reference<dim_mass, zeptotonne>{};
@ -325,3 +326,56 @@ using namespace mass_references;
#endif // UNITS_REFERENCES #endif // UNITS_REFERENCES
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline mass {
template<Representation Rep = double> using g = units::isq::si::mass<units::isq::si::gram, Rep>;
template<Representation Rep = double> using yg = units::isq::si::mass<units::isq::si::yoctogram, Rep>;
template<Representation Rep = double> using zg = units::isq::si::mass<units::isq::si::zeptogram, Rep>;
template<Representation Rep = double> using ag = units::isq::si::mass<units::isq::si::attogram, Rep>;
template<Representation Rep = double> using fg = units::isq::si::mass<units::isq::si::femtogram, Rep>;
template<Representation Rep = double> using pg = units::isq::si::mass<units::isq::si::picogram, Rep>;
template<Representation Rep = double> using ng = units::isq::si::mass<units::isq::si::nanogram, Rep>;
template<Representation Rep = double> using ug = units::isq::si::mass<units::isq::si::microgram, Rep>;
template<Representation Rep = double> using mg = units::isq::si::mass<units::isq::si::milligram, Rep>;
template<Representation Rep = double> using cg = units::isq::si::mass<units::isq::si::centigram, Rep>;
template<Representation Rep = double> using dg = units::isq::si::mass<units::isq::si::decigram, Rep>;
template<Representation Rep = double> using dag = units::isq::si::mass<units::isq::si::decagram, Rep>;
template<Representation Rep = double> using hg = units::isq::si::mass<units::isq::si::hectogram, Rep>;
template<Representation Rep = double> using kg = units::isq::si::mass<units::isq::si::kilogram, Rep>;
template<Representation Rep = double> using Mg = units::isq::si::mass<units::isq::si::megagram, Rep>;
template<Representation Rep = double> using Gg = units::isq::si::mass<units::isq::si::gigagram, Rep>;
template<Representation Rep = double> using Tg = units::isq::si::mass<units::isq::si::teragram, Rep>;
template<Representation Rep = double> using Pg = units::isq::si::mass<units::isq::si::petagram, Rep>;
template<Representation Rep = double> using Eg = units::isq::si::mass<units::isq::si::exagram, Rep>;
template<Representation Rep = double> using Zg = units::isq::si::mass<units::isq::si::zettagram, Rep>;
template<Representation Rep = double> using Yg = units::isq::si::mass<units::isq::si::yottagram, Rep>;
template<Representation Rep = double> using t = units::isq::si::mass<units::isq::si::tonne, Rep>;
template<Representation Rep = double> using yt = units::isq::si::mass<units::isq::si::yoctotonne, Rep>;
template<Representation Rep = double> using zt = units::isq::si::mass<units::isq::si::zeptotonne, Rep>;
template<Representation Rep = double> using at = units::isq::si::mass<units::isq::si::attotonne, Rep>;
template<Representation Rep = double> using ft = units::isq::si::mass<units::isq::si::femtotonne, Rep>;
template<Representation Rep = double> using pt = units::isq::si::mass<units::isq::si::picotonne, Rep>;
template<Representation Rep = double> using nt = units::isq::si::mass<units::isq::si::nanotonne, Rep>;
template<Representation Rep = double> using ut = units::isq::si::mass<units::isq::si::microtonne, Rep>;
template<Representation Rep = double> using mt = units::isq::si::mass<units::isq::si::millitonne, Rep>;
template<Representation Rep = double> using ct = units::isq::si::mass<units::isq::si::centitonne, Rep>;
template<Representation Rep = double> using dt = units::isq::si::mass<units::isq::si::decitonne, Rep>;
template<Representation Rep = double> using dat = units::isq::si::mass<units::isq::si::decatonne, Rep>;
template<Representation Rep = double> using ht = units::isq::si::mass<units::isq::si::hectotonne, Rep>;
template<Representation Rep = double> using kt = units::isq::si::mass<units::isq::si::kilotonne, Rep>;
template<Representation Rep = double> using Mt = units::isq::si::mass<units::isq::si::megatonne, Rep>;
template<Representation Rep = double> using Gt = units::isq::si::mass<units::isq::si::gigatonne, Rep>;
template<Representation Rep = double> using Tt = units::isq::si::mass<units::isq::si::teratonne, Rep>;
template<Representation Rep = double> using Pt = units::isq::si::mass<units::isq::si::petatonne, Rep>;
template<Representation Rep = double> using Et = units::isq::si::mass<units::isq::si::exatonne, Rep>;
template<Representation Rep = double> using Zt = units::isq::si::mass<units::isq::si::zettatonne, Rep>;
template<Representation Rep = double> using Yt = units::isq::si::mass<units::isq::si::yottatonne, Rep>;
template<Representation Rep = double> using Da = units::isq::si::mass<units::isq::si::dalton, Rep>;
} // namespace units::aliases::isq::si::inline mass
#endif // UNITS_ALIASES

View File

@ -55,3 +55,13 @@ constexpr auto operator"" _q_J_per_mol(long double l) { return molar_energy<joul
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline molar_energy {
template<Representation Rep = double> using J_per_mol = units::isq::si::molar_energy<units::isq::si::joule_per_mole, Rep>;
} // namespace units::aliases::isq::si::inline molar_energy
#endif // UNITS_ALIASES

View File

@ -53,3 +53,13 @@ constexpr auto operator"" _q_kg_m_per_s(long double l) { return momentum<kilogra
#endif // UNITS_LITERALS #endif // UNITS_LITERALS
} // namespace units::isq::si } // namespace units::isq::si
#ifdef UNITS_ALIASES
namespace units::aliases::isq::si::inline momentum {
template<Representation Rep = double> using kg_m_per_s = units::isq::si::momentum<units::isq::si::kilogram_metre_per_second, Rep>;
} // namespace units::aliases::isq::si::inline momentum
#endif // UNITS_ALIASES

Some files were not shown because too many files have changed in this diff Show More