diff --git a/src/systems/CMakeLists.txt b/src/systems/CMakeLists.txt index e061e4a0e..a3467eadc 100644 --- a/src/systems/CMakeLists.txt +++ b/src/systems/CMakeLists.txt @@ -43,6 +43,7 @@ add_mp_units_module( include/mp-units/systems/isq/electromagnetism.h include/mp-units/systems/isq/isq.h include/mp-units/systems/isq/mechanics.h + include/mp-units/systems/isq/si_quantities.h include/mp-units/systems/isq/space_and_time.h include/mp-units/systems/isq/thermodynamics.h include/mp-units/systems/isq_angle/isq_angle.h diff --git a/src/systems/include/mp-units/systems/hep/hep.h b/src/systems/include/mp-units/systems/hep/hep.h index 637fc27fc..ac7a192e8 100644 --- a/src/systems/include/mp-units/systems/hep/hep.h +++ b/src/systems/include/mp-units/systems/hep/hep.h @@ -22,7 +22,8 @@ #pragma once -#include +#include +#include #include template<> @@ -52,8 +53,6 @@ inline constexpr struct speed_of_light : decltype(si::si2019::speed_of_light_in_ namespace unit_symbols { -using si::unit_symbols::eV; - inline constexpr auto qeV = si::quecto; inline constexpr auto reV = si::ronto; inline constexpr auto yeV = si::yocto; @@ -66,6 +65,7 @@ inline constexpr auto ueV = si::micro; inline constexpr auto meV = si::milli; inline constexpr auto ceV = si::centi; inline constexpr auto deV = si::deci; +inline constexpr auto eV = electronvolt; inline constexpr auto daeV = si::deca; inline constexpr auto heV = si::hecto; inline constexpr auto keV = si::kilo; diff --git a/src/systems/include/mp-units/systems/international/international.h b/src/systems/include/mp-units/systems/international/international.h index db9e3330e..4177e8fcd 100644 --- a/src/systems/include/mp-units/systems/international/international.h +++ b/src/systems/include/mp-units/systems/international/international.h @@ -22,7 +22,8 @@ #pragma once -#include +#include +#include #include namespace mp_units::international { diff --git a/src/systems/include/mp-units/systems/isq/atomic_and_nuclear_physics.h b/src/systems/include/mp-units/systems/isq/atomic_and_nuclear_physics.h index 24075900b..bdffc6ba6 100644 --- a/src/systems/include/mp-units/systems/isq/atomic_and_nuclear_physics.h +++ b/src/systems/include/mp-units/systems/isq/atomic_and_nuclear_physics.h @@ -23,16 +23,9 @@ #pragma once #include -#include -#include -#include +#include namespace mp_units::isq { -// TODO Add all the remaining ISQ definitions -QUANTITY_SPEC(activity, inverse(duration)); -QUANTITY_SPEC(absorbed_dose, energy / mass); -QUANTITY_SPEC(ionizing_radiation_quality_factor, dimensionless); -QUANTITY_SPEC(dose_equivalent, absorbed_dose* ionizing_radiation_quality_factor); } // namespace mp_units::isq diff --git a/src/systems/include/mp-units/systems/isq/base_quantities.h b/src/systems/include/mp-units/systems/isq/base_quantities.h index d7b7c46ab..f10c7fc37 100644 --- a/src/systems/include/mp-units/systems/isq/base_quantities.h +++ b/src/systems/include/mp-units/systems/isq/base_quantities.h @@ -43,6 +43,7 @@ inline constexpr struct dim_luminous_intensity : base_dimension<"J"> {} dim_lumi QUANTITY_SPEC(length, dim_length); QUANTITY_SPEC(mass, dim_mass); QUANTITY_SPEC(time, dim_time); +inline constexpr auto duration = time; QUANTITY_SPEC(electric_current, dim_electric_current); QUANTITY_SPEC(thermodynamic_temperature, dim_thermodynamic_temperature); QUANTITY_SPEC(amount_of_substance, dim_amount_of_substance); diff --git a/src/systems/include/mp-units/systems/isq/isq.h b/src/systems/include/mp-units/systems/isq/isq.h index a85e51f08..e2d31c7b7 100644 --- a/src/systems/include/mp-units/systems/isq/isq.h +++ b/src/systems/include/mp-units/systems/isq/isq.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include // IWYU pragma: end_exports diff --git a/src/systems/include/mp-units/systems/isq/mechanics.h b/src/systems/include/mp-units/systems/isq/mechanics.h index fd0795507..90daaaae4 100644 --- a/src/systems/include/mp-units/systems/isq/mechanics.h +++ b/src/systems/include/mp-units/systems/isq/mechanics.h @@ -23,7 +23,7 @@ #pragma once #include -#include +#include #include namespace mp_units::isq { @@ -88,9 +88,8 @@ QUANTITY_SPEC(kinematic_viscosity, dynamic_viscosity / mass_density); QUANTITY_SPEC(surface_tension, force / length, quantity_character::scalar); // TODO what is a correct equation here? QUANTITY_SPEC(power, mass* pow<2>(length) / pow<3>(time)); // not in ISO 80000 QUANTITY_SPEC(mechanical_power, power, force* velocity, quantity_character::scalar); -QUANTITY_SPEC(energy, mass* pow<2>(length) / pow<2>(time)); // differs from ISO 80000 (defined in thermodynamics) -QUANTITY_SPEC(mechanical_energy, energy); // differs from ISO 80000 -QUANTITY_SPEC(potential_energy, mechanical_energy); // differs from ISO 80000 +QUANTITY_SPEC(mechanical_energy, energy); // differs from ISO 80000 +QUANTITY_SPEC(potential_energy, mechanical_energy); // differs from ISO 80000 QUANTITY_SPEC(kinetic_energy, mechanical_energy, mass* pow<2>(speed)); // differs from ISO 80000 QUANTITY_SPEC(mechanical_work, force* displacement, quantity_character::scalar); inline constexpr auto work = mechanical_work; diff --git a/src/systems/include/mp-units/systems/isq/si_quantities.h b/src/systems/include/mp-units/systems/isq/si_quantities.h new file mode 100644 index 000000000..33621b75b --- /dev/null +++ b/src/systems/include/mp-units/systems/isq/si_quantities.h @@ -0,0 +1,52 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include +#include + +namespace mp_units::isq { + +// space and time +QUANTITY_SPEC(width, length); +inline constexpr auto breadth = width; +QUANTITY_SPEC(radius, width); // differs from ISO 80000 +QUANTITY_SPEC(path_length, length); +inline constexpr auto arc_length = path_length; +QUANTITY_SPEC(area, pow<2>(length)); +QUANTITY_SPEC(angular_measure, dimensionless, arc_length / radius, is_kind); +QUANTITY_SPEC(solid_angular_measure, dimensionless, area / pow<2>(radius), is_kind); +QUANTITY_SPEC(period_duration, duration); +inline constexpr auto period = period_duration; +QUANTITY_SPEC(frequency, inverse(period_duration)); + +// mechanics +QUANTITY_SPEC(energy, mass* pow<2>(length) / pow<2>(time)); // differs from ISO 80000 (defined in thermodynamics) + +// atomic_and_nuclear_physics +QUANTITY_SPEC(activity, inverse(duration)); +QUANTITY_SPEC(absorbed_dose, energy / mass); +QUANTITY_SPEC(ionizing_radiation_quality_factor, dimensionless); +QUANTITY_SPEC(dose_equivalent, absorbed_dose* ionizing_radiation_quality_factor); + +} // namespace mp_units::isq diff --git a/src/systems/include/mp-units/systems/isq/space_and_time.h b/src/systems/include/mp-units/systems/isq/space_and_time.h index c60be5fd7..03846884b 100644 --- a/src/systems/include/mp-units/systems/isq/space_and_time.h +++ b/src/systems/include/mp-units/systems/isq/space_and_time.h @@ -23,45 +23,33 @@ #pragma once #include -#include +#include namespace mp_units::isq { -QUANTITY_SPEC(width, length); -inline constexpr auto breadth = width; QUANTITY_SPEC(height, length); inline constexpr auto depth = height; inline constexpr auto altitude = height; QUANTITY_SPEC(thickness, width); QUANTITY_SPEC(diameter, width); -QUANTITY_SPEC(radius, width); // differs from ISO 80000 -QUANTITY_SPEC(path_length, length); -inline constexpr auto arc_length = path_length; QUANTITY_SPEC(distance, path_length); QUANTITY_SPEC(radial_distance, distance); QUANTITY_SPEC(position_vector, length, quantity_character::vector); QUANTITY_SPEC(displacement, length, quantity_character::vector); QUANTITY_SPEC(radius_of_curvature, radius); QUANTITY_SPEC(curvature, inverse(radius_of_curvature)); -QUANTITY_SPEC(area, pow<2>(length)); QUANTITY_SPEC(volume, pow<3>(length)); -QUANTITY_SPEC(angular_measure, dimensionless, arc_length / radius, is_kind); QUANTITY_SPEC(rotational_displacement, angular_measure, path_length / radius); inline constexpr auto angular_displacement = rotational_displacement; QUANTITY_SPEC(phase_angle, angular_measure); -QUANTITY_SPEC(solid_angular_measure, dimensionless, area / pow<2>(radius), is_kind); -inline constexpr auto duration = time; QUANTITY_SPEC(speed, length / time); // differs from ISO 80000 QUANTITY_SPEC(velocity, speed, position_vector / duration); // vector // differs from ISO 80000 QUANTITY_SPEC(acceleration, velocity / duration); // vector QUANTITY_SPEC(acceleration_of_free_fall, acceleration); // not in ISO 80000 QUANTITY_SPEC(angular_velocity, angular_displacement / duration, quantity_character::vector); QUANTITY_SPEC(angular_acceleration, angular_velocity / duration); -QUANTITY_SPEC(period_duration, duration); -inline constexpr auto period = period_duration; QUANTITY_SPEC(time_constant, duration); QUANTITY_SPEC(rotation, dimensionless); -QUANTITY_SPEC(frequency, inverse(period_duration)); QUANTITY_SPEC(rotational_frequency, rotation / duration); QUANTITY_SPEC(angular_frequency, phase_angle / duration); QUANTITY_SPEC(wavelength, length); diff --git a/src/systems/include/mp-units/systems/isq/thermodynamics.h b/src/systems/include/mp-units/systems/isq/thermodynamics.h index 3a543a6d5..c7d398247 100644 --- a/src/systems/include/mp-units/systems/isq/thermodynamics.h +++ b/src/systems/include/mp-units/systems/isq/thermodynamics.h @@ -23,9 +23,7 @@ #pragma once #include -#include -#include -#include +#include namespace mp_units::isq { diff --git a/src/systems/include/mp-units/systems/si/units.h b/src/systems/include/mp-units/systems/si/units.h index 387355804..b8cd3fcef 100644 --- a/src/systems/include/mp-units/systems/si/units.h +++ b/src/systems/include/mp-units/systems/si/units.h @@ -23,9 +23,7 @@ #pragma once #include -#include -#include -#include +#include #include #include