Merge branch 'master' of github.com:mpusz/units
This commit is contained in:
commit
4a46f44618
18 files changed
+1082
-6
No files matched your search
@@ -0,0 +1,45 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/speed.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
struct foot_per_second_sq : unit<foot_per_second_sq> {};
|
||||
struct dim_acceleration : physical::dim_acceleration<dim_acceleration, foot_per_second_sq, dim_length, dim_time> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using acceleration = quantity<dim_acceleration, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ft_per_s2
|
||||
constexpr auto operator"" q_ft_per_s2(unsigned long long l) { return acceleration<foot_per_second_sq, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ft_per_s2(long double l) { return acceleration<foot_per_second_sq, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
@@ -0,0 +1,47 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/length.h>
|
||||
// #include <units/physical/si/area.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
struct square_foot : unit<square_foot> {};
|
||||
struct dim_area : physical::dim_area<dim_area, square_foot, dim_length> {};
|
||||
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using area = quantity<dim_area, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ft2
|
||||
constexpr auto operator"" q_ft2(unsigned long long l) { return area<square_foot, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ft2(long double l) { return area<square_foot, long double>(l); }
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::fps
|
||||
@@ -0,0 +1,46 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/mass.h>
|
||||
#include <units/physical/fps/length.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
struct pound_per_foot_cub : unit<pound_per_foot_cub> {};
|
||||
|
||||
struct dim_density : physical::dim_density<dim_density, pound_per_foot_cub, dim_mass, dim_length> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using density = quantity<dim_density, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
constexpr auto operator"" q_lb_per_ft3(unsigned long long l) { return density<pound_per_foot_cub, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_lb_per_ft3(long double l) { return density<pound_per_foot_cub, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
@@ -0,0 +1,57 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/force.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot-poundal
|
||||
struct foot_poundal : unit<foot_poundal> {};
|
||||
|
||||
struct dim_energy : physical::dim_energy<dim_energy, foot_poundal, dim_force, dim_length> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot-pound_(energy)
|
||||
struct foot_pound_force : noble_deduced_unit<foot_pound_force, dim_energy, pound_force, foot> {};
|
||||
|
||||
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
constexpr auto operator"" q_ft_pdl(unsigned long long l) { return energy<foot_poundal, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ft_pdl(long double l) { return energy<foot_poundal, long double>(l); }
|
||||
|
||||
// foot_pound force
|
||||
constexpr auto operator"" q_ft_lbf(unsigned long long l) { return energy<foot_pound_force, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ft_lbf(long double l) { return energy<foot_pound_force, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
@@ -0,0 +1,58 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/acceleration.h>
|
||||
#include <units/physical/fps/mass.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Poundal
|
||||
struct poundal : named_unit<poundal, "pdl", no_prefix> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Pound_(force)
|
||||
struct pound_force : named_scaled_unit<pound_force, "lbf", no_prefix, ratio<32'174'049, 1'000'000>, poundal> {};
|
||||
|
||||
|
||||
|
||||
struct dim_force : physical::dim_force<dim_force, poundal, dim_mass, dim_acceleration> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using force = quantity<dim_force, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// poundal
|
||||
constexpr auto operator"" q_pdl(unsigned long long l) { return force<poundal, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_pdl(long double l) { return force<poundal, long double>(l); }
|
||||
|
||||
// pound force
|
||||
constexpr auto operator"" q_lbf(unsigned long long l) { return force<pound_force, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_lbf(long double l) { return force<pound_force, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
@@ -0,0 +1,70 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
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>
|
||||
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
|
||||
@@ -0,0 +1,67 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/si/mass.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Pound_(mass)
|
||||
struct pound : named_scaled_unit<pound, "lb", no_prefix, ratio<45'359'237, 100'000'000>, si::kilogram> {};
|
||||
|
||||
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 {
|
||||
|
||||
|
||||
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
|
||||
@@ -0,0 +1,60 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/energy.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
struct foot_poundal_per_second : unit<foot_poundal_per_second> {};
|
||||
|
||||
struct dim_power : physical::dim_power<dim_power, foot_poundal_per_second, dim_energy, dim_time> {};
|
||||
|
||||
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>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// foot pound force per second
|
||||
constexpr auto operator"" q_ft_pdl_per_s(unsigned long long l) { return power<foot_poundal_per_second, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ft_pdl_per_s(long double l) { return power<foot_poundal_per_second, long double>(l); }
|
||||
|
||||
|
||||
// foot pound force per second
|
||||
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
|
||||
@@ -0,0 +1,57 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/area.h>
|
||||
#include <units/physical/fps/force.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
struct poundal_per_foot_sq : unit<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 : noble_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 {
|
||||
// Poundal per square foot
|
||||
constexpr auto operator"" q_pdl_per_ft2(unsigned long long l) { return pressure<poundal_per_foot_sq, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_pdl_per_ft2(long double l) { return pressure<poundal_per_foot_sq, long double>(l); }
|
||||
|
||||
// Pounds per square inch
|
||||
constexpr auto operator"" q_psi(unsigned long long l) { return pressure<pound_force_per_inch_sq, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_psi(long double l) { return pressure<pound_force_per_inch_sq, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
@@ -0,0 +1,59 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/length.h>
|
||||
#include <units/physical/fps/time.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
struct foot_per_second : unit<foot_per_second> {};
|
||||
struct dim_speed : physical::dim_speed<dim_speed, foot_per_second, dim_length, dim_time> {};
|
||||
|
||||
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 :named_deduced_derived_unit<nautical_mile_per_hour, dim_speed, "knot", no_prefix, nautical_mile, hour>{};
|
||||
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "knot", no_prefix> {};
|
||||
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
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
|
||||
@@ -0,0 +1,44 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
using si::second;
|
||||
using si::minute;
|
||||
using si::hour;
|
||||
|
||||
using si::dim_time;
|
||||
using si::time;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
using si::literals::operator"" q_s;
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::fps
|
||||
@@ -0,0 +1,51 @@
|
||||
// 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 <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/length.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
|
||||
struct cubic_foot : unit<cubic_foot> {};
|
||||
struct dim_volume : physical::dim_volume<dim_volume, cubic_foot, dim_length> {};
|
||||
|
||||
struct cubic_yard : deduced_unit<cubic_yard, dim_volume, yard> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using volume = quantity<dim_volume, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// ft3
|
||||
constexpr auto operator"" q_ft3(unsigned long long l) { return volume<cubic_foot, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_ft3(long double l) { return volume<cubic_foot, long double>(l); }
|
||||
|
||||
// yard3
|
||||
constexpr auto operator"" q_yd3(unsigned long long l) { return volume<cubic_yard, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_yd3(long double l) { return volume<cubic_yard, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
@@ -165,12 +165,53 @@ struct deduced_unit : downcast_child<Child, detail::deduced_unit<Dim, U, URest..
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
|
||||
// template<typename Child, Dimension Dim, basic_fixed_string Symbol, PrefixFamily PF, Unit U, Unit... Us>
|
||||
// struct named_deduced_derived_unit : downcast_child<Child, detail::deduced_derived_unit<Dim, U, Us...>> {
|
||||
// static constexpr bool is_named = true;
|
||||
// static constexpr auto symbol = Symbol;
|
||||
// using prefix_family = PF;
|
||||
// };
|
||||
|
||||
/**
|
||||
* @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 a 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_deduced_unit : downcast_child<Child, detail::deduced_unit<Dim, U, URest...>> {
|
||||
static constexpr bool is_named = true;
|
||||
static constexpr auto symbol = detail::deduced_symbol_text<Dim, U, URest...>();
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief A named unit with a deduced ratio
|
||||
*
|
||||
* Defines a new unit with a deduced ratio and the given 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 a 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 Symbol a short text representation of the unit
|
||||
* @tparam PF no_prefix or a type of prefix family
|
||||
* @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, basic_symbol_text Symbol, PrefixFamily PF, Unit U, Unit... URest>
|
||||
requires detail::same_scaled_units<typename Dim::recipe, U, URest...>
|
||||
struct named_deduced_derived_unit : downcast_child<Child, detail::deduced_unit<Dim, U, URest...>> {
|
||||
static constexpr bool is_named = true;
|
||||
static constexpr auto symbol = Symbol;
|
||||
using prefix_family = PF;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief An aliased named unit
|
||||
|
||||
Reference in new issue
Block a user