forked from mpusz/mp-units
Added electric field strength
This commit is contained in:
@@ -152,6 +152,12 @@ struct dim_specific_heat_capacity : derived_dimension<Child, U, exp<C, 1>, exp<M
|
||||
template<typename Child, Unit U, DimensionOf<dim_power> P, DimensionOf<dim_length> L, DimensionOf<dim_thermodynamic_temperature> T>
|
||||
struct dim_thermal_conductivity : derived_dimension<Child, U, exp<P, 1>, exp<L, -1>, exp<T, -1>> {};
|
||||
|
||||
template<typename Child, Unit U, DimensionOf<dim_energy> E, DimensionOf<dim_length> L>
|
||||
struct dim_energy_density : derived_dimension<Child, U, exp<E, 1>, exp<L, -3>> {};
|
||||
|
||||
template<typename Child, Unit U, DimensionOf<dim_voltage> V, DimensionOf<dim_length> L>
|
||||
struct dim_electric_field_strength : derived_dimension<Child, U, exp<V, 1>, exp<L, -1>> {};
|
||||
|
||||
} // namespace physical
|
||||
|
||||
template<typename T>
|
||||
@@ -199,6 +205,9 @@ concept Momentum = physical::QuantityOf<T, physical::dim_momentum>;
|
||||
template<typename T>
|
||||
concept Energy = physical::QuantityOf<T, physical::dim_energy>;
|
||||
|
||||
template<typename T>
|
||||
concept Density = physical::QuantityOf<T, physical::dim_density>;
|
||||
|
||||
template<typename T>
|
||||
concept Power = physical::QuantityOf<T, physical::dim_power>;
|
||||
|
||||
@@ -259,4 +268,10 @@ concept SpecificHeatCapacity = physical::QuantityOf<T, physical::dim_specific_he
|
||||
template<typename T>
|
||||
concept ThermalConductivity = physical::QuantityOf<T, physical::dim_thermal_conductivity>;
|
||||
|
||||
// template<typename T>
|
||||
// concept EnergyDensity = physical::QuantityOf<T, physical::dim_energy_density>;
|
||||
|
||||
template<typename T>
|
||||
concept ElectricFieldStrength = physical::QuantityOf<T, physical::dim_electric_field_strength>;
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "si/current_density.h"
|
||||
#include "si/density.h"
|
||||
#include "si/dynamic_viscosity.h"
|
||||
#include "si/electric_field_strength.h"
|
||||
#include "si/frequency.h"
|
||||
#include "si/heat_capacity.h"
|
||||
#include "si/inductance.h"
|
||||
|
||||
@@ -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/si/voltage.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::si {
|
||||
|
||||
struct volt_per_metre : unit<volt_per_metre> {};
|
||||
struct dim_electric_field_strength : physical::dim_electric_field_strength<dim_electric_field_strength, volt_per_metre, dim_voltage, dim_length> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using electric_field_strength = quantity<dim_electric_field_strength, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// V/m
|
||||
constexpr auto operator"" q_V_per_m(unsigned long long l) { return electric_field_strength<volt_per_metre, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_V_per_m(long double l) { return electric_field_strength<volt_per_metre, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::si
|
||||
Reference in New Issue
Block a user