mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-29 18:07:16 +02:00
refactor: V2 design update
This commit is contained in:
@ -73,7 +73,7 @@ add_subdirectory(example)
|
||||
# add unit tests
|
||||
enable_testing()
|
||||
|
||||
# add_subdirectory(test)
|
||||
add_subdirectory(test)
|
||||
|
||||
# tests for standalone headers
|
||||
include(TestPublicHeaders)
|
||||
|
@ -6,6 +6,11 @@ quantity
|
||||
Interface
|
||||
---------
|
||||
|
||||
The value of a quantity is generally expressed as the product of a number and a unit. The
|
||||
unit is simply a particular example of the quantity concerned which is used as a reference,
|
||||
and the number is the ratio of the value of the quantity to the unit.
|
||||
|
||||
|
||||
`quantity` class template provides a similar interface to
|
||||
`std::chrono::duration <https://en.cppreference.com/w/cpp/chrono/duration>`_.
|
||||
The difference is that it uses ``double`` as a default representation and has
|
||||
|
@ -125,3 +125,68 @@ In order to obtain the base/coherent unit of any dimension type a
|
||||
|
||||
static_assert(is_same_v<dimension_unit<si::dim_length>, si::metre>);
|
||||
static_assert(is_same_v<dimension_unit<si::dim_speed>, si::metre_per_second>);
|
||||
|
||||
|
||||
|
||||
|
||||
How do you feel about:
|
||||
|
||||
inline constexpr second second;
|
||||
?
|
||||
|
||||
We could do the same to dimensions to not have to type dim_length{} all the time.
|
||||
|
||||
6 replies 2 new
|
||||
@JohelEGP
|
||||
JohelEGP
|
||||
2 days ago
|
||||
mp_units::units::second is a variable. The reference isq::si::second could stay a type and s continue to be a variable.
|
||||
|
||||
@mpusz
|
||||
mpusz
|
||||
2 days ago
|
||||
Maintainer
|
||||
Author
|
||||
The problem is the following:
|
||||
|
||||
Variables are really needed for a new design. We can ask users to put {} after every dimension unit, and reference types but it would be really nasty and a lot of boilerplate.
|
||||
Short names have to be opt-in as they collide with a lot of code (especially on MSVC).
|
||||
@JohelEGP
|
||||
JohelEGP
|
||||
yesterday
|
||||
As pointed out by #389 (reply in thread), I think it'd be OK suffix _t to the types.
|
||||
|
||||
@mpusz
|
||||
mpusz
|
||||
10 hours ago
|
||||
Maintainer
|
||||
Author
|
||||
It will be visible in the compilation errors, which is inconvenient :-(
|
||||
|
||||
Instead of:
|
||||
|
||||
quantity<reference<derived_dimension<length_dim, per<time_dim>>, derived_unit<metre, per<second>>>
|
||||
we will have something like:
|
||||
|
||||
quantity<reference<derived_dimension<length_dim_t, per<time_dim_t>>, derived_unit<metre_t, per<second_t>>>
|
||||
Personally, I like the first output more.
|
||||
|
||||
Note that definition like:
|
||||
|
||||
inline constexpr second second;
|
||||
besides, being really unconventional, is allowed by the language and will not impact our users at all. A user is about to always work with values in the code and observe types in the compilation errors. Using the same nicely blends those two domains together.
|
||||
|
||||
@mpusz
|
||||
mpusz
|
||||
10 hours ago
|
||||
Maintainer
|
||||
Author
|
||||
I could use a list of values instead of types as template parameters in the dervied_dimension and derived_unit but in such case the error would look like:
|
||||
|
||||
quantity<reference<derived_dimension<length_dim{}, per<time_dim{}>{}>{}, derived_unit<metre{}, per<second{}>{}>{}>>
|
||||
which also is not that nice.
|
||||
|
||||
@JohelEGP
|
||||
JohelEGP
|
||||
6 hours ago
|
||||
That's convincing. This justification should definitely be part of the documentation.
|
||||
|
@ -417,3 +417,18 @@ class template::
|
||||
|
||||
To learn more about unknown units please refer to the
|
||||
:ref:`use_cases/unknown_dimensions:Working with Unknown Dimensions and Their Units` chapter.
|
||||
|
||||
|
||||
## System reference
|
||||
|
||||
"It is important to emphasize that each physical quantity has only one coherent SI unit, even
|
||||
though this unit can be expressed in different forms by using some of the special names and
|
||||
symbols."
|
||||
The converse, however, is not true, because in general several different quantities may
|
||||
share the same SI unit.
|
||||
|
||||
|
||||
For example, for the quantity heat capacity as well as for the
|
||||
quantity entropy the SI unit is joule per kelvin. Similarly, for the base quantity electric
|
||||
current as well as the derived quantity magnetomotive force the SI unit is the ampere. It is
|
||||
therefore important not to use the unit alone to specify the quantity.
|
||||
|
@ -33,7 +33,7 @@ function(add_example target)
|
||||
target_link_libraries(${target} PRIVATE ${ARGN})
|
||||
endfunction()
|
||||
|
||||
add_example(v2_framework mp-units::core-fmt mp-units::core-io mp-units::si)
|
||||
add_example(v2_framework mp-units::core mp-units::si)
|
||||
|
||||
# add_example(conversion_factor mp-units::core-fmt mp-units::core-io mp-units::si)
|
||||
# add_example(custom_systems mp-units::core-io mp-units::si)
|
||||
|
@ -20,366 +20,135 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
// #include <units/concepts.h>
|
||||
#include <units/dimension.h>
|
||||
#include <units/si/si.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
inline constexpr struct length_dim : base_dimension<"L"> {
|
||||
} length_dim;
|
||||
inline constexpr struct mass_dim : base_dimension<"M"> {
|
||||
} mass_dim;
|
||||
inline constexpr struct time_dim : base_dimension<"T"> {
|
||||
} time_dim;
|
||||
inline constexpr struct electric_current_dim : base_dimension<"I"> {
|
||||
} electric_current_dim;
|
||||
// TODO Should the below use basic_symbol_text? How to name it for ASCII?
|
||||
inline constexpr struct thermodynamic_temperature_dim : base_dimension<"Θ"> {
|
||||
} thermodynamic_temperature_dim;
|
||||
inline constexpr struct amount_of_substance_dim : base_dimension<"N"> {
|
||||
} amount_of_substance_dim;
|
||||
inline constexpr struct luminous_intensity_dim : base_dimension<"J"> {
|
||||
} luminous_intensity_dim;
|
||||
|
||||
inline constexpr struct frequency_dim : decltype(1 / time_dim) {
|
||||
} frequency_dim;
|
||||
inline constexpr struct area_dim : decltype(length_dim * length_dim) {
|
||||
} area_dim;
|
||||
inline constexpr struct volume_dim : decltype(area_dim * length_dim) {
|
||||
} volume_dim;
|
||||
inline constexpr struct speed_dim : decltype(length_dim / time_dim) {
|
||||
} speed_dim;
|
||||
inline constexpr struct acceleration_dim : decltype(speed_dim / time_dim) {
|
||||
} acceleration_dim;
|
||||
|
||||
// inline constexpr auto speed = length / time;
|
||||
|
||||
// using speed_dim = decltype(length_dim / time_dim);
|
||||
// inline constexpr speed_dim speed_dim;
|
||||
|
||||
// template<typename T>
|
||||
// concept Length = QuantityOf<T, length_dim>;
|
||||
|
||||
} // namespace units::isq
|
||||
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace isq::si {
|
||||
|
||||
// length units
|
||||
inline constexpr struct metre : named_unit<"m"> {
|
||||
} metre;
|
||||
inline constexpr struct kilometre : kilo<metre> {
|
||||
} kilometre;
|
||||
|
||||
inline constexpr struct astronomical_unit : named_scaled_unit<"au", mag<149'597'870'700>(), metre> {
|
||||
} astronomical_unit;
|
||||
|
||||
// area units
|
||||
inline constexpr struct square_metre : derived_unit<decltype(metre * metre)> {
|
||||
} square_metre;
|
||||
|
||||
// volume units
|
||||
inline constexpr struct cubic_metre : derived_unit<decltype(metre * metre * metre)> {
|
||||
} cubic_metre;
|
||||
|
||||
// time units
|
||||
inline constexpr struct second : named_unit<"s"> {
|
||||
} second;
|
||||
inline constexpr struct minute : named_scaled_unit<"min", mag<60>(), second> {
|
||||
} minute;
|
||||
inline constexpr struct hour : named_scaled_unit<"h", mag<60>(), minute> {
|
||||
} hour;
|
||||
inline constexpr struct day : named_scaled_unit<"d", mag<24>(), hour> {
|
||||
} day;
|
||||
|
||||
// not time units!
|
||||
// TODO should those be provided for other scaled units like ms, h, ...
|
||||
inline constexpr struct second_squared : derived_unit<decltype(second * second)> {
|
||||
} second_squared;
|
||||
inline constexpr struct second_cubed : derived_unit<decltype(second * second * second)> {
|
||||
} second_cubed;
|
||||
|
||||
// mass units
|
||||
inline constexpr struct gram : named_unit<"g"> {
|
||||
} gram;
|
||||
inline constexpr struct kilogram : kilo<gram> {
|
||||
} kilogram;
|
||||
inline constexpr struct tonne : named_scaled_unit<"t", mag<1000>(), gram> {
|
||||
} tonne;
|
||||
|
||||
// other units
|
||||
inline constexpr struct hertz : named_unit<"Hz", 1 / second> {
|
||||
} hertz;
|
||||
inline constexpr struct newton : named_unit<"N", kilogram * metre / second_squared> {
|
||||
} newton;
|
||||
inline constexpr struct pascal : named_unit<"Pa", kilogram / (metre * second_squared)> {
|
||||
} pascal;
|
||||
inline constexpr struct joule : named_unit<"J", newton * metre> {
|
||||
} joule;
|
||||
inline constexpr struct watt : named_unit<"W", joule / second> {
|
||||
} watt;
|
||||
|
||||
namespace unit_symbols {
|
||||
|
||||
inline namespace length_units {
|
||||
|
||||
inline constexpr auto m = metre;
|
||||
inline constexpr auto km = kilometre;
|
||||
inline constexpr auto au = astronomical_unit;
|
||||
|
||||
} // namespace length_units
|
||||
|
||||
inline namespace area_units {
|
||||
|
||||
inline constexpr auto m2 = square_metre;
|
||||
|
||||
template<typename T, typename Expr>
|
||||
constexpr bool is_of_type(Expr)
|
||||
{
|
||||
return std::is_same_v<Expr, T>;
|
||||
}
|
||||
|
||||
inline namespace volume_units {
|
||||
namespace {
|
||||
|
||||
inline constexpr auto m3 = cubic_metre;
|
||||
using namespace units;
|
||||
using namespace units::si::unit_symbols;
|
||||
|
||||
}
|
||||
|
||||
inline namespace time_units {
|
||||
|
||||
inline constexpr auto s = second;
|
||||
inline constexpr auto min = minute;
|
||||
inline constexpr auto h = hour;
|
||||
inline constexpr auto d = day;
|
||||
|
||||
inline constexpr auto s2 = second_squared;
|
||||
|
||||
} // namespace time_units
|
||||
|
||||
inline namespace mass_units {
|
||||
|
||||
inline constexpr auto g = gram;
|
||||
inline constexpr auto kg = kilogram;
|
||||
inline constexpr auto t = tonne;
|
||||
|
||||
} // namespace mass_units
|
||||
|
||||
inline namespace frequency_units {
|
||||
|
||||
inline constexpr auto Hz = hertz;
|
||||
|
||||
}
|
||||
|
||||
inline namespace force_units {
|
||||
|
||||
inline constexpr auto N = newton;
|
||||
|
||||
}
|
||||
|
||||
inline namespace pressure_units {
|
||||
|
||||
inline constexpr auto Pa = pascal;
|
||||
|
||||
}
|
||||
|
||||
inline namespace energy_units {
|
||||
|
||||
inline constexpr auto J = joule;
|
||||
|
||||
}
|
||||
|
||||
inline namespace power_units {
|
||||
|
||||
inline constexpr auto W = watt;
|
||||
|
||||
}
|
||||
|
||||
} // namespace unit_symbols
|
||||
|
||||
} // namespace isq::si
|
||||
} // namespace units
|
||||
|
||||
#include <units/reference.h>
|
||||
|
||||
namespace units {
|
||||
|
||||
inline constexpr struct dimensionless : system_reference<dimensionless, one_dim, one> {
|
||||
} dimensionless;
|
||||
|
||||
} // namespace units
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
inline constexpr struct length : system_reference<length, length_dim, metre> {
|
||||
} length;
|
||||
inline constexpr struct time : system_reference<time, time_dim, second> {
|
||||
} time;
|
||||
inline constexpr struct frequency : system_reference<frequency, frequency_dim, hertz> {
|
||||
} frequency;
|
||||
inline constexpr struct area : system_reference<area, area_dim, square_metre> {
|
||||
} area;
|
||||
inline constexpr struct volume : system_reference<volume, volume_dim, cubic_metre> {
|
||||
} volume;
|
||||
inline constexpr struct speed : system_reference<speed, speed_dim, metre / second> {
|
||||
} speed;
|
||||
inline constexpr struct acceleration : system_reference<acceleration, acceleration_dim, metre / second / second> {
|
||||
} acceleration;
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
|
||||
template<auto V, typename T>
|
||||
inline constexpr bool is_of_type = std::is_same_v<std::remove_cvref_t<decltype(V)>, T>;
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
// derived dimension expression template syntax verification
|
||||
static_assert(is_of_type<1 / time_dim, derived_dimension<struct one_dim, per<struct time_dim>>>);
|
||||
static_assert(is_of_type<1 / (1 / time_dim), struct time_dim>);
|
||||
|
||||
static_assert(is_of_type<one_dim * time_dim, struct time_dim>);
|
||||
static_assert(is_of_type<time_dim * one_dim, struct time_dim>);
|
||||
static_assert(is_of_type<one_dim * (1 / time_dim), derived_dimension<struct one_dim, per<struct time_dim>>>);
|
||||
static_assert(is_of_type<1 / time_dim * one_dim, derived_dimension<struct one_dim, per<struct time_dim>>>);
|
||||
|
||||
static_assert(is_of_type<length_dim * time_dim, derived_dimension<struct length_dim, struct time_dim>>);
|
||||
static_assert(is_of_type<length_dim * length_dim, derived_dimension<power<struct length_dim, 2>>>);
|
||||
constexpr auto power = 5 * si::power[W];
|
||||
static_assert(is_of_type<quantity<reference<struct isq::power_dim, struct si::watt>{}, int>>(power));
|
||||
|
||||
constexpr auto speed = 5 * si::speed[m / s];
|
||||
static_assert(
|
||||
is_of_type<length_dim * length_dim * time_dim, derived_dimension<power<struct length_dim, 2>, struct time_dim>>);
|
||||
static_assert(
|
||||
is_of_type<length_dim * time_dim * length_dim, derived_dimension<power<struct length_dim, 2>, struct time_dim>>);
|
||||
is_of_type<quantity<reference<struct isq::speed_dim, derived_unit<struct si::metre, per<struct si::second>>>{}, int>>(
|
||||
speed));
|
||||
|
||||
static_assert(
|
||||
is_of_type<length_dim*(time_dim* length_dim), derived_dimension<power<struct length_dim, 2>, struct time_dim>>);
|
||||
static_assert(
|
||||
is_of_type<time_dim*(length_dim* length_dim), derived_dimension<power<struct length_dim, 2>, struct time_dim>>);
|
||||
constexpr auto q = 10 * si::length[m] / (2 * si::time[s]);
|
||||
static_assert(is_of_type<quantity<reference<derived_dimension<struct isq::length_dim, per<struct isq::time_dim>>,
|
||||
derived_unit<struct si::metre, per<struct si::second>>>{},
|
||||
int>>(q));
|
||||
|
||||
static_assert(is_of_type<1 / time_dim * length_dim, derived_dimension<struct length_dim, per<struct time_dim>>>);
|
||||
static_assert(is_of_type<1 / time_dim * time_dim, struct one_dim>);
|
||||
constexpr auto distance = 5 * si::speed[m / s] * (5 * si::time[s]);
|
||||
|
||||
static_assert(is_of_type<time_dim / one_dim, struct time_dim>);
|
||||
static_assert(is_of_type<1 / time_dim / one_dim, derived_dimension<struct one_dim, per<struct time_dim>>>);
|
||||
static_assert(is_of_type<quantity<reference<struct isq::length_dim, struct si::metre>{}, int>>(distance));
|
||||
|
||||
static_assert(is_of_type<length_dim / time_dim * time_dim, struct length_dim>);
|
||||
static_assert(
|
||||
is_of_type<1 / time_dim * (1 / time_dim), derived_dimension<struct one_dim, per<power<struct time_dim, 2>>>>);
|
||||
static_assert(is_of_type<1 / (time_dim * time_dim), derived_dimension<struct one_dim, per<power<struct time_dim, 2>>>>);
|
||||
static_assert(is_of_type<1 / (1 / (time_dim * time_dim)), derived_dimension<power<struct time_dim, 2>>>);
|
||||
constexpr auto dimensionless = 20 * si::speed[m / s] / (10 * si::length[m]) * (5 * si::time[s]);
|
||||
|
||||
static_assert(is_of_type<length_dim / time_dim * (1 / time_dim),
|
||||
derived_dimension<struct length_dim, per<power<struct time_dim, 2>>>>);
|
||||
static_assert(is_of_type<length_dim / time_dim*(length_dim / time_dim),
|
||||
derived_dimension<power<struct length_dim, 2>, per<power<struct time_dim, 2>>>>);
|
||||
static_assert(is_of_type<length_dim / time_dim*(time_dim / length_dim), struct one_dim>);
|
||||
|
||||
static_assert(is_of_type<speed_dim / acceleration_dim, struct time_dim>);
|
||||
static_assert(is_of_type<acceleration_dim / speed_dim, derived_dimension<struct one_dim, per<struct time_dim>>>);
|
||||
static_assert(
|
||||
is_of_type<speed_dim * speed_dim / length_dim, derived_dimension<struct length_dim, per<power<struct time_dim, 2>>>>);
|
||||
static_assert(is_of_type<1 / (speed_dim * speed_dim) * length_dim,
|
||||
derived_dimension<power<struct time_dim, 2>, per<struct length_dim>>>);
|
||||
|
||||
namespace si {
|
||||
|
||||
// comparisons of equivalent dimensions
|
||||
static_assert(length_dim / length_dim == one_dim);
|
||||
|
||||
static_assert(1 / time_dim == frequency_dim);
|
||||
static_assert(1 / frequency_dim == time_dim);
|
||||
static_assert(frequency_dim * time_dim == one_dim);
|
||||
|
||||
static_assert(length_dim * length_dim == area_dim);
|
||||
static_assert(length_dim * length_dim != volume_dim);
|
||||
static_assert(area_dim / length_dim == length_dim);
|
||||
|
||||
static_assert(length_dim * length_dim * length_dim == volume_dim);
|
||||
static_assert(area_dim * length_dim == volume_dim);
|
||||
static_assert(volume_dim / length_dim == area_dim);
|
||||
static_assert(volume_dim / length_dim / length_dim == length_dim);
|
||||
static_assert(area_dim * area_dim / length_dim == volume_dim);
|
||||
static_assert(area_dim * (area_dim / length_dim) == volume_dim);
|
||||
static_assert(volume_dim / (length_dim * length_dim) == length_dim);
|
||||
|
||||
static_assert(length_dim / time_dim == speed_dim);
|
||||
static_assert(length_dim * time_dim != speed_dim);
|
||||
static_assert(length_dim / time_dim / time_dim != speed_dim);
|
||||
static_assert(length_dim / speed_dim == time_dim);
|
||||
static_assert(speed_dim * time_dim == length_dim);
|
||||
|
||||
static_assert(length_dim / time_dim / time_dim == acceleration_dim);
|
||||
static_assert(length_dim / (time_dim * time_dim) == acceleration_dim);
|
||||
static_assert(speed_dim / time_dim == acceleration_dim);
|
||||
static_assert(speed_dim / acceleration_dim == time_dim);
|
||||
static_assert(acceleration_dim * time_dim == speed_dim);
|
||||
static_assert(acceleration_dim * (time_dim * time_dim) == length_dim);
|
||||
static_assert(acceleration_dim / speed_dim == frequency_dim);
|
||||
|
||||
} // namespace si
|
||||
|
||||
} // namespace units::isq
|
||||
static_assert(is_of_type<quantity<reference<struct one_dim, struct one>{}, int>>(dimensionless));
|
||||
|
||||
|
||||
namespace units::isq::si {
|
||||
// constexpr auto q1 = 10 * si::length[m] / (2 * si::time[s]) + 5 * si::speed[m / s];
|
||||
// static_assert(is_of_type<quantity<reference<derived_dimension<struct isq::length_dim, per<struct isq::time_dim>>,
|
||||
// derived_unit<struct si::metre, per<struct si::second>>>{},
|
||||
// int>>(q1));
|
||||
|
||||
// static_assert(quantity_of<decltype(120 * si::length[km] / (2 * si::time[h])), isq::speed_dim>);
|
||||
// static_assert(quantity_of<decltype(120 * si::length[km] / (2 * si::time[h])), si::speed[km / h]>);
|
||||
// static_assert(!quantity_of<decltype(120 * si::length[km] / (2 * si::time[h])), si::speed[m / s]>);
|
||||
|
||||
|
||||
// quantity<reference<speed_dim, derived_unit<si::metre, per<si::second>>>, int> s = 5 * speed[m / s];
|
||||
// quantity<reference<derived_dimension<length_dim, per<time_dim>>, derived_unit<metre, per<second>>>, int> q =
|
||||
// 10 * length[m] / (2 * si::time[s]);
|
||||
|
||||
// auto q1 = 10 * length[m] / (2 * si::time[s]) + 5 * speed[m / s]; // should this be allowed?
|
||||
// bool b1 = (10 * length[m] / (2 * si::time[s]) == 5 * speed[m / s]); // should this be allowed?
|
||||
|
||||
// auto q2 = 10 / (2 * si::time[s]) + 5 * frequency[Hz]; // should this be allowed?
|
||||
// bool b2 = (10 / (2 * si::time[s]) == 5 * frequency[Hz]); // should this be allowed?
|
||||
|
||||
// auto q3 = 5 * activity[Bq] + 5 * frequency[Hz]; // should this be allowed?
|
||||
// auto b3 = (5 * activity[Bq] == 5 * frequency[Hz]); // should this be allowed?
|
||||
|
||||
// auto q4 = 5 * activity[Bq] + 10 / (2 * si::time[s]) + 5 * frequency[Hz]; // should this be allowed?
|
||||
|
||||
// auto q5 = 120 * length[km] / (2 * si::time[h]); // not speed
|
||||
// auto q6 = quantity_cast<dim_speed>(120 * length[km] / (2 * si::time[h]));
|
||||
// auto q7 = quantity_cast<speed[m / s]>(120 * length[km] / (2 * si::time[h]));
|
||||
// quantity<speed[km / h]> s = q5; // should this implicit conversion be allowed?
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace units::si {
|
||||
|
||||
// derived unit expression template syntax verification
|
||||
static_assert(is_of_type<1 / second, derived_unit<struct one, per<struct second>>>);
|
||||
static_assert(is_of_type<1 / (1 / second), struct second>);
|
||||
static_assert(is_of_type<derived_unit<struct one, per<struct second>>>(1 / second));
|
||||
static_assert(is_of_type<struct second>(1 / (1 / second)));
|
||||
|
||||
static_assert(is_of_type<one * second, struct second>);
|
||||
static_assert(is_of_type<second * one, struct second>);
|
||||
static_assert(is_of_type<one * (1 / second), derived_unit<struct one, per<struct second>>>);
|
||||
static_assert(is_of_type<1 / second * one, derived_unit<struct one, per<struct second>>>);
|
||||
static_assert(is_of_type<struct second>(one * second));
|
||||
static_assert(is_of_type<struct second>(second * one));
|
||||
static_assert(is_of_type<derived_unit<struct one, per<struct second>>>(one * (1 / second)));
|
||||
static_assert(is_of_type<derived_unit<struct one, per<struct second>>>(1 / second * one));
|
||||
|
||||
static_assert(is_of_type<metre * second, derived_unit<struct metre, struct second>>);
|
||||
static_assert(is_of_type<metre * metre, derived_unit<power<struct metre, 2>>>);
|
||||
static_assert(is_of_type<derived_unit<struct metre, struct second>>(metre * second));
|
||||
static_assert(is_of_type<derived_unit<units::power<struct metre, 2>>>(metre * metre));
|
||||
|
||||
static_assert(is_of_type<metre * metre * second, derived_unit<power<struct metre, 2>, struct second>>);
|
||||
static_assert(is_of_type<metre * second * metre, derived_unit<power<struct metre, 2>, struct second>>);
|
||||
static_assert(is_of_type<derived_unit<units::power<struct metre, 2>, struct second>>(metre * metre * second));
|
||||
static_assert(is_of_type<derived_unit<units::power<struct metre, 2>, struct second>>(metre * second * metre));
|
||||
|
||||
static_assert(is_of_type<metre*(second* metre), derived_unit<power<struct metre, 2>, struct second>>);
|
||||
static_assert(is_of_type<second*(metre* metre), derived_unit<power<struct metre, 2>, struct second>>);
|
||||
static_assert(is_of_type<derived_unit<units::power<struct metre, 2>, struct second>>(metre * (second * metre)));
|
||||
static_assert(is_of_type<derived_unit<units::power<struct metre, 2>, struct second>>(second * (metre * metre)));
|
||||
|
||||
static_assert(is_of_type<1 / second * metre, derived_unit<struct metre, per<struct second>>>);
|
||||
static_assert(is_of_type<1 / second * second, struct one>);
|
||||
static_assert(is_of_type<derived_unit<struct metre, per<struct second>>>(1 / second * metre));
|
||||
static_assert(is_of_type<struct one>(1 / second * second));
|
||||
|
||||
static_assert(is_of_type<second / one, struct second>);
|
||||
static_assert(is_of_type<1 / second / one, derived_unit<struct one, per<struct second>>>);
|
||||
static_assert(is_of_type<struct second>(second / one));
|
||||
static_assert(is_of_type<derived_unit<struct one, per<struct second>>>(1 / second / one));
|
||||
|
||||
static_assert(is_of_type<metre / second * second, struct metre>);
|
||||
static_assert(is_of_type<1 / second * (1 / second), derived_unit<struct one, per<power<struct second, 2>>>>);
|
||||
static_assert(is_of_type<1 / (second * second), derived_unit<struct one, per<power<struct second, 2>>>>);
|
||||
static_assert(is_of_type<1 / (1 / (second * second)), derived_unit<power<struct second, 2>>>);
|
||||
static_assert(is_of_type<struct metre>(metre / second * second));
|
||||
static_assert(is_of_type<derived_unit<struct one, per<units::power<struct second, 2>>>>(1 / second * (1 / second)));
|
||||
static_assert(is_of_type<derived_unit<struct one, per<units::power<struct second, 2>>>>(1 / (second * second)));
|
||||
static_assert(is_of_type<derived_unit<units::power<struct second, 2>>>(1 / (1 / (second * second))));
|
||||
|
||||
static_assert(is_of_type<metre / second * (1 / second), derived_unit<struct metre, per<power<struct second, 2>>>>);
|
||||
static_assert(
|
||||
is_of_type<metre / second*(metre / second), derived_unit<power<struct metre, 2>, per<power<struct second, 2>>>>);
|
||||
static_assert(is_of_type<metre / second*(second / metre), struct one>);
|
||||
static_assert(is_of_type<derived_unit<struct metre, per<units::power<struct second, 2>>>>(metre / second *
|
||||
(1 / second)));
|
||||
static_assert(is_of_type<derived_unit<units::power<struct metre, 2>, per<units::power<struct second, 2>>>>(
|
||||
metre / second * (metre / second)));
|
||||
static_assert(is_of_type<struct one>(metre / second * (second / metre)));
|
||||
|
||||
static_assert(is_of_type<watt / joule, derived_unit<struct watt, per<struct joule>>>);
|
||||
static_assert(is_of_type<joule / watt, derived_unit<struct joule, per<struct watt>>>);
|
||||
static_assert(is_of_type<derived_unit<struct watt, per<struct joule>>>(watt / joule));
|
||||
static_assert(is_of_type<derived_unit<struct joule, per<struct watt>>>(joule / watt));
|
||||
|
||||
// comparisons of equivalent units
|
||||
static_assert(metre / metre == one);
|
||||
static_assert(metre * metre == square_metre);
|
||||
static_assert(second * second == second_squared);
|
||||
static_assert(second * second * second == second_cubed);
|
||||
static_assert(second * (second * second) == second_cubed);
|
||||
static_assert(second_squared * second == second_cubed);
|
||||
static_assert(second * second_squared == second_cubed);
|
||||
// static_assert(metre * metre == square_metre);
|
||||
// static_assert(second * second == second_squared);
|
||||
// static_assert(second * second * second == second_cubed);
|
||||
// static_assert(second * (second * second) == second_cubed);
|
||||
// static_assert(second_squared * second == second_cubed);
|
||||
// static_assert(second * second_squared == second_cubed);
|
||||
|
||||
static_assert(1 / second * metre == metre / second);
|
||||
static_assert(metre * (1 / second) == metre / second);
|
||||
static_assert((metre / second) * (1 / second) == metre / second / second);
|
||||
static_assert((metre / second) * (1 / second) == metre / (second * second));
|
||||
static_assert((metre / second) * (1 / second) == metre / second_squared);
|
||||
// static_assert(1 / second * metre == metre / second);
|
||||
// static_assert(metre * (1 / second) == metre / second);
|
||||
// static_assert((metre / second) * (1 / second) == metre / second / second);
|
||||
// static_assert((metre / second) * (1 / second) == metre / (second * second));
|
||||
// static_assert((metre / second) * (1 / second) == metre / second_squared);
|
||||
|
||||
static_assert(hertz == 1 / second);
|
||||
static_assert(newton == kilogram * metre / second_squared);
|
||||
static_assert(joule == kilogram * square_metre / second_squared);
|
||||
static_assert(joule == newton * metre);
|
||||
static_assert(watt == joule / second);
|
||||
static_assert(watt == kilogram * square_metre / second_cubed);
|
||||
// static_assert(hertz == 1 / second);
|
||||
// static_assert(newton == kilogram * metre / second_squared);
|
||||
// static_assert(joule == kilogram * square_metre / second_squared);
|
||||
// static_assert(joule == newton * metre);
|
||||
// static_assert(watt == joule / second);
|
||||
// static_assert(watt == kilogram * square_metre / second_cubed);
|
||||
|
||||
// static_assert(1 / frequency_dim == second);
|
||||
// static_assert(frequency_dim * second == one);
|
||||
@ -416,18 +185,21 @@ static_assert(watt == kilogram * square_metre / second_cubed);
|
||||
// Bq + Hz + 1/s should compile?
|
||||
|
||||
|
||||
} // namespace units::isq::si
|
||||
} // namespace units::si
|
||||
|
||||
namespace units {
|
||||
|
||||
template<typename T, Dimension auto D, Unit auto U>
|
||||
inline constexpr bool is_exactly_quantity_of =
|
||||
is_same_v<decltype(T::dimension), decltype(D)> && is_same_v<decltype(T::unit), decltype(U)>;
|
||||
|
||||
}
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
// quantity tests
|
||||
static_assert(
|
||||
is_exactly_quantity_of<decltype(4 * length[km] / (2 * length[m])), one_dim, derived_unit<kilometre, per<metre>>>);
|
||||
// static_assert(
|
||||
// is_exactly_quantity_of<decltype(4 * length[km] / (2 * length[m])), one_dim, derived_unit<kilometre, per<metre>>>);
|
||||
|
||||
// static_assert(QuantityOf<decltype(4 * length[km] / (2 * length[m])), one_dim, derived_unit<kilometre, per<metre>>);
|
||||
// static_assert(QuantityOf<decltype(4 * length[km] / (2 * length[m])), one_dim, derived_unit<metre, per<millimetre>>);
|
||||
@ -435,37 +207,57 @@ static_assert(
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
// using namespace units;
|
||||
// using namespace units::si;
|
||||
// using namespace units::si::unit_symbols;
|
||||
|
||||
using namespace units;
|
||||
using namespace units::isq::si;
|
||||
using namespace units::isq::si::unit_symbols;
|
||||
// /* Frequency */ auto freq1 = 20 * frequency[Hz];
|
||||
// // /* Frequency */ auto freq2 = 20 / (1 * si::time[s]);
|
||||
// quantity<frequency[Hz]> freq3(20);
|
||||
// quantity<frequency[1 / s]> freq4(20);
|
||||
// quantity<dimensionless[one] / si::time[s]> freq5(20);
|
||||
|
||||
/* Frequency */ auto freq1 = 20 * frequency[Hz];
|
||||
// /* Frequency */ auto freq2 = 20 / (1 * isq::si::time[s]);
|
||||
quantity<frequency[Hz]> freq3(20);
|
||||
quantity<frequency[1 / s]> freq4(20);
|
||||
quantity<dimensionless[one] / isq::si::time[s]> freq5(20);
|
||||
|
||||
/* Speed */ auto speed1 = 20 * speed[m / s];
|
||||
/* Speed */ auto speed2 = 20 * (length[m] / isq::si::time[s]);
|
||||
quantity<speed[m / s]> speed3(20);
|
||||
quantity<length[m] / isq::si::time[s]> speed4(20);
|
||||
// /* Speed */ auto speed1 = 20 * speed[m / s];
|
||||
// /* Speed */ auto speed2 = 20 * (length[m] / si::time[s]);
|
||||
// quantity<speed[km / s]> speed3(20);
|
||||
// quantity<length[m] / si::time[s]> speed4(20);
|
||||
|
||||
template<typename T>
|
||||
void print();
|
||||
|
||||
// constexpr auto avg_speed(quantity<length[km]> d, quantity<isq::si::time[h]> t) { return d / t; }
|
||||
// constexpr auto avg_speed(quantity<length[km]> d, quantity<si::time[h]> t) { return d / t; }
|
||||
|
||||
int main()
|
||||
{
|
||||
print<decltype(freq1)>();
|
||||
// print<decltype(freq2)>();
|
||||
print<decltype(freq3)>();
|
||||
print<decltype(freq4)>();
|
||||
print<decltype(freq5)>();
|
||||
// print<decltype(speed)>();
|
||||
// print<decltype(freq1)>();
|
||||
// // print<decltype(freq2)>();
|
||||
// print<decltype(freq3)>();
|
||||
// print<decltype(freq4)>();
|
||||
// print<decltype(freq5)>();
|
||||
|
||||
print<decltype(speed1)>();
|
||||
print<decltype(speed2)>();
|
||||
print<decltype(speed3)>();
|
||||
print<decltype(speed4)>();
|
||||
// print<decltype(speed1)>();
|
||||
// print<decltype(speed2)>();
|
||||
// print<decltype(speed3)>();
|
||||
// print<decltype(speed4)>();
|
||||
}
|
||||
|
||||
|
||||
// 1 * joule + 1 * erg ???
|
||||
|
||||
// joule * erg???
|
||||
// joule / erg???
|
||||
|
||||
// auto d1 = 42 * isq::length_dim[si::kilo<si::metre>];
|
||||
// auto d2 = 42 * isq::length_dim[cgs::centimetre];
|
||||
|
||||
// auto s1 = 42 * isq::speed_dim[si::metre / si::second];
|
||||
// auto s2 = 42 * isq::speed_dim[cgs::centimetre / si::second];
|
||||
// auto e1 = 42 * isq::energy_dim[si::joule];
|
||||
// auto e2 = 42 * isq::energy_dim[cgs::erg];
|
||||
// auto e2_bad = 42 * isq::energy_dim[cgs::erg / si::second];
|
||||
// auto p1 = 42 * isq::power_dim[si::watt];
|
||||
// auto p2 = 42 * isq::power_dim[cgs::erg / si::second];
|
||||
|
||||
// type of Rep{1} * (mag<ratio(662'607'015, 100'000'000)> * mag_power<10, -34> * energy[joule] * time[second])
|
||||
// and inline constexpr auto planck_constant = Rep{1} * mag_planck * energy[joule] * time[second];
|
||||
|
@ -38,13 +38,21 @@ if(${projectPrefix}AS_SYSTEM_HEADERS)
|
||||
endif()
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(core-fmt)
|
||||
add_subdirectory(core-io)
|
||||
|
||||
# add_subdirectory(core-fmt)
|
||||
# add_subdirectory(core-io)
|
||||
add_subdirectory(systems)
|
||||
|
||||
# project-wide wrapper
|
||||
add_library(mp-units INTERFACE)
|
||||
target_link_libraries(mp-units INTERFACE mp-units::core mp-units::core-io mp-units::core-fmt mp-units::systems)
|
||||
target_link_libraries(
|
||||
mp-units
|
||||
INTERFACE
|
||||
mp-units::core
|
||||
# mp-units::core-io
|
||||
# mp-units::core-fmt
|
||||
mp-units::systems
|
||||
)
|
||||
add_library(mp-units::mp-units ALIAS mp-units)
|
||||
install(TARGETS mp-units EXPORT mp-unitsTargets)
|
||||
|
||||
|
@ -37,26 +37,26 @@ check_libcxx_in_use(${projectPrefix}LIBCXX)
|
||||
add_library(
|
||||
mp-units-core
|
||||
INTERFACE
|
||||
include/units/chrono.h
|
||||
# include/units/chrono.h
|
||||
include/units/concepts.h
|
||||
include/units/customization_points.h
|
||||
include/units/dimension.h
|
||||
include/units/generic/angle.h
|
||||
include/units/generic/dimensionless.h
|
||||
include/units/generic/solid_angle.h
|
||||
include/units/kind.h
|
||||
# include/units/generic/angle.h
|
||||
# include/units/generic/dimensionless.h
|
||||
# include/units/generic/solid_angle.h
|
||||
# include/units/kind.h
|
||||
include/units/magnitude.h
|
||||
include/units/math.h
|
||||
include/units/point_origin.h
|
||||
# include/units/math.h
|
||||
# include/units/point_origin.h
|
||||
include/units/quantity.h
|
||||
include/units/quantity_cast.h
|
||||
include/units/quantity_kind.h
|
||||
include/units/quantity_point.h
|
||||
include/units/quantity_point_kind.h
|
||||
include/units/random.h
|
||||
# include/units/quantity_cast.h
|
||||
# include/units/quantity_kind.h
|
||||
# include/units/quantity_point.h
|
||||
# include/units/quantity_point_kind.h
|
||||
# include/units/random.h
|
||||
include/units/ratio.h
|
||||
include/units/reference.h
|
||||
include/units/symbol_text.h
|
||||
# include/units/symbol_text.h
|
||||
include/units/unit.h
|
||||
)
|
||||
target_compile_features(mp-units-core INTERFACE cxx_std_20)
|
||||
|
@ -22,58 +22,56 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/bits/dimension_op.h>
|
||||
#include <units/bits/equivalent.h>
|
||||
#include <units/quantity_cast.h>
|
||||
#include <units/concepts.h>
|
||||
#include <units/dimension.h>
|
||||
#include <units/unit.h>
|
||||
// #include <units/bits/equivalent.h>
|
||||
// #include <units/quantity_cast.h>
|
||||
|
||||
namespace units {
|
||||
|
||||
template<Dimension D, UnitOf<D> U>
|
||||
struct reference;
|
||||
// template<PointOrigin O, UnitOf<typename O::dimension> U, Representation Rep>
|
||||
// class quantity_point;
|
||||
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep>
|
||||
class quantity;
|
||||
// template<Kind K, UnitOf<typename K::dimension> U, Representation Rep>
|
||||
// class quantity_kind;
|
||||
|
||||
template<PointOrigin O, UnitOf<typename O::dimension> U, Representation Rep>
|
||||
class quantity_point;
|
||||
// template<PointKind PK, UnitOf<typename PK::dimension> U, Representation Rep>
|
||||
// class quantity_point_kind;
|
||||
|
||||
template<Kind K, UnitOf<typename K::dimension> U, Representation Rep>
|
||||
class quantity_kind;
|
||||
// TODO common_unit should use common_magnitude(U1::mag, U2::mag)
|
||||
|
||||
template<PointKind PK, UnitOf<typename PK::dimension> U, Representation Rep>
|
||||
class quantity_point_kind;
|
||||
template<Dimension D1, Dimension D2>
|
||||
requires(equivalent(D1{}, D2{}))
|
||||
using common_dimension = conditional<std::is_same_v<D1, D2>, D1, detail::dim_type<D1>>;
|
||||
|
||||
template<Unit U1, Unit U2>
|
||||
// requires(equivalent<U1, U2>)
|
||||
using common_unit = U1;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename R1, typename R2>
|
||||
struct common_quantity_reference_impl;
|
||||
|
||||
template<typename D, typename U>
|
||||
struct common_quantity_reference_impl<reference<D, U>, reference<D, U>> {
|
||||
using type = reference<D, U>;
|
||||
template<typename R>
|
||||
struct common_quantity_reference_impl<R, R> {
|
||||
using type = R;
|
||||
};
|
||||
|
||||
template<typename D, typename U1, typename U2>
|
||||
struct common_quantity_reference_impl<reference<D, U1>, reference<D, U2>> {
|
||||
using type = reference<D, downcast_unit<D, common_magnitude(U1::mag, U2::mag)>>;
|
||||
using type = reference<D, common_unit<U1, U2>>;
|
||||
};
|
||||
|
||||
template<typename D1, typename U1, typename D2, typename U2>
|
||||
requires(same_unit_reference<dimension_unit<D1>, dimension_unit<D2>>::value)
|
||||
struct common_quantity_reference_impl<reference<D1, U1>, reference<D2, U2>> {
|
||||
using type = reference<D1, downcast_unit<D1, common_magnitude(U1::mag, U2::mag)>>;
|
||||
template<typename R1, typename R2>
|
||||
requires(equivalent(R1::dimension, R2::dimension))
|
||||
struct common_quantity_reference_impl<R1, R2> {
|
||||
using type = reference<common_dimension<decltype(R1::dimension), decltype(R2::dimension)>,
|
||||
common_unit<decltype(R1::unit), decltype(R2::unit)>>;
|
||||
};
|
||||
|
||||
template<typename D1, typename U1, typename D2, typename U2>
|
||||
struct common_quantity_reference_impl<reference<D1, U1>, reference<D2, U2>> {
|
||||
static constexpr UNITS_MSVC_WORKAROUND(Magnitude) auto mag = common_magnitude(reference<D1, U1>::mag,
|
||||
reference<D2, U2>::mag);
|
||||
using dimension = conditional<is_specialization_of<D1, unknown_dimension>, D2, D1>;
|
||||
using unit = downcast_unit<dimension, mag / dimension::mag>;
|
||||
using type = reference<dimension, unit>;
|
||||
};
|
||||
|
||||
template<Quantity Q1, QuantityEquivalentTo<Q1> Q2>
|
||||
template<Quantity Q1, quantity_equivalent_to<Q1> Q2>
|
||||
using common_quantity_reference =
|
||||
TYPENAME detail::common_quantity_reference_impl<std::remove_const_t<decltype(Q1::reference)>,
|
||||
std::remove_const_t<decltype(Q2::reference)>>::type;
|
||||
@ -83,43 +81,42 @@ using common_quantity_reference =
|
||||
|
||||
namespace std {
|
||||
|
||||
template<units::Quantity Q1, units::QuantityEquivalentTo<Q1> Q2>
|
||||
template<units::Quantity Q1, units::quantity_equivalent_to<Q1> Q2>
|
||||
requires requires { typename common_type_t<typename Q1::rep, typename Q2::rep>; }
|
||||
struct common_type<Q1, Q2> {
|
||||
private:
|
||||
using ref = units::detail::common_quantity_reference<Q1, Q2>;
|
||||
public:
|
||||
using type =
|
||||
units::quantity<typename ref::dimension, typename ref::unit, common_type_t<typename Q1::rep, typename Q2::rep>>;
|
||||
using type = units::quantity<ref{}, common_type_t<typename Q1::rep, typename Q2::rep>>;
|
||||
};
|
||||
|
||||
template<units::QuantityPoint QP1, units::QuantityPointEquivalentTo<QP1> QP2>
|
||||
requires requires { typename common_type_t<typename QP1::rep, typename QP2::rep>; }
|
||||
struct common_type<QP1, QP2> {
|
||||
using type =
|
||||
units::quantity_point<units::rebind_point_origin_dimension<
|
||||
typename QP1::origin, typename common_type_t<typename QP1::quantity_type,
|
||||
typename QP2::quantity_type>::dimension>,
|
||||
typename common_type_t<typename QP1::quantity_type, typename QP2::quantity_type>::unit,
|
||||
typename common_type_t<typename QP1::quantity_type, typename QP2::quantity_type>::rep>;
|
||||
};
|
||||
// template<units::QuantityPoint QP1, units::QuantityPointEquivalentTo<QP1> QP2>
|
||||
// requires requires { typename common_type_t<typename QP1::rep, typename QP2::rep>; }
|
||||
// struct common_type<QP1, QP2> {
|
||||
// using type =
|
||||
// units::quantity_point<units::rebind_point_origin_dimension<
|
||||
// typename QP1::origin, typename common_type_t<typename QP1::quantity_type,
|
||||
// typename QP2::quantity_type>::dimension>,
|
||||
// typename common_type_t<typename QP1::quantity_type, typename QP2::quantity_type>::unit,
|
||||
// typename common_type_t<typename QP1::quantity_type, typename QP2::quantity_type>::rep>;
|
||||
// };
|
||||
|
||||
template<units::QuantityKind QK1, units::QuantityKindEquivalentTo<QK1> QK2>
|
||||
requires requires { typename common_type_t<typename QK1::rep, typename QK2::rep>; }
|
||||
struct common_type<QK1, QK2> {
|
||||
using type =
|
||||
units::quantity_kind<typename QK1::kind_type,
|
||||
typename common_type_t<typename QK1::quantity_type, typename QK2::quantity_type>::unit,
|
||||
typename common_type_t<typename QK1::quantity_type, typename QK2::quantity_type>::rep>;
|
||||
};
|
||||
// template<units::QuantityKind QK1, units::QuantityKindEquivalentTo<QK1> QK2>
|
||||
// requires requires { typename common_type_t<typename QK1::rep, typename QK2::rep>; }
|
||||
// struct common_type<QK1, QK2> {
|
||||
// using type =
|
||||
// units::quantity_kind<typename QK1::kind_type,
|
||||
// typename common_type_t<typename QK1::quantity_type, typename QK2::quantity_type>::unit,
|
||||
// typename common_type_t<typename QK1::quantity_type, typename QK2::quantity_type>::rep>;
|
||||
// };
|
||||
|
||||
template<units::QuantityPointKind QPK1, units::QuantityPointKindEquivalentTo<QPK1> QPK2>
|
||||
requires requires { typename common_type_t<typename QPK1::rep, typename QPK2::rep>; }
|
||||
struct common_type<QPK1, QPK2> {
|
||||
using type = units::quantity_point_kind<
|
||||
typename QPK1::point_kind_type,
|
||||
typename common_type_t<typename QPK1::quantity_kind_type, typename QPK2::quantity_kind_type>::unit,
|
||||
typename common_type_t<typename QPK1::quantity_kind_type, typename QPK2::quantity_kind_type>::rep>;
|
||||
};
|
||||
// template<units::QuantityPointKind QPK1, units::QuantityPointKindEquivalentTo<QPK1> QPK2>
|
||||
// requires requires { typename common_type_t<typename QPK1::rep, typename QPK2::rep>; }
|
||||
// struct common_type<QPK1, QPK2> {
|
||||
// using type = units::quantity_point_kind<
|
||||
// typename QPK1::point_kind_type,
|
||||
// typename common_type_t<typename QPK1::quantity_kind_type, typename QPK2::quantity_kind_type>::unit,
|
||||
// typename common_type_t<typename QPK1::quantity_kind_type, typename QPK2::quantity_kind_type>::rep>;
|
||||
// };
|
||||
|
||||
} // namespace std
|
||||
|
@ -34,7 +34,39 @@ struct type_list {};
|
||||
template<typename T, typename... Ts>
|
||||
struct per {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<int Num, int... Den>
|
||||
inline constexpr bool valid_ratio = true;
|
||||
|
||||
template<int... Den>
|
||||
inline constexpr bool valid_ratio<0, Den...> = false;
|
||||
|
||||
template<int Num>
|
||||
inline constexpr bool valid_ratio<Num, 0> = false;
|
||||
|
||||
template<>
|
||||
inline constexpr bool valid_ratio<0, 0> = false;
|
||||
|
||||
template<int Num, int... Den>
|
||||
inline constexpr bool positive_ratio = (Num > 0);
|
||||
|
||||
template<int Num, int Den>
|
||||
inline constexpr bool positive_ratio<Num, Den> = (Num * Den > 0);
|
||||
|
||||
template<int Num, int... Den>
|
||||
inline constexpr bool ratio_one = false;
|
||||
|
||||
template<>
|
||||
inline constexpr bool ratio_one<1> = true;
|
||||
|
||||
template<int N>
|
||||
inline constexpr bool ratio_one<N, N> = true;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<typename F, int Num, int... Den>
|
||||
requires(detail::valid_ratio<Num, Den...> && detail::positive_ratio<Num, Den...> && !detail::ratio_one<Num, Den...>)
|
||||
struct power {
|
||||
using factor = F;
|
||||
static constexpr ratio exponent{Num, Den...};
|
||||
@ -146,9 +178,9 @@ using expr_consolidate = typename expr_consolidate_impl<List>::type;
|
||||
|
||||
// expr_simplify
|
||||
|
||||
template<typename T, typename powerNum, typename powerDen>
|
||||
template<typename T, ratio Num, ratio Den>
|
||||
struct expr_simplify_power {
|
||||
static constexpr ratio r = powerNum::exponent - powerDen::exponent;
|
||||
static constexpr ratio r = Num - Den;
|
||||
using type = power_or_T<T, ratio{abs(r.num), r.den}>;
|
||||
using num = conditional<(r > 0), type_list<type>, type_list<>>;
|
||||
using den = conditional<(r < 0), type_list<type>, type_list<>>;
|
||||
@ -179,7 +211,7 @@ struct expr_simplify<type_list<T, NRest...>, type_list<T, DRest...>, Pred> :
|
||||
template<typename T, typename... NRest, int... Ints, typename... DRest, template<typename, typename> typename Pred>
|
||||
struct expr_simplify<type_list<power<T, Ints...>, NRest...>, type_list<T, DRest...>, Pred> {
|
||||
using impl = expr_simplify<type_list<NRest...>, type_list<DRest...>, Pred>;
|
||||
using type = expr_simplify_power<T, power<T, Ints...>, power<T, 1>>;
|
||||
using type = expr_simplify_power<T, power<T, Ints...>::exponent, ratio{1}>;
|
||||
using num = type_list_join<typename type::num, typename impl::num>;
|
||||
using den = type_list_join<typename type::den, typename impl::den>;
|
||||
};
|
||||
@ -187,7 +219,7 @@ struct expr_simplify<type_list<power<T, Ints...>, NRest...>, type_list<T, DRest.
|
||||
template<typename T, typename... NRest, typename... DRest, int... Ints, template<typename, typename> typename Pred>
|
||||
struct expr_simplify<type_list<T, NRest...>, type_list<power<T, Ints...>, DRest...>, Pred> {
|
||||
using impl = expr_simplify<type_list<NRest...>, type_list<DRest...>, Pred>;
|
||||
using type = expr_simplify_power<T, power<T, 1>, power<T, Ints...>>;
|
||||
using type = expr_simplify_power<T, ratio{1}, power<T, Ints...>::exponent>;
|
||||
using num = type_list_join<typename impl::num, typename type::num>;
|
||||
using den = type_list_join<typename impl::den, typename type::den>;
|
||||
};
|
||||
@ -197,7 +229,7 @@ template<typename T, typename... NRest, int... Ints1, typename... DRest, int...
|
||||
requires(!std::same_as<power<T, Ints1...>, power<T, Ints2...>>)
|
||||
struct expr_simplify<type_list<power<T, Ints1...>, NRest...>, type_list<power<T, Ints2...>, DRest...>, Pred> {
|
||||
using impl = expr_simplify<type_list<NRest...>, type_list<DRest...>, Pred>;
|
||||
using type = expr_simplify_power<T, power<T, Ints1...>, power<T, Ints2...>>;
|
||||
using type = expr_simplify_power<T, power<T, Ints1...>::exponent, power<T, Ints2...>::exponent>;
|
||||
using num = type_list_join<typename impl::num, typename type::num>;
|
||||
using den = type_list_join<typename impl::den, typename type::den>;
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <string_view>
|
||||
|
||||
template<typename T>
|
||||
constexpr auto type_name()
|
||||
[[nodiscard]] consteval std::string_view type_name()
|
||||
{
|
||||
std::string_view name, prefix, suffix;
|
||||
#ifdef __clang__
|
||||
|
@ -77,4 +77,7 @@ template<typename T, template<typename...> typename Type>
|
||||
// inline constexpr bool // TODO: Replace with concept when it works with MSVC
|
||||
concept is_derived_from_specialization_of = requires(T* t) { detail::to_base_specialization_of<Type>(t); };
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
concept one_of = (... || std::same_as<T, Ts>);
|
||||
|
||||
} // namespace units
|
||||
|
@ -37,7 +37,7 @@ constexpr auto magnitude_text()
|
||||
{
|
||||
constexpr auto exp10 = extract_power_of_10(M);
|
||||
|
||||
constexpr Magnitude auto base = M / pow<exp10>(mag<10>());
|
||||
constexpr Magnitude auto base = M / mag_power<10, exp10>;
|
||||
constexpr Magnitude auto num = numerator(base);
|
||||
constexpr Magnitude auto den = denominator(base);
|
||||
static_assert(base == num / den, "Printing rational powers, or irrational bases, not yet supported");
|
||||
|
@ -23,6 +23,94 @@
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/bits/basic_concepts.h>
|
||||
#include <units/bits/quantity_of.h>
|
||||
// #include <units/bits/basic_concepts.h>
|
||||
// #include <units/bits/quantity_of.h>
|
||||
// IWYU pragma: end_exports
|
||||
#include <units/bits/external/type_traits.h>
|
||||
#include <units/dimension.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units {
|
||||
|
||||
template<Dimension D, Unit U>
|
||||
struct reference;
|
||||
|
||||
/**
|
||||
* @brief A concept matching all references in the library.
|
||||
*
|
||||
* Satisfied by all specializations of @c reference.
|
||||
*/
|
||||
template<typename T>
|
||||
concept Reference = is_specialization_of<T, reference>;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_quantity = false;
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
concept Quantity = detail::is_quantity<T>;
|
||||
|
||||
template<typename T, typename U>
|
||||
concept common_type_with_ = // exposition only
|
||||
(std::same_as<std::common_type_t<T, U>, std::common_type_t<U, T>>) &&
|
||||
(std::constructible_from<std::common_type_t<T, U>, T>) && (std::constructible_from<std::common_type_t<T, U>, U>);
|
||||
|
||||
template<typename T, typename U = T>
|
||||
concept scalable_number_ = // exposition only
|
||||
(std::regular_invocable<std::multiplies<>, T, U>) && (std::regular_invocable<std::divides<>, T, U>);
|
||||
|
||||
template<typename T>
|
||||
concept castable_number_ = // exposition only
|
||||
common_type_with_<T, std::intmax_t> && scalable_number_<std::common_type_t<T, std::intmax_t>>;
|
||||
|
||||
template<typename T>
|
||||
concept scalable_ = // exposition only
|
||||
castable_number_<T> || (requires { typename T::value_type; } && castable_number_<typename T::value_type> &&
|
||||
scalable_number_<T, std::common_type_t<typename T::value_type, std::intmax_t>>);
|
||||
|
||||
template<typename T, typename U>
|
||||
concept scalable_with_ = // exposition only
|
||||
common_type_with_<T, U> && scalable_<std::common_type_t<T, U>>;
|
||||
|
||||
template<typename T>
|
||||
concept Representation = (!Quantity<T>) &&
|
||||
// (!QuantityLike<T>) && (!wrapped_quantity_<T>) &&
|
||||
std::regular<T> && scalable_<T>;
|
||||
|
||||
template<Reference auto R, Representation Rep>
|
||||
class quantity;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<auto R, typename Rep>
|
||||
inline constexpr bool is_quantity<quantity<R, Rep>> = true;
|
||||
|
||||
// template<typename T>
|
||||
// requires units::is_derived_from_specialization_of<T, units::quantity>
|
||||
// inline constexpr bool is_quantity<T> = true;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* @brief A concept matching all quantities with provided dimension
|
||||
*
|
||||
* Satisfied by all quantities with a dimension being the instantiation derived from
|
||||
* the provided dimension type.
|
||||
*/
|
||||
template<typename Q, auto V>
|
||||
concept quantity_of = Quantity<Q> && ((Dimension<std::remove_const_t<decltype(V)>> && Q::dimension == V) ||
|
||||
(Reference<std::remove_const_t<decltype(V)>> && Q::dimension == V.dimension));
|
||||
|
||||
/**
|
||||
* @brief A concept matching two equivalent quantities
|
||||
*
|
||||
* Satisfied by quantities having equivalent dimensions and units.
|
||||
*/
|
||||
template<typename Q1, typename Q2>
|
||||
concept quantity_equivalent_to = Quantity<Q1> && equivalent(Q1::dimension, Q2::dimension) &&
|
||||
equivalent(Q1::unit, Q2::unit);
|
||||
|
||||
} // namespace units
|
||||
|
@ -52,6 +52,12 @@ namespace detail {
|
||||
template<basic_fixed_string Symbol>
|
||||
void to_base_base_dimension(const volatile base_dimension<Symbol>*);
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_specialization_of_base_dimension = false;
|
||||
|
||||
template<basic_fixed_string Symbol>
|
||||
inline constexpr bool is_specialization_of_base_dimension<base_dimension<Symbol>> = true;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
@ -60,13 +66,18 @@ void to_base_base_dimension(const volatile base_dimension<Symbol>*);
|
||||
* Satisfied by all dimension types derived from an specialization of `base_dimension`.
|
||||
*/
|
||||
template<typename T>
|
||||
concept BaseDimension = requires(T* t) { detail::to_base_base_dimension(t); };
|
||||
concept BaseDimension = requires(T* t) { detail::to_base_base_dimension(t); } &&
|
||||
(!detail::is_specialization_of_base_dimension<T>);
|
||||
|
||||
template<BaseDimension D1, BaseDimension D2>
|
||||
struct base_dimension_less : std::bool_constant<(D1::symbol < D2::symbol)> {};
|
||||
|
||||
// TODO Can we provide a smarter implementation?
|
||||
std::false_type is_derived_dimension(...);
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_derived_dimension = false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A concept matching all derived dimensions in the library.
|
||||
@ -74,7 +85,7 @@ std::false_type is_derived_dimension(...);
|
||||
* Satisfied by all dimension types derived from an specialization of `derived_dimension`.
|
||||
*/
|
||||
template<typename T>
|
||||
concept DerivedDimension = decltype(is_derived_dimension(std::declval<T*>()))::value;
|
||||
concept DerivedDimension = detail::is_derived_dimension<T>;
|
||||
|
||||
/**
|
||||
* @brief A concept matching all dimensions in the library.
|
||||
@ -107,8 +118,20 @@ struct derived_dimension : detail::expr_fractions<derived_dimension<>, Ds...> {
|
||||
using type = derived_dimension<Ds...>;
|
||||
};
|
||||
|
||||
template<typename... Args>
|
||||
std::true_type is_derived_dimension(const volatile derived_dimension<Args...>*);
|
||||
namespace detail {
|
||||
|
||||
template<typename... Ds>
|
||||
void to_base_specialization_of_derived_dimension(const volatile derived_dimension<Ds...>*);
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_derived_from_specialization_of_derived_dimension =
|
||||
requires(T * t) { to_base_specialization_of_derived_dimension(t); };
|
||||
|
||||
template<typename T>
|
||||
requires is_derived_from_specialization_of_derived_dimension<T>
|
||||
inline constexpr bool is_derived_dimension<T> = true;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* @brief Dimension one
|
||||
@ -162,6 +185,12 @@ template<Dimension D>
|
||||
|
||||
template<Dimension D1, Dimension D2>
|
||||
[[nodiscard]] consteval bool operator==(D1, D2)
|
||||
{
|
||||
return is_same_v<D1, D2>;
|
||||
}
|
||||
|
||||
template<Dimension D1, Dimension D2>
|
||||
[[nodiscard]] consteval bool equivalent(D1, D2)
|
||||
{
|
||||
return is_same_v<detail::dim_type<D1>, detail::dim_type<D2>>;
|
||||
}
|
||||
|
@ -22,7 +22,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/bits/expression_template.h>
|
||||
#include <units/bits/external/hacks.h>
|
||||
#include <units/bits/external/type_name.h>
|
||||
#include <units/bits/external/type_traits.h>
|
||||
#include <units/bits/prime.h>
|
||||
#include <units/ratio.h>
|
||||
#include <concepts>
|
||||
@ -40,31 +43,47 @@ using factorizer = wheel_factorizer<4>;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* @brief A type to represent a standalone constant value.
|
||||
*/
|
||||
template<auto V>
|
||||
struct constant {
|
||||
static constexpr auto value = V;
|
||||
};
|
||||
|
||||
// is_derived_from_specialization_of_constant
|
||||
namespace detail {
|
||||
|
||||
template<auto V>
|
||||
void to_base_specialization_of_constant(const volatile constant<V>*);
|
||||
template<typename T>
|
||||
inline constexpr bool is_magnitude = false;
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_derived_from_specialization_of_constant =
|
||||
requires(T * t) { to_base_specialization_of_constant(t); };
|
||||
inline constexpr bool is_specialization_of_magnitude = false;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
/**
|
||||
* @brief Concept to detect whether T is a valid Magnitude.
|
||||
*/
|
||||
template<typename T>
|
||||
concept Constant = detail::is_derived_from_specialization_of_constant<T>;
|
||||
concept Magnitude = detail::is_magnitude<T>;
|
||||
|
||||
struct pi_v : constant<std::numbers::pi_v<long double>> {};
|
||||
/**
|
||||
* @brief A type to represent a standalone constant value.
|
||||
*/
|
||||
// template<auto V>
|
||||
// struct constant {
|
||||
// static constexpr auto value = V;
|
||||
// };
|
||||
|
||||
// // is_derived_from_specialization_of_constant
|
||||
// namespace detail {
|
||||
|
||||
// template<auto V>
|
||||
// void to_base_specialization_of_constant(const volatile constant<V>*);
|
||||
|
||||
// template<typename T>
|
||||
// inline constexpr bool is_derived_from_specialization_of_constant =
|
||||
// requires(T * t) { to_base_specialization_of_constant(t); };
|
||||
|
||||
// } // namespace detail
|
||||
|
||||
|
||||
// template<typename T>
|
||||
// concept Constant = detail::is_derived_from_specialization_of_constant<T>;
|
||||
|
||||
// struct pi_v : constant<std::numbers::pi_v<long double>> {};
|
||||
|
||||
/**
|
||||
* @brief Any type which can be used as a basis vector in a PowerV.
|
||||
@ -106,20 +125,26 @@ struct pi_v : constant<std::numbers::pi_v<long double>> {};
|
||||
* _existing_ bases, including both prime numbers and any other irrational bases. For example, even though `sqrt(2)` is
|
||||
* irrational, we must not ever use it as a base; instead, we would use `base_power{2, ratio{1, 2}}`.
|
||||
*/
|
||||
template<typename T>
|
||||
concept PowerVBase = Constant<T> || std::integral<T>;
|
||||
|
||||
// TODO Unify with `power` if UTPs (P1985) are accepted by the Committee
|
||||
template<PowerVBase auto V, int Num, int... Den>
|
||||
requires(Num != 0)
|
||||
struct power_v {
|
||||
static constexpr auto base = V;
|
||||
static constexpr ratio exponent{Num, Den...};
|
||||
static_assert(exponent != 1);
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_named_magnitude = Magnitude<T> && !detail::is_specialization_of_magnitude<T>;
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
concept PowerVBase = one_of<T, int, std::intmax_t, long double> || detail::is_named_magnitude<T>;
|
||||
|
||||
// TODO Unify with `power` if UTPs (P1985) are accepted by the Committee
|
||||
template<PowerVBase auto V, int Num, int... Den>
|
||||
requires(detail::valid_ratio<Num, Den...> && !detail::ratio_one<Num, Den...>)
|
||||
struct power_v {
|
||||
static constexpr auto base = V;
|
||||
static constexpr ratio exponent{Num, Den...};
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* @brief Deduction guides for base_power: only permit deducing integral bases.
|
||||
@ -149,6 +174,8 @@ concept PowerV = detail::is_specialization_of_power_v<T>;
|
||||
|
||||
namespace detail {
|
||||
|
||||
// We do not want magnitude type to have the `l` literal after a value for a small integral number.
|
||||
// For example this modifies `magnitude<3l>` to be `magnitude<3>`
|
||||
template<auto V>
|
||||
[[nodiscard]] consteval auto shorten_T()
|
||||
{
|
||||
@ -156,8 +183,10 @@ template<auto V>
|
||||
if constexpr (V <= std::numeric_limits<int>::max()) {
|
||||
return static_cast<int>(V);
|
||||
} else {
|
||||
return V;
|
||||
return static_cast<std::intmax_t>(V);
|
||||
}
|
||||
} else if constexpr (std::floating_point<decltype(V)>) {
|
||||
return static_cast<long double>(V);
|
||||
} else {
|
||||
return V;
|
||||
}
|
||||
@ -178,7 +207,7 @@ template<PowerVBase auto V, ratio R>
|
||||
}
|
||||
};
|
||||
|
||||
consteval auto inverse(PowerV auto bp) { return power_v_or_T<bp.base, bp.exponent * (-1)>(); }
|
||||
// consteval auto inverse(PowerV auto bp) { return power_v_or_T<bp.base, bp.exponent * (-1)>(); }
|
||||
|
||||
// `widen_t` gives the widest arithmetic type in the same category, for intermediate computations.
|
||||
// template<typename T>
|
||||
@ -253,35 +282,35 @@ consteval auto inverse(PowerV auto bp) { return power_v_or_T<bp.base, bp.exponen
|
||||
//
|
||||
// The input is the desired result, but in a (wider) intermediate type. The point of this function
|
||||
// is to cast to the desired type, but avoid overflow in doing so.
|
||||
// template<typename To, typename From>
|
||||
// // TODO(chogg): Migrate this to use `treat_as_floating_point`.
|
||||
// requires(!std::is_integral_v<To> || std::is_integral_v<From>)
|
||||
// constexpr To checked_static_cast(From x)
|
||||
// {
|
||||
// // This function should only ever be called at compile time. The purpose of these exceptions is
|
||||
// // to produce compiler errors, because we cannot `static_assert` on function arguments.
|
||||
// if constexpr (std::is_integral_v<To>) {
|
||||
// if (!std::in_range<To>(x)) {
|
||||
// throw std::invalid_argument{"Cannot represent magnitude in this type"};
|
||||
// }
|
||||
// }
|
||||
template<typename To, typename From>
|
||||
// TODO(chogg): Migrate this to use `treat_as_floating_point`.
|
||||
requires(!std::is_integral_v<To> || std::is_integral_v<From>)
|
||||
constexpr To checked_static_cast(From x)
|
||||
{
|
||||
// This function should only ever be called at compile time. The purpose of these exceptions is
|
||||
// to produce compiler errors, because we cannot `static_assert` on function arguments.
|
||||
if constexpr (std::is_integral_v<To>) {
|
||||
if (!std::in_range<To>(x)) {
|
||||
throw std::invalid_argument{"Cannot represent magnitude in this type"};
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<To>(x);
|
||||
}
|
||||
|
||||
// return static_cast<To>(x);
|
||||
// }
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* @brief Equality detection for two base powers.
|
||||
*/
|
||||
template<PowerV T, PowerV U>
|
||||
[[nodiscard]] consteval bool operator==(T, U)
|
||||
{
|
||||
return std::is_same_v<T, U>;
|
||||
}
|
||||
// template<PowerV T, PowerV U>
|
||||
// [[nodiscard]] consteval bool operator==(T, U)
|
||||
// {
|
||||
// return std::is_same_v<T, U>;
|
||||
// }
|
||||
|
||||
template<typename T>
|
||||
concept MagnitudeSpec = std::integral<T> || Constant<T> || PowerV<T>;
|
||||
|
||||
concept MagnitudeSpec = PowerVBase<T> || PowerV<T>;
|
||||
|
||||
// A variety of implementation detail helpers.
|
||||
namespace detail {
|
||||
@ -295,17 +324,6 @@ template<MagnitudeSpec Element>
|
||||
return element;
|
||||
}
|
||||
|
||||
template<MagnitudeSpec Element>
|
||||
[[nodiscard]] consteval auto get_base_value(Element element)
|
||||
{
|
||||
const auto base = get_base(element);
|
||||
using base_type = decltype(base);
|
||||
if constexpr (std::integral<base_type>)
|
||||
return base;
|
||||
else
|
||||
return base_type::value;
|
||||
}
|
||||
|
||||
template<MagnitudeSpec Element>
|
||||
[[nodiscard]] consteval ratio get_exponent(Element)
|
||||
{
|
||||
@ -338,88 +356,92 @@ template<MagnitudeSpec Element>
|
||||
}
|
||||
|
||||
// A way to check whether a number is prime at compile time.
|
||||
[[nodiscard]] consteval bool is_prime(std::intmax_t n)
|
||||
{
|
||||
return (n >= 0) && factorizer::is_prime(static_cast<std::size_t>(n));
|
||||
}
|
||||
// [[nodiscard]] consteval bool is_prime(std::intmax_t n)
|
||||
// {
|
||||
// return (n >= 0) && factorizer::is_prime(static_cast<std::size_t>(n));
|
||||
// }
|
||||
|
||||
template<MagnitudeSpec Element>
|
||||
[[nodiscard]] consteval bool is_valid_element(Element element)
|
||||
{
|
||||
if (get_exponent(element) == 0) {
|
||||
return false;
|
||||
}
|
||||
if constexpr (std::integral<decltype(get_base(element))>) {
|
||||
// Some prime numbers are so big, that we can't check their primality without exhausting limits on constexpr steps
|
||||
// and/or iterations. We can still _perform_ the factorization for these by using the `known_first_factor`
|
||||
// workaround. However, we can't _check_ that they are prime, because this workaround depends on the input being
|
||||
// usable in a constexpr expression. This is true for `prime_factorization` (below), where the input `N` is a
|
||||
// template parameter, but is not true for our case, where the input `bp.get_base()` is a function parameter. (See
|
||||
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1045r1.html for some background reading on this
|
||||
// distinction.)
|
||||
//
|
||||
// In our case: we simply give up on excluding every possible ill-formed base power, and settle for catching the
|
||||
// most likely and common mistakes.
|
||||
if (const bool too_big_to_check = (get_base_value(element) > 1'000'000'000)) {
|
||||
return true;
|
||||
}
|
||||
// template<MagnitudeSpec Element>
|
||||
// [[nodiscard]] consteval bool is_valid_element(Element element)
|
||||
// {
|
||||
// if (get_exponent(element) == 0) {
|
||||
// return false;
|
||||
// }
|
||||
// if constexpr (std::integral<decltype(get_base(element))>) {
|
||||
// // Some prime numbers are so big, that we can't check their primality without exhausting limits on constexpr
|
||||
// steps
|
||||
// // and/or iterations. We can still _perform_ the factorization for these by using the `known_first_factor`
|
||||
// // workaround. However, we can't _check_ that they are prime, because this workaround depends on the input being
|
||||
// // usable in a constexpr expression. This is true for `prime_factorization` (below), where the input `N` is a
|
||||
// // template parameter, but is not true for our case, where the input `bp.get_base()` is a function parameter.
|
||||
// (See
|
||||
// // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1045r1.html for some background reading on this
|
||||
// // distinction.)
|
||||
// //
|
||||
// // In our case: we simply give up on excluding every possible ill-formed base power, and settle for catching the
|
||||
// // most likely and common mistakes.
|
||||
// if (const bool too_big_to_check = (get_base_value(element) > 1'000'000'000)) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
return is_prime(get_base_value(element));
|
||||
} else {
|
||||
return get_base_value(element) > 0;
|
||||
}
|
||||
}
|
||||
// return is_prime(get_base_value(element));
|
||||
// } else {
|
||||
// return get_base_value(element) > 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
// A function object to apply a predicate to all consecutive pairs of values in a sequence.
|
||||
template<typename Predicate>
|
||||
struct pairwise_all {
|
||||
Predicate predicate;
|
||||
// template<typename Predicate>
|
||||
// struct pairwise_all {
|
||||
// Predicate predicate;
|
||||
|
||||
template<typename... Ts>
|
||||
[[nodiscard]] consteval bool operator()(Ts&&... ts) const
|
||||
{
|
||||
// Carefully handle different sizes, avoiding unsigned integer underflow.
|
||||
constexpr auto num_comparisons = [](auto num_elements) {
|
||||
return (num_elements > 1) ? (num_elements - 1) : 0;
|
||||
}(sizeof...(Ts));
|
||||
// template<typename... Ts>
|
||||
// [[nodiscard]] consteval bool operator()(Ts&&... ts) const
|
||||
// {
|
||||
// // Carefully handle different sizes, avoiding unsigned integer underflow.
|
||||
// constexpr auto num_comparisons = [](auto num_elements) {
|
||||
// return (num_elements > 1) ? (num_elements - 1) : 0;
|
||||
// }(sizeof...(Ts));
|
||||
|
||||
// Compare zero or more pairs of neighbours as needed.
|
||||
return [this]<std::size_t... Is>(std::tuple<Ts...> && t, std::index_sequence<Is...>)
|
||||
{
|
||||
return (predicate(std::get<Is>(t), std::get<Is + 1>(t)) && ...);
|
||||
}
|
||||
(std::make_tuple(std::forward<Ts>(ts)...), std::make_index_sequence<num_comparisons>());
|
||||
}
|
||||
};
|
||||
// // Compare zero or more pairs of neighbours as needed.
|
||||
// return [this]<std::size_t... Is>(std::tuple<Ts...> && t, std::index_sequence<Is...>)
|
||||
// {
|
||||
// return (predicate(std::get<Is>(t), std::get<Is + 1>(t)) && ...);
|
||||
// }
|
||||
// (std::make_tuple(std::forward<Ts>(ts)...), std::make_index_sequence<num_comparisons>());
|
||||
// }
|
||||
// };
|
||||
|
||||
// Deduction guide: permit constructions such as `pairwise_all{std::less{}}`.
|
||||
// template<typename T>
|
||||
// pairwise_all(T) -> pairwise_all<T>;
|
||||
|
||||
// Check whether a sequence of (possibly heterogeneously typed) values are strictly increasing.
|
||||
template<typename... Ts>
|
||||
requires(std::is_signed_v<Ts> && ...)
|
||||
[[nodiscard]] consteval bool strictly_increasing(Ts&&... ts)
|
||||
{
|
||||
return pairwise_all{std::less{}}(std::forward<Ts>(ts)...);
|
||||
}
|
||||
// template<typename... Ts>
|
||||
// requires(std::is_signed_v<Ts> && ...)
|
||||
// [[nodiscard]] consteval bool strictly_increasing(Ts&&... ts)
|
||||
// {
|
||||
// return pairwise_all{std::less{}}(std::forward<Ts>(ts)...);
|
||||
// }
|
||||
|
||||
template<MagnitudeSpec auto... Elements>
|
||||
inline constexpr bool all_elements_valid = (is_valid_element(Elements) && ...);
|
||||
// template<MagnitudeSpec auto... Elements>
|
||||
// inline constexpr bool all_elements_valid = (is_valid_element(Elements) && ...);
|
||||
|
||||
template<MagnitudeSpec auto... Elements>
|
||||
inline constexpr bool all_elements_in_order = strictly_increasing(get_base_value(Elements)...);
|
||||
// template<MagnitudeSpec auto... Elements>
|
||||
// inline constexpr bool all_elements_in_order = strictly_increasing(get_base_value(Elements)...);
|
||||
|
||||
template<MagnitudeSpec auto... Elements>
|
||||
inline constexpr bool is_element_pack_valid = all_elements_valid<Elements...> && all_elements_in_order<Elements...>;
|
||||
// template<MagnitudeSpec auto... Elements>
|
||||
// inline constexpr bool is_element_pack_valid = all_elements_valid<Elements...> && all_elements_in_order<Elements...>;
|
||||
|
||||
[[nodiscard]] consteval bool is_rational(MagnitudeSpec auto element)
|
||||
{
|
||||
return std::is_integral_v<decltype(get_base_value(element))> && (get_exponent(element).den == 1);
|
||||
static_assert(!Magnitude<decltype(element)>); // magnitudes are handles by another overload
|
||||
return std::is_integral_v<decltype(get_base(element))> && (get_exponent(element).den == 1);
|
||||
}
|
||||
|
||||
[[nodiscard]] consteval bool is_integral(MagnitudeSpec auto element)
|
||||
{
|
||||
static_assert(!Magnitude<decltype(element)>); // magnitudes are handles by another overload
|
||||
return is_rational(element) && get_exponent(element).num > 0;
|
||||
}
|
||||
|
||||
@ -433,29 +455,40 @@ inline constexpr bool is_element_pack_valid = all_elements_valid<Elements...> &&
|
||||
* rational powers, and compare for equality.
|
||||
*/
|
||||
template<MagnitudeSpec auto... Ms>
|
||||
requires detail::is_element_pack_valid<Ms...>
|
||||
// requires detail::is_element_pack_valid<Ms...>
|
||||
struct magnitude {
|
||||
// Whether this magnitude represents an integer.
|
||||
[[nodiscard]] friend consteval bool is_integral(const magnitude&) { return (detail::is_integral(Ms) && ...); }
|
||||
[[nodiscard]] friend consteval bool is_integral(const magnitude&)
|
||||
{
|
||||
using namespace detail; // needed for recursive case when magnitudes are in the MagnitudeSpec
|
||||
return (is_integral(Ms) && ...);
|
||||
}
|
||||
|
||||
// Whether this magnitude represents a rational number.
|
||||
[[nodiscard]] friend consteval bool is_rational(const magnitude&) { return (detail::is_rational(Ms) && ...); }
|
||||
[[nodiscard]] friend consteval bool is_rational(const magnitude&)
|
||||
{
|
||||
using namespace detail; // needed for recursive case when magnitudes are in the MagnitudeSpec
|
||||
return (is_rational(Ms) && ...);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace detail {
|
||||
|
||||
// Implementation for Magnitude concept (below).
|
||||
template<auto... Ms>
|
||||
void to_base_specialization_of_magnitude(const volatile magnitude<Ms...>*);
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_magnitude = false;
|
||||
template<auto... BPs>
|
||||
inline constexpr bool is_magnitude<magnitude<BPs...>> = true;
|
||||
inline constexpr bool is_derived_from_specialization_of_magnitude =
|
||||
requires(T * t) { to_base_specialization_of_magnitude(t); };
|
||||
|
||||
template<typename T>
|
||||
requires is_derived_from_specialization_of_magnitude<T>
|
||||
inline constexpr bool is_magnitude<T> = true;
|
||||
|
||||
template<auto... Ms>
|
||||
inline constexpr bool is_specialization_of_magnitude<magnitude<Ms...>> = true;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* @brief Concept to detect whether T is a valid Magnitude.
|
||||
*/
|
||||
template<typename T>
|
||||
concept Magnitude = detail::is_magnitude<T>;
|
||||
|
||||
/**
|
||||
* @brief The value of a Magnitude in a desired type T.
|
||||
@ -471,23 +504,25 @@ concept Magnitude = detail::is_magnitude<T>;
|
||||
// return result;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* @brief A convenient Magnitude constant for pi, which we can manipulate like a regular number.
|
||||
*/
|
||||
inline constexpr Magnitude auto mag_pi = magnitude<pi_v{}>{};
|
||||
inline constexpr struct mag_pi : magnitude<std::numbers::pi_v<long double>> {
|
||||
} mag_pi;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Magnitude equality implementation.
|
||||
|
||||
template<auto... LeftBPs, auto... RightBPs>
|
||||
constexpr bool operator==(magnitude<LeftBPs...>, magnitude<RightBPs...>)
|
||||
{
|
||||
if constexpr (sizeof...(LeftBPs) == sizeof...(RightBPs)) {
|
||||
return ((LeftBPs == RightBPs) && ...);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// template<auto... LeftBPs, auto... RightBPs>
|
||||
// constexpr bool operator==(magnitude<LeftBPs...>, magnitude<RightBPs...>)
|
||||
// {
|
||||
// if constexpr (sizeof...(LeftBPs) == sizeof...(RightBPs)) {
|
||||
// return ((LeftBPs == RightBPs) && ...);
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Magnitude rational powers implementation.
|
||||
@ -517,6 +552,21 @@ constexpr auto cbrt(magnitude<Ms...> m)
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Magnitude product implementation.
|
||||
|
||||
namespace detail {
|
||||
|
||||
consteval bool less(MagnitudeSpec auto lhs, MagnitudeSpec auto rhs)
|
||||
{
|
||||
if constexpr (is_named_magnitude<decltype(lhs)> && is_named_magnitude<decltype(rhs)>)
|
||||
return type_name(lhs) < type_name(rhs);
|
||||
else if constexpr (!is_named_magnitude<decltype(lhs)> && !is_named_magnitude<decltype(rhs)>)
|
||||
return get_base(lhs) < get_base(rhs);
|
||||
else
|
||||
return is_named_magnitude<decltype(lhs)>;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
// Base cases, for when either (or both) inputs are the identity.
|
||||
constexpr Magnitude auto operator*(magnitude<>, magnitude<>) { return magnitude<>{}; }
|
||||
constexpr Magnitude auto operator*(magnitude<>, Magnitude auto m) { return m; }
|
||||
@ -528,32 +578,31 @@ constexpr Magnitude auto operator*(magnitude<H1, T1...>, magnitude<H2, T2...>)
|
||||
{
|
||||
using namespace detail;
|
||||
|
||||
// Case for when H1 has the smaller base.
|
||||
if constexpr (get_base_value(H1) < get_base_value(H2)) {
|
||||
if constexpr (less(H1, H2)) {
|
||||
if constexpr (sizeof...(T1) == 0) {
|
||||
// Shortcut for the "pure prepend" case, which makes it easier to implement some of the other cases.
|
||||
return magnitude<H1, H2, T2...>{};
|
||||
} else {
|
||||
return magnitude<H1>{} * (magnitude<T1...>{} * magnitude<H2, T2...>{});
|
||||
}
|
||||
}
|
||||
|
||||
// Case for when H2 has the smaller base.
|
||||
if constexpr (get_base_value(H1) > get_base_value(H2)) {
|
||||
} else if constexpr (less(H2, H1)) {
|
||||
return magnitude<H2>{} * (magnitude<H1, T1...>{} * magnitude<T2...>{});
|
||||
}
|
||||
|
||||
// "Same leading base" case.
|
||||
if constexpr (get_base(H1) == get_base(H2)) {
|
||||
} else {
|
||||
constexpr auto partial_product = magnitude<T1...>{} * magnitude<T2...>{};
|
||||
|
||||
// Make a new power_v with the common base of H1 and H2, whose power is their powers' sum.
|
||||
constexpr auto new_head = power_v_or_T<get_base(H1), get_exponent(H1) + get_exponent(H2)>();
|
||||
if constexpr (is_same_v<decltype(get_base(H1)), decltype(get_base(H2))>) {
|
||||
// Make a new power_v with the common base of H1 and H2, whose power is their powers' sum.
|
||||
constexpr auto new_head = power_v_or_T<get_base(H1), get_exponent(H1) + get_exponent(H2)>();
|
||||
|
||||
if constexpr (get_exponent(new_head) == 0) {
|
||||
return partial_product;
|
||||
if constexpr (get_exponent(new_head) == 0) {
|
||||
return partial_product;
|
||||
} else {
|
||||
return magnitude<new_head>{} * partial_product;
|
||||
}
|
||||
} else if constexpr (is_named_magnitude<decltype(get_base(H1))>) {
|
||||
return magnitude<H1>{} * (magnitude<T1...>{} * magnitude<H2, T2...>{});
|
||||
} else {
|
||||
return magnitude<new_head>{} * partial_product;
|
||||
return magnitude<H2>{} * (magnitude<H1, T1...>{} * magnitude<T2...>{});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,33 +23,37 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/bits/common_type.h>
|
||||
#include <units/generic/dimensionless.h>
|
||||
// #include <units/bits/common_type.h>
|
||||
// #include <units/generic/dimensionless.h>
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/quantity_cast.h>
|
||||
#include <units/ratio.h>
|
||||
// #include <units/quantity_cast.h>
|
||||
// #include <units/ratio.h>
|
||||
#include <units/bits/common_type.h>
|
||||
#include <units/concepts.h>
|
||||
#include <units/customization_points.h>
|
||||
#include <units/dimension.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/unit.h>
|
||||
#include <compare>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/reference.h>
|
||||
#include <utility>
|
||||
// #include <units/reference.h>
|
||||
// #include <utility>
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<Reference auto R> // TODO: Replace with `v * R` pending https://github.com/BobSteagall/wg21/issues/58.
|
||||
inline constexpr auto make_quantity = [](auto&& v) {
|
||||
// TODO: Replace with `v * R` pending https://github.com/BobSteagall/wg21/issues/58.
|
||||
template<Reference auto R>
|
||||
inline constexpr auto make_quantity = [](Representation auto&& v) {
|
||||
using Rep = std::remove_cvref_t<decltype(v)>;
|
||||
return quantity<typename decltype(R)::dimension, typename decltype(R)::unit, Rep>(std::forward<decltype(v)>(v));
|
||||
return quantity<R, Rep>(std::forward<decltype(v)>(v));
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concept quantity_one =
|
||||
Quantity<T> &&
|
||||
(std::same_as<typename T::dimension, dim_one> || std::same_as<typename T::dimension, unknown_dimension<>>) &&
|
||||
detail::equivalent_unit<typename T::unit, typename T::dimension, ::units::one, typename T::dimension>::value;
|
||||
concept quantity_one = Quantity<T> && (T::dimension == one_dim) && (T::unit == one);
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@ -65,12 +69,12 @@ concept safe_convertible_to_ = // exposition only
|
||||
// QFrom ratio is an exact multiple of QTo
|
||||
template<typename QFrom, typename QTo>
|
||||
concept harmonic_ = // exposition only
|
||||
Quantity<QFrom> && Quantity<QTo> && is_integral(detail::quantity_magnitude<QFrom> / detail::quantity_magnitude<QTo>);
|
||||
true; // TODO fix it when magnitudes are ready
|
||||
// Quantity<QFrom> && Quantity<QTo> && is_integral(detail::quantity_magnitude<QFrom> / detail::quantity_magnitude<QTo>);
|
||||
|
||||
template<typename QFrom, typename QTo>
|
||||
concept safe_castable_to_ = // exposition only
|
||||
Quantity<QFrom> && QuantityOf<QTo, typename QFrom::dimension> &&
|
||||
scalable_with_<typename QFrom::rep, typename QTo::rep> &&
|
||||
Quantity<QFrom> && quantity_of<QTo, QFrom::dimension> && scalable_with_<typename QFrom::rep, typename QTo::rep> &&
|
||||
(floating_point_<QTo> || (!floating_point_<QFrom> && harmonic_<QFrom, QTo>));
|
||||
|
||||
template<typename Func, typename T, typename U>
|
||||
@ -83,9 +87,23 @@ concept invoke_result_convertible_to_ =
|
||||
template<typename Func, typename Q, typename V>
|
||||
concept have_quantity_for_ = Quantity<Q> && (!Quantity<V>) && quantity_value_for_<Func, typename Q::rep, V>;
|
||||
|
||||
template<typename T>
|
||||
concept QuantityLike = requires(T q) {
|
||||
typename quantity_like_traits<T>::dimension;
|
||||
typename quantity_like_traits<T>::unit;
|
||||
typename quantity_like_traits<T>::rep;
|
||||
requires Dimension<typename quantity_like_traits<T>::dimension>;
|
||||
requires Unit<typename quantity_like_traits<T>::unit>;
|
||||
requires Representation<typename quantity_like_traits<T>::rep>;
|
||||
{
|
||||
quantity_like_traits<T>::number(q)
|
||||
} -> std::convertible_to<typename quantity_like_traits<T>::rep>;
|
||||
};
|
||||
|
||||
template<QuantityLike Q>
|
||||
using quantity_like_type = quantity<typename quantity_like_traits<Q>::dimension, typename quantity_like_traits<Q>::unit,
|
||||
typename quantity_like_traits<Q>::rep>;
|
||||
using quantity_like_type =
|
||||
quantity<reference<typename quantity_like_traits<Q>::dimension, typename quantity_like_traits<Q>::unit>{},
|
||||
typename quantity_like_traits<Q>::rep>;
|
||||
|
||||
/**
|
||||
* @brief A quantity
|
||||
@ -97,15 +115,15 @@ using quantity_like_type = quantity<typename quantity_like_traits<Q>::dimension,
|
||||
* @tparam U a measurement unit of the quantity
|
||||
* @tparam Rep a type to be used to represent values of a quantity
|
||||
*/
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep = double>
|
||||
template<Reference auto R, Representation Rep = double>
|
||||
class quantity {
|
||||
Rep number_;
|
||||
public:
|
||||
// member types and values
|
||||
using dimension = D;
|
||||
using unit = U;
|
||||
using rep = Rep;
|
||||
static constexpr units::reference<dimension, unit> reference{};
|
||||
static constexpr auto reference = R;
|
||||
static constexpr auto dimension = R.dimension;
|
||||
static constexpr auto unit = R.unit;
|
||||
|
||||
// static member functions
|
||||
[[nodiscard]] static constexpr quantity zero() noexcept
|
||||
@ -171,14 +189,14 @@ public:
|
||||
} -> std::common_with<rep>;
|
||||
}
|
||||
{
|
||||
using ret = quantity<D, U, decltype(+number())>;
|
||||
using ret = quantity<R, decltype(+number())>;
|
||||
return ret(+number());
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr Quantity auto operator-() const
|
||||
requires(std::regular_invocable<std::negate<>, rep>)
|
||||
{
|
||||
using ret = quantity<D, U, decltype(-number())>;
|
||||
using ret = quantity<R, decltype(-number())>;
|
||||
return ret(-number());
|
||||
}
|
||||
|
||||
@ -380,7 +398,7 @@ public:
|
||||
requires(invoke_result_convertible_to_<rep, std::multiplies<>, rep, const Value&>)
|
||||
[[nodiscard]] friend constexpr Quantity auto operator*(const quantity& q, const Value& v)
|
||||
{
|
||||
using ret = quantity<D, U, std::invoke_result_t<std::multiplies<>, rep, Value>>;
|
||||
using ret = quantity<R, std::invoke_result_t<std::multiplies<>, rep, Value>>;
|
||||
return ret(q.number() * v);
|
||||
}
|
||||
|
||||
@ -388,7 +406,7 @@ public:
|
||||
requires(invoke_result_convertible_to_<rep, std::multiplies<>, const Value&, rep>)
|
||||
[[nodiscard]] friend constexpr Quantity auto operator*(const Value& v, const quantity& q)
|
||||
{
|
||||
using ret = quantity<D, U, std::invoke_result_t<std::multiplies<>, Value, rep>>;
|
||||
using ret = quantity<R, std::invoke_result_t<std::multiplies<>, Value, rep>>;
|
||||
return ret(v * q.number());
|
||||
}
|
||||
|
||||
@ -397,7 +415,7 @@ public:
|
||||
[[nodiscard]] friend constexpr Quantity auto operator/(const quantity& q, const Value& v)
|
||||
{
|
||||
gsl_ExpectsAudit(v != quantity_values<Value>::zero());
|
||||
using ret = quantity<D, U, std::invoke_result_t<std::divides<>, rep, Value>>;
|
||||
using ret = quantity<R, std::invoke_result_t<std::divides<>, rep, Value>>;
|
||||
return ret(q.number() / v);
|
||||
}
|
||||
|
||||
@ -405,7 +423,7 @@ public:
|
||||
requires(!Quantity<Value>) && (invoke_result_convertible_to_<rep, std::divides<>, const Value&, rep>)
|
||||
[[nodiscard]] friend constexpr Quantity auto operator/(const Value& v, const quantity& q)
|
||||
{
|
||||
return detail::make_quantity<::units::reference<dim_one, ::units::one>{} / reference>(v / q.number());
|
||||
return detail::make_quantity<dimensionless[one] / reference>(v / q.number());
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
@ -414,7 +432,7 @@ public:
|
||||
[[nodiscard]] friend constexpr Quantity auto operator%(const quantity& q, const Value& v)
|
||||
{
|
||||
gsl_ExpectsAudit(v != quantity_values<Value>::zero());
|
||||
using ret = quantity<D, U, std::invoke_result_t<std::modulus<>, rep, Value>>;
|
||||
using ret = quantity<R, std::invoke_result_t<std::modulus<>, rep, Value>>;
|
||||
return ret(q.number() % v);
|
||||
}
|
||||
|
||||
@ -422,7 +440,7 @@ public:
|
||||
requires(!floating_point_<rep>) && (invoke_result_convertible_to_<rep, std::modulus<>, rep, rep>)
|
||||
{
|
||||
gsl_ExpectsAudit(rhs.number() != quantity_values<rep>::zero());
|
||||
using ret = quantity<D, U, std::invoke_result_t<std::modulus<>, rep, rep>>;
|
||||
using ret = quantity<R, std::invoke_result_t<std::modulus<>, rep, rep>>;
|
||||
return ret(lhs.number() % rhs.number());
|
||||
}
|
||||
|
||||
@ -441,36 +459,37 @@ public:
|
||||
|
||||
// CTAD
|
||||
#if !UNITS_COMP_CLANG || UNITS_COMP_CLANG > 16
|
||||
template<typename D, typename U, typename Rep>
|
||||
explicit(false) quantity(Rep&&)->quantity<D, U, Rep>;
|
||||
template<auto R, typename Rep>
|
||||
explicit(false) quantity(Rep&&) -> quantity<R, Rep>;
|
||||
#endif
|
||||
|
||||
template<typename D, typename U, typename Rep>
|
||||
explicit(false) quantity(quantity<D, U, Rep>)->quantity<D, U, Rep>;
|
||||
template<auto R, typename Rep>
|
||||
explicit(false) quantity(quantity<R, Rep>) -> quantity<R, Rep>;
|
||||
|
||||
template<Representation Rep>
|
||||
explicit(false) quantity(Rep)->quantity<dim_one, one, Rep>;
|
||||
explicit(false) quantity(Rep)->quantity<dimensionless[one], Rep>;
|
||||
|
||||
template<QuantityLike Q>
|
||||
explicit quantity(Q) -> quantity<typename quantity_like_traits<Q>::dimension, typename quantity_like_traits<Q>::unit,
|
||||
typename quantity_like_traits<Q>::rep>;
|
||||
explicit quantity(Q)
|
||||
-> quantity<reference<typename quantity_like_traits<Q>::dimension, typename quantity_like_traits<Q>::unit>{},
|
||||
typename quantity_like_traits<Q>::rep>;
|
||||
|
||||
// non-member binary operators
|
||||
template<Quantity Q1, QuantityEquivalentTo<Q1> Q2>
|
||||
template<Quantity Q1, quantity_equivalent_to<Q1> Q2>
|
||||
requires(quantity_value_for_<std::plus<>, typename Q1::rep, typename Q2::rep>)
|
||||
[[nodiscard]] constexpr Quantity auto operator+(const Q1& lhs, const Q2& rhs)
|
||||
{
|
||||
using ref = detail::common_quantity_reference<Q1, Q2>;
|
||||
using ret = quantity<typename ref::dimension, typename ref::unit, decltype(lhs.number() + rhs.number())>;
|
||||
using ret = quantity<ref{}, decltype(lhs.number() + rhs.number())>;
|
||||
return ret(ret(lhs).number() + ret(rhs).number());
|
||||
}
|
||||
|
||||
template<Quantity Q1, QuantityEquivalentTo<Q1> Q2>
|
||||
template<Quantity Q1, quantity_equivalent_to<Q1> Q2>
|
||||
requires(quantity_value_for_<std::minus<>, typename Q1::rep, typename Q2::rep>)
|
||||
[[nodiscard]] constexpr Quantity auto operator-(const Q1& lhs, const Q2& rhs)
|
||||
{
|
||||
using ref = detail::common_quantity_reference<Q1, Q2>;
|
||||
using ret = quantity<typename ref::dimension, typename ref::unit, decltype(lhs.number() - rhs.number())>;
|
||||
using ret = quantity<ref{}, decltype(lhs.number() - rhs.number())>;
|
||||
return ret(ret(lhs).number() - ret(rhs).number());
|
||||
}
|
||||
|
||||
@ -491,17 +510,17 @@ template<Quantity Q1, Quantity Q2>
|
||||
|
||||
template<Quantity Q1, Quantity Q2>
|
||||
requires(!floating_point_<typename Q1::rep>) && (!floating_point_<typename Q2::rep>) &&
|
||||
(QuantityEquivalentTo<Q2, Q1> || Dimensionless<Q2>) &&
|
||||
(quantity_equivalent_to<Q2, Q1> || quantity_of<Q2, one_dim>) &&
|
||||
(quantity_value_for_<std::modulus<>, typename Q1::rep, typename Q2::rep>)
|
||||
[[nodiscard]] constexpr Quantity auto operator%(const Q1& lhs, const Q2& rhs)
|
||||
{
|
||||
gsl_ExpectsAudit(rhs.number() != quantity_values<typename Q2::rep>::zero());
|
||||
using ret = quantity<typename Q1::dimension, typename Q1::unit,
|
||||
using ret = quantity<reference<typename Q1::dimension, typename Q1::unit>{},
|
||||
std::invoke_result_t<std::modulus<>, typename Q1::rep, typename Q2::rep>>;
|
||||
return ret(lhs.number() % rhs.number());
|
||||
}
|
||||
|
||||
template<Quantity Q1, QuantityEquivalentTo<Q1> Q2>
|
||||
template<Quantity Q1, quantity_equivalent_to<Q1> Q2>
|
||||
requires std::three_way_comparable_with<typename Q1::rep, typename Q2::rep>
|
||||
[[nodiscard]] constexpr auto operator<=>(const Q1& lhs, const Q2& rhs)
|
||||
{
|
||||
@ -509,7 +528,7 @@ template<Quantity Q1, QuantityEquivalentTo<Q1> Q2>
|
||||
return cq(lhs).number() <=> cq(rhs).number();
|
||||
}
|
||||
|
||||
template<Quantity Q1, QuantityEquivalentTo<Q1> Q2>
|
||||
template<Quantity Q1, quantity_equivalent_to<Q1> Q2>
|
||||
requires std::equality_comparable_with<typename Q1::rep, typename Q2::rep>
|
||||
[[nodiscard]] constexpr bool operator==(const Q1& lhs, const Q2& rhs)
|
||||
{
|
||||
@ -517,16 +536,4 @@ template<Quantity Q1, QuantityEquivalentTo<Q1> Q2>
|
||||
return cq(lhs).number() == cq(rhs).number();
|
||||
}
|
||||
|
||||
// type traits
|
||||
namespace detail {
|
||||
|
||||
template<typename D, typename U, typename Rep>
|
||||
inline constexpr bool is_quantity<quantity<D, U, Rep>> = true;
|
||||
|
||||
template<typename T>
|
||||
requires units::is_derived_from_specialization_of<T, units::quantity>
|
||||
inline constexpr bool is_quantity<T> = true;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace units
|
||||
|
@ -22,36 +22,27 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/dimension.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units {
|
||||
|
||||
// TODO Concept for system reference
|
||||
template<auto R, typename Rep = double>
|
||||
class quantity {
|
||||
public:
|
||||
using reference = decltype(R);
|
||||
static constexpr auto dimension = reference::dimension;
|
||||
static constexpr auto unit = reference::unit;
|
||||
|
||||
quantity(Rep) {}
|
||||
};
|
||||
|
||||
template<typename Child, Dimension auto Dim, Unit auto CoU>
|
||||
template<Dimension auto Dim, Unit auto CoU>
|
||||
struct system_reference;
|
||||
|
||||
namespace detail {
|
||||
// namespace detail {
|
||||
|
||||
template<typename Child, auto Dim, auto CoU>
|
||||
void to_base_specialization_of_system_reference(const volatile system_reference<Child, Dim, CoU>*);
|
||||
// template<typename Child, auto Dim, auto CoU>
|
||||
// void to_base_specialization_of_inline constexpr struct const volatile system_reference<Child : system_reference<Dim,
|
||||
// CoU>*> {} const volatile system_reference<Child;
|
||||
|
||||
template<typename T>
|
||||
// inline constexpr bool // TODO: Replace with concept when it works with MSVC
|
||||
concept is_derived_from_specialization_of_system_reference =
|
||||
requires(T* t) { detail::to_base_specialization_of_system_reference(t); };
|
||||
// template<typename T>
|
||||
// // inline constexpr bool // TODO: Replace with concept when it works with MSVC
|
||||
// concept is_derived_from_specialization_of_system_reference =
|
||||
// requires(T* t) { detail::to_base_specialization_of_system_reference(t); };
|
||||
|
||||
} // namespace detail
|
||||
// } // namespace detail
|
||||
|
||||
/**
|
||||
* @brief The type for quantity references
|
||||
@ -92,33 +83,36 @@ concept is_derived_from_specialization_of_system_reference =
|
||||
* The following syntaxes are not allowed:
|
||||
* `2 / s`, `km * 3`, `s / 4`, `70 * km / h`.
|
||||
*/
|
||||
template<typename T, Unit U>
|
||||
struct reference;
|
||||
// template<typename R, Unit U>
|
||||
// requires detail::is_derived_from_specialization_of_system_reference<R>
|
||||
// struct reference<R, U> {
|
||||
// using system_reference = R;
|
||||
// static constexpr auto dimension = R::dimension;
|
||||
// static constexpr U unit{};
|
||||
// // static constexpr UNITS_MSVC_WORKAROUND(Magnitude) auto mag = dimension::mag * unit::mag;
|
||||
// };
|
||||
|
||||
template<typename R, Unit U>
|
||||
requires detail::is_derived_from_specialization_of_system_reference<R>
|
||||
struct reference<R, U> {
|
||||
using system_reference = R;
|
||||
static constexpr auto dimension = R::dimension;
|
||||
static constexpr U unit{};
|
||||
// static constexpr UNITS_MSVC_WORKAROUND(Magnitude) auto mag = dimension::mag * unit::mag;
|
||||
};
|
||||
|
||||
template<DerivedDimension D, Unit U>
|
||||
struct reference<D, U> {
|
||||
template<Dimension D, Unit U>
|
||||
struct reference {
|
||||
static constexpr D dimension{};
|
||||
static constexpr U unit{};
|
||||
// static constexpr UNITS_MSVC_WORKAROUND(Magnitude) auto mag = dimension::mag * unit::mag;
|
||||
};
|
||||
|
||||
// Reference
|
||||
/**
|
||||
* @brief A concept matching all references in the library.
|
||||
*
|
||||
* Satisfied by all specializations of @c reference.
|
||||
*/
|
||||
template<typename T>
|
||||
concept Reference = is_specialization_of<T, reference>;
|
||||
|
||||
template<Magnitude M, Reference R>
|
||||
[[nodiscard]] consteval reference<decltype(R::dimension), decltype(M{} * R::unit)> operator*(M, R)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
// template<Magnitude M, Reference R>
|
||||
// requires requires { typename R::system_reference; }
|
||||
// [[nodiscard]] consteval reference<typename R::system_reference, decltype(M{} * R::unit)> operator*(M, R)
|
||||
// {
|
||||
// return {};
|
||||
// }
|
||||
|
||||
template<Reference R1, Reference R2>
|
||||
[[nodiscard]] consteval reference<decltype(R1::dimension * R2::dimension), decltype(R1::unit * R2::unit)> operator*(R1,
|
||||
@ -134,29 +128,28 @@ template<Reference R1, Reference R2>
|
||||
return {};
|
||||
}
|
||||
|
||||
// TODO Update when quantity is done
|
||||
// template<Representation Rep>
|
||||
// [[nodiscard]] friend constexpr Quantity auto operator*(const Rep& lhs, reference)
|
||||
template<typename Rep, Reference R>
|
||||
template<Representation Rep, Reference R>
|
||||
[[nodiscard]] constexpr quantity<R{}, Rep> operator*(const Rep& lhs, R)
|
||||
{
|
||||
return quantity<R{}, Rep>(lhs);
|
||||
}
|
||||
|
||||
// friend void /*Use `q * (1 * r)` rather than `q * r`.*/ operator*(Quantity auto, reference) = delete;
|
||||
void /*Use `q * (1 * r)` rather than `q * r`.*/ operator*(Quantity auto, Reference auto) = delete;
|
||||
|
||||
// TODO will use deducing this
|
||||
template<typename Child, Dimension auto Dim, Unit auto CoU>
|
||||
template<Dimension auto Dim, Unit auto CoU>
|
||||
struct system_reference {
|
||||
static constexpr auto dimension = Dim;
|
||||
static constexpr auto coherent_unit = CoU;
|
||||
|
||||
template<Unit U>
|
||||
// requires same_unit_reference<CoU, U>
|
||||
[[nodiscard]] consteval reference<Child, U> operator[](U) const
|
||||
// requires same_unit_reference<CoU, U>
|
||||
[[nodiscard]] constexpr reference<std::remove_const_t<decltype(dimension)>, U> operator[](U) const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
inline constexpr struct dimensionless : system_reference<one_dim, one> {
|
||||
} dimensionless;
|
||||
|
||||
} // namespace units
|
||||
|
@ -75,6 +75,12 @@ namespace detail {
|
||||
template<Magnitude auto M, typename U>
|
||||
void to_base_scaled_unit(const volatile scaled_unit<M, U>*);
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_specialization_of_scaled_unit = false;
|
||||
|
||||
template<Magnitude auto M, typename U>
|
||||
inline constexpr bool is_specialization_of_scaled_unit<scaled_unit<M, U>> = true;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
@ -98,14 +104,106 @@ concept NamedUnit = Unit<T> && detail::is_named<T>;
|
||||
template<Unit auto U1, Unit auto U2>
|
||||
struct same_unit_reference : is_same<typename decltype(U1)::reference, typename decltype(U2)::reference> {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<Unit U1, Unit U2>
|
||||
struct unit_less : std::bool_constant<type_name<U1>() < type_name<U2>()> {};
|
||||
|
||||
template<typename T1, typename T2>
|
||||
using type_list_of_unit_less = expr_less<T1, T2, unit_less>;
|
||||
|
||||
/**
|
||||
* @brief Unpacks the list of potentially derived dimensions to a list containing only base dimensions
|
||||
*
|
||||
* @tparam Es Exponents of potentially derived dimensions
|
||||
*/
|
||||
// template<typename NumList, typename DenList>
|
||||
// struct unit_extract;
|
||||
|
||||
// template<>
|
||||
// struct unit_extract<type_list<>, type_list<>> {
|
||||
// using num = type_list<>;
|
||||
// using den = type_list<>;
|
||||
// };
|
||||
|
||||
// template<typename T, typename... NRest, typename... Dens>
|
||||
// requires BaseUnit<T> || BaseUnit<typename T::factor>
|
||||
// struct unit_extract<type_list<T, NRest...>, type_list<Dens...>> {
|
||||
// using impl = unit_extract<type_list<NRest...>, type_list<Dens...>>;
|
||||
// using num = type_list_push_front<typename impl::num, T>;
|
||||
// using den = TYPENAME impl::den;
|
||||
// };
|
||||
|
||||
// template<typename T, typename... DRest>
|
||||
// requires BaseUnit<T> || BaseUnit<typename T::factor>
|
||||
// struct unit_extract<type_list<>, type_list<T, DRest...>> {
|
||||
// using impl = unit_extract<type_list<>, type_list<DRest...>>;
|
||||
// using num = TYPENAME impl::num;
|
||||
// using den = type_list_push_front<typename impl::den, T>;
|
||||
// };
|
||||
|
||||
// template<DerivedUnit T, typename... NRest, typename... Dens>
|
||||
// struct unit_extract<type_list<T, NRest...>, type_list<Dens...>> :
|
||||
// unit_extract<type_list_push_back<typename T::normalized_num, NRest...>,
|
||||
// type_list_push_back<typename T::normalized_den, Dens...>> {};
|
||||
|
||||
// template<DerivedUnit T, int... Ints, typename... NRest, typename... Dens>
|
||||
// struct unit_extract<type_list<power<T, Ints...>, NRest...>, type_list<Dens...>> :
|
||||
// unit_extract<type_list_push_back<typename expr_power<typename T::normalized_num, power<T, Ints...>::num,
|
||||
// power<T, Ints...>::den>::type,
|
||||
// NRest...>,
|
||||
// type_list_push_back<typename expr_power<typename T::normalized_den, power<T, Ints...>::num,
|
||||
// power<T, Ints...>::den>::type,
|
||||
// Dens...>> {};
|
||||
|
||||
|
||||
// template<DerivedUnit T, typename... DRest>
|
||||
// struct unit_extract<type_list<>, type_list<T, DRest...>> :
|
||||
// unit_extract<typename T::normalized_den, type_list_push_back<typename T::normalized_num, DRest...>> {};
|
||||
|
||||
// template<DerivedUnit T, int... Ints, typename... DRest>
|
||||
// struct unit_extract<type_list<>, type_list<power<T, Ints...>, DRest...>> :
|
||||
// unit_extract<typename expr_power<typename T::normalized_den, power<T, Ints...>::num, power<T,
|
||||
// Ints...>::den>::type,
|
||||
// type_list_push_back<typename expr_power<typename T::normalized_num, power<T, Ints...>::num,
|
||||
// power<T, Ints...>::den>::type,
|
||||
// DRest...>> {};
|
||||
|
||||
/**
|
||||
* @brief Converts user provided derived dimension specification into a valid units::normalized_dimension definition
|
||||
*
|
||||
* User provided definition of a derived dimension may contain the same base dimension repeated more than once on the
|
||||
* list possibly hidden in other derived units provided by the user. The process here should:
|
||||
* 1. Extract derived dimensions into exponents of base dimensions.
|
||||
* 2. Sort the exponents so the same dimensions are placed next to each other.
|
||||
* 3. Consolidate contiguous range of exponents of the same base dimensions to a one (or possibly zero) exponent for
|
||||
* this base dimension.
|
||||
*/
|
||||
template<typename OneTypeBase, typename... Us>
|
||||
struct normalized_unit : detail::expr_fractions<OneTypeBase, Us...> {
|
||||
// private:
|
||||
// using base = detail::expr_fractions<OneTypeBase, Us...>;
|
||||
// using extracted = unit_extract<typename base::num, typename base::den>;
|
||||
// using num_list = expr_consolidate<type_list_sort<typename extracted::num, type_list_of_unit_less>>;
|
||||
// using den_list = expr_consolidate<type_list_sort<typename extracted::den, type_list_of_unit_less>>;
|
||||
// using simple = expr_simplify<num_list, den_list, type_list_of_unit_less>;
|
||||
// public:
|
||||
// using normalized_num = TYPENAME simple::num;
|
||||
// using normalized_den = TYPENAME simple::den;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// TODO add checking for `per` and power elements as well
|
||||
template<typename T>
|
||||
concept UnitSpec = Unit<T> || is_specialization_of<T, per> || detail::is_specialization_of_power<T>;
|
||||
|
||||
// User should not instantiate this type!!!
|
||||
// It should not be exported from the module
|
||||
template<UnitSpec... Us>
|
||||
struct derived_unit : detail::expr_fractions<derived_unit<>, Us...>, scaled_unit<mag<1>, derived_unit<Us...>> {};
|
||||
|
||||
// : detail::normalized_dimension<derived_dimension<>, Ds...> {};
|
||||
struct derived_unit : detail::normalized_unit<derived_unit<>, Us...>, scaled_unit<mag<1>, derived_unit<Us...>> {
|
||||
static constexpr bool is_base = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Unit one
|
||||
@ -129,28 +227,13 @@ struct named_unit;
|
||||
template<basic_symbol_text Symbol>
|
||||
struct named_unit<Symbol> : scaled_unit<mag<1>, named_unit<Symbol>> {
|
||||
static constexpr auto symbol = Symbol;
|
||||
static constexpr bool is_base = true;
|
||||
};
|
||||
|
||||
template<basic_symbol_text Symbol, auto U>
|
||||
requires is_specialization_of<std::remove_const_t<decltype(U)>, derived_unit>
|
||||
template<basic_symbol_text Symbol, Unit auto U>
|
||||
struct named_unit<Symbol, U> : decltype(U) {
|
||||
static constexpr auto symbol = Symbol;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief A named scaled unit
|
||||
*
|
||||
* Defines a new named unit that is a scaled version of another unit.
|
||||
* A named unit may be composed with a prefix to create a prefixed_unit.
|
||||
*
|
||||
* @tparam Symbol a short text representation of the unit
|
||||
* @tparam M the Magnitude by which to scale U
|
||||
* @tparam U a reference unit to scale
|
||||
*/
|
||||
template<basic_symbol_text Symbol, Magnitude auto M, Unit auto U>
|
||||
struct named_scaled_unit : scaled_unit<M* decltype(U)::mag, typename decltype(U)::reference> {
|
||||
static constexpr auto symbol = Symbol;
|
||||
static constexpr bool is_base = decltype(U)::is_base;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -164,15 +247,12 @@ struct named_scaled_unit : scaled_unit<M* decltype(U)::mag, typename decltype(U)
|
||||
* @tparam P prefix to be appied to the reference unit
|
||||
* @tparam U reference unit
|
||||
*/
|
||||
// template<typename Child, Prefix P, NamedUnit U>
|
||||
// requires detail::can_be_prefixed<U>
|
||||
// struct prefixed_unit : downcast_dispatch<Child, scaled_unit<P::mag * U::mag, typename U::reference>> {
|
||||
// static constexpr auto symbol = P::symbol + U::symbol;
|
||||
// };
|
||||
|
||||
|
||||
template<basic_symbol_text Symbol, Magnitude auto M, NamedUnit auto U>
|
||||
struct prefixed_unit : scaled_unit<M* decltype(U)::mag, typename decltype(U)::reference> {};
|
||||
// requires detail::can_be_prefixed<U>
|
||||
struct prefixed_unit : scaled_unit<M* decltype(U)::mag, typename decltype(U)::reference> {
|
||||
// static constexpr auto symbol = symbol + decltype(U)::symbol;
|
||||
static constexpr bool is_base = decltype(U)::is_base;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A coherent unit of a derived quantity
|
||||
@ -187,11 +267,11 @@ struct prefixed_unit : scaled_unit<M* decltype(U)::mag, typename decltype(U)::re
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<basic_symbol_text Symbol>
|
||||
void is_named_impl(const volatile named_unit<Symbol>*);
|
||||
template<basic_symbol_text Symbol, auto... Args>
|
||||
void is_named_impl(const volatile named_unit<Symbol, Args...>*);
|
||||
|
||||
template<basic_symbol_text Symbol, Magnitude auto M, auto U>
|
||||
void is_named_impl(const volatile named_scaled_unit<Symbol, M, U>*);
|
||||
template<basic_symbol_text Symbol, Magnitude auto M, NamedUnit auto U>
|
||||
void is_named_impl(const volatile prefixed_unit<Symbol, M, U>*);
|
||||
|
||||
template<Unit U>
|
||||
inline constexpr bool is_named<U> = requires(U * u) { is_named_impl(u); };
|
||||
@ -211,15 +291,20 @@ inline constexpr bool is_named<U> = requires(U * u) { is_named_impl(u); };
|
||||
// template<Magnitude auto M, typename U>
|
||||
// inline constexpr bool can_be_prefixed<scaled_unit<M, U>> = can_be_prefixed<typename U::reference>;
|
||||
|
||||
|
||||
template<Unit U1, Unit U2>
|
||||
struct unit_less : std::bool_constant<type_name<U1>() < type_name<U2>()> {};
|
||||
|
||||
template<typename T1, typename T2>
|
||||
using type_list_of_unit_less = expr_less<T1, T2, unit_less>;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<Magnitude M, Unit U>
|
||||
[[nodiscard]] consteval Unit auto operator*(M mag, U)
|
||||
{
|
||||
return scaled_unit<mag, U>{};
|
||||
}
|
||||
|
||||
template<Magnitude M1, Magnitude auto M2, typename U>
|
||||
[[nodiscard]] consteval Unit auto operator*(M1 mag, scaled_unit<M2, U>)
|
||||
{
|
||||
return scaled_unit<mag * M2, U>{};
|
||||
}
|
||||
|
||||
template<Unit U1, Unit U2>
|
||||
[[nodiscard]] consteval Unit auto operator*(U1, U2)
|
||||
{
|
||||
@ -242,9 +327,16 @@ template<Unit U>
|
||||
template<Unit U1, Unit U2>
|
||||
[[nodiscard]] consteval bool operator==(U1, U2)
|
||||
{
|
||||
return false;
|
||||
return is_same_v<U1, U2>;
|
||||
}
|
||||
|
||||
template<Unit U1, Unit U2>
|
||||
[[nodiscard]] consteval bool equivalent(U1, U2)
|
||||
{
|
||||
return true; // TODO implement this
|
||||
}
|
||||
|
||||
|
||||
// template<BaseDimension D1, BaseDimension D2>
|
||||
// constexpr bool operator==(D1, D2)
|
||||
// {
|
||||
@ -274,4 +366,16 @@ template<Unit U1, Unit U2>
|
||||
// std::is_same_v<typename D1::normalized_den, typename D2::normalized_den>;
|
||||
// }
|
||||
|
||||
template<Unit U>
|
||||
struct square_ : decltype(U{} * U{}) {};
|
||||
|
||||
template<Unit auto U>
|
||||
inline constexpr square_<std::remove_const_t<decltype(U)>> square;
|
||||
|
||||
template<Unit U>
|
||||
struct cubic_ : decltype(U{} * U{} * U{}) {};
|
||||
|
||||
template<Unit auto U>
|
||||
inline constexpr cubic_<std::remove_const_t<decltype(U)>> cubic;
|
||||
|
||||
} // namespace units
|
||||
|
@ -24,17 +24,19 @@ cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
# systems
|
||||
add_subdirectory(isq)
|
||||
add_subdirectory(isq-iec80000)
|
||||
add_subdirectory(isq-natural)
|
||||
|
||||
# add_subdirectory(isq-iec80000)
|
||||
# add_subdirectory(isq-natural)
|
||||
add_subdirectory(si)
|
||||
add_subdirectory(si-cgs)
|
||||
add_subdirectory(si-fps)
|
||||
add_subdirectory(si-hep)
|
||||
add_subdirectory(si-iau)
|
||||
add_subdirectory(si-imperial)
|
||||
add_subdirectory(si-international)
|
||||
add_subdirectory(si-typographic)
|
||||
add_subdirectory(si-uscs)
|
||||
|
||||
# add_subdirectory(si-fps)
|
||||
# add_subdirectory(si-hep)
|
||||
# add_subdirectory(si-iau)
|
||||
# add_subdirectory(si-imperial)
|
||||
# add_subdirectory(si-international)
|
||||
# add_subdirectory(si-typographic)
|
||||
# add_subdirectory(si-uscs)
|
||||
|
||||
# wrapper for all the systems
|
||||
add_library(mp-units-systems INTERFACE)
|
||||
@ -42,17 +44,17 @@ target_link_libraries(
|
||||
mp-units-systems
|
||||
INTERFACE
|
||||
mp-units::isq
|
||||
mp-units::isq-iec80000
|
||||
mp-units::isq-natural
|
||||
# mp-units::isq-iec80000
|
||||
# mp-units::isq-natural
|
||||
mp-units::si
|
||||
mp-units::si-cgs
|
||||
mp-units::si-fps
|
||||
mp-units::si-hep
|
||||
mp-units::si-iau
|
||||
mp-units::si-imperial
|
||||
mp-units::si-international
|
||||
mp-units::si-typographic
|
||||
mp-units::si-uscs
|
||||
# mp-units::si-fps
|
||||
# mp-units::si-hep
|
||||
# mp-units::si-iau
|
||||
# mp-units::si-imperial
|
||||
# mp-units::si-international
|
||||
# mp-units::si-typographic
|
||||
# mp-units::si-uscs
|
||||
)
|
||||
add_library(mp-units::systems ALIAS mp-units-systems)
|
||||
set_target_properties(mp-units-systems PROPERTIES EXPORT_NAME systems)
|
||||
|
@ -23,53 +23,6 @@
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(
|
||||
isq
|
||||
DEPENDENCIES mp-units::core
|
||||
HEADERS include/units/isq/dimensions/absorbed_dose.h
|
||||
include/units/isq/dimensions/acceleration.h
|
||||
include/units/isq/dimensions/amount_of_substance.h
|
||||
include/units/isq/dimensions/angular_acceleration.h
|
||||
include/units/isq/dimensions/angular_velocity.h
|
||||
include/units/isq/dimensions/area.h
|
||||
include/units/isq/dimensions/capacitance.h
|
||||
include/units/isq/dimensions/catalytic_activity.h
|
||||
include/units/isq/dimensions/charge_density.h
|
||||
include/units/isq/dimensions/concentration.h
|
||||
include/units/isq/dimensions/conductance.h
|
||||
include/units/isq/dimensions/current_density.h
|
||||
include/units/isq/dimensions/density.h
|
||||
include/units/isq/dimensions/dynamic_viscosity.h
|
||||
include/units/isq/dimensions/electric_charge.h
|
||||
include/units/isq/dimensions/electric_current.h
|
||||
include/units/isq/dimensions/electric_field_strength.h
|
||||
include/units/isq/dimensions/energy.h
|
||||
include/units/isq/dimensions/energy_density.h
|
||||
include/units/isq/dimensions/force.h
|
||||
include/units/isq/dimensions/frequency.h
|
||||
include/units/isq/dimensions/heat_capacity.h
|
||||
include/units/isq/dimensions/inductance.h
|
||||
include/units/isq/dimensions/length.h
|
||||
include/units/isq/dimensions/luminance.h
|
||||
include/units/isq/dimensions/luminous_flux.h
|
||||
include/units/isq/dimensions/luminous_intensity.h
|
||||
include/units/isq/dimensions/magnetic_flux.h
|
||||
include/units/isq/dimensions/magnetic_induction.h
|
||||
include/units/isq/dimensions/mass.h
|
||||
include/units/isq/dimensions/molar_energy.h
|
||||
include/units/isq/dimensions/momentum.h
|
||||
include/units/isq/dimensions/permeability.h
|
||||
include/units/isq/dimensions/permittivity.h
|
||||
include/units/isq/dimensions/power.h
|
||||
include/units/isq/dimensions/pressure.h
|
||||
include/units/isq/dimensions/radioactivity.h
|
||||
include/units/isq/dimensions/resistance.h
|
||||
include/units/isq/dimensions/speed.h
|
||||
include/units/isq/dimensions/surface_tension.h
|
||||
include/units/isq/dimensions/thermal_conductivity.h
|
||||
include/units/isq/dimensions/thermodynamic_temperature.h
|
||||
include/units/isq/dimensions/time.h
|
||||
include/units/isq/dimensions/torque.h
|
||||
include/units/isq/dimensions/voltage.h
|
||||
include/units/isq/dimensions/volume.h
|
||||
include/units/isq/dimensions.h
|
||||
isq DEPENDENCIES mp-units::core HEADERS include/units/isq/base_dimensions.h include/units/isq/isq.h
|
||||
include/units/isq/mechanics.h include/units/isq/space_and_time.h
|
||||
)
|
||||
|
@ -22,19 +22,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/generic/angle.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
#include <units/dimension.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_angular_acceleration;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_angle> A, DimensionOfT<dim_time> T>
|
||||
struct dim_angular_acceleration<Child, U, A, T> : derived_dimension<Child, U, exponent<A, 1>, exponent<T, -2>> {};
|
||||
|
||||
template<typename T>
|
||||
concept AngularAcceleration = QuantityOfT<T, dim_angular_acceleration>;
|
||||
// clang-format off
|
||||
inline constexpr struct length_dim : base_dimension<"L"> {} length_dim;
|
||||
inline constexpr struct mass_dim : base_dimension<"M"> {} mass_dim;
|
||||
inline constexpr struct time_dim : base_dimension<"T"> {} time_dim;
|
||||
inline constexpr struct electric_current_dim : base_dimension<"I"> {} electric_current_dim;
|
||||
// TODO Should the below use basic_symbol_text? How to name it for ASCII?
|
||||
inline constexpr struct thermodynamic_temperature_dim : base_dimension<"Θ"> {} thermodynamic_temperature_dim;
|
||||
inline constexpr struct amount_of_substance_dim : base_dimension<"N"> {} amount_of_substance_dim;
|
||||
inline constexpr struct luminous_intensity_dim : base_dimension<"J"> {} luminous_intensity_dim;
|
||||
// clang-format on
|
||||
|
||||
} // namespace units::isq
|
@ -1,74 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/absorbed_dose.h>
|
||||
#include <units/isq/dimensions/acceleration.h>
|
||||
#include <units/isq/dimensions/amount_of_substance.h>
|
||||
#include <units/isq/dimensions/angular_acceleration.h>
|
||||
#include <units/isq/dimensions/angular_velocity.h>
|
||||
#include <units/isq/dimensions/area.h>
|
||||
#include <units/isq/dimensions/capacitance.h>
|
||||
#include <units/isq/dimensions/catalytic_activity.h>
|
||||
#include <units/isq/dimensions/charge_density.h>
|
||||
#include <units/isq/dimensions/concentration.h>
|
||||
#include <units/isq/dimensions/conductance.h>
|
||||
#include <units/isq/dimensions/current_density.h>
|
||||
#include <units/isq/dimensions/density.h>
|
||||
#include <units/isq/dimensions/dynamic_viscosity.h>
|
||||
#include <units/isq/dimensions/electric_charge.h>
|
||||
#include <units/isq/dimensions/electric_current.h>
|
||||
#include <units/isq/dimensions/electric_field_strength.h>
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
// TODO Add when downcasting issue is solved (collides with pressure)
|
||||
// #include <units/isq/dimensions/energy_density.h>
|
||||
#include <units/isq/dimensions/force.h>
|
||||
#include <units/isq/dimensions/frequency.h>
|
||||
#include <units/isq/dimensions/heat_capacity.h>
|
||||
#include <units/isq/dimensions/inductance.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
#include <units/isq/dimensions/luminance.h>
|
||||
#include <units/isq/dimensions/luminous_flux.h>
|
||||
#include <units/isq/dimensions/luminous_intensity.h>
|
||||
#include <units/isq/dimensions/magnetic_flux.h>
|
||||
#include <units/isq/dimensions/magnetic_induction.h>
|
||||
#include <units/isq/dimensions/mass.h>
|
||||
#include <units/isq/dimensions/molar_energy.h>
|
||||
#include <units/isq/dimensions/momentum.h>
|
||||
#include <units/isq/dimensions/permeability.h>
|
||||
#include <units/isq/dimensions/permittivity.h>
|
||||
#include <units/isq/dimensions/power.h>
|
||||
#include <units/isq/dimensions/pressure.h>
|
||||
// TODO Add when downcasting issue is solved (collides with frequency)
|
||||
// #include <units/isq/dimensions/radioactivity.h>
|
||||
#include <units/isq/dimensions/resistance.h>
|
||||
#include <units/isq/dimensions/speed.h>
|
||||
#include <units/isq/dimensions/surface_tension.h>
|
||||
#include <units/isq/dimensions/thermal_conductivity.h>
|
||||
#include <units/isq/dimensions/thermodynamic_temperature.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
#include <units/isq/dimensions/torque.h>
|
||||
#include <units/isq/dimensions/voltage.h>
|
||||
#include <units/isq/dimensions/volume.h>
|
||||
// IWYU pragma: end_exports
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
#include <units/isq/dimensions/mass.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_absorbed_dose;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_energy> E, DimensionOfT<dim_mass> M>
|
||||
struct dim_absorbed_dose<Child, U, E, M> : derived_dimension<Child, U, exponent<E, 1>, exponent<M, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept AbsorbedDose = QuantityOfT<T, dim_absorbed_dose>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_acceleration;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_length> L, DimensionOfT<dim_time> T>
|
||||
struct dim_acceleration<Child, U, L, T> : derived_dimension<Child, U, exponent<L, 1>, exponent<T, -2>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Acceleration = QuantityOfT<T, dim_acceleration>;
|
||||
|
||||
} // namespace units::isq
|
@ -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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<Unit U>
|
||||
struct dim_amount_of_substance : base_dimension<"N", U> {};
|
||||
|
||||
template<typename T>
|
||||
concept AmountOfSubstance = QuantityOfT<T, dim_amount_of_substance>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/generic/angle.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_angular_velocity;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_angle> A, DimensionOfT<dim_time> T>
|
||||
struct dim_angular_velocity<Child, U, A, T> : derived_dimension<Child, U, exponent<A, 1>, exponent<T, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept AngularVelocity = QuantityOfT<T, dim_angular_velocity>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/electric_charge.h>
|
||||
#include <units/isq/dimensions/voltage.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_capacitance;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_electric_charge> C, DimensionOfT<dim_voltage> V>
|
||||
struct dim_capacitance<Child, U, C, V> : derived_dimension<Child, U, exponent<C, 1>, exponent<V, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Capacitance = QuantityOfT<T, dim_capacitance>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/amount_of_substance.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_catalytic_activity;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_time> T, DimensionOfT<dim_amount_of_substance> M>
|
||||
struct dim_catalytic_activity<Child, U, T, M> : derived_dimension<Child, U, exponent<T, -1>, exponent<M, 1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept CatalyticActivity = QuantityOfT<T, dim_catalytic_activity>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,49 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/electric_charge.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_charge_density;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_electric_charge> Q, DimensionOfT<dim_length> L>
|
||||
struct dim_charge_density<Child, U, Q, L> : derived_dimension<Child, U, exponent<Q, 1>, exponent<L, -3>> {};
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_surface_charge_density;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_electric_charge> Q, DimensionOfT<dim_length> L>
|
||||
struct dim_surface_charge_density<Child, U, Q, L> : derived_dimension<Child, U, exponent<Q, 1>, exponent<L, -2>> {};
|
||||
|
||||
template<typename T>
|
||||
concept ChargeDensity = QuantityOfT<T, dim_charge_density>;
|
||||
|
||||
template<typename T>
|
||||
concept SurfaceChargeDensity = QuantityOfT<T, dim_surface_charge_density>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/amount_of_substance.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_concentration;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_amount_of_substance> M, DimensionOfT<dim_length> L>
|
||||
struct dim_concentration<Child, U, M, L> : derived_dimension<Child, U, exponent<M, 1>, exponent<L, -3>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Concentration = QuantityOfT<T, dim_concentration>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/electric_current.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_current_density;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_electric_current> I, DimensionOfT<dim_length> L>
|
||||
struct dim_current_density<Child, U, I, L> : derived_dimension<Child, U, exponent<I, 1>, exponent<L, -2>> {};
|
||||
|
||||
template<typename T>
|
||||
concept CurrentDensity = QuantityOfT<T, dim_current_density>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
#include <units/isq/dimensions/mass.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_density;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_mass> M, DimensionOfT<dim_length> L>
|
||||
struct dim_density<Child, U, M, L> : derived_dimension<Child, U, exponent<M, 1>, exponent<L, -3>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Density = QuantityOfT<T, dim_density>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/pressure.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_dynamic_viscosity;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_pressure> P, DimensionOfT<dim_time> T>
|
||||
struct dim_dynamic_viscosity<Child, U, P, T> : derived_dimension<Child, U, exponent<P, 1>, exponent<T, 1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept DynamicViscosity = QuantityOfT<T, dim_dynamic_viscosity>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/electric_current.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_electric_charge;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_time> T, DimensionOfT<dim_electric_current> C>
|
||||
struct dim_electric_charge<Child, U, T, C> : derived_dimension<Child, U, exponent<T, 1>, exponent<C, 1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept ElectricCharge = QuantityOfT<T, dim_electric_charge>;
|
||||
|
||||
} // namespace units::isq
|
@ -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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<Unit U>
|
||||
struct dim_electric_current : base_dimension<"I", U> {};
|
||||
|
||||
template<typename T>
|
||||
concept ElectricCurrent = QuantityOfT<T, dim_electric_current>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
#include <units/isq/dimensions/voltage.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_electric_field_strength;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_voltage> V, DimensionOfT<dim_length> L>
|
||||
struct dim_electric_field_strength<Child, U, V, L> : derived_dimension<Child, U, exponent<V, 1>, exponent<L, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept ElectricFieldStrength = QuantityOfT<T, dim_electric_field_strength>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,43 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/force.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_energy;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_force> F, DimensionOfT<dim_length> L>
|
||||
struct dim_energy<Child, U, F, L> : derived_dimension<Child, U, exponent<F, 1>, exponent<L, 1>> {};
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_length> L, DimensionOfT<dim_force> F>
|
||||
struct dim_energy<Child, U, L, F> : derived_dimension<Child, U, exponent<L, 1>, exponent<F, 1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Energy = QuantityOfT<T, dim_energy>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
#include <units/isq/dimensions/volume.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_energy_density;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_energy> E, DimensionOfT<dim_volume> V>
|
||||
struct dim_energy_density<Child, U, E, V> : derived_dimension<Child, U, exponent<E, 1>, exponent<V, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept EnergyDensity = QuantityOfT<T, dim_energy_density>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/acceleration.h>
|
||||
#include <units/isq/dimensions/mass.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_force;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_mass> M, DimensionOfT<dim_acceleration> A>
|
||||
struct dim_force<Child, U, M, A> : derived_dimension<Child, U, exponent<M, 1>, exponent<A, 1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Force = QuantityOfT<T, dim_force>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,39 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_frequency;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_time> T>
|
||||
struct dim_frequency<Child, U, T> : derived_dimension<Child, U, exponent<T, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Frequency = QuantityOfT<T, dim_frequency>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,60 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/amount_of_substance.h>
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
#include <units/isq/dimensions/mass.h>
|
||||
#include <units/isq/dimensions/thermodynamic_temperature.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_heat_capacity;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_energy> E, DimensionOfT<dim_thermodynamic_temperature> T>
|
||||
struct dim_heat_capacity<Child, U, E, T> : derived_dimension<Child, U, exponent<E, 1>, exponent<T, -1>> {};
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_specific_heat_capacity;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_heat_capacity> C, DimensionOfT<dim_mass> M>
|
||||
struct dim_specific_heat_capacity<Child, U, C, M> : derived_dimension<Child, U, exponent<C, 1>, exponent<M, -1>> {};
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_molar_heat_capacity;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_heat_capacity> C, DimensionOfT<dim_amount_of_substance> M>
|
||||
struct dim_molar_heat_capacity<Child, U, C, M> : derived_dimension<Child, U, exponent<C, 1>, exponent<M, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept HeatCapacity = QuantityOfT<T, dim_heat_capacity>;
|
||||
|
||||
template<typename T>
|
||||
concept SpecificHeatCapacity = QuantityOfT<T, dim_specific_heat_capacity>;
|
||||
|
||||
template<typename T>
|
||||
concept MolarHeatCapacity = QuantityOfT<T, dim_molar_heat_capacity>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/electric_current.h>
|
||||
#include <units/isq/dimensions/magnetic_flux.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_inductance;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_magnetic_flux> F, DimensionOfT<dim_electric_current> I>
|
||||
struct dim_inductance<Child, U, F, I> : derived_dimension<Child, U, exponent<F, 1>, exponent<I, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Inductance = QuantityOfT<T, dim_inductance>;
|
||||
|
||||
} // namespace units::isq
|
@ -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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<Unit U>
|
||||
struct dim_length : base_dimension<"L", U> {};
|
||||
|
||||
template<typename T>
|
||||
concept Length = QuantityOfT<T, dim_length>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
#include <units/isq/dimensions/luminous_intensity.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_luminance;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_luminous_intensity> I, DimensionOfT<dim_length> L>
|
||||
struct dim_luminance<Child, U, I, L> : derived_dimension<Child, U, exponent<I, 1>, exponent<L, -2>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Luminance = QuantityOfT<T, dim_luminance>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/generic/solid_angle.h>
|
||||
#include <units/isq/dimensions/luminous_intensity.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_luminous_flux;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_luminous_intensity> I, DimensionOfT<dim_solid_angle> A>
|
||||
struct dim_luminous_flux<Child, U, I, A> : derived_dimension<Child, U, exponent<I, 1>, exponent<A, 1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept LuminousFlux = QuantityOfT<T, dim_luminous_flux>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/area.h>
|
||||
#include <units/isq/dimensions/magnetic_induction.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_magnetic_flux;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_magnetic_induction> B, DimensionOfT<dim_area> A>
|
||||
struct dim_magnetic_flux<Child, U, B, A> : derived_dimension<Child, U, exponent<B, 1>, exponent<A, 1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept MagneticFlux = QuantityOfT<T, dim_magnetic_flux>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,42 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
#include <units/isq/dimensions/voltage.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_magnetic_induction;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_voltage> V, DimensionOfT<dim_time> T, DimensionOfT<dim_length> L>
|
||||
struct dim_magnetic_induction<Child, U, V, T, L> :
|
||||
derived_dimension<Child, U, exponent<V, 1>, exponent<T, 1>, exponent<L, -2>> {};
|
||||
|
||||
template<typename T>
|
||||
concept MagneticInduction = QuantityOfT<T, dim_magnetic_induction>;
|
||||
|
||||
} // namespace units::isq
|
@ -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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<Unit U>
|
||||
struct dim_mass : base_dimension<"M", U> {};
|
||||
|
||||
template<typename T>
|
||||
concept Mass = QuantityOfT<T, dim_mass>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/amount_of_substance.h>
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_molar_energy;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_energy> E, DimensionOfT<dim_amount_of_substance> M>
|
||||
struct dim_molar_energy<Child, U, E, M> : derived_dimension<Child, U, exponent<E, 1>, exponent<M, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept MolarEnergy = QuantityOfT<T, dim_molar_energy>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/mass.h>
|
||||
#include <units/isq/dimensions/speed.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_momentum;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_mass> M, DimensionOfT<dim_speed> V>
|
||||
struct dim_momentum<Child, U, M, V> : derived_dimension<Child, U, exponent<M, 1>, exponent<V, 1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Momentum = QuantityOfT<T, dim_momentum>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/inductance.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_permeability;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_inductance> H, DimensionOfT<dim_length> L>
|
||||
struct dim_permeability<Child, U, H, L> : derived_dimension<Child, U, exponent<H, 1>, exponent<L, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Permeability = QuantityOfT<T, dim_permeability>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/capacitance.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_permittivity;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_capacitance> C, DimensionOfT<dim_length> L>
|
||||
struct dim_permittivity<Child, U, C, L> : derived_dimension<Child, U, exponent<C, 1>, exponent<L, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Permittivity = QuantityOfT<T, dim_permittivity>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,43 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_power;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_energy> E, DimensionOfT<dim_time> T>
|
||||
struct dim_power<Child, U, E, T> : derived_dimension<Child, U, exponent<E, 1>, exponent<T, -1>> {};
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_length> L, DimensionOfT<dim_force> F, DimensionOfT<dim_time> T>
|
||||
struct dim_power<Child, U, L, F, T> : derived_dimension<Child, U, exponent<L, 1>, exponent<F, 1>, exponent<T, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Power = QuantityOfT<T, dim_power>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/area.h>
|
||||
#include <units/isq/dimensions/force.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_pressure;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_force> F, DimensionOfT<dim_area> A>
|
||||
struct dim_pressure<Child, U, F, A> : derived_dimension<Child, U, exponent<F, 1>, exponent<A, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Pressure = QuantityOfT<T, dim_pressure>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,39 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_radioactivity;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_time> T>
|
||||
struct dim_radioactivity<Child, U, T> : derived_dimension<Child, U, exponent<T, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Radioactivity = QuantityOfT<T, dim_radioactivity>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/electric_current.h>
|
||||
#include <units/isq/dimensions/voltage.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_resistance;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_voltage> V, DimensionOfT<dim_electric_current> C>
|
||||
struct dim_resistance<Child, U, V, C> : derived_dimension<Child, U, exponent<V, 1>, exponent<C, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Resistance = QuantityOfT<T, dim_resistance>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
#include <units/isq/dimensions/time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_speed;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_length> L, DimensionOfT<dim_time> T>
|
||||
struct dim_speed<Child, U, L, T> : derived_dimension<Child, U, exponent<L, 1>, exponent<T, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Speed = QuantityOfT<T, dim_speed>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/force.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_surface_tension;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_force> F, DimensionOfT<dim_length> L>
|
||||
struct dim_surface_tension<Child, U, F, L> : derived_dimension<Child, U, exponent<F, 1>, exponent<L, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept SurfaceTension = QuantityOfT<T, dim_surface_tension>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,43 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
#include <units/isq/dimensions/power.h>
|
||||
#include <units/isq/dimensions/thermodynamic_temperature.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_thermal_conductivity;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_power> P, DimensionOfT<dim_length> L,
|
||||
DimensionOfT<dim_thermodynamic_temperature> T>
|
||||
struct dim_thermal_conductivity<Child, U, P, L, T> :
|
||||
derived_dimension<Child, U, exponent<P, 1>, exponent<L, -1>, exponent<T, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept ThermalConductivity = QuantityOfT<T, dim_thermal_conductivity>;
|
||||
|
||||
} // namespace units::isq
|
@ -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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<Unit U>
|
||||
struct dim_thermodynamic_temperature : base_dimension<"Θ", U> {};
|
||||
|
||||
template<typename T>
|
||||
concept ThermodynamicTemperature = QuantityOfT<T, dim_thermodynamic_temperature>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/generic/angle.h>
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_torque;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_force> F, DimensionOfT<dim_length> L, DimensionOfT<dim_angle> A>
|
||||
struct dim_torque<Child, U, F, L, A> : derived_dimension<Child, U, exponent<F, 1>, exponent<L, 1>, exponent<A, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Torque = QuantityOfT<T, dim_torque>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,40 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/electric_current.h>
|
||||
#include <units/isq/dimensions/power.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_voltage;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_power> P, DimensionOfT<dim_electric_current> C>
|
||||
struct dim_voltage<Child, U, P, C> : derived_dimension<Child, U, exponent<P, 1>, exponent<C, -1>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Voltage = QuantityOfT<T, dim_voltage>;
|
||||
|
||||
} // namespace units::isq
|
@ -1,39 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/length.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_volume;
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_length> L>
|
||||
struct dim_volume<Child, U, L> : derived_dimension<Child, U, exponent<L, 3>> {};
|
||||
|
||||
template<typename T>
|
||||
concept Volume = QuantityOfT<T, dim_volume>;
|
||||
|
||||
} // namespace units::isq
|
@ -22,14 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<Unit U>
|
||||
struct dim_time : base_dimension<"T", U> {};
|
||||
|
||||
template<typename T>
|
||||
concept Time = QuantityOfT<T, dim_time>;
|
||||
|
||||
} // namespace units::isq
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/base_dimensions.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
// IWYU pragma: end_exports
|
72
src/systems/isq/include/units/isq/mechanics.h
Normal file
72
src/systems/isq/include/units/isq/mechanics.h
Normal 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/dimension.h>
|
||||
#include <units/isq/base_dimensions.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
// clang-format off
|
||||
// inline constexpr struct mass_dim : base_dimension<"M"> {} mass_dim;
|
||||
inline constexpr struct mass_density_dim : decltype(mass_dim / volume_dim) {} mass_density_dim;
|
||||
inline constexpr struct specific_volume_dim : decltype(1 / mass_density_dim) {} specific_volume_dim;
|
||||
inline constexpr struct relative_mass_density_dim : decltype(mass_density_dim / mass_density_dim) {} relative_mass_density_dim;
|
||||
inline constexpr struct surface_mass_density_dim : decltype(mass_dim / area_dim) {} surface_mass_density_dim;
|
||||
inline constexpr struct linear_mass_density_dim : decltype(mass_dim / length_dim) {} linear_mass_density_dim;
|
||||
inline constexpr struct momentum_dim : decltype(mass_dim * speed_dim) {} momentum_dim; // TODO velocity_dim?
|
||||
inline constexpr struct force_dim : decltype(mass_dim * acceleration_dim) {} force_dim; // TODO what is a correct equation here?
|
||||
// inline constexpr struct weight_dim : decltype(mass_dim * acceleration_dim) {} weight_dim; // TODO should we add it as a quantity or should it be a quantity_kind?
|
||||
// TODO Should we add other forces as well: static_friction_force, kinematic_friction_force, rolling_resistance, drag_force
|
||||
inline constexpr struct impulse_dim : decltype(force_dim / time_dim) {} impulse_dim;
|
||||
inline constexpr struct angular_momentum_dim : decltype(length_dim * momentum_dim) {} angular_momentum_dim; // TODO position_vector
|
||||
inline constexpr struct moment_of_inertia_dim : decltype(angular_momentum_dim * angular_velocity_dim) {} moment_of_inertia_dim;
|
||||
inline constexpr struct moment_of_force_dim : decltype(length_dim * force_dim) {} moment_of_force_dim; // TODO position_vector
|
||||
inline constexpr struct torque_dim : decltype(moment_of_force_dim) {} torque_dim; // TODO angle?
|
||||
inline constexpr struct angular_impulse_dim : decltype(moment_of_force_dim * time_dim) {} angular_impulse_dim;
|
||||
inline constexpr struct pressure_dim : decltype(force_dim / area_dim) {} pressure_dim;
|
||||
inline constexpr struct stress_dim : decltype(pressure_dim) {} stress_dim; // TODO tensor?
|
||||
inline constexpr struct normal_stress_dim : decltype(force_dim / area_dim) {} normal_stress_dim;
|
||||
inline constexpr struct strain_dim : decltype(stress_dim / stress_dim) {} strain_dim; // TODO what is a correct equation here?
|
||||
inline constexpr struct poisson_number_dim : decltype(length_dim / length_dim) {} poisson_number_dim; // TODO width?
|
||||
// TODO modulus quantities
|
||||
inline constexpr struct compressibility_dim : decltype(volume_dim / pressure_dim) {} compressibility_dim;
|
||||
inline constexpr struct second_axial_moment_of_area_dim : decltype(area_dim * area_dim) {} second_axial_moment_of_area_dim; // TODO what is a correct equation here?
|
||||
inline constexpr struct section_modulus_dim : decltype(second_axial_moment_of_area_dim / length_dim) {} section_modulus_dim; // TODO radial distance
|
||||
// TODO friction coefficients?
|
||||
inline constexpr struct dynamic_viscosity_dim : decltype(stress_dim * length_dim / speed_dim) {} dynamic_viscosity_dim; // TODO shear stress, velocity
|
||||
inline constexpr struct kinematic_viscosity_dim : decltype(dynamic_viscosity_dim / mass_density_dim) {} kinematic_viscosity_dim;
|
||||
inline constexpr struct surface_tension_dim : decltype(force_dim / length_dim) {} surface_tension_dim; // TODO what is a correct equation here?
|
||||
inline constexpr struct power_dim : decltype(force_dim * speed_dim) {} power_dim;
|
||||
// TODO what about energy (potential and kinetic as separate quantities will prevent an equation for mechanical one, is it expected?)
|
||||
inline constexpr struct efficiency_dim : decltype(power_dim / power_dim) {} efficiency_dim;
|
||||
inline constexpr struct mass_flow_dim : decltype(mass_density_dim * speed_dim) {} mass_flow_dim; // TODO velocity
|
||||
inline constexpr struct mass_flow_rate_dim : decltype(mass_flow_dim * area_dim) {} mass_flow_rate_dim;
|
||||
inline constexpr struct mass_change_rate_dim : decltype(mass_dim / time_dim) {} mass_change_rate_dim;
|
||||
inline constexpr struct volume_flow_rate_dim : decltype(speed_dim * area_dim) {} volume_flow_rate_dim; // TODO velocity
|
||||
// inline constexpr struct action_dim : decltype(energy_dim * time_dim) {} action_dim; // TODO make it compile
|
||||
|
||||
// clang-format on
|
||||
|
||||
} // namespace units::isq
|
68
src/systems/isq/include/units/isq/space_and_time.h
Normal file
68
src/systems/isq/include/units/isq/space_and_time.h
Normal file
@ -0,0 +1,68 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/dimension.h>
|
||||
#include <units/isq/base_dimensions.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
// clang-format off
|
||||
// inline constexpr struct length_dim : base_dimension<"L"> {} length_dim;
|
||||
inline constexpr struct curvature_dim : decltype(1 / length_dim) {} curvature_dim;
|
||||
inline constexpr struct area_dim : decltype(length_dim * length_dim) {} area_dim;
|
||||
inline constexpr struct volume_dim : decltype(length_dim * length_dim * length_dim) {} volume_dim;
|
||||
inline constexpr struct angular_measure_dim : decltype(length_dim / length_dim) {} angular_measure_dim;
|
||||
inline constexpr struct angular_displacement_dim : decltype(length_dim / length_dim) {} angular_displacement_dim;
|
||||
inline constexpr struct phase_angle_dim : decltype(length_dim / length_dim) {} phase_angle_dim;
|
||||
inline constexpr struct solid_angular_measure_dim : decltype(area_dim / (length_dim * length_dim)) {} solid_angular_measure_dim;
|
||||
// inline constexpr struct time_dim : base_dimension<"T"> {} time_dim; // TODO called duration in ISO 80000
|
||||
// TODO there is also a velocity in ISO 80000
|
||||
inline constexpr struct speed_dim : decltype(length_dim / time_dim) {} speed_dim;
|
||||
inline constexpr struct acceleration_dim : decltype(speed_dim / time_dim) {} acceleration_dim;
|
||||
inline constexpr struct angular_velocity_dim : decltype(angular_displacement_dim / time_dim) {} angular_velocity_dim;
|
||||
inline constexpr struct angular_acceleration_dim : decltype(angular_velocity_dim / time_dim) {} angular_acceleration_dim;
|
||||
inline constexpr struct period_duration_dim : time_dim {} period_duration_dim;
|
||||
inline constexpr struct time_constant_dim : time_dim {} time_constant_dim;
|
||||
inline constexpr struct rotation_dim : angular_displacement_dim {} rotation_dim;
|
||||
inline constexpr struct frequency_dim : decltype(1 / time_dim) {} frequency_dim;
|
||||
inline constexpr struct rotational_frequency_dim : decltype(rotation_dim / time_dim) {} rotational_frequency_dim;
|
||||
inline constexpr struct angular_frequency_dim : decltype(angular_measure_dim / time_dim) {} angular_frequency_dim;
|
||||
inline constexpr struct wavelength_dim : length_dim {} wavelength_dim;
|
||||
inline constexpr struct repetency_dim : decltype(1 / wavelength_dim) {} repetency_dim;
|
||||
inline constexpr struct wave_vector_dim : decltype(1 / length_dim) {} wave_vector_dim;
|
||||
inline constexpr struct angular_repetency_dim : decltype(1 / wavelength_dim) {} angular_repetency_dim;
|
||||
inline constexpr struct phase_velocity_dim : decltype(angular_frequency_dim / angular_repetency_dim) {} phase_velocity_dim;
|
||||
inline constexpr struct damping_coefficient_dim : decltype(1 / time_constant_dim) {} damping_coefficient_dim;
|
||||
inline constexpr struct logarithmic_decrement_dim : decltype(damping_coefficient_dim * period_duration_dim) {} logarithmic_decrement_dim;
|
||||
inline constexpr struct attenuation_dim : decltype(1 / length_dim) {} attenuation_dim;
|
||||
inline constexpr struct phase_coefficient_dim : decltype(phase_angle_dim / length_dim) {} phase_coefficient_dim;
|
||||
inline constexpr struct propagation_coefficient_dim : decltype(1 / length_dim) {} propagation_coefficient_dim;
|
||||
// clang-format on
|
||||
|
||||
} // namespace units::isq
|
||||
|
||||
|
||||
// inline constexpr struct force_dim : decltype(mass_dim * acceleration_dim) {} force_dim;
|
||||
// inline constexpr struct energy_dim : decltype(force_dim * length_dim) {} energy_dim;
|
||||
// inline constexpr struct power_dim : decltype(force_dim * speed_dim) {} power_dim;
|
@ -22,18 +22,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/isq/dimensions/resistance.h>
|
||||
#include <units/dimension.h>
|
||||
#include <units/isq/base_dimensions.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
template<typename Child, Unit U, typename...>
|
||||
struct dim_conductance;
|
||||
// clang-format off
|
||||
// inline constexpr struct thermodynamic_temperature_dim : base_dimension<"Θ"> {} thermodynamic_temperature_dim;
|
||||
// TODO Celsius temperature???
|
||||
|
||||
template<typename Child, Unit U, DimensionOfT<dim_resistance> R>
|
||||
struct dim_conductance<Child, U, R> : derived_dimension<Child, U, exponent<R, -1>> {};
|
||||
// inline constexpr struct mass_density_dim : decltype(mass_dim / volume_dim) {} mass_density_dim;
|
||||
|
||||
template<typename T>
|
||||
concept Conductance = QuantityOfT<T, dim_conductance>;
|
||||
|
||||
inline constexpr struct energy_dim : decltype(force_dim * length_dim) {} energy_dim;
|
||||
|
||||
// clang-format on
|
||||
|
||||
} // namespace units::isq
|
@ -22,18 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
add_units_module(
|
||||
si-cgs
|
||||
DEPENDENCIES mp-units::si
|
||||
HEADERS include/units/isq/si/cgs/acceleration.h
|
||||
include/units/isq/si/cgs/area.h
|
||||
include/units/isq/si/cgs/cgs.h
|
||||
include/units/isq/si/cgs/energy.h
|
||||
include/units/isq/si/cgs/force.h
|
||||
include/units/isq/si/cgs/length.h
|
||||
include/units/isq/si/cgs/mass.h
|
||||
include/units/isq/si/cgs/power.h
|
||||
include/units/isq/si/cgs/pressure.h
|
||||
include/units/isq/si/cgs/speed.h
|
||||
include/units/isq/si/cgs/time.h
|
||||
)
|
||||
add_units_module(si-cgs DEPENDENCIES mp-units::si HEADERS include/units/si/cgs/cgs.h)
|
||||
|
@ -1,86 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/acceleration.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/cgs/speed.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct gal : named_unit<gal, "Gal"> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, gal, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
using acceleration = quantity<dim_acceleration, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// Gal
|
||||
constexpr auto operator"" _q_Gal(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return acceleration<gal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Gal(long double l) { return acceleration<gal, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace acceleration_references {
|
||||
|
||||
inline constexpr auto Gal = reference<dim_acceleration, gal>{};
|
||||
|
||||
} // namespace acceleration_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace acceleration_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::cgs
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,88 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/area.h>
|
||||
#include <units/isq/si/area.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/cgs/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
using si::square_centimetre;
|
||||
|
||||
struct dim_area : isq::dim_area<dim_area, square_centimetre, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_area> U, Representation Rep = double>
|
||||
using area = quantity<dim_area, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// cm2
|
||||
constexpr auto operator"" _q_cm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_centimetre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_cm2(long double l) { return area<square_centimetre, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace area_references {
|
||||
|
||||
inline constexpr auto cm2 = reference<dim_area, square_centimetre>{};
|
||||
|
||||
} // namespace area_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace area_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::cgs
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,36 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/si/cgs/acceleration.h>
|
||||
#include <units/isq/si/cgs/area.h>
|
||||
#include <units/isq/si/cgs/energy.h>
|
||||
#include <units/isq/si/cgs/force.h>
|
||||
#include <units/isq/si/cgs/length.h>
|
||||
#include <units/isq/si/cgs/mass.h>
|
||||
#include <units/isq/si/cgs/power.h>
|
||||
#include <units/isq/si/cgs/pressure.h>
|
||||
#include <units/isq/si/cgs/speed.h>
|
||||
#include <units/isq/si/cgs/time.h>
|
||||
// IWYU pragma: end_exports
|
@ -1,88 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/cgs/force.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct erg : named_unit<erg, "erg"> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, erg, dim_force, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// erg
|
||||
constexpr auto operator"" _q_erg(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<erg, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_erg(long double l) { return energy<erg, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace energy_references {
|
||||
|
||||
inline constexpr auto erg = reference<dim_energy, cgs::erg>{};
|
||||
|
||||
} // namespace energy_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace energy_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::cgs
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,89 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/force.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/cgs/acceleration.h>
|
||||
#include <units/isq/si/cgs/mass.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct dyne : named_unit<dyne, "dyn"> {};
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, dyne, dim_mass, dim_acceleration> {};
|
||||
|
||||
template<UnitOf<dim_force> U, Representation Rep = double>
|
||||
using force = quantity<dim_force, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// dyn
|
||||
constexpr auto operator"" _q_dyn(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return force<dyne, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_dyn(long double l) { return force<dyne, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace force_references {
|
||||
|
||||
inline constexpr auto dyn = reference<dim_force, dyne>{};
|
||||
|
||||
} // namespace force_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace force_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::cgs
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,87 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/length.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
using si::centimetre;
|
||||
|
||||
struct dim_length : isq::dim_length<centimetre> {};
|
||||
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// cm
|
||||
constexpr auto operator"" _q_cm(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return length<centimetre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_cm(long double l) { return length<centimetre, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace length_references {
|
||||
|
||||
inline constexpr auto cm = reference<dim_length, centimetre>{};
|
||||
|
||||
} // namespace length_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace length_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::cgs
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,87 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/mass.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/mass.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
using si::gram;
|
||||
|
||||
struct dim_mass : isq::dim_mass<gram> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// g
|
||||
constexpr auto operator"" _q_g(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return mass<gram, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_g(long double l) { return mass<gram, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace mass_references {
|
||||
|
||||
inline constexpr auto g = reference<dim_mass, gram>{};
|
||||
|
||||
} // namespace mass_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace mass_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::cgs
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,71 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/power.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/cgs/energy.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct erg_per_second : derived_unit<erg_per_second> {};
|
||||
|
||||
struct dim_power : isq::dim_power<dim_power, erg_per_second, dim_energy, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_power> U, Representation Rep = double>
|
||||
using power = quantity<dim_power, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// erg/s
|
||||
constexpr auto operator"" _q_erg_per_s(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return power<erg_per_second, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_erg_per_s(long double l) { return power<erg_per_second, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si::cgs
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,89 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/pressure.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/cgs/area.h>
|
||||
#include <units/isq/si/cgs/force.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct barye : named_unit<barye, "Ba"> {};
|
||||
|
||||
struct dim_pressure : isq::dim_pressure<dim_pressure, barye, dim_force, dim_area> {};
|
||||
|
||||
template<UnitOf<dim_pressure> U, Representation Rep = double>
|
||||
using pressure = quantity<dim_pressure, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// Ba
|
||||
constexpr auto operator"" _q_Ba(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return pressure<barye, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Ba(long double l) { return pressure<barye, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace pressure_references {
|
||||
|
||||
inline constexpr auto Ba = reference<dim_pressure, barye>{};
|
||||
|
||||
} // namespace pressure_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace pressure_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::cgs
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,70 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/speed.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/cgs/length.h>
|
||||
#include <units/isq/si/cgs/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct centimetre_per_second : derived_unit<centimetre_per_second> {};
|
||||
struct dim_speed : isq::dim_speed<dim_speed, centimetre_per_second, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_speed> U, Representation Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// cm/s
|
||||
constexpr auto operator"" _q_cm_per_s(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return speed<centimetre_per_second, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_cm_per_s(long double l) { return speed<centimetre_per_second, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si::cgs
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
57
src/systems/si-cgs/include/units/si/cgs/cgs.h
Normal file
57
src/systems/si-cgs/include/units/si/cgs/cgs.h
Normal file
@ -0,0 +1,57 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/isq/mechanics.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/isq/thermodynamics.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/si/units.h>
|
||||
|
||||
namespace units::si::cgs {
|
||||
|
||||
// clang-format off
|
||||
inline constexpr struct centimetre : si::centi_<si::metre> {} centimetre;
|
||||
inline constexpr struct gram : si::gram {} gram;
|
||||
inline constexpr struct second : si::second {} second;
|
||||
inline constexpr struct gal : named_unit<"Gal", centimetre / square<second>> {} gal;
|
||||
inline constexpr struct dyne : named_unit<"dyn", gram * centimetre / square<second>> {} dyne;
|
||||
inline constexpr struct erg : named_unit<"erg", dyne / centimetre> {} erg;
|
||||
inline constexpr struct barye : named_unit<"Ba", gram / (centimetre * square<second>)> {} barye;
|
||||
inline constexpr struct poise : named_unit<"P", gram / (centimetre * second)> {} poise;
|
||||
inline constexpr struct stokes : named_unit<"St", square<centimetre> / second> {} stokes;
|
||||
inline constexpr struct kayser : decltype(1 / centimetre) {} kayser;
|
||||
|
||||
inline constexpr struct length : system_reference<isq::length_dim, centimetre> {} length;
|
||||
inline constexpr struct mass : system_reference<isq::mass_dim, gram> {} mass;
|
||||
inline constexpr struct time : system_reference<isq::time_dim, second> {} time;
|
||||
inline constexpr struct speed : system_reference<isq::speed_dim, centimetre / second> {} speed;
|
||||
inline constexpr struct acceleration : system_reference<isq::acceleration_dim, gal> {} acceleration;
|
||||
inline constexpr struct force : system_reference<isq::force_dim, dyne> {} force;inline constexpr struct energy : system_reference<isq::energy_dim, erg> {} energy;
|
||||
inline constexpr struct power : system_reference<isq::power_dim, erg / second> {} power;
|
||||
inline constexpr struct dynamic_viscosity : system_reference<isq::dynamic_viscosity_dim, poise> {} dynamic_viscosity;
|
||||
inline constexpr struct kinematic_viscosity : system_reference<isq::kinematic_viscosity_dim, stokes> {} kinematic_viscosity;
|
||||
// inline constexpr struct wavenumber : system_reference<isq::wavenumber_dim, dyne> {} wavenumber;
|
||||
// clang-format on
|
||||
|
||||
} // namespace units::si::cgs
|
@ -25,53 +25,13 @@ cmake_minimum_required(VERSION 3.19)
|
||||
add_units_module(
|
||||
si
|
||||
DEPENDENCIES mp-units::isq
|
||||
HEADERS include/units/isq/si/absorbed_dose.h
|
||||
include/units/isq/si/acceleration.h
|
||||
include/units/isq/si/amount_of_substance.h
|
||||
include/units/isq/si/angular_acceleration.h
|
||||
include/units/isq/si/angular_velocity.h
|
||||
include/units/isq/si/area.h
|
||||
include/units/isq/si/capacitance.h
|
||||
include/units/isq/si/catalytic_activity.h
|
||||
include/units/isq/si/charge_density.h
|
||||
include/units/isq/si/concentration.h
|
||||
include/units/isq/si/conductance.h
|
||||
include/units/isq/si/constants.h
|
||||
include/units/isq/si/current_density.h
|
||||
include/units/isq/si/density.h
|
||||
include/units/isq/si/dynamic_viscosity.h
|
||||
include/units/isq/si/electric_charge.h
|
||||
include/units/isq/si/electric_current.h
|
||||
include/units/isq/si/electric_field_strength.h
|
||||
include/units/isq/si/energy.h
|
||||
include/units/isq/si/energy_density.h
|
||||
include/units/isq/si/force.h
|
||||
include/units/isq/si/frequency.h
|
||||
include/units/isq/si/heat_capacity.h
|
||||
include/units/isq/si/inductance.h
|
||||
include/units/isq/si/length.h
|
||||
include/units/isq/si/luminance.h
|
||||
include/units/isq/si/luminous_flux.h
|
||||
include/units/isq/si/luminous_intensity.h
|
||||
include/units/isq/si/magnetic_flux.h
|
||||
include/units/isq/si/magnetic_induction.h
|
||||
include/units/isq/si/mass.h
|
||||
include/units/isq/si/molar_energy.h
|
||||
include/units/isq/si/momentum.h
|
||||
include/units/isq/si/permeability.h
|
||||
include/units/isq/si/permittivity.h
|
||||
include/units/isq/si/power.h
|
||||
include/units/isq/si/prefixes.h
|
||||
include/units/isq/si/pressure.h
|
||||
include/units/isq/si/radioactivity.h
|
||||
include/units/isq/si/resistance.h
|
||||
include/units/isq/si/si.h
|
||||
include/units/isq/si/speed.h
|
||||
include/units/isq/si/surface_tension.h
|
||||
include/units/isq/si/thermal_conductivity.h
|
||||
include/units/isq/si/thermodynamic_temperature.h
|
||||
include/units/isq/si/time.h
|
||||
include/units/isq/si/torque.h
|
||||
include/units/isq/si/voltage.h
|
||||
include/units/isq/si/volume.h
|
||||
HEADERS include/units/si/base_quantities.h
|
||||
include/units/si/constants.h
|
||||
include/units/si/mechanics.h
|
||||
include/units/si/prefixes.h
|
||||
include/units/si/si.h
|
||||
include/units/si/space_and_time.h
|
||||
include/units/si/thermodynamics.h
|
||||
include/units/si/unit_symbols.h
|
||||
include/units/si/units.h
|
||||
)
|
||||
|
@ -1,328 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/absorbed_dose.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/energy.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct gray : named_unit<gray, "Gy"> {};
|
||||
struct yoctogray : prefixed_unit<yoctogray, yocto, gray> {};
|
||||
struct zeptogray : prefixed_unit<zeptogray, zepto, gray> {};
|
||||
struct attogray : prefixed_unit<attogray, atto, gray> {};
|
||||
struct femtogray : prefixed_unit<femtogray, femto, gray> {};
|
||||
struct picogray : prefixed_unit<picogray, pico, gray> {};
|
||||
struct nanogray : prefixed_unit<nanogray, nano, gray> {};
|
||||
struct microgray : prefixed_unit<microgray, micro, gray> {};
|
||||
struct milligray : prefixed_unit<milligray, milli, gray> {};
|
||||
struct centigray : prefixed_unit<centigray, centi, gray> {};
|
||||
struct decigray : prefixed_unit<decigray, deci, gray> {};
|
||||
struct decagray : prefixed_unit<decagray, deca, gray> {};
|
||||
struct hectogray : prefixed_unit<hectogray, hecto, gray> {};
|
||||
struct kilogray : prefixed_unit<kilogray, kilo, gray> {};
|
||||
struct megagray : prefixed_unit<megagray, mega, gray> {};
|
||||
struct gigagray : prefixed_unit<gigagray, giga, gray> {};
|
||||
struct teragray : prefixed_unit<teragray, tera, gray> {};
|
||||
struct petagray : prefixed_unit<petagray, peta, gray> {};
|
||||
struct exagray : prefixed_unit<exagray, exa, gray> {};
|
||||
struct zettagray : prefixed_unit<zettagray, zetta, gray> {};
|
||||
struct yottagray : prefixed_unit<yottagray, yotta, gray> {};
|
||||
|
||||
struct dim_absorbed_dose : isq::dim_absorbed_dose<dim_absorbed_dose, gray, dim_energy, dim_mass> {};
|
||||
|
||||
template<UnitOf<dim_absorbed_dose> U, Representation Rep = double>
|
||||
using absorbed_dose = quantity<dim_absorbed_dose, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// Gy
|
||||
constexpr auto operator"" _q_Gy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<gray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Gy(long double l) { return absorbed_dose<gray, long double>(l); }
|
||||
|
||||
// yGy
|
||||
constexpr auto operator"" _q_yGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<yoctogray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_yGy(long double l) { return absorbed_dose<yoctogray, long double>(l); }
|
||||
|
||||
// zGy
|
||||
constexpr auto operator"" _q_zGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<zeptogray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_zGy(long double l) { return absorbed_dose<zeptogray, long double>(l); }
|
||||
|
||||
// aGy
|
||||
constexpr auto operator"" _q_aGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<attogray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_aGy(long double l) { return absorbed_dose<attogray, long double>(l); }
|
||||
|
||||
// fGy
|
||||
constexpr auto operator"" _q_fGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<femtogray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fGy(long double l) { return absorbed_dose<femtogray, long double>(l); }
|
||||
|
||||
// pGy
|
||||
constexpr auto operator"" _q_pGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<picogray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pGy(long double l) { return absorbed_dose<picogray, long double>(l); }
|
||||
|
||||
// nGy
|
||||
constexpr auto operator"" _q_nGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<nanogray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nGy(long double l) { return absorbed_dose<nanogray, long double>(l); }
|
||||
|
||||
// uGy
|
||||
constexpr auto operator"" _q_uGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<microgray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_uGy(long double l) { return absorbed_dose<microgray, long double>(l); }
|
||||
|
||||
// mGy
|
||||
constexpr auto operator"" _q_mGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<milligray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mGy(long double l) { return absorbed_dose<milligray, long double>(l); }
|
||||
|
||||
// cGy
|
||||
constexpr auto operator"" _q_cGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<centigray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_cGy(long double l) { return absorbed_dose<centigray, long double>(l); }
|
||||
|
||||
// dGy
|
||||
constexpr auto operator"" _q_dGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<decigray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_dGy(long double l) { return absorbed_dose<decigray, long double>(l); }
|
||||
|
||||
// daGy
|
||||
constexpr auto operator"" _q_daGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<decagray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_daGy(long double l) { return absorbed_dose<decagray, long double>(l); }
|
||||
|
||||
// hGy
|
||||
constexpr auto operator"" _q_hGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<hectogray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_hGy(long double l) { return absorbed_dose<hectogray, long double>(l); }
|
||||
|
||||
// kGy
|
||||
constexpr auto operator"" _q_kGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<kilogray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kGy(long double l) { return absorbed_dose<kilogray, long double>(l); }
|
||||
|
||||
// MGy
|
||||
constexpr auto operator"" _q_MGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<megagray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_MGy(long double l) { return absorbed_dose<megagray, long double>(l); }
|
||||
|
||||
// GGy
|
||||
constexpr auto operator"" _q_GGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<gigagray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_GGy(long double l) { return absorbed_dose<gigagray, long double>(l); }
|
||||
|
||||
// TGy
|
||||
constexpr auto operator"" _q_TGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<teragray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_TGy(long double l) { return absorbed_dose<teragray, long double>(l); }
|
||||
|
||||
// PGy
|
||||
constexpr auto operator"" _q_PGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<petagray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_PGy(long double l) { return absorbed_dose<petagray, long double>(l); }
|
||||
|
||||
// EGy
|
||||
constexpr auto operator"" _q_EGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<exagray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_EGy(long double l) { return absorbed_dose<exagray, long double>(l); }
|
||||
|
||||
// ZGy
|
||||
constexpr auto operator"" _q_ZGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<zettagray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ZGy(long double l) { return absorbed_dose<zettagray, long double>(l); }
|
||||
|
||||
// YGy
|
||||
constexpr auto operator"" _q_YGy(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return absorbed_dose<yottagray, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_YGy(long double l) { return absorbed_dose<yottagray, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace absorbed_dose_references {
|
||||
|
||||
inline constexpr auto Gy = reference<dim_absorbed_dose, gray>{};
|
||||
inline constexpr auto yGy = reference<dim_absorbed_dose, yoctogray>{};
|
||||
inline constexpr auto zGy = reference<dim_absorbed_dose, zeptogray>{};
|
||||
inline constexpr auto aGy = reference<dim_absorbed_dose, attogray>{};
|
||||
inline constexpr auto fGy = reference<dim_absorbed_dose, femtogray>{};
|
||||
inline constexpr auto pGy = reference<dim_absorbed_dose, picogray>{};
|
||||
inline constexpr auto nGy = reference<dim_absorbed_dose, nanogray>{};
|
||||
inline constexpr auto uGy = reference<dim_absorbed_dose, microgray>{};
|
||||
inline constexpr auto mGy = reference<dim_absorbed_dose, milligray>{};
|
||||
inline constexpr auto cGy = reference<dim_absorbed_dose, centigray>{};
|
||||
inline constexpr auto dGy = reference<dim_absorbed_dose, decigray>{};
|
||||
inline constexpr auto daGy = reference<dim_absorbed_dose, decagray>{};
|
||||
inline constexpr auto hGy = reference<dim_absorbed_dose, hectogray>{};
|
||||
inline constexpr auto kGy = reference<dim_absorbed_dose, kilogray>{};
|
||||
inline constexpr auto MGy = reference<dim_absorbed_dose, megagray>{};
|
||||
inline constexpr auto GGy = reference<dim_absorbed_dose, gigagray>{};
|
||||
inline constexpr auto TGy = reference<dim_absorbed_dose, teragray>{};
|
||||
inline constexpr auto PGy = reference<dim_absorbed_dose, petagray>{};
|
||||
inline constexpr auto EGy = reference<dim_absorbed_dose, exagray>{};
|
||||
inline constexpr auto ZGy = reference<dim_absorbed_dose, zettagray>{};
|
||||
inline constexpr auto YGy = reference<dim_absorbed_dose, yottagray>{};
|
||||
|
||||
} // namespace absorbed_dose_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace absorbed_dose_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,69 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/acceleration.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
#include <units/unit.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/speed.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct metre_per_second_sq : derived_unit<metre_per_second_sq> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, metre_per_second_sq, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
using acceleration = quantity<dim_acceleration, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// m/s2
|
||||
constexpr auto operator"" _q_m_per_s2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return acceleration<metre_per_second_sq, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_m_per_s2(long double l) { return acceleration<metre_per_second_sq, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,87 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/amount_of_substance.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct mole : named_unit<mole, "mol"> {};
|
||||
|
||||
struct dim_amount_of_substance : isq::dim_amount_of_substance<mole> {};
|
||||
|
||||
template<UnitOf<dim_amount_of_substance> U, Representation Rep = double>
|
||||
using amount_of_substance = quantity<dim_amount_of_substance, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// mol
|
||||
constexpr auto operator"" _q_mol(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return amount_of_substance<mole, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mol(long double l) { return amount_of_substance<mole, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace amount_of_substance_references {
|
||||
|
||||
inline constexpr auto mol = reference<dim_amount_of_substance, mole>{};
|
||||
|
||||
} // namespace amount_of_substance_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace amount_of_substance_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,76 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/angular_acceleration.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/generic/angle.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct radian_per_second_sq : derived_unit<radian_per_second_sq> {};
|
||||
|
||||
struct dim_angular_acceleration :
|
||||
isq::dim_angular_acceleration<dim_angular_acceleration, radian_per_second_sq, dim_angle<>, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_angular_acceleration> U, Representation Rep = double>
|
||||
using angular_acceleration = quantity<dim_angular_acceleration, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// rad/s2
|
||||
constexpr auto operator"" _q_rad_per_s2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return angular_acceleration<radian_per_second_sq, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_rad_per_s2(long double l)
|
||||
{
|
||||
return angular_acceleration<radian_per_second_sq, long double>(l);
|
||||
}
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::si::inline angular_acceleration {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using rad_per_s2 = units::isq::si::angular_acceleration<units::isq::si::radian_per_second_sq, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::inline angular_acceleration
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -1,73 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/angular_velocity.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/generic/angle.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct radian_per_second : derived_unit<radian_per_second> {};
|
||||
|
||||
struct dim_angular_velocity :
|
||||
isq::dim_angular_velocity<dim_angular_velocity, radian_per_second, dim_angle<>, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_angular_velocity> U, Representation Rep = double>
|
||||
using angular_velocity = quantity<dim_angular_velocity, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// rad/s
|
||||
constexpr auto operator"" _q_rad_per_s(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return angular_velocity<radian_per_second, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_rad_per_s(long double l) { return angular_velocity<radian_per_second, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,382 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/area.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct square_metre : derived_unit<square_metre> {};
|
||||
struct dim_area : isq::dim_area<dim_area, square_metre, dim_length> {};
|
||||
|
||||
struct square_yoctometre : derived_scaled_unit<square_yoctometre, dim_area, yoctometre> {};
|
||||
struct square_zeptometre : derived_scaled_unit<square_zeptometre, dim_area, zeptometre> {};
|
||||
struct square_attometre : derived_scaled_unit<square_attometre, dim_area, attometre> {};
|
||||
struct square_femtometre : derived_scaled_unit<square_femtometre, dim_area, femtometre> {};
|
||||
struct square_picometre : derived_scaled_unit<square_picometre, dim_area, picometre> {};
|
||||
struct square_nanometre : derived_scaled_unit<square_nanometre, dim_area, nanometre> {};
|
||||
struct square_micrometre : derived_scaled_unit<square_micrometre, dim_area, micrometre> {};
|
||||
struct square_millimetre : derived_scaled_unit<square_millimetre, dim_area, millimetre> {};
|
||||
struct square_centimetre : derived_scaled_unit<square_centimetre, dim_area, centimetre> {};
|
||||
struct square_decimetre : derived_scaled_unit<square_decimetre, dim_area, decimetre> {};
|
||||
struct square_decametre : derived_scaled_unit<square_decametre, dim_area, decametre> {};
|
||||
struct square_hectometre : derived_scaled_unit<square_hectometre, dim_area, hectometre> {};
|
||||
struct square_kilometre : derived_scaled_unit<square_kilometre, dim_area, kilometre> {};
|
||||
struct square_megametre : derived_scaled_unit<square_megametre, dim_area, megametre> {};
|
||||
struct square_gigametre : derived_scaled_unit<square_gigametre, dim_area, gigametre> {};
|
||||
struct square_terametre : derived_scaled_unit<square_terametre, dim_area, terametre> {};
|
||||
struct square_petametre : derived_scaled_unit<square_petametre, dim_area, petametre> {};
|
||||
struct square_exametre : derived_scaled_unit<square_exametre, dim_area, exametre> {};
|
||||
struct square_zettametre : derived_scaled_unit<square_zettametre, dim_area, zettametre> {};
|
||||
struct square_yottametre : derived_scaled_unit<square_yottametre, dim_area, yottametre> {};
|
||||
|
||||
struct are : alias_unit<square_decametre, "a"> {};
|
||||
struct centiare : prefixed_alias_unit<square_metre, centi, are> {};
|
||||
struct deciare : prefixed_unit<deciare, deci, are> {};
|
||||
struct decare : prefixed_unit<decare, deca, are> {};
|
||||
struct hectare : prefixed_alias_unit<square_hectometre, hecto, are> {};
|
||||
|
||||
template<UnitOf<dim_area> U, Representation Rep = double>
|
||||
using area = quantity<dim_area, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// m2
|
||||
constexpr auto operator"" _q_m2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_metre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_m2(long double l) { return area<square_metre, long double>(l); }
|
||||
|
||||
// ym2
|
||||
constexpr auto operator"" _q_ym2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_yoctometre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ym2(long double l) { return area<square_yoctometre, long double>(l); }
|
||||
|
||||
// zm2
|
||||
constexpr auto operator"" _q_zm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_zeptometre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_zm2(long double l) { return area<square_zeptometre, long double>(l); }
|
||||
|
||||
// am2
|
||||
constexpr auto operator"" _q_am2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_attometre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_am2(long double l) { return area<square_attometre, long double>(l); }
|
||||
|
||||
// fm2
|
||||
constexpr auto operator"" _q_fm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_femtometre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fm2(long double l) { return area<square_femtometre, long double>(l); }
|
||||
|
||||
// pm2
|
||||
constexpr auto operator"" _q_pm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_picometre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pm2(long double l) { return area<square_picometre, long double>(l); }
|
||||
|
||||
// nm2
|
||||
constexpr auto operator"" _q_nm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_nanometre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nm2(long double l) { return area<square_nanometre, long double>(l); }
|
||||
|
||||
// um2
|
||||
constexpr auto operator"" _q_um2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_micrometre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_um2(long double l) { return area<square_micrometre, long double>(l); }
|
||||
|
||||
// mm2
|
||||
constexpr auto operator"" _q_mm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_millimetre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mm2(long double l) { return area<square_millimetre, long double>(l); }
|
||||
|
||||
// cm2
|
||||
constexpr auto operator"" _q_cm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_centimetre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_cm2(long double l) { return area<square_centimetre, long double>(l); }
|
||||
|
||||
// dm2
|
||||
constexpr auto operator"" _q_dm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_decimetre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_dm2(long double l) { return area<square_decimetre, long double>(l); }
|
||||
|
||||
// dam2
|
||||
constexpr auto operator"" _q_dam2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_decametre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_dam2(long double l) { return area<square_decametre, long double>(l); }
|
||||
|
||||
// hm2
|
||||
constexpr auto operator"" _q_hm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_hectometre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_hm2(long double l) { return area<square_hectometre, long double>(l); }
|
||||
|
||||
// km2
|
||||
constexpr auto operator"" _q_km2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_kilometre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_km2(long double l) { return area<square_kilometre, long double>(l); }
|
||||
|
||||
// Mm2
|
||||
constexpr auto operator"" _q_Mm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_megametre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Mm2(long double l) { return area<square_megametre, long double>(l); }
|
||||
|
||||
// Gm2
|
||||
constexpr auto operator"" _q_Gm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_gigametre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Gm2(long double l) { return area<square_gigametre, long double>(l); }
|
||||
|
||||
// Tm2
|
||||
constexpr auto operator"" _q_Tm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_terametre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Tm2(long double l) { return area<square_terametre, long double>(l); }
|
||||
|
||||
// Pm2
|
||||
constexpr auto operator"" _q_Pm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_petametre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Pm2(long double l) { return area<square_petametre, long double>(l); }
|
||||
|
||||
// Em2
|
||||
constexpr auto operator"" _q_Em2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_exametre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Em2(long double l) { return area<square_exametre, long double>(l); }
|
||||
|
||||
// Zm2
|
||||
constexpr auto operator"" _q_Zm2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_zettametre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Zm2(long double l) { return area<square_zettametre, long double>(l); }
|
||||
|
||||
// Ym2
|
||||
constexpr auto operator"" _q_Ym2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<square_yottametre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Ym2(long double l) { return area<square_yottametre, long double>(l); }
|
||||
|
||||
// a
|
||||
constexpr auto operator"" _q_a(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<are, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_a(long double l) { return area<are, long double>(l); }
|
||||
|
||||
// ca
|
||||
constexpr auto operator"" _q_ca(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<centiare, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ca(long double l) { return area<centiare, long double>(l); }
|
||||
|
||||
// da
|
||||
constexpr auto operator"" _q_da(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<deciare, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_da(long double l) { return area<deciare, long double>(l); }
|
||||
|
||||
// daa
|
||||
constexpr auto operator"" _q_daa(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<decare, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_daa(long double l) { return area<decare, long double>(l); }
|
||||
|
||||
// ha
|
||||
constexpr auto operator"" _q_ha(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return area<hectare, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ha(long double l) { return area<hectare, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace area_references {
|
||||
|
||||
inline constexpr auto m2 = reference<dim_area, square_metre>{};
|
||||
inline constexpr auto ym2 = reference<dim_area, square_yoctometre>{};
|
||||
inline constexpr auto zm2 = reference<dim_area, square_zeptometre>{};
|
||||
inline constexpr auto am2 = reference<dim_area, square_attometre>{};
|
||||
inline constexpr auto fm2 = reference<dim_area, square_femtometre>{};
|
||||
inline constexpr auto pm2 = reference<dim_area, square_picometre>{};
|
||||
inline constexpr auto nm2 = reference<dim_area, square_nanometre>{};
|
||||
inline constexpr auto um2 = reference<dim_area, square_micrometre>{};
|
||||
inline constexpr auto mm2 = reference<dim_area, square_millimetre>{};
|
||||
inline constexpr auto cm2 = reference<dim_area, square_centimetre>{};
|
||||
inline constexpr auto dm2 = reference<dim_area, square_decimetre>{};
|
||||
inline constexpr auto dam2 = reference<dim_area, square_decametre>{};
|
||||
inline constexpr auto hm2 = reference<dim_area, square_hectometre>{};
|
||||
inline constexpr auto km2 = reference<dim_area, square_kilometre>{};
|
||||
inline constexpr auto Mm2 = reference<dim_area, square_megametre>{};
|
||||
inline constexpr auto Gm2 = reference<dim_area, square_gigametre>{};
|
||||
inline constexpr auto Tm2 = reference<dim_area, square_terametre>{};
|
||||
inline constexpr auto Pm2 = reference<dim_area, square_petametre>{};
|
||||
inline constexpr auto Em2 = reference<dim_area, square_exametre>{};
|
||||
inline constexpr auto Zm2 = reference<dim_area, square_zettametre>{};
|
||||
inline constexpr auto Ym2 = reference<dim_area, square_yottametre>{};
|
||||
|
||||
inline constexpr auto a = reference<dim_area, are>{};
|
||||
inline constexpr auto ca = reference<dim_area, centiare>{};
|
||||
inline constexpr auto da = reference<dim_area, deciare>{};
|
||||
inline constexpr auto daa = reference<dim_area, decare>{};
|
||||
inline constexpr auto ha = reference<dim_area, hectare>{};
|
||||
|
||||
} // namespace area_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace area_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,329 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/capacitance.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/electric_charge.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/isq/si/voltage.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct farad : named_unit<farad, "F"> {};
|
||||
struct yoctofarad : prefixed_unit<yoctofarad, yocto, farad> {};
|
||||
struct zeptofarad : prefixed_unit<zeptofarad, zepto, farad> {};
|
||||
struct attofarad : prefixed_unit<attofarad, atto, farad> {};
|
||||
struct femtofarad : prefixed_unit<femtofarad, femto, farad> {};
|
||||
struct picofarad : prefixed_unit<picofarad, pico, farad> {};
|
||||
struct nanofarad : prefixed_unit<nanofarad, nano, farad> {};
|
||||
struct microfarad : prefixed_unit<microfarad, micro, farad> {};
|
||||
struct millifarad : prefixed_unit<millifarad, milli, farad> {};
|
||||
struct centifarad : prefixed_unit<centifarad, centi, farad> {};
|
||||
struct decifarad : prefixed_unit<decifarad, deci, farad> {};
|
||||
struct decafarad : prefixed_unit<decafarad, deca, farad> {};
|
||||
struct hectofarad : prefixed_unit<hectofarad, hecto, farad> {};
|
||||
struct kilofarad : prefixed_unit<kilofarad, kilo, farad> {};
|
||||
struct megafarad : prefixed_unit<megafarad, mega, farad> {};
|
||||
struct gigafarad : prefixed_unit<gigafarad, giga, farad> {};
|
||||
struct terafarad : prefixed_unit<terafarad, tera, farad> {};
|
||||
struct petafarad : prefixed_unit<petafarad, peta, farad> {};
|
||||
struct exafarad : prefixed_unit<exafarad, exa, farad> {};
|
||||
struct zettafarad : prefixed_unit<zettafarad, zetta, farad> {};
|
||||
struct yottafarad : prefixed_unit<yottafarad, yotta, farad> {};
|
||||
|
||||
struct dim_capacitance : isq::dim_capacitance<dim_capacitance, farad, dim_electric_charge, dim_voltage> {};
|
||||
|
||||
template<UnitOf<dim_capacitance> U, Representation Rep = double>
|
||||
using capacitance = quantity<dim_capacitance, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// F
|
||||
constexpr auto operator"" _q_F(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<farad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_F(long double l) { return capacitance<farad, long double>(l); }
|
||||
|
||||
// yF
|
||||
constexpr auto operator"" _q_yF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<yoctofarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_yF(long double l) { return capacitance<yoctofarad, long double>(l); }
|
||||
|
||||
// zF
|
||||
constexpr auto operator"" _q_zF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<zeptofarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_zF(long double l) { return capacitance<zeptofarad, long double>(l); }
|
||||
|
||||
// aF
|
||||
constexpr auto operator"" _q_aF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<attofarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_aF(long double l) { return capacitance<attofarad, long double>(l); }
|
||||
|
||||
// fF
|
||||
constexpr auto operator"" _q_fF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<femtofarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fF(long double l) { return capacitance<femtofarad, long double>(l); }
|
||||
|
||||
// pF
|
||||
constexpr auto operator"" _q_pF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<picofarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pF(long double l) { return capacitance<picofarad, long double>(l); }
|
||||
|
||||
// nF
|
||||
constexpr auto operator"" _q_nF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<nanofarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nF(long double l) { return capacitance<nanofarad, long double>(l); }
|
||||
|
||||
// uF
|
||||
constexpr auto operator"" _q_uF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<microfarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_uF(long double l) { return capacitance<microfarad, long double>(l); }
|
||||
|
||||
// mF
|
||||
constexpr auto operator"" _q_mF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<millifarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mF(long double l) { return capacitance<millifarad, long double>(l); }
|
||||
|
||||
// cF
|
||||
constexpr auto operator"" _q_cF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<centifarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_cF(long double l) { return capacitance<centifarad, long double>(l); }
|
||||
|
||||
// dF
|
||||
constexpr auto operator"" _q_dF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<decifarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_dF(long double l) { return capacitance<decifarad, long double>(l); }
|
||||
|
||||
// daF
|
||||
constexpr auto operator"" _q_daF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<decafarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_daF(long double l) { return capacitance<decafarad, long double>(l); }
|
||||
|
||||
// hF
|
||||
constexpr auto operator"" _q_hF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<hectofarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_hF(long double l) { return capacitance<hectofarad, long double>(l); }
|
||||
|
||||
// kF
|
||||
constexpr auto operator"" _q_kF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<kilofarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kF(long double l) { return capacitance<kilofarad, long double>(l); }
|
||||
|
||||
// MF
|
||||
constexpr auto operator"" _q_MF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<megafarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_MF(long double l) { return capacitance<megafarad, long double>(l); }
|
||||
|
||||
// GF
|
||||
constexpr auto operator"" _q_GF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<gigafarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_GF(long double l) { return capacitance<gigafarad, long double>(l); }
|
||||
|
||||
// TF
|
||||
constexpr auto operator"" _q_TF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<terafarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_TF(long double l) { return capacitance<terafarad, long double>(l); }
|
||||
|
||||
// PF
|
||||
constexpr auto operator"" _q_PF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<petafarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_PF(long double l) { return capacitance<petafarad, long double>(l); }
|
||||
|
||||
// EF
|
||||
constexpr auto operator"" _q_EF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<exafarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_EF(long double l) { return capacitance<exafarad, long double>(l); }
|
||||
|
||||
// ZF
|
||||
constexpr auto operator"" _q_ZF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<zettafarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ZF(long double l) { return capacitance<zettafarad, long double>(l); }
|
||||
|
||||
// YF
|
||||
constexpr auto operator"" _q_YF(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return capacitance<yottafarad, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_YF(long double l) { return capacitance<yottafarad, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace capacitance_references {
|
||||
|
||||
inline constexpr auto F = reference<dim_capacitance, farad>{};
|
||||
inline constexpr auto yF = reference<dim_capacitance, yoctofarad>{};
|
||||
inline constexpr auto zF = reference<dim_capacitance, zeptofarad>{};
|
||||
inline constexpr auto aF = reference<dim_capacitance, attofarad>{};
|
||||
inline constexpr auto fF = reference<dim_capacitance, femtofarad>{};
|
||||
inline constexpr auto pF = reference<dim_capacitance, picofarad>{};
|
||||
inline constexpr auto nF = reference<dim_capacitance, nanofarad>{};
|
||||
inline constexpr auto uF = reference<dim_capacitance, microfarad>{};
|
||||
inline constexpr auto mF = reference<dim_capacitance, millifarad>{};
|
||||
inline constexpr auto cF = reference<dim_capacitance, centifarad>{};
|
||||
inline constexpr auto dF = reference<dim_capacitance, decifarad>{};
|
||||
inline constexpr auto daF = reference<dim_capacitance, decafarad>{};
|
||||
inline constexpr auto hF = reference<dim_capacitance, hectofarad>{};
|
||||
inline constexpr auto kF = reference<dim_capacitance, kilofarad>{};
|
||||
inline constexpr auto MF = reference<dim_capacitance, megafarad>{};
|
||||
inline constexpr auto GF = reference<dim_capacitance, gigafarad>{};
|
||||
inline constexpr auto TF = reference<dim_capacitance, terafarad>{};
|
||||
inline constexpr auto PF = reference<dim_capacitance, petafarad>{};
|
||||
inline constexpr auto EF = reference<dim_capacitance, exafarad>{};
|
||||
inline constexpr auto ZF = reference<dim_capacitance, zettafarad>{};
|
||||
inline constexpr auto YF = reference<dim_capacitance, yottafarad>{};
|
||||
|
||||
} // namespace capacitance_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace capacitance_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,343 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/catalytic_activity.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/amount_of_substance.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct katal : named_unit<katal, "kat"> {};
|
||||
struct yoctokatal : prefixed_unit<yoctokatal, yocto, katal> {};
|
||||
struct zeptokatal : prefixed_unit<zeptokatal, zepto, katal> {};
|
||||
struct attokatal : prefixed_unit<attokatal, atto, katal> {};
|
||||
struct femtokatal : prefixed_unit<femtokatal, femto, katal> {};
|
||||
struct picokatal : prefixed_unit<picokatal, pico, katal> {};
|
||||
struct nanokatal : prefixed_unit<nanokatal, nano, katal> {};
|
||||
struct microkatal : prefixed_unit<microkatal, micro, katal> {};
|
||||
struct millikatal : prefixed_unit<millikatal, milli, katal> {};
|
||||
struct centikatal : prefixed_unit<centikatal, centi, katal> {};
|
||||
struct decikatal : prefixed_unit<decikatal, deci, katal> {};
|
||||
struct decakatal : prefixed_unit<decakatal, deca, katal> {};
|
||||
struct hectokatal : prefixed_unit<hectokatal, hecto, katal> {};
|
||||
struct kilokatal : prefixed_unit<kilokatal, kilo, katal> {};
|
||||
struct megakatal : prefixed_unit<megakatal, mega, katal> {};
|
||||
struct gigakatal : prefixed_unit<gigakatal, giga, katal> {};
|
||||
struct terakatal : prefixed_unit<terakatal, tera, katal> {};
|
||||
struct petakatal : prefixed_unit<petakatal, peta, katal> {};
|
||||
struct exakatal : prefixed_unit<exakatal, exa, katal> {};
|
||||
struct zettakatal : prefixed_unit<zettakatal, zetta, katal> {};
|
||||
struct yottakatal : prefixed_unit<yottakatal, yotta, katal> {};
|
||||
|
||||
struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", mag<ratio(1, 60)>() * mag_power<10, -6>(), katal> {};
|
||||
|
||||
struct dim_catalytic_activity :
|
||||
isq::dim_catalytic_activity<dim_catalytic_activity, katal, dim_time, dim_amount_of_substance> {};
|
||||
|
||||
template<UnitOf<dim_catalytic_activity> U, Representation Rep = double>
|
||||
using catalytic_activity = quantity<dim_catalytic_activity, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// kat
|
||||
constexpr auto operator"" _q_kat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<katal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kat(long double l) { return catalytic_activity<katal, long double>(l); }
|
||||
|
||||
// ykat
|
||||
constexpr auto operator"" _q_ykat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<yoctokatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ykat(long double l) { return catalytic_activity<yoctokatal, long double>(l); }
|
||||
|
||||
// zkat
|
||||
constexpr auto operator"" _q_zkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<zeptokatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_zkat(long double l) { return catalytic_activity<zeptokatal, long double>(l); }
|
||||
|
||||
// akat
|
||||
constexpr auto operator"" _q_akat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<attokatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_akat(long double l) { return catalytic_activity<attokatal, long double>(l); }
|
||||
|
||||
// fkat
|
||||
constexpr auto operator"" _q_fkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<femtokatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fkat(long double l) { return catalytic_activity<femtokatal, long double>(l); }
|
||||
|
||||
// pkat
|
||||
constexpr auto operator"" _q_pkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<picokatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pkat(long double l) { return catalytic_activity<picokatal, long double>(l); }
|
||||
|
||||
// nkat
|
||||
constexpr auto operator"" _q_nkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<nanokatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nkat(long double l) { return catalytic_activity<nanokatal, long double>(l); }
|
||||
|
||||
// ukat
|
||||
constexpr auto operator"" _q_ukat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<microkatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ukat(long double l) { return catalytic_activity<microkatal, long double>(l); }
|
||||
|
||||
// mkat
|
||||
constexpr auto operator"" _q_mkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<millikatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mkat(long double l) { return catalytic_activity<millikatal, long double>(l); }
|
||||
|
||||
// ckat
|
||||
constexpr auto operator"" _q_ckat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<centikatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ckat(long double l) { return catalytic_activity<centikatal, long double>(l); }
|
||||
|
||||
// dkat
|
||||
constexpr auto operator"" _q_dkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<decikatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_dkat(long double l) { return catalytic_activity<decikatal, long double>(l); }
|
||||
|
||||
// dakat
|
||||
constexpr auto operator"" _q_dakat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<decakatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_dakat(long double l) { return catalytic_activity<decakatal, long double>(l); }
|
||||
|
||||
// hkat
|
||||
constexpr auto operator"" _q_hkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<hectokatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_hkat(long double l) { return catalytic_activity<hectokatal, long double>(l); }
|
||||
|
||||
// kkat
|
||||
constexpr auto operator"" _q_kkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<kilokatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kkat(long double l) { return catalytic_activity<kilokatal, long double>(l); }
|
||||
|
||||
// Mkat
|
||||
constexpr auto operator"" _q_Mkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<megakatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Mkat(long double l) { return catalytic_activity<megakatal, long double>(l); }
|
||||
|
||||
// Gkat
|
||||
constexpr auto operator"" _q_Gkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<gigakatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Gkat(long double l) { return catalytic_activity<gigakatal, long double>(l); }
|
||||
|
||||
// Tkat
|
||||
constexpr auto operator"" _q_Tkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<terakatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Tkat(long double l) { return catalytic_activity<terakatal, long double>(l); }
|
||||
|
||||
// Pkat
|
||||
constexpr auto operator"" _q_Pkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<petakatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Pkat(long double l) { return catalytic_activity<petakatal, long double>(l); }
|
||||
|
||||
// Ekat
|
||||
constexpr auto operator"" _q_Ekat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<exakatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Ekat(long double l) { return catalytic_activity<exakatal, long double>(l); }
|
||||
|
||||
// Zkat
|
||||
constexpr auto operator"" _q_Zkat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<zettakatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Zkat(long double l) { return catalytic_activity<zettakatal, long double>(l); }
|
||||
|
||||
// Ykat
|
||||
constexpr auto operator"" _q_Ykat(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<yottakatal, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Ykat(long double l) { return catalytic_activity<yottakatal, long double>(l); }
|
||||
|
||||
// U
|
||||
constexpr auto operator"" _q_U(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return catalytic_activity<enzyme_unit, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_U(long double l) { return catalytic_activity<enzyme_unit, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace catalytic_activity_references {
|
||||
|
||||
inline constexpr auto kat = reference<dim_catalytic_activity, katal>{};
|
||||
inline constexpr auto ykat = reference<dim_catalytic_activity, yoctokatal>{};
|
||||
inline constexpr auto zkat = reference<dim_catalytic_activity, zeptokatal>{};
|
||||
inline constexpr auto akat = reference<dim_catalytic_activity, attokatal>{};
|
||||
inline constexpr auto fkat = reference<dim_catalytic_activity, femtokatal>{};
|
||||
inline constexpr auto pkat = reference<dim_catalytic_activity, picokatal>{};
|
||||
inline constexpr auto nkat = reference<dim_catalytic_activity, nanokatal>{};
|
||||
inline constexpr auto ukat = reference<dim_catalytic_activity, microkatal>{};
|
||||
inline constexpr auto mkat = reference<dim_catalytic_activity, millikatal>{};
|
||||
inline constexpr auto ckat = reference<dim_catalytic_activity, centikatal>{};
|
||||
inline constexpr auto dkat = reference<dim_catalytic_activity, decikatal>{};
|
||||
inline constexpr auto dakat = reference<dim_catalytic_activity, decakatal>{};
|
||||
inline constexpr auto hkat = reference<dim_catalytic_activity, hectokatal>{};
|
||||
inline constexpr auto kkat = reference<dim_catalytic_activity, kilokatal>{};
|
||||
inline constexpr auto Mkat = reference<dim_catalytic_activity, megakatal>{};
|
||||
inline constexpr auto Gkat = reference<dim_catalytic_activity, gigakatal>{};
|
||||
inline constexpr auto Tkat = reference<dim_catalytic_activity, terakatal>{};
|
||||
inline constexpr auto Pkat = reference<dim_catalytic_activity, petakatal>{};
|
||||
inline constexpr auto Ekat = reference<dim_catalytic_activity, exakatal>{};
|
||||
inline constexpr auto Zkat = reference<dim_catalytic_activity, zettakatal>{};
|
||||
inline constexpr auto Ykat = reference<dim_catalytic_activity, yottakatal>{};
|
||||
inline constexpr auto U = reference<dim_catalytic_activity, enzyme_unit>{};
|
||||
|
||||
} // namespace catalytic_activity_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace catalytic_activity_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,93 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/charge_density.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/electric_charge.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct coulomb_per_metre_cub : derived_unit<coulomb_per_metre_cub> {};
|
||||
struct coulomb_per_metre_sq : derived_unit<coulomb_per_metre_sq> {};
|
||||
|
||||
struct dim_charge_density :
|
||||
isq::dim_charge_density<dim_charge_density, coulomb_per_metre_cub, dim_electric_charge, dim_length> {};
|
||||
struct dim_surface_charge_density :
|
||||
isq::dim_surface_charge_density<dim_surface_charge_density, coulomb_per_metre_sq, dim_electric_charge, dim_length> {
|
||||
};
|
||||
|
||||
template<UnitOf<dim_charge_density> U, Representation Rep = double>
|
||||
using charge_density = quantity<dim_charge_density, U, Rep>;
|
||||
|
||||
template<UnitOf<dim_surface_charge_density> U, Representation Rep = double>
|
||||
using surface_charge_density = quantity<dim_surface_charge_density, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// C/m³
|
||||
constexpr auto operator"" _q_C_per_m3(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return charge_density<coulomb_per_metre_cub, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_C_per_m3(long double l) { return charge_density<coulomb_per_metre_cub, long double>(l); }
|
||||
|
||||
// C/m²
|
||||
constexpr auto operator"" _q_C_per_m2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return surface_charge_density<coulomb_per_metre_sq, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_C_per_m2(long double l)
|
||||
{
|
||||
return surface_charge_density<coulomb_per_metre_sq, long double>(l);
|
||||
}
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,71 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/concentration.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/amount_of_substance.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct mol_per_metre_cub : derived_unit<mol_per_metre_cub> {};
|
||||
struct dim_concentration :
|
||||
isq::dim_concentration<dim_concentration, mol_per_metre_cub, dim_amount_of_substance, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_concentration> U, Representation Rep = double>
|
||||
using concentration = quantity<dim_concentration, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// mol/m³
|
||||
constexpr auto operator"" _q_mol_per_m3(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return concentration<mol_per_metre_cub, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mol_per_m3(long double l) { return concentration<mol_per_metre_cub, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,280 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/conductance.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/isq/si/resistance.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct siemens : named_unit<siemens, "S"> {};
|
||||
struct yoctosiemens : prefixed_unit<yoctosiemens, yocto, siemens> {};
|
||||
struct zeptosiemens : prefixed_unit<zeptosiemens, zepto, siemens> {};
|
||||
struct attosiemens : prefixed_unit<attosiemens, atto, siemens> {};
|
||||
struct femtosiemens : prefixed_unit<femtosiemens, femto, siemens> {};
|
||||
struct picosiemens : prefixed_unit<picosiemens, pico, siemens> {};
|
||||
struct nanosiemens : prefixed_unit<nanosiemens, nano, siemens> {};
|
||||
struct microsiemens : prefixed_unit<microsiemens, micro, siemens> {};
|
||||
struct millisiemens : prefixed_unit<millisiemens, milli, siemens> {};
|
||||
struct kilosiemens : prefixed_unit<kilosiemens, kilo, siemens> {};
|
||||
struct megasiemens : prefixed_unit<megasiemens, mega, siemens> {};
|
||||
struct gigasiemens : prefixed_unit<gigasiemens, giga, siemens> {};
|
||||
struct terasiemens : prefixed_unit<terasiemens, tera, siemens> {};
|
||||
struct petasiemens : prefixed_unit<petasiemens, peta, siemens> {};
|
||||
struct exasiemens : prefixed_unit<exasiemens, exa, siemens> {};
|
||||
struct zettasiemens : prefixed_unit<zettasiemens, zetta, siemens> {};
|
||||
struct yottasiemens : prefixed_unit<yottasiemens, yotta, siemens> {};
|
||||
|
||||
struct dim_conductance : isq::dim_conductance<dim_conductance, siemens, dim_resistance> {};
|
||||
|
||||
template<UnitOf<dim_conductance> U, Representation Rep = double>
|
||||
using conductance = quantity<dim_conductance, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// R
|
||||
constexpr auto operator"" _q_S(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<siemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_S(long double l) { return conductance<siemens, long double>(l); }
|
||||
|
||||
// yS
|
||||
constexpr auto operator"" _q_yS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<yoctosiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_yS(long double l) { return conductance<yoctosiemens, long double>(l); }
|
||||
|
||||
// zS
|
||||
constexpr auto operator"" _q_zS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<zeptosiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_zS(long double l) { return conductance<zeptosiemens, long double>(l); }
|
||||
|
||||
// aS
|
||||
constexpr auto operator"" _q_aS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<attosiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_aS(long double l) { return conductance<attosiemens, long double>(l); }
|
||||
|
||||
// fS
|
||||
constexpr auto operator"" _q_fS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<femtosiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fS(long double l) { return conductance<femtosiemens, long double>(l); }
|
||||
|
||||
// pS
|
||||
constexpr auto operator"" _q_pS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<picosiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pS(long double l) { return conductance<picosiemens, long double>(l); }
|
||||
|
||||
// nS
|
||||
constexpr auto operator"" _q_nS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<nanosiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nS(long double l) { return conductance<nanosiemens, long double>(l); }
|
||||
|
||||
// µS
|
||||
constexpr auto operator"" _q_uS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<microsiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_uS(long double l) { return conductance<microsiemens, long double>(l); }
|
||||
|
||||
// mS
|
||||
constexpr auto operator"" _q_mS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<millisiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mS(long double l) { return conductance<millisiemens, long double>(l); }
|
||||
|
||||
// kS
|
||||
constexpr auto operator"" _q_kS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<kilosiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kS(long double l) { return conductance<kilosiemens, long double>(l); }
|
||||
|
||||
// MS
|
||||
constexpr auto operator"" _q_MS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<megasiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_MS(long double l) { return conductance<megasiemens, long double>(l); }
|
||||
|
||||
// GS
|
||||
constexpr auto operator"" _q_GS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<gigasiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_GS(long double l) { return conductance<gigasiemens, long double>(l); }
|
||||
|
||||
// TS
|
||||
constexpr auto operator"" _q_TS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<terasiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_TS(long double l) { return conductance<terasiemens, long double>(l); }
|
||||
|
||||
// PS
|
||||
constexpr auto operator"" _q_PS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<petasiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_PS(long double l) { return conductance<petasiemens, long double>(l); }
|
||||
|
||||
// ES
|
||||
constexpr auto operator"" _q_ES(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<exasiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ES(long double l) { return conductance<exasiemens, long double>(l); }
|
||||
|
||||
// ZS
|
||||
constexpr auto operator"" _q_ZS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<zettasiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ZS(long double l) { return conductance<zettasiemens, long double>(l); }
|
||||
|
||||
// YS
|
||||
constexpr auto operator"" _q_YS(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return conductance<yottasiemens, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_YS(long double l) { return conductance<yottasiemens, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace conductance_references {
|
||||
|
||||
inline constexpr auto S = reference<dim_conductance, siemens>{};
|
||||
inline constexpr auto yS = reference<dim_conductance, yoctosiemens>{};
|
||||
inline constexpr auto zS = reference<dim_conductance, zeptosiemens>{};
|
||||
inline constexpr auto aS = reference<dim_conductance, attosiemens>{};
|
||||
inline constexpr auto fS = reference<dim_conductance, femtosiemens>{};
|
||||
inline constexpr auto pS = reference<dim_conductance, picosiemens>{};
|
||||
inline constexpr auto nS = reference<dim_conductance, nanosiemens>{};
|
||||
inline constexpr auto uS = reference<dim_conductance, microsiemens>{};
|
||||
inline constexpr auto mS = reference<dim_conductance, millisiemens>{};
|
||||
inline constexpr auto kS = reference<dim_conductance, kilosiemens>{};
|
||||
inline constexpr auto MS = reference<dim_conductance, megasiemens>{};
|
||||
inline constexpr auto GS = reference<dim_conductance, gigasiemens>{};
|
||||
inline constexpr auto TS = reference<dim_conductance, terasiemens>{};
|
||||
inline constexpr auto PS = reference<dim_conductance, petasiemens>{};
|
||||
inline constexpr auto ES = reference<dim_conductance, exasiemens>{};
|
||||
inline constexpr auto ZS = reference<dim_conductance, zettasiemens>{};
|
||||
inline constexpr auto YS = reference<dim_conductance, yottasiemens>{};
|
||||
|
||||
} // namespace conductance_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace conductance_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,61 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/generic/angle.h>
|
||||
#include <units/isq/si/amount_of_substance.h>
|
||||
#include <units/isq/si/electric_charge.h>
|
||||
#include <units/isq/si/energy.h>
|
||||
#include <units/isq/si/frequency.h>
|
||||
#include <units/isq/si/luminous_flux.h>
|
||||
#include <units/isq/si/power.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/isq/si/thermodynamic_temperature.h>
|
||||
|
||||
namespace units::isq::si::si2019 {
|
||||
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto planck_constant = energy<joule, Rep>(6.62607015e-34) * time<second, Rep>(1);
|
||||
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto elementary_charge = electric_charge<coulomb, Rep>(1.602176634e-19);
|
||||
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto boltzmann_constant = energy<joule, Rep>(1.380649e-23) / thermodynamic_temperature<kelvin, Rep>(1);
|
||||
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto avogadro_constant = Rep(6.02214076e23) / amount_of_substance<mole, Rep>(1);
|
||||
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto speed_of_light = speed<metre_per_second, Rep>(299'792'458);
|
||||
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto hyperfine_structure_transition_frequency = frequency<hertz, Rep>(Rep{9'192'631'770});
|
||||
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto luminous_efficacy = luminous_flux<lumen, Rep>(683) / power<watt, Rep>(1);
|
||||
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto standard_gravity = acceleration<metre_per_second_sq, Rep>(9.80665);
|
||||
|
||||
} // namespace units::isq::si::si2019
|
@ -1,73 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/current_density.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/electric_current.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct ampere_per_metre_sq : derived_unit<ampere_per_metre_sq> {};
|
||||
|
||||
struct dim_current_density :
|
||||
isq::dim_current_density<dim_current_density, ampere_per_metre_sq, dim_electric_current, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_current_density> U, Representation Rep = double>
|
||||
using current_density = quantity<dim_current_density, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// A / m²
|
||||
constexpr auto operator"" _q_A_per_m2(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return current_density<ampere_per_metre_sq, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_A_per_m2(long double l) { return current_density<ampere_per_metre_sq, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,72 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/density.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/mass.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct kilogram_per_metre_cub : derived_unit<kilogram_per_metre_cub> {};
|
||||
|
||||
struct dim_density : isq::dim_density<dim_density, kilogram_per_metre_cub, dim_mass, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_density> U, Representation Rep = double>
|
||||
using density = quantity<dim_density, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// kg / m³
|
||||
constexpr auto operator"" _q_kg_per_m3(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return density<kilogram_per_metre_cub, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kg_per_m3(long double l) { return density<kilogram_per_metre_cub, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,71 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/dynamic_viscosity.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/pressure.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct pascal_second : derived_unit<pascal_second> {};
|
||||
struct dim_dynamic_viscosity :
|
||||
isq::dim_dynamic_viscosity<dim_dynamic_viscosity, pascal_second, dim_pressure, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_dynamic_viscosity> U, Representation Rep = double>
|
||||
using dynamic_viscosity = quantity<dim_dynamic_viscosity, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// Pa·s
|
||||
constexpr auto operator"" _q_Pa_s(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return dynamic_viscosity<pascal_second, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_Pa_s(long double l) { return dynamic_viscosity<pascal_second, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,88 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/electric_charge.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/electric_current.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct coulomb : named_unit<coulomb, "C"> {};
|
||||
|
||||
struct dim_electric_charge : isq::dim_electric_charge<dim_electric_charge, coulomb, dim_time, dim_electric_current> {};
|
||||
|
||||
template<UnitOf<dim_electric_charge> U, Representation Rep = double>
|
||||
using electric_charge = quantity<dim_electric_charge, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// C
|
||||
constexpr auto operator"" _q_C(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_charge<coulomb, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_C(long double l) { return electric_charge<coulomb, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace electric_charge_references {
|
||||
|
||||
inline constexpr auto C = reference<dim_electric_charge, coulomb>{};
|
||||
|
||||
} // namespace electric_charge_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace electric_charge_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,327 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/electric_current.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct ampere : named_unit<ampere, "A"> {};
|
||||
struct yoctoampere : prefixed_unit<yoctoampere, yocto, ampere> {};
|
||||
struct zeptoampere : prefixed_unit<zeptoampere, zepto, ampere> {};
|
||||
struct attoampere : prefixed_unit<attoampere, atto, ampere> {};
|
||||
struct femtoampere : prefixed_unit<femtoampere, femto, ampere> {};
|
||||
struct picoampere : prefixed_unit<picoampere, pico, ampere> {};
|
||||
struct nanoampere : prefixed_unit<nanoampere, nano, ampere> {};
|
||||
struct microampere : prefixed_unit<microampere, micro, ampere> {};
|
||||
struct milliampere : prefixed_unit<milliampere, milli, ampere> {};
|
||||
struct centiampere : prefixed_unit<centiampere, centi, ampere> {};
|
||||
struct deciampere : prefixed_unit<deciampere, deci, ampere> {};
|
||||
struct decaampere : prefixed_unit<decaampere, deca, ampere> {};
|
||||
struct hectoampere : prefixed_unit<hectoampere, hecto, ampere> {};
|
||||
struct kiloampere : prefixed_unit<kiloampere, kilo, ampere> {};
|
||||
struct megaampere : prefixed_unit<megaampere, mega, ampere> {};
|
||||
struct gigaampere : prefixed_unit<gigaampere, giga, ampere> {};
|
||||
struct teraampere : prefixed_unit<teraampere, tera, ampere> {};
|
||||
struct petaampere : prefixed_unit<petaampere, peta, ampere> {};
|
||||
struct exaampere : prefixed_unit<exaampere, exa, ampere> {};
|
||||
struct zettaampere : prefixed_unit<zettaampere, zetta, ampere> {};
|
||||
struct yottaampere : prefixed_unit<yottaampere, yotta, ampere> {};
|
||||
|
||||
struct dim_electric_current : isq::dim_electric_current<ampere> {};
|
||||
|
||||
template<UnitOf<dim_electric_current> U, Representation Rep = double>
|
||||
using electric_current = quantity<dim_electric_current, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// A
|
||||
constexpr auto operator"" _q_A(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<ampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_A(long double l) { return electric_current<ampere, long double>(l); }
|
||||
|
||||
// yA
|
||||
constexpr auto operator"" _q_yA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<yoctoampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_yA(long double l) { return electric_current<yoctoampere, long double>(l); }
|
||||
|
||||
// zA
|
||||
constexpr auto operator"" _q_zA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<zeptoampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_zA(long double l) { return electric_current<zeptoampere, long double>(l); }
|
||||
|
||||
// aA
|
||||
constexpr auto operator"" _q_aA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<attoampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_aA(long double l) { return electric_current<attoampere, long double>(l); }
|
||||
|
||||
// fA
|
||||
constexpr auto operator"" _q_fA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<femtoampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fA(long double l) { return electric_current<femtoampere, long double>(l); }
|
||||
|
||||
// pA
|
||||
constexpr auto operator"" _q_pA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<picoampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pA(long double l) { return electric_current<picoampere, long double>(l); }
|
||||
|
||||
// nA
|
||||
constexpr auto operator"" _q_nA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<nanoampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nA(long double l) { return electric_current<nanoampere, long double>(l); }
|
||||
|
||||
// uA
|
||||
constexpr auto operator"" _q_uA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<microampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_uA(long double l) { return electric_current<microampere, long double>(l); }
|
||||
|
||||
// mA
|
||||
constexpr auto operator"" _q_mA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<milliampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mA(long double l) { return electric_current<milliampere, long double>(l); }
|
||||
|
||||
// cA
|
||||
constexpr auto operator"" _q_cA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<centiampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_cA(long double l) { return electric_current<centiampere, long double>(l); }
|
||||
|
||||
// dA
|
||||
constexpr auto operator"" _q_dA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<deciampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_dA(long double l) { return electric_current<deciampere, long double>(l); }
|
||||
|
||||
// daA
|
||||
constexpr auto operator"" _q_daA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<decaampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_daA(long double l) { return electric_current<decaampere, long double>(l); }
|
||||
|
||||
// hA
|
||||
constexpr auto operator"" _q_hA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<hectoampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_hA(long double l) { return electric_current<hectoampere, long double>(l); }
|
||||
|
||||
// kA
|
||||
constexpr auto operator"" _q_kA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<kiloampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kA(long double l) { return electric_current<kiloampere, long double>(l); }
|
||||
|
||||
// MA
|
||||
constexpr auto operator"" _q_MA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<megaampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_MA(long double l) { return electric_current<megaampere, long double>(l); }
|
||||
|
||||
// GA
|
||||
constexpr auto operator"" _q_GA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<gigaampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_GA(long double l) { return electric_current<gigaampere, long double>(l); }
|
||||
|
||||
// TA
|
||||
constexpr auto operator"" _q_TA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<teraampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_TA(long double l) { return electric_current<teraampere, long double>(l); }
|
||||
|
||||
// PA
|
||||
constexpr auto operator"" _q_PA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<petaampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_PA(long double l) { return electric_current<petaampere, long double>(l); }
|
||||
|
||||
// EA
|
||||
constexpr auto operator"" _q_EA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<exaampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_EA(long double l) { return electric_current<exaampere, long double>(l); }
|
||||
|
||||
// ZA
|
||||
constexpr auto operator"" _q_ZA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<zettaampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ZA(long double l) { return electric_current<zettaampere, long double>(l); }
|
||||
|
||||
// YA
|
||||
constexpr auto operator"" _q_YA(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_current<yottaampere, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_YA(long double l) { return electric_current<yottaampere, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace electric_current_references {
|
||||
|
||||
inline constexpr auto A = reference<dim_electric_current, ampere>{};
|
||||
inline constexpr auto yA = reference<dim_electric_current, yoctoampere>{};
|
||||
inline constexpr auto zA = reference<dim_electric_current, zeptoampere>{};
|
||||
inline constexpr auto aA = reference<dim_electric_current, attoampere>{};
|
||||
inline constexpr auto fA = reference<dim_electric_current, femtoampere>{};
|
||||
inline constexpr auto pA = reference<dim_electric_current, picoampere>{};
|
||||
inline constexpr auto nA = reference<dim_electric_current, nanoampere>{};
|
||||
inline constexpr auto uA = reference<dim_electric_current, microampere>{};
|
||||
inline constexpr auto mA = reference<dim_electric_current, milliampere>{};
|
||||
inline constexpr auto cA = reference<dim_electric_current, centiampere>{};
|
||||
inline constexpr auto dA = reference<dim_electric_current, deciampere>{};
|
||||
inline constexpr auto daA = reference<dim_electric_current, decaampere>{};
|
||||
inline constexpr auto hA = reference<dim_electric_current, hectoampere>{};
|
||||
inline constexpr auto kA = reference<dim_electric_current, kiloampere>{};
|
||||
inline constexpr auto MA = reference<dim_electric_current, megaampere>{};
|
||||
inline constexpr auto GA = reference<dim_electric_current, gigaampere>{};
|
||||
inline constexpr auto TA = reference<dim_electric_current, teraampere>{};
|
||||
inline constexpr auto PA = reference<dim_electric_current, petaampere>{};
|
||||
inline constexpr auto EA = reference<dim_electric_current, exaampere>{};
|
||||
inline constexpr auto ZA = reference<dim_electric_current, zettaampere>{};
|
||||
inline constexpr auto YA = reference<dim_electric_current, yottaampere>{};
|
||||
|
||||
} // namespace electric_current_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace electric_current_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,70 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/electric_field_strength.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/voltage.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct volt_per_metre : derived_unit<volt_per_metre> {};
|
||||
struct dim_electric_field_strength :
|
||||
isq::dim_electric_field_strength<dim_electric_field_strength, volt_per_metre, dim_voltage, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_electric_field_strength> U, Representation Rep = double>
|
||||
using electric_field_strength = quantity<dim_electric_field_strength, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// V/m
|
||||
constexpr auto operator"" _q_V_per_m(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return electric_field_strength<volt_per_metre, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_V_per_m(long double l) { return electric_field_strength<volt_per_metre, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
@ -1,310 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/force.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct joule : named_unit<joule, "J"> {};
|
||||
struct yoctojoule : prefixed_unit<yoctojoule, yocto, joule> {};
|
||||
struct zeptojoule : prefixed_unit<zeptojoule, zepto, joule> {};
|
||||
struct attojoule : prefixed_unit<attojoule, atto, joule> {};
|
||||
struct femtojoule : prefixed_unit<femtojoule, femto, joule> {};
|
||||
struct picojoule : prefixed_unit<picojoule, pico, joule> {};
|
||||
struct nanojoule : prefixed_unit<nanojoule, nano, joule> {};
|
||||
struct microjoule : prefixed_unit<microjoule, micro, joule> {};
|
||||
struct millijoule : prefixed_unit<millijoule, milli, joule> {};
|
||||
struct kilojoule : prefixed_unit<kilojoule, kilo, joule> {};
|
||||
struct megajoule : prefixed_unit<megajoule, mega, joule> {};
|
||||
struct gigajoule : prefixed_unit<gigajoule, giga, joule> {};
|
||||
struct terajoule : prefixed_unit<terajoule, tera, joule> {};
|
||||
struct petajoule : prefixed_unit<petajoule, peta, joule> {};
|
||||
struct exajoule : prefixed_unit<exajoule, exa, joule> {};
|
||||
struct zettajoule : prefixed_unit<zettajoule, zetta, joule> {};
|
||||
struct yottajoule : prefixed_unit<yottajoule, yotta, joule> {};
|
||||
|
||||
// N.B. electron charge (and eV) is an exact constant:
|
||||
// https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf#page=147
|
||||
struct electronvolt :
|
||||
named_scaled_unit<electronvolt, "eV", mag<ratio(1'602'176'634, 1'000'000'000)>() * mag_power<10, -19>(), joule> {};
|
||||
struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, giga, electronvolt> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, joule, dim_force, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// J
|
||||
constexpr auto operator"" _q_J(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<joule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_J(long double l) { return energy<joule, long double>(l); }
|
||||
|
||||
// yJ
|
||||
constexpr auto operator"" _q_yJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<yoctojoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_yJ(long double l) { return energy<yoctojoule, long double>(l); }
|
||||
|
||||
// zJ
|
||||
constexpr auto operator"" _q_zJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<zeptojoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_zJ(long double l) { return energy<zeptojoule, long double>(l); }
|
||||
|
||||
// aJ
|
||||
constexpr auto operator"" _q_aJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<attojoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_aJ(long double l) { return energy<attojoule, long double>(l); }
|
||||
|
||||
// fJ
|
||||
constexpr auto operator"" _q_fJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<femtojoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_fJ(long double l) { return energy<femtojoule, long double>(l); }
|
||||
|
||||
// pJ
|
||||
constexpr auto operator"" _q_pJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<picojoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_pJ(long double l) { return energy<picojoule, long double>(l); }
|
||||
|
||||
// nJ
|
||||
constexpr auto operator"" _q_nJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<nanojoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_nJ(long double l) { return energy<nanojoule, long double>(l); }
|
||||
|
||||
// uJ
|
||||
constexpr auto operator"" _q_uJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<microjoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_uJ(long double l) { return energy<microjoule, long double>(l); }
|
||||
|
||||
// mJ
|
||||
constexpr auto operator"" _q_mJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<millijoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_mJ(long double l) { return energy<millijoule, long double>(l); }
|
||||
|
||||
// kJ
|
||||
constexpr auto operator"" _q_kJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<kilojoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_kJ(long double l) { return energy<kilojoule, long double>(l); }
|
||||
|
||||
// MJ
|
||||
constexpr auto operator"" _q_MJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<megajoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_MJ(long double l) { return energy<megajoule, long double>(l); }
|
||||
|
||||
// GJ
|
||||
constexpr auto operator"" _q_GJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<gigajoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_GJ(long double l) { return energy<gigajoule, long double>(l); }
|
||||
|
||||
// TJ
|
||||
constexpr auto operator"" _q_TJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<terajoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_TJ(long double l) { return energy<terajoule, long double>(l); }
|
||||
|
||||
// PJ
|
||||
constexpr auto operator"" _q_PJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<petajoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_PJ(long double l) { return energy<petajoule, long double>(l); }
|
||||
|
||||
// EJ
|
||||
constexpr auto operator"" _q_EJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<exajoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_EJ(long double l) { return energy<exajoule, long double>(l); }
|
||||
|
||||
// ZJ
|
||||
constexpr auto operator"" _q_ZJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<zettajoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_ZJ(long double l) { return energy<zettajoule, long double>(l); }
|
||||
|
||||
// YJ
|
||||
constexpr auto operator"" _q_YJ(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<yottajoule, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_YJ(long double l) { return energy<yottajoule, long double>(l); }
|
||||
|
||||
// eV
|
||||
constexpr auto operator"" _q_eV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<electronvolt, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_eV(long double l) { return energy<electronvolt, long double>(l); }
|
||||
|
||||
// GeV
|
||||
constexpr auto operator"" _q_GeV(unsigned long long l)
|
||||
{
|
||||
gsl_ExpectsAudit(std::in_range<std::int64_t>(l));
|
||||
return energy<gigaelectronvolt, std::int64_t>(static_cast<std::int64_t>(l));
|
||||
}
|
||||
constexpr auto operator"" _q_GeV(long double l) { return energy<gigaelectronvolt, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace energy_references {
|
||||
|
||||
inline constexpr auto J = reference<dim_energy, joule>{};
|
||||
inline constexpr auto yJ = reference<dim_energy, yoctojoule>{};
|
||||
inline constexpr auto zJ = reference<dim_energy, zeptojoule>{};
|
||||
inline constexpr auto aJ = reference<dim_energy, attojoule>{};
|
||||
inline constexpr auto fJ = reference<dim_energy, femtojoule>{};
|
||||
inline constexpr auto pJ = reference<dim_energy, picojoule>{};
|
||||
inline constexpr auto nJ = reference<dim_energy, nanojoule>{};
|
||||
inline constexpr auto uJ = reference<dim_energy, microjoule>{};
|
||||
inline constexpr auto mJ = reference<dim_energy, millijoule>{};
|
||||
inline constexpr auto kJ = reference<dim_energy, kilojoule>{};
|
||||
inline constexpr auto MJ = reference<dim_energy, megajoule>{};
|
||||
inline constexpr auto GJ = reference<dim_energy, gigajoule>{};
|
||||
inline constexpr auto TJ = reference<dim_energy, terajoule>{};
|
||||
inline constexpr auto PJ = reference<dim_energy, petajoule>{};
|
||||
inline constexpr auto EJ = reference<dim_energy, exajoule>{};
|
||||
inline constexpr auto ZJ = reference<dim_energy, zettajoule>{};
|
||||
inline constexpr auto YJ = reference<dim_energy, yottajoule>{};
|
||||
|
||||
inline constexpr auto eV = reference<dim_energy, electronvolt>{};
|
||||
inline constexpr auto GeV = reference<dim_energy, gigaelectronvolt>{};
|
||||
|
||||
} // namespace energy_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace energy_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_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_NO_ALIASES
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user