diff --git a/src/systems/isq/CMakeLists.txt b/src/systems/isq/CMakeLists.txt index f2633f91b..c0276bf1e 100644 --- a/src/systems/isq/CMakeLists.txt +++ b/src/systems/isq/CMakeLists.txt @@ -25,7 +25,11 @@ cmake_minimum_required(VERSION 3.19) add_units_module( isq DEPENDENCIES mp-units::core - HEADERS include/mp-units/systems/isq/base_quantities.h 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/space_and_time.h include/mp-units/systems/isq/thermodynamics.h + HEADERS include/mp-units/systems/isq/atomic_and_nuclear_physics.h + include/mp-units/systems/isq/base_quantities.h + 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/space_and_time.h + include/mp-units/systems/isq/thermodynamics.h ) diff --git a/src/systems/isq/include/mp-units/systems/isq/atomic_and_nuclear_physics.h b/src/systems/isq/include/mp-units/systems/isq/atomic_and_nuclear_physics.h new file mode 100644 index 000000000..5753c3250 --- /dev/null +++ b/src/systems/isq/include/mp-units/systems/isq/atomic_and_nuclear_physics.h @@ -0,0 +1,34 @@ +// 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 +#include + +namespace mp_units::isq { + +// TODO Add all the remaining ISQ definitions +QUANTITY_SPEC(activity, 1 / duration); + +} // namespace mp_units::isq diff --git a/src/systems/isq/include/mp-units/systems/isq/isq.h b/src/systems/isq/include/mp-units/systems/isq/isq.h index a73ffadfb..a85e51f08 100644 --- a/src/systems/isq/include/mp-units/systems/isq/isq.h +++ b/src/systems/isq/include/mp-units/systems/isq/isq.h @@ -23,6 +23,7 @@ #pragma once // IWYU pragma: begin_exports +#include #include #include #include diff --git a/src/systems/si/include/mp-units/systems/si/units.h b/src/systems/si/include/mp-units/systems/si/units.h index 0800907e8..88994638d 100644 --- a/src/systems/si/include/mp-units/systems/si/units.h +++ b/src/systems/si/include/mp-units/systems/si/units.h @@ -22,6 +22,7 @@ #pragma once +#include #include #include #include @@ -73,7 +74,7 @@ inline constexpr struct lumen : named_unit<"lm", candela * steradian> {} lumen; inline constexpr struct lux : named_unit<"lx", lumen / square(metre)> {} lux; // TODO add when isq::activity will be supported // inline constexpr struct becquerel : named_unit<"Bq", 1 / second, kind_of> {} becquerel; -inline constexpr struct becquerel : named_unit<"Bq", 1 / second> {} becquerel; +inline constexpr struct becquerel : named_unit<"Bq", 1 / second, kind_of> {} becquerel; inline constexpr struct gray : named_unit<"Gy", joule / kilogram> {} gray; inline constexpr struct sievert : named_unit<"Sv", joule / kilogram> {} sievert; inline constexpr struct katal : named_unit<"kat", mole / second> {} katal; diff --git a/test/unit_test/static/quantity_point_test.cpp b/test/unit_test/static/quantity_point_test.cpp index feb633d65..520e842f1 100644 --- a/test/unit_test/static/quantity_point_test.cpp +++ b/test/unit_test/static/quantity_point_test.cpp @@ -55,7 +55,6 @@ inline constexpr struct zero : absolute_point_origin { } zero; QUANTITY_SPEC(special_height, isq::height); -QUANTITY_SPEC(activity, 1 / isq::time); ///////////////////// // class invariants @@ -1203,18 +1202,18 @@ consteval bool invalid_subtraction(Ts... ts) return !requires { (... - ts); }; } -inline constexpr struct zero_Bq : absolute_point_origin> { +inline constexpr struct zero_Bq : absolute_point_origin> { } zero_Bq; -static_assert(invalid_addition(zero_Bq + 5 * activity[Bq], 5 * isq::frequency[Hz])); -static_assert(invalid_addition(5 * activity[Bq], zero_Hz + 5 * isq::frequency[Hz])); -static_assert(invalid_subtraction(zero_Bq + 5 * activity[Bq], 5 * isq::frequency[Hz])); -static_assert(invalid_subtraction(zero_Bq + 5 * activity[Bq], zero_Hz + 5 * isq::frequency[Hz])); +static_assert(invalid_addition(zero_Bq + 5 * isq::activity[Bq], 5 * isq::frequency[Hz])); +static_assert(invalid_addition(5 * isq::activity[Bq], zero_Hz + 5 * isq::frequency[Hz])); +static_assert(invalid_subtraction(zero_Bq + 5 * isq::activity[Bq], 5 * isq::frequency[Hz])); +static_assert(invalid_subtraction(zero_Bq + 5 * isq::activity[Bq], zero_Hz + 5 * isq::frequency[Hz])); -static_assert(invalid_addition(zero_Bq + 5 * activity[Bq], 10 / (2 * isq::time[s]), 5 * isq::frequency[Hz])); -static_assert(invalid_addition(5 * activity[Bq], zero_Hz + 10 / (2 * isq::time[s]), 5 * isq::frequency[Hz])); -static_assert(invalid_addition(5 * activity[Bq], 10 / (2 * isq::time[s]), zero_Hz + 5 * isq::frequency[Hz])); -static_assert(invalid_subtraction(zero_Bq + 5 * activity[Bq], 10 / (2 * isq::time[s]), 5 * isq::frequency[Hz])); +static_assert(invalid_addition(zero_Bq + 5 * isq::activity[Bq], 10 / (2 * isq::time[s]), 5 * isq::frequency[Hz])); +static_assert(invalid_addition(5 * isq::activity[Bq], zero_Hz + 10 / (2 * isq::time[s]), 5 * isq::frequency[Hz])); +static_assert(invalid_addition(5 * isq::activity[Bq], 10 / (2 * isq::time[s]), zero_Hz + 5 * isq::frequency[Hz])); +static_assert(invalid_subtraction(zero_Bq + 5 * isq::activity[Bq], 10 / (2 * isq::time[s]), 5 * isq::frequency[Hz])); ///////////////////////// diff --git a/test/unit_test/static/quantity_test.cpp b/test/unit_test/static/quantity_test.cpp index 77091cb73..ed2ab6e75 100644 --- a/test/unit_test/static/quantity_test.cpp +++ b/test/unit_test/static/quantity_test.cpp @@ -36,8 +36,6 @@ namespace { using namespace mp_units; using namespace mp_units::si::unit_symbols; -QUANTITY_SPEC(activity, 1 / isq::time); - ////////////////////////////// // quantity class invariants ////////////////////////////// @@ -695,8 +693,8 @@ consteval bool invalid_arithmetic(Ts... ts) { return !requires { (... + ts); } && !requires { (... - ts); }; } -static_assert(invalid_arithmetic(5 * activity[Bq], 5 * isq::frequency[Hz])); -static_assert(invalid_arithmetic(5 * activity[Bq], 10 / (2 * isq::time[s]), 5 * isq::frequency[Hz])); +static_assert(invalid_arithmetic(5 * isq::activity[Bq], 5 * isq::frequency[Hz])); +static_assert(invalid_arithmetic(5 * isq::activity[Bq], 10 / (2 * isq::time[s]), 5 * isq::frequency[Hz])); // Physical constants static_assert(1 * si::si2019::speed_of_light_in_vacuum + 10 * isq::speed[m / s] == 299'792'468 * isq::speed[m / s]); @@ -817,7 +815,7 @@ static_assert(1 * si::si2019::speed_of_light_in_vacuum == 299'792'458 * isq::spe // Different named dimensions template // TODO Use `Reference` when Clang supports it. concept invalid_comparison = !requires { 2 * R1 == 2 * R2; } && !requires { 2 * R2 == 2 * R1; }; -static_assert(invalid_comparison); +static_assert(invalid_comparison); ///////////////////////