mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
@@ -7,6 +7,7 @@
|
|||||||
- (!) refactor: `quantity::count()` renamed to `quantity::number()`
|
- (!) refactor: `quantity::count()` renamed to `quantity::number()`
|
||||||
- (!) refactor: `data` system renamed to `isq::iec80000` (quantity names renamed too)
|
- (!) refactor: `data` system renamed to `isq::iec80000` (quantity names renamed too)
|
||||||
- (!) refactor: `*deduced_unit` renamed to `*derived_unit`
|
- (!) 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: quantity (kind) point updated to reflect latest changes to `quantity`
|
||||||
- refactor: basic concepts, `quantity` and `quantity_cast` refactored
|
- refactor: basic concepts, `quantity` and `quantity_cast` refactored
|
||||||
- refactor: `abs()` definition refactored to be more explicit about the return type
|
- 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: ambiguous case for empty type list resolved
|
||||||
- fix: downcasting facility for non-default-constructible types
|
- fix: downcasting facility for non-default-constructible types
|
||||||
- fix: restore user-warnings within the library implementation
|
- 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: 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: 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`
|
- (!) build: `BUILD_DOCS` CMake option renamed to `UNITS_BUILD_DOCS`
|
||||||
|
BIN
docs/_static/img/units.png
vendored
BIN
docs/_static/img/units.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 54 KiB |
@@ -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
|
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
|
by him/her-self::
|
||||||
based on the ingredients::
|
|
||||||
|
|
||||||
namespace si::fps {
|
namespace si::fps {
|
||||||
|
|
||||||
struct knot : named_derived_unit<knot, dim_speed, "knot", no_prefix, nautical_mile, hour> {};
|
struct knot : named_derived_unit<knot, dim_speed, "knot", no_prefix, nautical_mile, hour> {};
|
||||||
struct foot_pound_force : noble_derived_unit<foot_pound_force, dim_energy, pound_force, foot> {};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +378,6 @@ of a `scaled_unit` class template:
|
|||||||
[scaled_unit<UnitRatio, Unit>]<:-[named_scaled_unit<Child, Symbol, PrefixFamily, Ratio, Unit>]
|
[scaled_unit<UnitRatio, Unit>]<:-[named_scaled_unit<Child, Symbol, PrefixFamily, Ratio, Unit>]
|
||||||
[scaled_unit<UnitRatio, Unit>]<:-[prefixed_unit<Child, Prefix, Unit>]
|
[scaled_unit<UnitRatio, Unit>]<:-[prefixed_unit<Child, Prefix, Unit>]
|
||||||
[scaled_unit<UnitRatio, Unit>]<:-[derived_unit<Child, Dimension, Unit, Unit...>]
|
[scaled_unit<UnitRatio, Unit>]<:-[derived_unit<Child, Dimension, Unit, Unit...>]
|
||||||
[scaled_unit<UnitRatio, Unit>]<:-[noble_derived_unit<Child, Dimension, Unit, Unit...>]
|
|
||||||
[scaled_unit<UnitRatio, Unit>]<:-[named_derived_unit<Child, Dimension, Symbol, PrefixFamily, Unit, Unit...>]
|
[scaled_unit<UnitRatio, Unit>]<:-[named_derived_unit<Child, Dimension, Symbol, PrefixFamily, Unit, Unit...>]
|
||||||
[scaled_unit<UnitRatio, Unit>]<:-[alias_unit<Unit, Symbol, PrefixFamily>]
|
[scaled_unit<UnitRatio, Unit>]<:-[alias_unit<Unit, Symbol, PrefixFamily>]
|
||||||
[scaled_unit<UnitRatio, Unit>]<:-[prefixed_alias_unit<Unit, Prefix, AliasUnit>]
|
[scaled_unit<UnitRatio, Unit>]<:-[prefixed_alias_unit<Unit, Prefix, AliasUnit>]
|
||||||
|
@@ -19,9 +19,6 @@ Units
|
|||||||
.. doxygenstruct:: units::derived_unit
|
.. doxygenstruct:: units::derived_unit
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. doxygenstruct:: units::noble_derived_unit
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. doxygenstruct:: units::named_derived_unit
|
.. doxygenstruct:: units::named_derived_unit
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
@@ -161,31 +161,6 @@ struct derived_unit : downcast_dispatch<Child, detail::derived_unit<Dim, U, URes
|
|||||||
using prefix_family = no_prefix;
|
using prefix_family = no_prefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief A unit with a deduced ratio and symbol that can be used as a named unit for children
|
|
||||||
*
|
|
||||||
* Defines a new unit with a deduced ratio and symbol based on the recipe from the provided
|
|
||||||
* derived dimension. The number and order of provided units should match the recipe of the
|
|
||||||
* derived dimension. All of the units provided should also be named ones so it is possible
|
|
||||||
* to create a deduced symbol text.
|
|
||||||
*
|
|
||||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
|
||||||
* @tparam Dim a derived dimension recipe to use for deduction
|
|
||||||
* @tparam U the unit of the first composite dimension from provided derived dimension's recipe
|
|
||||||
* @tparam URest the units for the rest of dimensions from the recipe
|
|
||||||
*/
|
|
||||||
template<typename Child, DerivedDimension Dim, Unit U, Unit... URest>
|
|
||||||
requires detail::same_scaled_units<typename Dim::recipe, U, URest...> &&
|
|
||||||
(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<Child, detail::derived_unit<Dim, U, URest...>> {
|
|
||||||
static constexpr bool is_named = true;
|
|
||||||
static constexpr auto symbol = detail::derived_symbol_text<Dim, U, URest...>();
|
|
||||||
using prefix_family = no_prefix;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A named unit with a deduced ratio
|
* @brief A named unit with a deduced ratio
|
||||||
*
|
*
|
||||||
|
@@ -28,8 +28,14 @@
|
|||||||
|
|
||||||
namespace units::isq {
|
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>
|
template<typename Child, Unit U, DimensionOfT<dim_force> F, DimensionOfT<dim_length> L>
|
||||||
struct dim_energy : derived_dimension<Child, U, exponent<F, 1>, exponent<L, 1>> {};
|
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>
|
template<typename T>
|
||||||
concept Energy = QuantityOfT<T, dim_energy>;
|
concept Energy = QuantityOfT<T, dim_energy>;
|
||||||
|
@@ -28,8 +28,14 @@
|
|||||||
|
|
||||||
namespace units::isq {
|
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>
|
template<typename Child, Unit U, DimensionOfT<dim_energy> E, DimensionOfT<dim_time> T>
|
||||||
struct dim_power : derived_dimension<Child, U, exponent<E, 1>, exponent<T, -1>> {};
|
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>
|
template<typename T>
|
||||||
concept Power = QuantityOfT<T, dim_power>;
|
concept Power = QuantityOfT<T, dim_power>;
|
||||||
|
@@ -37,10 +37,10 @@ namespace units::isq::si::fps {
|
|||||||
// https://en.wikipedia.org/wiki/Foot-poundal
|
// https://en.wikipedia.org/wiki/Foot-poundal
|
||||||
struct foot_poundal : unit<foot_poundal> {};
|
struct foot_poundal : unit<foot_poundal> {};
|
||||||
|
|
||||||
struct dim_energy : isq::dim_energy<dim_energy, foot_poundal, dim_force, dim_length> {};
|
struct dim_energy : isq::dim_energy<dim_energy, foot_poundal, dim_length, dim_force> {};
|
||||||
|
|
||||||
// https://en.wikipedia.org/wiki/Foot-pound_(energy)
|
// https://en.wikipedia.org/wiki/Foot-pound_(energy)
|
||||||
struct foot_pound_force : noble_derived_unit<foot_pound_force, dim_energy, pound_force, foot> {};
|
struct foot_pound_force : derived_unit<foot_pound_force, dim_energy, foot, pound_force> {};
|
||||||
|
|
||||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||||
using energy = quantity<dim_energy, U, Rep>;
|
using energy = quantity<dim_energy, U, Rep>;
|
||||||
|
@@ -37,9 +37,9 @@ namespace units::isq::si::fps {
|
|||||||
|
|
||||||
struct foot_poundal_per_second : unit<foot_poundal_per_second> {};
|
struct foot_poundal_per_second : unit<foot_poundal_per_second> {};
|
||||||
|
|
||||||
struct dim_power : isq::dim_power<dim_power, foot_poundal_per_second, dim_energy, dim_time> {};
|
struct dim_power : isq::dim_power<dim_power, foot_poundal_per_second, dim_length, dim_force, dim_time> {};
|
||||||
|
|
||||||
struct foot_pound_force_per_second : derived_unit<foot_pound_force_per_second, dim_power, foot_pound_force, second> {};
|
struct foot_pound_force_per_second : derived_unit<foot_pound_force_per_second, dim_power, foot, pound_force, second> {};
|
||||||
|
|
||||||
struct horse_power : named_scaled_unit<horse_power, "hp", no_prefix, ratio(550), foot_pound_force_per_second> {};
|
struct horse_power : named_scaled_unit<horse_power, "hp", no_prefix, ratio(550), foot_pound_force_per_second> {};
|
||||||
|
|
||||||
|
@@ -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_ft == 10_q_pdl);
|
||||||
static_assert(100_q_ft_pdl / 10_q_pdl == 10_q_ft);
|
static_assert(100_q_ft_pdl / 10_q_pdl == 10_q_ft);
|
||||||
|
|
||||||
|
static_assert(detail::unit_text<dim_energy, foot_pound_force>() == basic_symbol_text("ft ⋅ lbf", "ft lbf"));
|
||||||
|
|
||||||
/* ************** DERIVED DIMENSIONS IN TERMS OF OTHER UNITS **************** */
|
/* ************** DERIVED DIMENSIONS IN TERMS OF OTHER UNITS **************** */
|
||||||
|
|
||||||
// power
|
// 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(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(10_q_ft_pdl / 1_q_ft_pdl_per_s == 10_q_s);
|
||||||
|
|
||||||
// static_assert(detail::unit_text<dim_power, foot_pound_force_per_second>() == "ft_lbf/s");
|
static_assert(detail::unit_text<dim_power, foot_pound_force_per_second>() == basic_symbol_text("ft ⋅ lbf/s", "ft lbf/s"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user