Added concentration

This commit is contained in:
rbrugo
2020-04-10 16:36:08 +02:00
committed by Mateusz Pusz
parent a6614cace2
commit 8ddd7e1233
5 changed files with 65 additions and 2 deletions
+6
View File
@@ -134,6 +134,9 @@ struct dim_absorbed_dose : derived_dimension<Child, U, exp<E, 1>, exp<M, -1>> {}
template<typename Child, Unit U, DimensionOf<dim_electric_current> I, DimensionOf<dim_length> L>
struct dim_current_density : derived_dimension<Child, U, exp<I, 1>, exp<L, -2>> {};
template<typename Child, Unit U, DimensionOf<dim_substance> M, DimensionOf<dim_length> L>
struct dim_concentration : derived_dimension<Child, U, exp<M, 1>, exp<L, -3>> {};
} // namespace physical
template<typename T>
@@ -223,4 +226,7 @@ concept AbsorbedDose = physical::QuantityOf<T, physical::dim_absorbed_dose>;
template<typename T>
concept CurrentDensity = physical::QuantityOf<T, physical::dim_current_density>;
template<typename T>
concept Concentration = physical::QuantityOf<T, physical::dim_concentration>;
} // namespace units
+1
View File
@@ -26,6 +26,7 @@
#include "si/area.h"
#include "si/capacitance.h"
#include "si/catalytic_activity.h"
#include "si/concentration.h"
#include "si/conductance.h"
#include "si/constants.h"
#include "si/current_density.h"
@@ -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/physical/si/substance.h>
#include <units/quantity.h>
namespace units::si {
struct mol_per_metre_cub : unit<mol_per_metre_cub> {};
struct dim_concentration : physical::dim_concentration<dim_concentration, mol_per_metre_cub, dim_substance, dim_length> {};
template<Unit U, Scalar Rep = double>
using concentration = quantity<dim_concentration, U, Rep>;
inline namespace literals {
// mol/m³
constexpr auto operator"" q_mol_per_m3(unsigned long long l) { return concentration<mol_per_metre_cub, std::int64_t>(l); }
constexpr auto operator"" q_mol_per_m3(long double l) { return concentration<mol_per_metre_cub, long double>(l); }
} // namespace literals
} // namespace units::si