forked from mpusz/mp-units
Momentum support added
This commit is contained in:
@@ -80,6 +80,9 @@ struct dim_acceleration : derived_dimension<Child, U, exp<L, 1>, exp<T, -2>> {};
|
||||
template<typename Child, Unit U, DimensionOf<dim_mass> M, DimensionOf<dim_acceleration> A>
|
||||
struct dim_force : derived_dimension<Child, U, exp<M, 1>, exp<A, 1>> {};
|
||||
|
||||
template<typename Child, Unit U, DimensionOf<dim_mass> M, DimensionOf<dim_velocity> V>
|
||||
struct dim_momentum : derived_dimension<Child, U, exp<M, 1>, exp<V, 1>> {};
|
||||
|
||||
template<typename Child, Unit U, DimensionOf<dim_force> F, DimensionOf<dim_length> L>
|
||||
struct dim_energy : derived_dimension<Child, U, exp<F, 1>, exp<L, 1>> {};
|
||||
|
||||
@@ -148,6 +151,9 @@ concept Acceleration = physical::QuantityOf<T, physical::dim_acceleration>;
|
||||
template<typename T>
|
||||
concept Force = physical::QuantityOf<T, physical::dim_force>;
|
||||
|
||||
template<typename T>
|
||||
concept Momentum = physical::QuantityOf<T, physical::dim_momentum>;
|
||||
|
||||
template<typename T>
|
||||
concept Energy = physical::QuantityOf<T, physical::dim_energy>;
|
||||
|
||||
|
46
src/include/units/physical/si/momentum.h
Normal file
46
src/include/units/physical/si/momentum.h
Normal 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/si/mass.h>
|
||||
#include <units/physical/si/velocity.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::si {
|
||||
|
||||
struct kilogram_metre_per_second : unit<kilogram_metre_per_second> {};
|
||||
struct dim_momentum : physical::dim_momentum<dim_momentum, kilogram_metre_per_second, dim_mass, dim_velocity> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using momentum = quantity<dim_momentum, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// kgmps
|
||||
constexpr auto operator"" q_kgmps(unsigned long long l) { return momentum<kilogram_metre_per_second, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_kgmps(long double l) { return momentum<kilogram_metre_per_second, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::si
|
Reference in New Issue
Block a user