added some units for the foot-pound-second system and the static tests

This commit is contained in:
Mike Ford
2020-06-16 15:14:46 +02:00
committed by Mateusz Pusz
parent 10f93b5386
commit 8230a42cb0
13 changed files with 766 additions and 0 deletions
@@ -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
+47
View File
@@ -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 {
// fm2
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
+54
View File
@@ -0,0 +1,54 @@
// 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> {};
// https://en.wikipedia.org/wiki/Foot-pound_(energy)
struct foot_pound_force : named_scaled_unit<foot_poundal, "lbf", no_prefix, ratio<32'174'049, 1'000'000>, foot_poundal> {};
struct dim_energy : physical::dim_energy<dim_energy, foot_poundal, dim_force, dim_length> {};
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
+58
View File
@@ -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, "ftlbf", 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
+47
View File
@@ -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/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 dim_length : physical::dim_length<foot> {};
template<Unit U, Scalar Rep = double>
using length = quantity<dim_length, U, Rep>;
inline namespace literals {
// 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); }
}
} // namespace units::physical::fps
+47
View File
@@ -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/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>;
inline namespace literals {
// g
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); }
}
} // namespace units::physical::fps
+55
View File
@@ -0,0 +1,55 @@
// 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 foot_pound_force_per_second : scaled_unit<ratio<32'174'049, 1'000'000>, foot_poundal_per_second> {};
struct dim_power : physical::dim_power<dim_power, foot_poundal_per_second, dim_energy, dim_time> {};
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); }
} // namespace literals
} // namespace units::physical::fps
+56
View File
@@ -0,0 +1,56 @@
// 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 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_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
+46
View File
@@ -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/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>;
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); }
} // namespace literals
} // namespace units::physical::fps
+42
View File
@@ -0,0 +1,42 @@
// 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::dim_time;
using si::time;
inline namespace literals {
using si::literals::operator"" q_s;
}
} // namespace units::physical::fps