1 parent
7ead50acfc
commit
b894ee6558
10 files changed
+25
-40
No files matched your search
@@ -161,31 +161,6 @@ struct derived_unit : downcast_dispatch<Child, detail::derived_unit<Dim, U, URes
|
||||
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
|
||||
*
|
||||
|
||||
@@ -28,8 +28,14 @@
|
||||
|
||||
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 : 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>
|
||||
concept Energy = QuantityOfT<T, dim_energy>;
|
||||
|
||||
@@ -28,8 +28,14 @@
|
||||
|
||||
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 : 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>
|
||||
concept Power = QuantityOfT<T, dim_power>;
|
||||
|
||||
@@ -37,10 +37,10 @@ namespace units::isq::si::fps {
|
||||
// https://en.wikipedia.org/wiki/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)
|
||||
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>
|
||||
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 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> {};
|
||||
|
||||
|
||||
Reference in new issue
Block a user