diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7a2ed012..c4326c9d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,7 @@ - (!) refactor: `quantity::count()` renamed to `quantity::number()` - (!) refactor: `data` system renamed to `isq::iec80000` (quantity names renamed too) - (!) refactor: `*deduced_unit` renamed to `*derived_unit` + - (!) refactor: got rid of a `noble_derived_unit` - refactor: quantity (kind) point updated to reflect latest changes to `quantity` - refactor: basic concepts, `quantity` and `quantity_cast` refactored - refactor: `abs()` definition refactored to be more explicit about the return type @@ -32,6 +33,7 @@ - fix: ambiguous case for empty type list resolved - fix: downcasting facility for non-default-constructible types - fix: restore user-warnings within the library implementation + - fix: the text symbol of `foot_pound_force` and `foot_pound_force_per_second` - (!) build: Conan testing version is now hosted on [Artifactory](https://mpusz.jfrog.io/ui/packages/conan:%2F%2Fmp-units) - (!) build: Linear Algebra is now hosted on its [Artifactory](https://twonington.jfrog.io/artifactory/api/conan/conan-oss) - (!) build: `BUILD_DOCS` CMake option renamed to `UNITS_BUILD_DOCS` diff --git a/docs/_static/img/units.png b/docs/_static/img/units.png index 40727db1..41296df3 100644 Binary files a/docs/_static/img/units.png and b/docs/_static/img/units.png differ diff --git a/docs/framework/units.rst b/docs/framework/units.rst index c5d9e66c..014e57a7 100644 --- a/docs/framework/units.rst +++ b/docs/framework/units.rst @@ -315,15 +315,13 @@ does not exist at all. With it ``si::kilometre_per_hour`` can be defined as:: } -In case the scaled derived unit should serve as a named one we can use either +In case the scaled derived unit should serve as a named one we can use a `named_derived_unit` where the user is able to provide a symbol for the unit -by him/her-self or `noble_derived_unit` where the symbol is the deduced name -based on the ingredients:: +by him/her-self:: namespace si::fps { struct knot : named_derived_unit {}; - struct foot_pound_force : noble_derived_unit {}; } @@ -380,7 +378,6 @@ of a `scaled_unit` class template: [scaled_unit]<:-[named_scaled_unit] [scaled_unit]<:-[prefixed_unit] [scaled_unit]<:-[derived_unit] - [scaled_unit]<:-[noble_derived_unit] [scaled_unit]<:-[named_derived_unit] [scaled_unit]<:-[alias_unit] [scaled_unit]<:-[prefixed_alias_unit] diff --git a/docs/reference/core/types/units.rst b/docs/reference/core/types/units.rst index f2caf2c4..897fcc85 100644 --- a/docs/reference/core/types/units.rst +++ b/docs/reference/core/types/units.rst @@ -19,9 +19,6 @@ Units .. doxygenstruct:: units::derived_unit :members: -.. doxygenstruct:: units::noble_derived_unit - :members: - .. doxygenstruct:: units::named_derived_unit :members: diff --git a/src/core/include/units/unit.h b/src/core/include/units/unit.h index d6bca261..a4a46463 100644 --- a/src/core/include/units/unit.h +++ b/src/core/include/units/unit.h @@ -161,31 +161,6 @@ struct derived_unit : downcast_dispatch - requires detail::same_scaled_units && - (U::is_named && (URest::is_named && ... && true)) -// TODO - 'noble' is placeholder to sort of mean can pass its name on to other deduced units -struct noble_derived_unit : downcast_dispatch> { - static constexpr bool is_named = true; - static constexpr auto symbol = detail::derived_symbol_text(); - using prefix_family = no_prefix; -}; - - /** * @brief A named unit with a deduced ratio * diff --git a/src/systems/isq/include/units/isq/dimensions/energy.h b/src/systems/isq/include/units/isq/dimensions/energy.h index 1f88bc16..db090615 100644 --- a/src/systems/isq/include/units/isq/dimensions/energy.h +++ b/src/systems/isq/include/units/isq/dimensions/energy.h @@ -28,8 +28,14 @@ namespace units::isq { +template +struct dim_energy; + template F, DimensionOfT L> -struct dim_energy : derived_dimension, exponent> {}; +struct dim_energy : derived_dimension, exponent> {}; + +template L, DimensionOfT F> +struct dim_energy : derived_dimension, exponent> {}; template concept Energy = QuantityOfT; diff --git a/src/systems/isq/include/units/isq/dimensions/power.h b/src/systems/isq/include/units/isq/dimensions/power.h index 9bef0f74..5a0b24ca 100644 --- a/src/systems/isq/include/units/isq/dimensions/power.h +++ b/src/systems/isq/include/units/isq/dimensions/power.h @@ -28,8 +28,14 @@ namespace units::isq { +template +struct dim_power; + template E, DimensionOfT T> -struct dim_power : derived_dimension, exponent> {}; +struct dim_power : derived_dimension, exponent> {}; + +template L, DimensionOfT F, DimensionOfT T> +struct dim_power : derived_dimension, exponent, exponent> {}; template concept Power = QuantityOfT; diff --git a/src/systems/si-fps/include/units/isq/si/fps/energy.h b/src/systems/si-fps/include/units/isq/si/fps/energy.h index b33bab74..7d430d4f 100644 --- a/src/systems/si-fps/include/units/isq/si/fps/energy.h +++ b/src/systems/si-fps/include/units/isq/si/fps/energy.h @@ -37,10 +37,10 @@ namespace units::isq::si::fps { // https://en.wikipedia.org/wiki/Foot-poundal struct foot_poundal : unit {}; -struct dim_energy : isq::dim_energy {}; +struct dim_energy : isq::dim_energy {}; // https://en.wikipedia.org/wiki/Foot-pound_(energy) -struct foot_pound_force : noble_derived_unit {}; + struct foot_pound_force : derived_unit {}; template U, Representation Rep = double> using energy = quantity; diff --git a/src/systems/si-fps/include/units/isq/si/fps/power.h b/src/systems/si-fps/include/units/isq/si/fps/power.h index 92bba117..d8cb69fe 100644 --- a/src/systems/si-fps/include/units/isq/si/fps/power.h +++ b/src/systems/si-fps/include/units/isq/si/fps/power.h @@ -37,9 +37,9 @@ namespace units::isq::si::fps { struct foot_poundal_per_second : unit {}; -struct dim_power : isq::dim_power {}; +struct dim_power : isq::dim_power {}; -struct foot_pound_force_per_second : derived_unit {}; +struct foot_pound_force_per_second : derived_unit {}; struct horse_power : named_scaled_unit {}; diff --git a/test/unit_test/static/fps_test.cpp b/test/unit_test/static/fps_test.cpp index 054e2a5e..7bbf8ab8 100644 --- a/test/unit_test/static/fps_test.cpp +++ b/test/unit_test/static/fps_test.cpp @@ -84,6 +84,8 @@ static_assert(10_q_pdl * 10_q_ft == 100_q_ft_pdl); static_assert(100_q_ft_pdl / 10_q_ft == 10_q_pdl); static_assert(100_q_ft_pdl / 10_q_pdl == 10_q_ft); +static_assert(detail::unit_text() == basic_symbol_text("ft ⋅ lbf", "ft lbf")); + /* ************** DERIVED DIMENSIONS IN TERMS OF OTHER UNITS **************** */ // power @@ -92,6 +94,6 @@ static_assert(10_q_ft_pdl / 10_q_s == 1_q_ft_pdl_per_s); static_assert(1_q_ft_pdl_per_s * 10_q_s == 10_q_ft_pdl); static_assert(10_q_ft_pdl / 1_q_ft_pdl_per_s == 10_q_s); -// static_assert(detail::unit_text() == "ft_lbf/s"); +static_assert(detail::unit_text() == basic_symbol_text("ft ⋅ lbf/s", "ft lbf/s")); }