forked from mpusz/mp-units
Added catalytic activity
This commit is contained in:
@@ -122,6 +122,12 @@ struct dim_inductance : derived_dimension<Child, U, exp<F, 1>, exp<I, -1>> {};
|
||||
template<typename Child, Unit U, DimensionOf<dim_resistance> R>
|
||||
struct dim_conductance : derived_dimension<Child, U, exp<R, -1>> {};
|
||||
|
||||
// template<typename Child, Unit U, DimensionOf<dim_time> T>
|
||||
// struct dim_radioactivity : derived_dimension<Child, U, exp<T, -1>> {};
|
||||
|
||||
template<typename Child, Unit U, DimensionOf<dim_time> T, DimensionOf<dim_substance> M>
|
||||
struct dim_catalytic_activity : derived_dimension<Child, U, exp<T, -1>, exp<M, 1>> {};
|
||||
|
||||
} // namespace physical
|
||||
|
||||
template<typename T>
|
||||
@@ -190,13 +196,19 @@ concept Pressure = physical::QuantityOf<T, physical::dim_pressure>;
|
||||
template<typename T>
|
||||
concept MagneticInduction = physical::QuantityOf<T, physical::dim_magnetic_induction>;
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
concept MagneticFlux = physical::QuantityOf<T, physical::dim_magnetic_flux>;
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
concept Inductance = physical::QuantityOf<T, physical::dim_inductance>;
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
concept Conductance = physical::QuantityOf<T, physical::dim_inductance>;
|
||||
|
||||
// template<typename T>
|
||||
// concept Radioactivity = physical::QuantityOf<T, physical::dim_radioactivity>;
|
||||
|
||||
template<typename T>
|
||||
concept CatalyticActivity = physical::QuantityOf<T, physical::dim_catalytic_activity>;
|
||||
|
||||
} // namespace units
|
||||
|
60
src/include/units/physical/si/catalytic_activity.h
Normal file
60
src/include/units/physical/si/catalytic_activity.h
Normal file
@@ -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/si/substance.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::si {
|
||||
|
||||
struct katal : named_unit<katal, "kat", prefix> {};
|
||||
struct nanokatal : prefixed_unit<nanokatal, nano, katal> {};
|
||||
|
||||
struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", prefix, ratio<1, 60, -6>, katal> {};
|
||||
|
||||
struct dim_catalytic_activity : physical::dim_catalytic_activity<dim_catalytic_activity, katal, dim_time, dim_substance> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
using catalytic_activity = quantity<dim_catalytic_activity, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
// kat
|
||||
constexpr auto operator"" q_kat(unsigned long long l) { return catalytic_activity<katal, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_kat(long double l) { return catalytic_activity<katal, long double>(l); }
|
||||
|
||||
// nkat
|
||||
constexpr auto operator"" q_nkat(unsigned long long l) { return catalytic_activity<nanokatal, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_nkat(long double l) { return catalytic_activity<nanokatal, long double>(l); }
|
||||
|
||||
// U
|
||||
constexpr auto operator"" q_U(unsigned long long l) { return catalytic_activity<enzyme_unit, std::int64_t>(l); }
|
||||
constexpr auto operator"" q_U(long double l) { return catalytic_activity<enzyme_unit, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::si
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "units/physical/si/magnetic_flux.h"
|
||||
#include "units/physical/si/inductance.h"
|
||||
#include "units/physical/si/conductance.h"
|
||||
#include "units/physical/si/catalytic_activity.h"
|
||||
#include "units/format.h"
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
@@ -229,6 +230,12 @@ TEST_CASE("fmt::format on synthesized unit symbols", "[text][fmt]")
|
||||
CHECK(fmt::format("{}", 1q_nS) == "1 nS");
|
||||
}
|
||||
|
||||
SECTION("catalytic activity")
|
||||
{
|
||||
CHECK(fmt::format("{}", 1q_kat) == "1 kat");
|
||||
CHECK(fmt::format("{}", 1q_U) == "1 U");
|
||||
}
|
||||
|
||||
SECTION("addition with common ratio")
|
||||
{
|
||||
CHECK(fmt::format("{}", 1q_in + 1q_yd) == "37 in");
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include <units/physical/si/magnetic_flux.h>
|
||||
#include <units/physical/si/inductance.h>
|
||||
#include <units/physical/si/conductance.h>
|
||||
#include <units/physical/si/catalytic_activity.h>
|
||||
#include <utility>
|
||||
|
||||
namespace {
|
||||
@@ -236,6 +237,11 @@ static_assert(millisiemens::symbol == "mS");
|
||||
static_assert(microsiemens::symbol == basic_symbol_text("µS", "uS"));
|
||||
static_assert(nanosiemens::symbol == "nS");
|
||||
|
||||
// catalytic activity
|
||||
|
||||
static_assert(1q_kat == 1q_mol / 1q_s);
|
||||
static_assert(1'000'000q_U == 1q_mol / 1q_min);
|
||||
|
||||
/* ************** DERIVED DIMENSIONS IN TERMS OF BASE UNITS **************** */
|
||||
|
||||
// velocity
|
||||
|
Reference in New Issue
Block a user