Physical units put in the physical namespace (I am sorry)

This commit is contained in:
Mateusz Pusz
2020-05-08 22:39:24 +02:00
parent 771a9a1551
commit 7e935a4108
117 changed files with 352 additions and 349 deletions

View File

@@ -54,7 +54,7 @@ the below example for a quick preview of basic library features:
#include <units/physical/international/velocity.h>
#include <iostream>
using namespace units;
using namespace units::physical;
constexpr Velocity auto avg_speed(Length auto d, Time auto t)
{
@@ -63,7 +63,7 @@ constexpr Velocity auto avg_speed(Length auto d, Time auto t)
int main()
{
using namespace si::literals;
using namespace units::physical::si::literals;
Velocity auto v1 = avg_speed(220q_km, 2q_h);
Velocity auto v2 = avg_speed(si::length<international::mile>(140), si::time<si::hour>(2));
Velocity auto v3 = quantity_cast<si::metre_per_second>(v2);

View File

@@ -148,7 +148,7 @@ in the design documentation.
Coming back to units, here are a few examples of unit definitions:
```cpp
namespace units::si {
namespace units::physical::si {
// prefixes
struct prefix : prefix_family {};
@@ -170,7 +170,7 @@ struct kilometre_per_hour : deduced_unit<kilometre_per_hour, dim_velocity, kilom
}
namespace units::us {
namespace units::physical::us {
// length
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio<9'144, 10'000>, si::metre> {};
@@ -224,7 +224,7 @@ These identifiers provide total ordering of exponents of base dimensions in a de
The SI physical units system defines 7 base dimensions:
```cpp
namespace units::si {
namespace units::physical::si {
struct dim_length : base_dimension<"L", metre> {};
struct dim_mass : base_dimension<"M", kilogram> {};
@@ -244,7 +244,7 @@ base unit is needed for the text output of unnamed derived units. Second, there
one system of physical units. For example CGS definitions look as follows:
```cpp
namespace units::cgs {
namespace units::physical::cgs {
using si::centimetre;
using si::gram;
@@ -354,7 +354,7 @@ directly define a barye in terms of pascal or vice versa.
Below are a few examples of derived dimension definitions:
```cpp
namespace units::si {
namespace units::physical::si {
struct dim_velocity : derived_dimension<dim_velocity, metre_per_second,
exp<dim_length, 1>, exp<dim_time, -1>> {};
@@ -448,8 +448,8 @@ Beside adding new elements a few other changes where applied compared to the `st
To simplify writing efficient generic code quantities of each dimension have associated:
1. Concept (i.e. `units::Length`) that matches a length dimension of any physical systems.
2. Per-system quantity alias (i.e. `units::si::length<Unit, Rep>` for
`units::quantity<units::si::dim_length, Unit, Rep>`).
2. Per-system quantity alias (i.e. `units::physical::si::length<Unit, Rep>` for
`units::quantity<units::physical::si::dim_length, Unit, Rep>`).
Also, to help instantiate quantities with compile-time known values every unit in the library
has an associated UDL. For example:
@@ -603,9 +603,9 @@ user. If we will get a compilation error message containing `dim_capacitance` in
the compiler will print the following type instead of the alias:
```text
units::detail::derived_dimension_base<units::exp<units::si::dim_electric_current, 2, 1>,
units::exp<units::si::dim_length, -2, 1>, units::exp<units::si::dim_mass, -1, 1>,
units::exp<units::si::dim_time, 4, 1> >
units::detail::derived_dimension_base<units::exp<units::physical::si::dim_electric_current, 2, 1>,
units::exp<units::physical::si::dim_length, -2, 1>, units::exp<units::physical::si::dim_mass, -1, 1>,
units::exp<units::physical::si::dim_time, 4, 1> >
```
You can notice that even this long syntax was carefully selected to provide quite good user
@@ -760,8 +760,8 @@ struct unknown_dimension : derived_dimension<unknown_dimension<E, ERest...>,
with this the error log or a debugger breakpoint involving a `temp1` type will include:
```text
units::quantity<units::unknown_dimension<units::exp<units::si::dim_length, 2, 1>,
units::exp<units::si::dim_time, -1, 1> >, units::unknown_coherent_unit, long int>
units::quantity<units::unknown_dimension<units::exp<units::physical::si::dim_length, 2, 1>,
units::exp<units::physical::si::dim_time, -1, 1> >, units::unknown_coherent_unit, long int>
```

View File

@@ -6,6 +6,7 @@ Design Deep Dive
For brevity all the code examples in this chapter assume::
using namespace units;
using namespace units::physical;
.. toctree::
:maxdepth: 2

View File

@@ -6,6 +6,7 @@ Framework Basics
For brevity all the code examples in this chapter assume::
using namespace units;
using namespace units::physical;
.. toctree::
:maxdepth: 2

View File

@@ -47,7 +47,7 @@ values the library provides :abbr:`UDL (User Defined Literal)` s for each
:term:`unit` of every :term:`dimension`. Thanks to them the same code can
be as simple as::
using namespace si::literals;
using namespace units::physical::si::literals;
constexpr auto d1 = 123q_km; // si::length<si::kilometre, std::int64_t>
constexpr auto d2 = 123.q_km; // si::length<si::kilometre, long double>
@@ -66,7 +66,7 @@ In case the user does not care about the specific unit and representation but
requires quantity of a concrete dimension than dimension-specific concepts can
be used::
using namespace si::literals;
using namespace units::physical::si::literals;
constexpr Length auto d = 123q_km; // si::length<si::kilometre, std::int64_t>
.. note::
@@ -80,8 +80,8 @@ assume that the user wants to implement an ``avg_speed`` function that will
be calculating the average speed based on provided distance and duration
quantities. The usage of such a function can look as follows::
using namespace si::literals;
using namespace international::literals;
using namespace units::physical::si::literals;
using namespace units::physical::international::literals;
constexpr Velocity auto v1 = avg_speed(220q_km, 2q_h);
constexpr Velocity auto v2 = avg_speed(140q_mi, 2q_h);

View File

@@ -12,8 +12,8 @@ Output Streams
The easiest way to print a quantity is to provide its object to the output
stream::
using namespace si::literals;
using namespace international::literals;
using namespace units::physical::si::literals;
using namespace units::physical::international::literals;
constexpr Velocity auto v1 = avg_speed(220.q_km, 2q_h);
constexpr Velocity auto v2 = avg_speed(140.q_mi, 2q_h);
std::cout << v1 << '\n'; // 110 km/h

View File

@@ -161,8 +161,8 @@ of ``N/m``):
:emphasize-lines: 2
struct dim_surface_tension : derived_dimension<dim_surface_tension, newton_per_metre,
exp<si::dim_force, 1>,
exp<si::dim_length, -1>> {}; // N/m
exp<si::dim_force, 1>,
exp<si::dim_length, -1>> {}; // N/m
If we defined the above in terms of base units we would end up with
a ``kg/s²`` derived unit symbol.
@@ -361,7 +361,7 @@ and user should not instantiate it by him/her-self. However the user can sometim
observe this type in case an unit/dimension conversion expression will end up with an
unknown/undefined unit type like in the below example::
using namespace si::literals;
using namespace units::physical::si::literals;
Length auto l = 100q_km_per_h * 10q_s;

View File

@@ -32,7 +32,7 @@ of basic library features::
#include <units/physical/international/velocity.h>
#include <iostream>
using namespace units;
using namespace units::physical;
constexpr Velocity auto avg_speed(Length auto d, Time auto t)
{
@@ -41,7 +41,7 @@ of basic library features::
int main()
{
using namespace si::literals;
using namespace units::physical::si::literals;
Velocity auto v1 = avg_speed(220q_km, 2q_h);
Velocity auto v2 = avg_speed(si::length<international::mile>(140), si::time<si::hour>(2));
Velocity auto v3 = quantity_cast<si::metre_per_second>(v2);

View File

@@ -8,7 +8,7 @@ Systems
SI
--
.. doxygennamespace:: units::si
.. doxygennamespace:: units::physical::si
:members:
:undoc-members:
:outline:

View File

@@ -6,6 +6,7 @@ Use Cases
For brevity all the code examples in this chapter assume::
using namespace units;
using namespace units::physical;
.. toctree::
:maxdepth: 2

View File

@@ -21,7 +21,7 @@ pass it to the library's output:
#include "legacy.h"
#include <units/physical/si/velocity.h>
using namespace units;
using namespace units::physical;
constexpr Velocity auto avg_speed(Length auto d, Time auto t)
{

View File

@@ -9,7 +9,7 @@ namespace experimental{
namespace acceleration {
template<typename Rep = double>
using m_per_s2 = units::si::acceleration<units::si::metre_per_second_sq, Rep>;
using m_per_s2 = units::physical::si::acceleration<units::physical::si::metre_per_second_sq, Rep>;
template<typename Rep = double>
constexpr m_per_s2<Rep> g{static_cast<Rep>(9.80665)};

View File

@@ -6,9 +6,9 @@
namespace area {
template<typename Rep = double>
using m2 = units::si::area<units::si::square_metre, Rep>;
using m2 = units::physical::si::area<units::physical::si::square_metre, Rep>;
template<typename Rep = double>
using fm2 = units::si::area<units::si::square_femtometre, Rep>;
using fm2 = units::physical::si::area<units::physical::si::square_femtometre, Rep>;
} // namespace area

View File

@@ -52,7 +52,7 @@ struct Box {
#include <iostream>
using namespace units::si::literals;
using namespace units::physical::si::literals;
int main()
{

View File

@@ -28,7 +28,7 @@
#include <iostream>
using namespace units::experimental;
using namespace units::si::literals;
using namespace units::physical::si::literals;
int main()
{

View File

@@ -24,8 +24,8 @@
#include "./area.h"
#include "./units_str.h"
using namespace units::si::literals;
using namespace units::international;
using namespace units::physical::si::literals;
using namespace units::physical::international;
using namespace units::experimental;
void simple_quantities()

View File

@@ -40,7 +40,7 @@ inline constexpr std::common_type_t<typename Target::rep, typename Source::rep>
} // namespace
using namespace units::si::literals;
using namespace units::physical::si::literals;
using namespace units::experimental;
int main()

View File

@@ -10,7 +10,7 @@ namespace experimental{
namespace density {
template<typename Rep = double>
using kg_per_m3 = units::si::density<units::si::kilogram_per_metre_cub, Rep>;
using kg_per_m3 = units::physical::si::density<units::physical::si::kilogram_per_metre_cub, Rep>;
}

View File

@@ -9,7 +9,7 @@ namespace experimental{
namespace force {
template<typename Rep = double>
using N = units::si::force<units::si::newton, Rep>;
using N = units::physical::si::force<units::physical::si::newton, Rep>;
}

View File

@@ -15,70 +15,70 @@ namespace experimental{
namespace length {
template<typename Rep = double>
using m = units::si::length<units::si::metre, Rep>;
using m = units::physical::si::length<units::physical::si::metre, Rep>;
template<typename Rep = double>
using mm = units::si::length<units::si::millimetre, Rep>;
using mm = units::physical::si::length<units::physical::si::millimetre, Rep>;
template<typename Rep = double>
using fm = units::si::length<units::si::femtometre, Rep>;
using fm = units::physical::si::length<units::physical::si::femtometre, Rep>;
template<typename Rep = double>
using km = units::si::length<units::si::kilometre, Rep>;
using km = units::physical::si::length<units::physical::si::kilometre, Rep>;
template<typename Rep = double>
using AU = units::si::length<units::si::astronomical_unit, Rep>;
using AU = units::physical::si::length<units::physical::si::astronomical_unit, Rep>;
template<typename Rep = double>
using in = units::si::length<units::international::inch, Rep>;
using in = units::physical::si::length<units::physical::international::inch, Rep>;
template<typename Rep = double>
using angstrom = units::si::length<units::iau::angstrom, Rep>;
using angstrom = units::physical::si::length<units::physical::iau::angstrom, Rep>;
template<typename Rep = double>
using ch = units::si::length<units::imperial::chain, Rep>;
using ch = units::physical::si::length<units::physical::imperial::chain, Rep>;
template<typename Rep = double>
using fathom = units::si::length<units::international::fathom, Rep>;
using fathom = units::physical::si::length<units::physical::international::fathom, Rep>;
template<typename Rep = double>
using fathom_us = units::si::length<units::us::fathom, Rep>;
using fathom_us = units::physical::si::length<units::physical::us::fathom, Rep>;
template<typename Rep = double>
using ft = units::si::length<units::international::foot, Rep>;
using ft = units::physical::si::length<units::physical::international::foot, Rep>;
template<typename Rep = double>
using ft_us = units::si::length<units::us::foot, Rep>;
using ft_us = units::physical::si::length<units::physical::us::foot, Rep>;
template<typename Rep = double>
using ly = units::si::length<units::iau::light_year, Rep>;
using ly = units::physical::si::length<units::physical::iau::light_year, Rep>;
template<typename Rep = double>
using mi = units::si::length<units::international::mile, Rep>;
using mi = units::physical::si::length<units::physical::international::mile, Rep>;
template<typename Rep = double>
using mi_naut = units::si::length<units::international::nautical_mile, Rep>;
using mi_naut = units::physical::si::length<units::physical::international::nautical_mile, Rep>;
template<typename Rep = double>
using pc = units::si::length<units::iau::parsec, Rep>;
using pc = units::physical::si::length<units::physical::iau::parsec, Rep>;
template<typename Rep = double>
using pica_comp = units::si::length<units::typographic::pica_comp, Rep>;
using pica_comp = units::physical::si::length<units::physical::typographic::pica_comp, Rep>;
template<typename Rep = double>
using pica_prn = units::si::length<units::typographic::pica_prn, Rep>;
using pica_prn = units::physical::si::length<units::physical::typographic::pica_prn, Rep>;
template<typename Rep = double>
using point_comp = units::si::length<units::typographic::point_comp, Rep>;
using point_comp = units::physical::si::length<units::physical::typographic::point_comp, Rep>;
template<typename Rep = double>
using point_prn = units::si::length<units::typographic::point_prn, Rep>;
using point_prn = units::physical::si::length<units::physical::typographic::point_prn, Rep>;
template<typename Rep = double>
using rd = units::si::length<units::imperial::rod, Rep>;
using rd = units::physical::si::length<units::physical::imperial::rod, Rep>;
template<typename Rep = double>
using yd = units::si::length<units::international::yard, Rep>;
using yd = units::physical::si::length<units::physical::international::yard, Rep>;
} // namespace length

View File

@@ -10,7 +10,7 @@ namespace experimental{
namespace mass {
template<typename Rep = double>
using kg = units::si::mass<units::si::kilogram, Rep>;
using kg = units::physical::si::mass<units::physical::si::kilogram, Rep>;
}

View File

@@ -7,15 +7,15 @@
namespace q_time {
template<typename Rep = double>
using s = units::si::time<units::si::second, Rep>;
using s = units::physical::si::time<units::physical::si::second, Rep>;
template<typename Rep = double>
using ms = units::si::time<units::si::millisecond, Rep>;
using ms = units::physical::si::time<units::physical::si::millisecond, Rep>;
template<typename Rep = double>
using min = units::si::time<units::si::minute, Rep>;
using min = units::physical::si::time<units::physical::si::minute, Rep>;
template<typename Rep = double>
using h = units::si::time<units::si::hour, Rep>;
using h = units::physical::si::time<units::physical::si::hour, Rep>;
} // namespace time

View File

@@ -7,7 +7,7 @@
*/
using namespace units::experimental;
using namespace units::si::literals;
using namespace units::physical::si::literals;
int main()
{

View File

@@ -10,19 +10,19 @@ namespace experimental{
namespace voltage {
template<typename Rep = double>
using V = units::si::voltage<units::si::volt, Rep>;
using V = units::physical::si::voltage<units::physical::si::volt, Rep>;
template<typename Rep = double>
using mV = units::si::voltage<units::si::millivolt, Rep>;
using mV = units::physical::si::voltage<units::physical::si::millivolt, Rep>;
template<typename Rep = double>
using uV = units::si::voltage<units::si::microvolt, Rep>;
using uV = units::physical::si::voltage<units::physical::si::microvolt, Rep>;
template<typename Rep = double>
using nV = units::si::voltage<units::si::nanovolt, Rep>;
using nV = units::physical::si::voltage<units::physical::si::nanovolt, Rep>;
template<typename Rep = double>
using pV = units::si::voltage<units::si::picovolt, Rep>;
using pV = units::physical::si::voltage<units::physical::si::picovolt, Rep>;
} // namespace voltage

View File

@@ -10,7 +10,7 @@ namespace experimental{
namespace volume {
template<typename Rep = double>
using m3 = units::si::volume<units::si::cubic_metre, Rep>;
using m3 = units::physical::si::volume<units::physical::si::cubic_metre, Rep>;
}

View File

@@ -27,47 +27,47 @@
namespace {
constexpr units::si::velocity<units::si::metre_per_second, int>
fixed_int_si_avg_speed(units::si::length<units::si::metre, int> d,
units::si::time<units::si::second, int> t)
using namespace units::physical;
constexpr si::velocity<si::metre_per_second, int>
fixed_int_si_avg_speed(si::length<si::metre, int> d,
si::time<si::second, int> t)
{
return d / t;
}
constexpr units::si::velocity<units::si::metre_per_second>
fixed_double_si_avg_speed(units::si::length<units::si::metre> d,
units::si::time<units::si::second> t)
constexpr si::velocity<si::metre_per_second>
fixed_double_si_avg_speed(si::length<si::metre> d,
si::time<si::second> t)
{
return d / t;
}
template<typename U1, typename R1, typename U2, typename R2>
constexpr units::Velocity AUTO si_avg_speed(units::si::length<U1, R1> d,
units::si::time<U2, R2> t)
constexpr Velocity AUTO si_avg_speed(si::length<U1, R1> d,
si::time<U2, R2> t)
{
return d / t;
}
constexpr units::Velocity AUTO avg_speed(units::Length AUTO d, units::Time AUTO t)
constexpr Velocity AUTO avg_speed(Length AUTO d, Time AUTO t)
{
return d / t;
}
template<units::Length D, units::Time T, units::Velocity V>
template<Length D, Time T, Velocity V>
void print_result(D distance, T duration, V velocity)
{
const auto result_in_kmph = units::quantity_cast<units::si::velocity<units::si::kilometre_per_hour>>(velocity);
const auto result_in_kmph = units::quantity_cast<si::velocity<si::kilometre_per_hour>>(velocity);
std::cout << "Average speed of a car that makes " << distance << " in "
<< duration << " is " << result_in_kmph << ".\n";
}
void example()
{
using namespace units;
// SI (int)
{
using namespace units::si::literals;
using namespace units::physical::si::literals;
constexpr Length AUTO distance = 220q_km; // constructed from a UDL
constexpr si::time<si::hour, int> duration(2); // constructed from a value
@@ -81,7 +81,7 @@ void example()
// SI (double)
{
using namespace units::si::literals;
using namespace units::physical::si::literals;
constexpr Length AUTO distance = 220.q_km; // constructed from a UDL
constexpr si::time<si::hour> duration(2); // constructed from a value
@@ -97,7 +97,7 @@ void example()
// Customary Units (int)
{
using namespace units::international::literals;
using namespace units::physical::international::literals;
constexpr Length AUTO distance = 140q_mi; // constructed from a UDL
constexpr si::time<si::hour, int> duration(2); // constructed from a value
@@ -113,7 +113,7 @@ void example()
// Customary Units (double)
{
using namespace units::international::literals;
using namespace units::physical::international::literals;
constexpr Length AUTO distance = 140q_mi; // constructed from a UDL
constexpr si::time<si::hour> duration(2); // constructed from a value
@@ -131,7 +131,7 @@ void example()
// CGS (int)
{
using namespace units::cgs::literals;
using namespace units::physical::cgs::literals;
constexpr Length AUTO distance = 22'000'000q_cm; // constructed from a UDL
constexpr cgs::time<si::hour, int> duration(2); // constructed from a value
@@ -150,7 +150,7 @@ void example()
// CGS (double)
{
using namespace units::cgs::literals;
using namespace units::physical::cgs::literals;
constexpr Length AUTO distance = 22'000'000q_cm; // constructed from a UDL
constexpr cgs::time<si::hour> duration(2); // constructed from a value

View File

@@ -11,8 +11,8 @@
namespace {
using namespace units;
using namespace units::si::literals;
using namespace units::physical;
using namespace units::physical::si::literals;
using m = si::metre;
using kg = si::kilogram;

View File

@@ -29,8 +29,8 @@
int main()
{
using namespace units;
using namespace units::si;
using namespace units::physical;
using namespace units::physical::si;
std::cout << "mp-units capacitor time curve example...\n";
std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield);

View File

@@ -33,11 +33,11 @@ using namespace units;
void simple_quantities()
{
using namespace units::si;
using namespace units::international;
using namespace units::physical::si;
using namespace units::physical::international;
using distance = length<metre>;
using duration = si::time<second>;
using duration = physical::si::time<second>;
constexpr distance km = 1.0q_km;
constexpr distance miles = 1.0q_mi;
@@ -57,8 +57,9 @@ void simple_quantities()
void quantities_with_typed_units()
{
using namespace units::si;
using namespace units::international;
using namespace units::physical;
using namespace units::physical::si;
using namespace units::physical::international;
constexpr length<kilometre> km = 1.0q_km;
constexpr length<mile> miles = 1.0q_mi;
@@ -104,7 +105,7 @@ void quantities_with_typed_units()
void calcs_comparison()
{
using namespace units::si;
using namespace units::physical::si;
std::cout << "\nA distinct unit for each type is efficient and accurate\n"
"when adding two values of the same very big\n"

View File

@@ -41,7 +41,7 @@ inline constexpr std::common_type_t<typename Target::rep, typename Source::rep>
int main()
{
using namespace units::si;
using namespace units::physical::si;
std::cout << "conversion factor in mp-units...\n\n";

View File

@@ -25,7 +25,7 @@
#include <units/format.h>
#include <iostream>
using namespace units;
using namespace units::physical;
constexpr Velocity AUTO avg_speed(Length AUTO d, Time AUTO t)
{
@@ -34,7 +34,7 @@ constexpr Velocity AUTO avg_speed(Length AUTO d, Time AUTO t)
int main()
{
using namespace si::literals;
using namespace units::physical::si::literals;
Velocity AUTO v1 = avg_speed(220q_km, 2q_h);
Velocity AUTO v2 = avg_speed(si::length<international::mile>(140), si::time<si::hour>(2));
Velocity AUTO v3 = quantity_cast<si::metre_per_second>(v2);

View File

@@ -20,7 +20,7 @@ struct state_variable {
Q predicted_next_state;
};
using namespace units::si;
using namespace units::physical::si;
constexpr auto radar_transmit_interval = 5.0q_s;
constexpr double kalman_range_gain = 0.2;

View File

@@ -55,8 +55,8 @@ std::ostream& operator<<(std::ostream& os, const std::experimental::math::matrix
using namespace std::experimental::math;
using namespace units;
using namespace si::literals;
using namespace units::physical;
using namespace units::physical::si::literals;
template<typename Rep = double>
using vector = fs_vector<Rep, 3>;
@@ -201,10 +201,10 @@ void matrix_of_quantity_tests()
matrix_of_quantity_divide_by_scalar();
}
template<Unit U = si::metre, Scalar Rep = double>
template<units::Unit U = si::metre, units::Scalar Rep = double>
using length_v = si::length<U, vector<Rep>>;
template<Unit U = si::newton, Scalar Rep = double>
template<units::Unit U = si::newton, units::Scalar Rep = double>
using force_v = si::force<U, vector<Rep>>;
void quantity_of_vector_add()

View File

@@ -157,7 +157,7 @@ namespace {
void example()
{
using namespace units;
using namespace units::physical;
const auto a = si::acceleration<si::metre_per_second_sq, measurement<double>>(measurement(9.8, 0.1));
const auto t = si::time<si::second, measurement<double>>(measurement(1.2, 0.1));

View File

@@ -30,7 +30,7 @@
namespace {
using namespace units;
using namespace units::physical;
Energy AUTO total_energy(Momentum AUTO p, Mass AUTO m, Velocity AUTO c)
{
@@ -39,7 +39,7 @@ Energy AUTO total_energy(Momentum AUTO p, Mass AUTO m, Velocity AUTO c)
void si_example()
{
using namespace si;
using namespace units::physical::si;
using GeV = gigaelectronvolt;
constexpr Velocity AUTO c = si2019::speed_of_light<>;
@@ -70,7 +70,7 @@ void si_example()
void natural_example()
{
using namespace natural;
using namespace units::physical::natural;
using GeV = gigaelectronvolt;
constexpr Velocity AUTO c = speed_of_light<>;

View File

@@ -25,23 +25,24 @@
namespace {
template<units::Length D, units::Time T>
constexpr units::Velocity AUTO avg_speed(D d, T t)
template<units::physical::Length D, units::physical::Time T>
constexpr units::physical::Velocity AUTO avg_speed(D d, T t)
{
return d / t;
}
void example()
{
using namespace units::si::literals;
using namespace units::physical;
using namespace units::physical::si::literals;
units::Length AUTO d1 = 123q_m;
units::Time AUTO t1 = 10q_s;
units::Velocity AUTO v1 = avg_speed(d1, t1);
Length AUTO d1 = 123q_m;
Time AUTO t1 = 10q_s;
Velocity AUTO v1 = avg_speed(d1, t1);
auto temp1 = v1 * 50q_m; // produces intermediate unknown dimension with 'unknown_coherent_unit' as its 'coherent_unit'
units::Velocity AUTO v2 = temp1 / 100q_m; // back to known dimensions again
units::Length AUTO d2 = v2 * 60q_s;
Velocity AUTO v2 = temp1 / 100q_m; // back to known dimensions again
Length AUTO d2 = v2 * 60q_s;
std::cout << "d1 = " << d1 << '\n';
std::cout << "t1 = " << t1 << '\n';

View File

@@ -30,13 +30,13 @@
namespace units::data {
struct bit_per_second : unit<bit_per_second> {};
struct dim_bitrate : derived_dimension<dim_bitrate, bit_per_second, exp<dim_information, 1>, exp<si::dim_time, -1>> {};
struct dim_bitrate : derived_dimension<dim_bitrate, bit_per_second, exp<dim_information, 1>, exp<physical::si::dim_time, -1>> {};
struct kibibit_per_second : deduced_unit<kibibit_per_second, dim_bitrate, kibibit, si::second> {};
struct mebibit_per_second : deduced_unit<mebibit_per_second, dim_bitrate, mebibit, si::second> {};
struct gibibit_per_second : deduced_unit<gibibit_per_second, dim_bitrate, gibibit, si::second> {};
struct tebibit_per_second : deduced_unit<tebibit_per_second, dim_bitrate, tebibit, si::second> {};
struct pebibit_per_second : deduced_unit<pebibit_per_second, dim_bitrate, pebibit, si::second> {};
struct kibibit_per_second : deduced_unit<kibibit_per_second, dim_bitrate, kibibit, physical::si::second> {};
struct mebibit_per_second : deduced_unit<mebibit_per_second, dim_bitrate, mebibit, physical::si::second> {};
struct gibibit_per_second : deduced_unit<gibibit_per_second, dim_bitrate, gibibit, physical::si::second> {};
struct tebibit_per_second : deduced_unit<tebibit_per_second, dim_bitrate, tebibit, physical::si::second> {};
struct pebibit_per_second : deduced_unit<pebibit_per_second, dim_bitrate, pebibit, physical::si::second> {};
template<typename T>
concept Bitrate = QuantityOf<T, dim_bitrate>;

View File

@@ -35,4 +35,4 @@ struct tebi : units::prefix<tebi, prefix, "Ti", ratio< 1'099'511'627'776>
struct pebi : units::prefix<pebi, prefix, "Pi", ratio< 1'125'899'906'842'624>> {};
struct exbi : units::prefix<exbi, prefix, "Ei", ratio<1'152'921'504'606'846'976>> {};
} // namespace units::si
} // namespace units::data

View File

@@ -26,7 +26,7 @@
#include <units/physical/cgs/velocity.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
struct gal : named_unit<gal, "Gal", si::prefix> {};
struct dim_acceleration : physical::dim_acceleration<dim_acceleration, gal, dim_length, dim_time> {};
@@ -42,4 +42,4 @@ constexpr auto operator"" q_Gal(long double l) { return acceleration<gal, long d
} // namespace literals
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/area.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
using si::square_centimetre;
@@ -44,4 +44,4 @@ constexpr auto operator"" q_cm2(long double l) { return area<square_centimetre,
}
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
struct erg : named_unit<erg, "erg", si::prefix> {};
@@ -44,4 +44,4 @@ constexpr auto operator"" q_erg(long double l) { return energy<erg, long double>
} // namespace literals
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
struct dyne : named_unit<dyne, "dyn", si::prefix> {};
@@ -45,4 +45,4 @@ constexpr auto operator"" q_dyn(long double l) { return force<dyne, long double>
} // namespace literals
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/length.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
using si::centimetre;
@@ -43,4 +43,4 @@ constexpr auto operator"" q_cm(long double l) { return length<centimetre, long d
}
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/mass.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
using si::gram;
@@ -43,4 +43,4 @@ constexpr auto operator"" q_g(long double l) { return mass<gram, long double>(l)
}
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
struct erg_per_second : unit<erg_per_second> {};
@@ -44,4 +44,4 @@ constexpr auto operator"" q_erg_per_s(long double l) { return power<erg_per_seco
} // namespace literals
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
struct barye : named_unit<barye, "Ba", si::prefix> {};
@@ -45,4 +45,4 @@ constexpr auto operator"" q_Ba(long double l) { return pressure<barye, long doub
} // namespace literals
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/time.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
using si::second;
@@ -39,4 +39,4 @@ using si::literals::operator"" q_s;
}
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -27,7 +27,7 @@
#include <units/physical/cgs/time.h>
#include <units/quantity.h>
namespace units::cgs {
namespace units::physical::cgs {
struct centimetre_per_second : unit<centimetre_per_second> {};
struct dim_velocity : physical::dim_velocity<dim_velocity, centimetre_per_second, dim_length, dim_time> {};
@@ -43,4 +43,4 @@ constexpr auto operator"" q_cm_per_s(long double l) { return velocity<centimetre
} // namespace literals
} // namespace units::cgs
} // namespace units::physical::cgs

View File

@@ -27,9 +27,7 @@
#include <units/quantity.h>
#include <units/unit.h>
namespace units {
namespace physical {
namespace units::physical {
template<typename Dim, template<typename...> typename DimTemplate>
concept DimensionOf = Dimension<Dim> && is_derived_from_instantiation<Dim, DimTemplate>;
@@ -178,140 +176,138 @@ struct dim_permeability : derived_dimension<Child, U, exp<H, 1>, exp<L, -1>> {};
template<typename Child, Unit U, DimensionOf<dim_energy> E, DimensionOf<dim_substance> M>
struct dim_molar_energy : derived_dimension<Child, U, exp<E, 1>, exp<M, -1>> {};
} // namespace physical
template<typename T>
concept Length = QuantityOf<T, dim_length>;
template<typename T>
concept Length = physical::QuantityOf<T, physical::dim_length>;
concept Mass = QuantityOf<T, dim_mass>;
template<typename T>
concept Mass = physical::QuantityOf<T, physical::dim_mass>;
concept Time = QuantityOf<T, dim_time>;
template<typename T>
concept Time = physical::QuantityOf<T, physical::dim_time>;
concept Current = QuantityOf<T, dim_electric_current>;
template<typename T>
concept Current = physical::QuantityOf<T, physical::dim_electric_current>;
concept Temperature = QuantityOf<T, dim_thermodynamic_temperature>;
template<typename T>
concept Temperature = physical::QuantityOf<T, physical::dim_thermodynamic_temperature>;
concept Substance = QuantityOf<T, dim_substance>;
template<typename T>
concept Substance = physical::QuantityOf<T, physical::dim_substance>;
concept LuminousIntensity = QuantityOf<T, dim_luminous_intensity>;
template<typename T>
concept LuminousIntensity = physical::QuantityOf<T, physical::dim_luminous_intensity>;
concept Frequency = QuantityOf<T, dim_frequency>;
template<typename T>
concept Frequency = physical::QuantityOf<T, physical::dim_frequency>;
concept Area = QuantityOf<T, dim_area>;
template<typename T>
concept Area = physical::QuantityOf<T, physical::dim_area>;
concept Volume = QuantityOf<T, dim_volume>;
template<typename T>
concept Volume = physical::QuantityOf<T, physical::dim_volume>;
concept Velocity = QuantityOf<T, dim_velocity>;
template<typename T>
concept Velocity = physical::QuantityOf<T, physical::dim_velocity>;
concept Acceleration = QuantityOf<T, dim_acceleration>;
template<typename T>
concept Acceleration = physical::QuantityOf<T, physical::dim_acceleration>;
concept Force = QuantityOf<T, dim_force>;
template<typename T>
concept Force = physical::QuantityOf<T, physical::dim_force>;
concept Momentum = QuantityOf<T, dim_momentum>;
template<typename T>
concept Momentum = physical::QuantityOf<T, physical::dim_momentum>;
concept Energy = QuantityOf<T, dim_energy>;
template<typename T>
concept Energy = physical::QuantityOf<T, physical::dim_energy>;
concept Density = QuantityOf<T, dim_density>;
template<typename T>
concept Density = physical::QuantityOf<T, physical::dim_density>;
concept Power = QuantityOf<T, dim_power>;
template<typename T>
concept Power = physical::QuantityOf<T, physical::dim_power>;
concept Voltage = QuantityOf<T, dim_voltage>;
template<typename T>
concept Voltage = physical::QuantityOf<T, physical::dim_voltage>;
concept ElectricCharge = QuantityOf<T, dim_electric_charge>;
template<typename T>
concept ElectricCharge = physical::QuantityOf<T, physical::dim_electric_charge>;
concept Capacitance = QuantityOf<T, dim_capacitance>;
template<typename T>
concept Capacitance = physical::QuantityOf<T, physical::dim_capacitance>;
concept SurfaceTension = QuantityOf<T, dim_surface_tension>;
template<typename T>
concept SurfaceTension = physical::QuantityOf<T, physical::dim_surface_tension>;
concept Pressure = QuantityOf<T, dim_pressure>;
template<typename T>
concept Pressure = physical::QuantityOf<T, physical::dim_pressure>;
concept MagneticInduction = QuantityOf<T, dim_magnetic_induction>;
template<typename T>
concept MagneticInduction = physical::QuantityOf<T, physical::dim_magnetic_induction>;
concept MagneticFlux = QuantityOf<T, dim_magnetic_flux>;
template<typename T>
concept MagneticFlux = physical::QuantityOf<T, physical::dim_magnetic_flux>;
concept Inductance = QuantityOf<T, dim_inductance>;
template<typename T>
concept Inductance = physical::QuantityOf<T, physical::dim_inductance>;
template<typename T>
concept Conductance = physical::QuantityOf<T, physical::dim_conductance>;
concept Conductance = QuantityOf<T, dim_conductance>;
// TODO Add when downcasting issue is solved
// template<typename T>
// concept Radioactivity = physical::QuantityOf<T, physical::dim_radioactivity>;
// concept Radioactivity = QuantityOf<T, dim_radioactivity>;
template<typename T>
concept CatalyticActivity = physical::QuantityOf<T, physical::dim_catalytic_activity>;
concept CatalyticActivity = QuantityOf<T, dim_catalytic_activity>;
template<typename T>
concept AbsorbedDose = physical::QuantityOf<T, physical::dim_absorbed_dose>;
concept AbsorbedDose = QuantityOf<T, dim_absorbed_dose>;
template<typename T>
concept CurrentDensity = physical::QuantityOf<T, physical::dim_current_density>;
concept CurrentDensity = QuantityOf<T, dim_current_density>;
template<typename T>
concept Concentration = physical::QuantityOf<T, physical::dim_concentration>;
concept Concentration = QuantityOf<T, dim_concentration>;
template<typename T>
concept Luminance = physical::QuantityOf<T, physical::dim_luminance>;
concept Luminance = QuantityOf<T, dim_luminance>;
template<typename T>
concept DynamicViscosity = physical::QuantityOf<T, physical::dim_dynamic_viscosity>;
concept DynamicViscosity = QuantityOf<T, dim_dynamic_viscosity>;
template<typename T>
concept HeatCapacity = physical::QuantityOf<T, physical::dim_heat_capacity>;
concept HeatCapacity = QuantityOf<T, dim_heat_capacity>;
template<typename T>
concept SpecificHeatCapacity = physical::QuantityOf<T, physical::dim_specific_heat_capacity>;
concept SpecificHeatCapacity = QuantityOf<T, dim_specific_heat_capacity>;
template<typename T>
concept MolarHeatCapacity = physical::QuantityOf<T, physical::dim_molar_heat_capacity>;
concept MolarHeatCapacity = QuantityOf<T, dim_molar_heat_capacity>;
template<typename T>
concept ThermalConductivity = physical::QuantityOf<T, physical::dim_thermal_conductivity>;
concept ThermalConductivity = QuantityOf<T, dim_thermal_conductivity>;
// TODO Add when downcasting issue is solved
// template<typename T>
// concept EnergyDensity = physical::QuantityOf<T, physical::dim_energy_density>;
// concept EnergyDensity = QuantityOf<T, dim_energy_density>;
template<typename T>
concept ElectricFieldStrength = physical::QuantityOf<T, physical::dim_electric_field_strength>;
concept ElectricFieldStrength = QuantityOf<T, dim_electric_field_strength>;
template<typename T>
concept ChargeDensity = physical::QuantityOf<T, physical::dim_charge_density>;
concept ChargeDensity = QuantityOf<T, dim_charge_density>;
template<typename T>
concept SurfaceChargeDensity = physical::QuantityOf<T, physical::dim_surface_charge_density>;
concept SurfaceChargeDensity = QuantityOf<T, dim_surface_charge_density>;
template<typename T>
concept Permittivity = physical::QuantityOf<T, physical::dim_permittivity>;
concept Permittivity = QuantityOf<T, dim_permittivity>;
template<typename T>
concept Permeability = physical::QuantityOf<T, physical::dim_permeability>;
concept Permeability = QuantityOf<T, dim_permeability>;
template<typename T>
concept MolarEnergy = physical::QuantityOf<T, physical::dim_molar_energy>;
concept MolarEnergy = QuantityOf<T, dim_molar_energy>;
} // namespace units
} // namespace units::physical

View File

@@ -25,7 +25,7 @@
#include <units/physical/si/length.h>
namespace units::iau {
namespace units::physical::iau {
// https://en.wikipedia.org/wiki/Light-year
struct light_year : named_scaled_unit<light_year, "ly", no_prefix, ratio<9460730472580800>, si::metre> {};
@@ -49,4 +49,4 @@ constexpr auto operator"" q_angstrom(long double l) { return si::length<angstrom
} // namespace literals
} // namespace units::iau
} // namespace units::physical::iau

View File

@@ -24,7 +24,7 @@
#include <units/physical/international/length.h>
namespace units::imperial {
namespace units::physical::imperial {
// https://en.wikipedia.org/wiki/Chain_(unit)
struct chain : named_scaled_unit<chain, "ch", no_prefix, ratio<22, 1>, international::yard> {};
@@ -42,4 +42,4 @@ constexpr auto operator"" q_rd(long double l) { return si::length<rod, long doub
} // namespace literals
} // namespace units::imperial
} // namespace units::physical::imperial

View File

@@ -25,7 +25,7 @@
#include <units/physical/si/area.h>
#include <units/physical/international/length.h>
namespace units::international {
namespace units::physical::international {
struct square_foot : deduced_unit<square_foot, si::dim_area, international::foot> {};
@@ -37,4 +37,4 @@ constexpr auto operator"" q_ft2(long double l) { return si::area<square_foot, lo
} // namespace literals
} // namespace units::international
} // namespace units::physical::international

View File

@@ -25,7 +25,7 @@
#include <units/physical/si/length.h>
namespace units::international {
namespace units::physical::international {
// international yard
// https://en.wikipedia.org/wiki/International_yard_and_pound
@@ -94,4 +94,4 @@ constexpr auto operator"" q_mil(long double l) { return si::length<mil, long dou
} // namespace literals
} // namespace units::international
} // namespace units::physical::international

View File

@@ -25,7 +25,7 @@
#include <units/physical/si/velocity.h>
#include <units/physical/international/length.h>
namespace units::international {
namespace units::physical::international {
struct mile_per_hour : deduced_unit<mile_per_hour, si::dim_velocity, international::mile, si::hour> {};
@@ -37,4 +37,4 @@ constexpr auto operator"" q_mi_per_h(long double l) { return si::velocity<mile_p
} // namespace literals
} // namespace units::international
} // namespace units::physical::international

View File

@@ -25,7 +25,7 @@
#include <units/physical/si/volume.h>
#include <units/physical/international/length.h>
namespace units::international {
namespace units::physical::international {
struct cubic_foot : deduced_unit<cubic_foot, si::dim_volume, international::foot> {};
@@ -37,4 +37,4 @@ constexpr auto operator"" q_ft3(long double l) { return si::volume<cubic_foot, l
} // namespace literals
} // namespace units::international
} // namespace units::physical::international

View File

@@ -24,9 +24,9 @@
#include <units/physical/natural/dimensions.h>
namespace units::natural {
namespace units::physical::natural {
template<Scalar Rep = double>
inline constexpr auto speed_of_light = velocity<unitless, Rep>(1);
} // namespace units::natural
} // namespace units::physical::natural

View File

@@ -26,7 +26,7 @@
#include <units/physical/natural/units.h>
#include <units/quantity.h>
namespace units::natural {
namespace units::physical::natural {
struct dim_length : physical::dim_length<inverted_gigaelectronvolt> {};
template<Unit U, Scalar Rep = double>
@@ -63,4 +63,4 @@ using energy = quantity<dim_force, U, Rep>;
// Typical UDLs will not work here as the same units are reused by many quantities.
// Should we define some strange ones (i.e. q_mass_GeV)?
} // namespace units::natural
} // namespace units::physical::natural

View File

@@ -25,7 +25,7 @@
#include <units/unit.h>
#include <units/physical/si/prefixes.h>
namespace units::natural {
namespace units::physical::natural {
struct unitless : named_unit<unitless, "", no_prefix> {};
struct electronvolt : named_unit<electronvolt, "eV", si::prefix> {};
@@ -38,4 +38,4 @@ struct square_gigaelectronvolt : named_unit<square_gigaelectronvolt, {"GeV²", "
// natural units as an isolated island with ev = 1 which simplifies all
// the maths a lot?
} // namespace units::natural
} // namespace units::physical::natural

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct gray : named_unit<gray, "Gy", prefix> {};
struct yoctogray : prefixed_unit<yoctogray, yocto, gray> {};
@@ -145,4 +145,4 @@ constexpr auto operator"" q_YGy(long double l) { return absorbed_dose<yottagray,
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/velocity.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct metre_per_second_sq : unit<metre_per_second_sq> {};
struct dim_acceleration : physical::dim_acceleration<dim_acceleration, metre_per_second_sq, dim_length, dim_time> {};
@@ -42,4 +42,4 @@ constexpr auto operator"" q_m_per_s2(long double l) { return acceleration<metre_
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/length.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct square_metre : unit<square_metre> {};
struct dim_area : physical::dim_area<dim_area, square_metre, dim_length> {};
@@ -149,4 +149,4 @@ constexpr auto operator"" q_ha(long double l) { return area<hectare, long double
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct farad : named_unit<farad, "F", prefix> {};
struct yoctofarad : prefixed_unit<yoctofarad, yocto, farad> {};
@@ -145,4 +145,4 @@ constexpr auto operator"" q_YF(long double l) { return capacitance<yottafarad, l
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct katal : named_unit<katal, "kat", prefix> {};
struct yoctokatal : prefixed_unit<yoctokatal, yocto, katal> {};
@@ -151,5 +151,5 @@ constexpr auto operator"" q_U(long double l) { return catalytic_activity<enzyme_
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct coulomb_per_metre_cub : unit<coulomb_per_metre_cub> {};
struct coulomb_per_metre_sq : unit<coulomb_per_metre_sq> {};
@@ -54,4 +54,4 @@ constexpr auto operator"" q_C_per_m2(long double l) { return surface_charge_dens
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/substance.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::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> {};
@@ -43,5 +43,5 @@ constexpr auto operator"" q_mol_per_m3(long double l) { return concentration<mol
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct siemens : named_unit<siemens, "S", prefix> {};
struct yoctosiemens : prefixed_unit<yoctosiemens, yocto, siemens> {};
@@ -124,5 +124,5 @@ constexpr auto operator"" q_YS(long double l) { return conductance<yottasiemens,
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -30,7 +30,7 @@
#include <units/physical/si/temperature.h>
#include <units/physical/si/velocity.h>
namespace units::si::si2019 {
namespace units::physical::si::si2019 {
template<Scalar Rep = double>
inline constexpr auto planck_constant = energy<joule, Rep>(6.62607015e-34) * time<second, Rep>(1);
@@ -59,4 +59,4 @@ inline constexpr auto hyperfine_structure_transition_frequency = frequency<hertz
template<Scalar Rep = double>
inline constexpr auto standard_gravity = acceleration<metre_per_second_sq, Rep>(9.80665);
} // namespace units::si::si2019
} // namespace units::physical::si::si2019

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct ampere : named_unit<ampere, "A", prefix> {};
struct yoctoampere : prefixed_unit<yoctoampere, yocto, ampere> {};
@@ -143,4 +143,4 @@ constexpr auto operator"" q_YA(long double l) { return current<yottaampere, long
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct ampere_per_metre_sq : unit<ampere_per_metre_sq> {};
@@ -44,4 +44,4 @@ constexpr auto operator"" q_A_per_m2(long double l) { return current_density<amp
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct kilogram_per_metre_cub : unit<kilogram_per_metre_cub> {};
@@ -44,4 +44,4 @@ constexpr auto operator"" q_kg_per_m3(long double l) { return density<kilogram_p
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/pressure.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct pascal_second : unit<pascal_second> {};
struct dim_dynamic_viscosity : physical::dim_dynamic_viscosity<dim_dynamic_viscosity, pascal_second, dim_pressure, dim_time> {};
@@ -43,5 +43,5 @@ constexpr auto operator"" q_Pa_s(long double l) { return dynamic_viscosity<pasca
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/time.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct coulomb : named_unit<coulomb, "C", prefix> {};
@@ -44,4 +44,4 @@ constexpr auto operator"" q_C(long double l) { return electric_charge<coulomb, l
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/voltage.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::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> {};
@@ -42,4 +42,4 @@ constexpr auto operator"" q_V_per_m(long double l) { return electric_field_stren
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct joule : named_unit<joule, "J", prefix> {};
struct yoctojoule : prefixed_unit<yoctojoule, yocto, joule> {};
@@ -135,4 +135,4 @@ constexpr auto operator"" q_GeV(long double l) { return energy<gigaelectronvolt,
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct newton : named_unit<newton, "N", prefix> {};
struct yoctonewton : prefixed_unit<yoctonewton, yocto, newton> {};
@@ -145,4 +145,4 @@ constexpr auto operator"" q_YN(long double l) { return force<yottanewton, long d
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/time.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct hertz : named_unit<hertz, "Hz", prefix> {};
struct yoctohertz : prefixed_unit<yoctohertz, yocto, hertz> {};
@@ -123,4 +123,4 @@ constexpr auto operator"" q_YHz(long double l) { return frequency<yottahertz, lo
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -29,7 +29,7 @@
#include <units/physical/si/substance.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct joule_per_kelvin : unit<joule_per_kelvin> {};
struct joule_per_kilogram_kelvin : unit<joule_per_kilogram_kelvin> {};
@@ -64,5 +64,5 @@ constexpr auto operator"" q_J_per_mol_K(long double l) { return molar_heat_capac
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/current.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct henry : named_unit<henry, "H", prefix> {};
@@ -125,4 +125,4 @@ constexpr auto operator"" q_YH(long double l) { return inductance<yottahenry, lo
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct metre : named_unit<metre, "m", prefix> {};
struct yoctometre : prefixed_unit<yoctometre, yocto, metre> {};
@@ -149,4 +149,4 @@ constexpr auto operator"" q_au(long double l) { return length<astronomical_unit,
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/luminous_intensity.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct candela_per_metre_sq : unit<candela_per_metre_sq> {};
struct dim_luminance : physical::dim_luminance<dim_luminance, candela_per_metre_sq, dim_luminous_intensity, dim_length> {};
@@ -43,5 +43,5 @@ constexpr auto operator"" q_cd_per_m2(long double l) { return luminance<candela_
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct candela : named_unit<candela, "cd", prefix> {};
struct yoctocandela : prefixed_unit<yoctocandela, yocto, candela> {};
@@ -143,4 +143,4 @@ constexpr auto operator"" q_Ycd(long double l) { return luminous_intensity<yotta
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/area.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct weber : named_unit<weber, "Wb", prefix> {};
@@ -125,4 +125,4 @@ constexpr auto operator"" q_YWb(long double l) { return magnetic_flux<yottaweber
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -29,7 +29,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct tesla : named_unit<tesla, "T", prefix> {};

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct gram : named_unit<gram, "g", prefix> {};
struct yoctogram : prefixed_unit<yoctogram, yocto, gram> {};
@@ -255,4 +255,4 @@ constexpr auto operator"" q_Da(long double l) { return mass<dalton, long double>
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct joule_per_mole : unit<joule_per_mole> {};
@@ -45,4 +45,4 @@ constexpr auto operator"" q_J_per_mol(long double l) { return molar_energy<joule
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/velocity.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::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> {};
@@ -43,4 +43,4 @@ constexpr auto operator"" q_kg_m_per_s(long double l) { return momentum<kilogram
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct henry_per_metre : unit<henry_per_metre> {};
@@ -44,5 +44,5 @@ constexpr auto operator"" q_H_per_m(long double l) { return permeability<henry_p
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct farad_per_metre : unit<farad_per_metre> {};
@@ -44,5 +44,5 @@ constexpr auto operator"" q_F_per_m(long double l) { return permittivity<farad_p
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct watt : named_unit<watt, "W", prefix> {};
struct yoctowatt : prefixed_unit<yoctowatt, yocto, watt> {};
@@ -124,4 +124,4 @@ constexpr auto operator"" q_YW(long double l) { return power<yottawatt, long dou
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -24,7 +24,7 @@
#include <units/prefix.h>
namespace units::si {
namespace units::physical::si {
struct prefix : prefix_family {};
@@ -51,4 +51,4 @@ struct zetta : units::prefix<zetta, prefix, "Z", ratio<1, 1, 21>>
struct yotta : units::prefix<yotta, prefix, "Y", ratio<1, 1, 24>> {};
// clang-format on
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct pascal : named_unit<pascal, "Pa", prefix> {};
struct yoctopascal : prefixed_unit<yoctopascal, yocto, pascal> {};
@@ -145,4 +145,4 @@ constexpr auto operator"" q_YPa(long double l) { return pressure<yottapascal, lo
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct ohm : named_unit<ohm, {"Ω", "ohm"}, prefix> {};
struct yoctoohm : prefixed_unit<yoctoohm, yocto, ohm> {};
@@ -125,4 +125,4 @@ constexpr auto operator"" q_YR(long double l) { return resistance<yottaohm, long
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct mole : named_unit<metre, "mol", prefix> {};
@@ -43,4 +43,4 @@ constexpr auto operator"" q_mol(long double l) { return substance<mole, long dou
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/force.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct newton_per_metre : unit<newton_per_metre> {};
@@ -43,4 +43,4 @@ inline namespace literals {
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -25,7 +25,7 @@
#include <units/physical/dimensions.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct kelvin : named_unit<kelvin, "K", no_prefix> {};
@@ -42,4 +42,4 @@ constexpr auto operator"" q_K(long double l) { return temperature<kelvin, long d
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/temperature.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct watt_per_metre_kelvin : unit<watt_per_metre_kelvin> {};
@@ -44,4 +44,4 @@ constexpr auto operator"" q_W_per_m_K(long double l) { return thermal_conductivi
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct second : named_unit<second, "s", prefix> {};
struct yoctosecond : prefixed_unit<yoctosecond, yocto, second> {};
@@ -98,4 +98,4 @@ constexpr auto operator"" q_d(long double l) { return time<day, long double>(l);
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -27,7 +27,7 @@
#include <units/physical/si/time.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct metre_per_second : unit<metre_per_second> {};
struct dim_velocity : physical::dim_velocity<dim_velocity, metre_per_second, dim_length, dim_time> {};
@@ -49,4 +49,4 @@ constexpr auto operator"" q_km_per_h(long double l) { return velocity<kilometre_
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -28,7 +28,7 @@
#include <units/physical/si/prefixes.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct volt : named_unit<volt, "V", prefix> {};
struct yoctovolt : prefixed_unit<yoctovolt, yocto, volt> {};
@@ -145,4 +145,4 @@ constexpr auto operator"" q_YV(long double l) { return voltage<yottavolt, long d
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

View File

@@ -26,7 +26,7 @@
#include <units/physical/si/length.h>
#include <units/quantity.h>
namespace units::si {
namespace units::physical::si {
struct cubic_metre : unit<cubic_metre> {};
struct dim_volume : physical::dim_volume<dim_volume, cubic_metre, dim_length> {};
@@ -249,4 +249,4 @@ constexpr auto operator"" q_Yl(long double l) { return volume<yottalitre, long d
} // namespace literals
} // namespace units::si
} // namespace units::physical::si

Some files were not shown because too many files have changed in this diff Show More