forked from mpusz/mp-units
added example and some more units to fps system
This commit is contained in:
@@ -31,6 +31,16 @@ namespace units::physical::fps {
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio<3'048, 1'000, -1>, si::metre> {};
|
||||
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio<3, 1>, foot> {};
|
||||
|
||||
struct inch : named_scaled_unit<inch, "in", no_prefix, ratio<1, 12>, foot> {};
|
||||
|
||||
struct mile : named_scaled_unit<mile, "mile", no_prefix, ratio<5'280>, foot> {};
|
||||
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", no_prefix, ratio<2000>, yard> {};
|
||||
|
||||
|
||||
|
||||
struct dim_length : physical::dim_length<foot> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
@@ -38,10 +48,23 @@ using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
constexpr auto operator"" q_in(unsigned long long l) { return length<inch, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_in(long double l) { return length<inch, long double>(l); }
|
||||
|
||||
// ft
|
||||
constexpr auto operator"" q_ft(unsigned long long l) { return length<foot, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ft(long double l) { return length<foot, long double>(l); }
|
||||
|
||||
constexpr auto operator"" q_yd(unsigned long long l) { return length<yard, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_yd(long double l) { return length<yard, long double>(l); }
|
||||
|
||||
constexpr auto operator"" q_mile(unsigned long long l) { return length<mile, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_mile(long double l) { return length<mile, long double>(l); }
|
||||
|
||||
constexpr auto operator"" q_naut_mi(unsigned long long l) { return length<nautical_mile, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_naut_mi(long double l) { return length<nautical_mile, long double>(l); }
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::fps
|
||||
|
||||
@@ -36,12 +36,32 @@ struct dim_mass : physical::dim_mass<pound> {};
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
struct ounce : named_scaled_unit<ounce, "oz", no_prefix, ratio<1, 16>, pound>{};
|
||||
|
||||
struct short_ton : named_scaled_unit<short_ton, "ton (short)", no_prefix, ratio<2'000, 1>, pound>{};
|
||||
|
||||
struct long_ton : named_scaled_unit<long_ton, "ton (long)", no_prefix, ratio<2'240, 1>, pound>{};
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// g
|
||||
|
||||
constexpr auto operator"" q_oz(unsigned long long l) { return mass<ounce, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_oz(long double l) { return mass<ounce, long double>(l); }
|
||||
|
||||
|
||||
// lb
|
||||
constexpr auto operator"" q_lb(unsigned long long l) { return mass<pound, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_lb(long double l) { return mass<pound, long double>(l); }
|
||||
|
||||
|
||||
constexpr auto operator"" q_ston(unsigned long long l) { return mass<short_ton, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ston(long double l) { return mass<short_ton, long double>(l); }
|
||||
|
||||
|
||||
constexpr auto operator"" q_lton(unsigned long long l) { return mass<long_ton, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_lton(long double l) { return mass<long_ton, long double>(l); }
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::fps
|
||||
|
||||
@@ -35,6 +35,8 @@ struct dim_power : physical::dim_power<dim_power, foot_poundal_per_second, dim_e
|
||||
|
||||
struct foot_pound_force_per_second : deduced_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> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using power = quantity<dim_power, U, Rep>;
|
||||
|
||||
@@ -49,6 +51,10 @@ constexpr auto operator"" q_ft_pdl_per_s(long double l) { return power<foot_poun
|
||||
constexpr auto operator"" q_ft_lbf_per_s(unsigned long long l) { return power<foot_pound_force_per_second, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ft_lbf_per_s(long double l) { return power<foot_pound_force_per_second, long double>(l); }
|
||||
|
||||
|
||||
constexpr auto operator"" q_hp(unsigned long long l) { return power<horse_power, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_hp(long double l) { return power<horse_power, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
|
||||
@@ -32,14 +32,15 @@ namespace units::physical::fps {
|
||||
|
||||
struct poundal_per_foot_sq : unit<poundal_per_foot_sq> {};
|
||||
|
||||
struct pound_force_per_foot_sq : named_scaled_unit<pound_force_per_foot_sq, "lbf ft2", si::prefix, ratio<32'174'049, 1'000'000>, poundal_per_foot_sq> {};
|
||||
|
||||
|
||||
struct dim_pressure : physical::dim_pressure<dim_pressure, poundal_per_foot_sq, dim_force, dim_area> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using pressure = quantity<dim_pressure, U, Rep>;
|
||||
|
||||
struct pound_force_per_foot_sq : named_scaled_unit<pound_force_per_foot_sq, "lbf ft2", si::prefix, ratio<32'174'049, 1'000'000>, poundal_per_foot_sq> {};
|
||||
|
||||
// struct pound_force_per_foot_sq : named_deduced_unit<pound_force_per_foot_sq, dim_pressure, pound_force, square_ft> {};
|
||||
|
||||
struct pound_force_per_inch_sq : named_scaled_unit<pound_force_per_inch_sq, "psi", si::prefix, ratio<1, 144>, pound_force_per_foot_sq> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
@@ -35,12 +35,25 @@ struct dim_speed : physical::dim_speed<dim_speed, foot_per_second, dim_length, d
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
struct mile_per_hour : deduced_unit<mile_per_hour, dim_speed, mile, hour>{};
|
||||
|
||||
struct nautical_mile_per_hour : deduced_unit<nautical_mile_per_hour, dim_speed, nautical_mile, hour>{};
|
||||
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "knot", si::prefix> {};
|
||||
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// cmps
|
||||
constexpr auto operator"" q_ft_per_s(unsigned long long l) { return speed<foot_per_second, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ft_per_s(long double l) { return speed<foot_per_second, long double>(l); }
|
||||
|
||||
constexpr auto operator"" q_mph(unsigned long long l) { return speed<mile_per_hour, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_mph(long double l) { return speed<mile_per_hour, long double>(l); }
|
||||
|
||||
constexpr auto operator"" q_knot(unsigned long long l) { return speed<knot, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_knot(long double l) { return speed<knot, long double>(l); }
|
||||
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
namespace units::physical::fps {
|
||||
|
||||
using si::second;
|
||||
using si::minute;
|
||||
using si::hour;
|
||||
|
||||
using si::dim_time;
|
||||
using si::time;
|
||||
|
||||
Reference in New Issue
Block a user