refactor: physical replaced with isq

Refers to #249
This commit is contained in:
Mateusz Pusz
2021-03-16 12:03:25 +01:00
parent f3bcdc4ad2
commit bbbb77286c
304 changed files with 1354 additions and 1354 deletions

View File

@@ -28,11 +28,11 @@ analysis and unit/quantity manipulation. The basic idea and design heavily bases
Here is a small example of possible operations: Here is a small example of possible operations:
```cpp ```cpp
#include <units/physical/si/area.h> #include <units/isq/si/area.h>
#include <units/physical/si/frequency.h> #include <units/isq/si/frequency.h>
#include <units/physical/si/speed.h> #include <units/isq/si/speed.h>
using namespace units::physical::si; using namespace units::isq::si;
// simple numeric operations // simple numeric operations
static_assert(10_q_km / 2 == 5_q_km); static_assert(10_q_km / 2 == 5_q_km);
@@ -62,12 +62,12 @@ the below example for a quick preview of basic library features:
```cpp ```cpp
#include <units/format.h> #include <units/format.h>
#include <units/physical/si/speed.h> #include <units/isq/si/speed.h>
#include <units/physical/si/international/speed.h> #include <units/isq/si/international/speed.h>
#include <units/quantity_io.h> #include <units/quantity_io.h>
#include <iostream> #include <iostream>
using namespace units::physical; using namespace units::isq;
constexpr Speed auto avg_speed(Length auto d, Time auto t) constexpr Speed auto avg_speed(Length auto d, Time auto t)
{ {
@@ -76,8 +76,8 @@ constexpr Speed auto avg_speed(Length auto d, Time auto t)
int main() int main()
{ {
using namespace units::physical::si::literals; using namespace units::isq::si::literals;
using namespace units::physical::si::unit_constants; using namespace units::isq::si::unit_constants;
constexpr Speed auto v1 = 110 * km / h; constexpr Speed auto v1 = 110 * km / h;
constexpr Speed auto v2 = avg_speed(220_q_km, 2_q_h); constexpr Speed auto v2 = avg_speed(220_q_km, 2_q_h);

View File

@@ -124,104 +124,104 @@ set(unitsSphinxDocs
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/generic/dimensionless.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/generic/dimensionless.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/generic/unknown.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/generic/unknown.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/natural.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/natural/constants.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural/constants.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/natural/dimensions.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural/dimensions.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/natural/units.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/natural/units.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si_cgs.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_cgs.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/acceleration.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/acceleration.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/area.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/area.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/energy.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/energy.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/force.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/force.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/mass.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/mass.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/power.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/power.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/pressure.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/pressure.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/speed.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/speed.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/time.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/cgs/time.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/dimensions_and_concepts.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/dimensions_and_concepts.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si_fps.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_fps.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/acceleration.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/acceleration.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/area.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/area.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/density.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/density.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/energy.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/energy.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/force.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/force.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/mass.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/mass.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/power.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/power.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/pressure.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/pressure.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/speed.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/speed.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/time.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/time.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/volume.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/fps/volume.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si_iau.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_iau.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/iau/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/iau/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si_imperial.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_imperial.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/imperial/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/imperial/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si_international.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_international.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/international/area.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/international/area.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/international/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/international/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/international/speed.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/international/speed.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/international/volume.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/international/volume.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/absorbed_dose.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/absorbed_dose.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/acceleration.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/acceleration.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/amount_of_substance.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/amount_of_substance.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/area.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/area.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/capacitance.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/capacitance.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/catalytic_activity.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/catalytic_activity.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/charge_density.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/charge_density.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/concentration.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/concentration.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/conductance.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/conductance.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/constants.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/constants.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/current_density.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/current_density.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/density.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/density.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/dynamic_viscosity.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/dynamic_viscosity.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/electric_charge.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/electric_charge.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/electric_current.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/electric_current.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/electric_field_strength.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/electric_field_strength.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/energy.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/energy.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/force.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/force.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/frequency.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/frequency.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/heat_capacity.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/heat_capacity.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/inductance.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/inductance.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/luminance.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/luminance.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/luminous_intensity.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/luminous_intensity.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/magnetic_flux.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/magnetic_flux.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/magnetic_induction.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/magnetic_induction.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/mass.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/mass.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/molar_energy.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/molar_energy.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/momentum.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/momentum.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/permeability.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/permeability.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/permittivity.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/permittivity.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/power.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/power.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/prefixes.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/prefixes.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/pressure.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/pressure.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/resistance.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/resistance.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/speed.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/speed.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/surface_tension.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/surface_tension.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/thermal_conductivity.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/thermal_conductivity.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/thermodynamic_temperature.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/thermodynamic_temperature.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/time.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/time.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/voltage.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/voltage.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/volume.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/volume.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si_typographic.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_typographic.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/typographic/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/typographic/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si_us.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si_us.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/us/length.rst" "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/isq/si/us/length.rst"
"${CMAKE_CURRENT_SOURCE_DIR}/references.rst" "${CMAKE_CURRENT_SOURCE_DIR}/references.rst"

View File

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

View File

@@ -63,4 +63,4 @@ Library Directories Structure
While working with predefined systems please always include a header file with all While working with predefined systems please always include a header file with all
the definitions for the current system to limit the possibility of an ODR violation the definitions for the current system to limit the possibility of an ODR violation
(e.g. *units/physical/si/si.h*). (e.g. *units/isq/si/si.h*).

View File

@@ -23,9 +23,9 @@ The above solution does provide a good developer's experience but a really poor
user. If we will get a compilation error message containing ``dim_capacitance`` in most cases user. If we will get a compilation error message containing ``dim_capacitance`` in most cases
the compiler will print the following type instead of the alias:: the compiler will print the following type instead of the alias::
units::detail::derived_dimension_base<units::exponent<units::physical::si::dim_electric_current, 2, 1>, units::detail::derived_dimension_base<units::exponent<units::isq::si::dim_electric_current, 2, 1>,
units::exponent<units::physical::si::dim_length, -2, 1>, units::exponent<units::physical::si::dim_mass, units::exponent<units::isq::si::dim_length, -2, 1>, units::exponent<units::isq::si::dim_mass,
-1, 1>, units::exponent<units::physical::si::dim_time, 4, 1> > -1, 1>, units::exponent<units::isq::si::dim_time, 4, 1> >
You can notice that in case of **mp-units** even this long syntax was carefully selected to You can notice that in case of **mp-units** even this long syntax was carefully selected to
provide quite good user experience (some other units libraries produce a type that cannot easily provide quite good user experience (some other units libraries produce a type that cannot easily

View File

@@ -30,10 +30,10 @@ different dimensions (i.e. height, width, and depth) all of them will just be
measured in meters. measured in meters.
Why other systems are defined in the `physical::si` namespace? Why other systems are defined in the `isq::si` namespace?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All systems defined in the `physical::si` namespace are defined in terms of All systems defined in the `isq::si` namespace are defined in terms of
base units that are convertible to the :term:`SI` units. This enables conversions base units that are convertible to the :term:`SI` units. This enables conversions
of units of the same physical dimension between different systems. of units of the same physical dimension between different systems.
@@ -125,7 +125,7 @@ error: reference to time is ambiguous
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Unfortunately, if `using-directives <https://en.cppreference.com/w/cpp/language/namespace#Using-directives>`_ Unfortunately, if `using-directives <https://en.cppreference.com/w/cpp/language/namespace#Using-directives>`_
(i.e. ``using namespace units::physical::si``) are being used, `units::physical::si::time` (i.e. ``using namespace units::isq::si``) are being used, `units::isq::si::time`
will collide with C `time <https://en.cppreference.com/w/c/chrono/time>`_ function. In will collide with C `time <https://en.cppreference.com/w/c/chrono/time>`_ function. In
such a case the library's ``time`` function needs to be prefixed with at least one (or all) such a case the library's ``time`` function needs to be prefixed with at least one (or all)
namespace names. namespace names.

View File

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

View File

@@ -171,7 +171,7 @@ provided. For example the SI base dimension of length can be defined as::
} }
In the above code sample ``"L"`` is an base dimension's unique identifier In the above code sample ``"L"`` is an base dimension's unique identifier
and `physical::si::metre` is a :term:`base unit` of this base dimension. We can and `isq::si::metre` is a :term:`base unit` of this base dimension. We can
obtain those back easily with:: obtain those back easily with::
static_assert(si::dim_length::symbol == "L"); static_assert(si::dim_length::symbol == "L");
@@ -206,8 +206,8 @@ The above dimensions can be defined in the library with the
} }
In the above code sample `physical::si::square_metre` and In the above code sample `isq::si::square_metre` and
`physical::si::metre_per_second` are the `isq::si::metre_per_second` are the
:term:`coherent derived units <coherent derived unit>` of those derived dimensions. :term:`coherent derived units <coherent derived unit>` of those derived dimensions.
Coherent unit argument is followed by the list of exponents that form this Coherent unit argument is followed by the list of exponents that form this

View File

@@ -69,7 +69,7 @@ values the library provides :abbr:`UDL (User Defined Literal)` s for each
Thanks to them the same code can be as simple as:: Thanks to them the same code can be as simple as::
using namespace units::physical::si::literals; using namespace units::isq::si::literals;
auto d = 123._q_km; // si::length<si::kilometre, long double> auto d = 123._q_km; // si::length<si::kilometre, long double>
auto v = 70_q_km_per_h; // si::speed<si::kilometre_per_hour, std::int64_t> auto v = 70_q_km_per_h; // si::speed<si::kilometre_per_hour, std::int64_t>
@@ -98,7 +98,7 @@ They are defined using a special `one_rep` representation type::
With the above our code can look as follows:: With the above our code can look as follows::
using namespace units::physical::si::unit_constants; using namespace units::isq::si::unit_constants;
auto d = 123. * km; // si::length<si::kilometre, double> auto d = 123. * km; // si::length<si::kilometre, double>
auto v = 70 * km / h; // si::speed<si::kilometre_per_hour, int> auto v = 70 * km / h; // si::speed<si::kilometre_per_hour, int>
@@ -121,13 +121,13 @@ UDLs are helpful but they also have some disadvantages compared to Unit Constant
- UDLs:: - UDLs::
using namespace units::physical::si::literals; using namespace units::isq::si::literals;
auto v1 = 120_q_km / 2_q_h; auto v1 = 120_q_km / 2_q_h;
auto v2 = length<kilometre>(distance) / time<hour>(duration); auto v2 = length<kilometre>(distance) / time<hour>(duration);
- Unit Constants:: - Unit Constants::
using namespace units::physical::si::unit_constants; using namespace units::isq::si::unit_constants;
auto v1 = 120 * km / (2 * h); auto v1 = 120 * km / (2 * h);
auto v2 = distance * km / (duration * h); auto v2 = distance * km / (duration * h);
@@ -139,14 +139,14 @@ UDLs are helpful but they also have some disadvantages compared to Unit Constant
- UDLs:: - UDLs::
using namespace units::physical::si::literals; using namespace units::isq::si::literals;
using namespace units::physical::si::cgs::literals; using namespace units::isq::si::cgs::literals;
auto d = 1_q_cm; // FAILS TO COMPILE auto d = 1_q_cm; // FAILS TO COMPILE
- Unit Constants:: - Unit Constants::
inline constexpr auto si_cm = units::physical::si::unit_constants::cm; inline constexpr auto si_cm = units::isq::si::unit_constants::cm;
inline constexpr auto cgs_cm = units::physical::si::cgs::unit_constants::cm; inline constexpr auto cgs_cm = units::isq::si::cgs::unit_constants::cm;
auto d1 = 1. * si_cm; // si::length<si::centimetre> auto d1 = 1. * si_cm; // si::length<si::centimetre>
auto d2 = 1. * cgs_cm; // si::cgs::length<si::centimetre> auto d2 = 1. * cgs_cm; // si::cgs::length<si::centimetre>
@@ -156,7 +156,7 @@ UDLs are helpful but they also have some disadvantages compared to Unit Constant
- UDLs:: - UDLs::
using namespace units::physical::si::literals; using namespace units::isq::si::literals;
auto d1 = 123._q_km; // si::length<si::kilometre, long double> auto d1 = 123._q_km; // si::length<si::kilometre, long double>
auto d2 = 123_q_km; // si::length<si::kilometre, std::int64_t> auto d2 = 123_q_km; // si::length<si::kilometre, std::int64_t>
@@ -164,7 +164,7 @@ UDLs are helpful but they also have some disadvantages compared to Unit Constant
- Unit Constants:: - Unit Constants::
using namespace units::physical::si::unit_constants; using namespace units::isq::si::unit_constants;
auto d1 = 123. * km; // si::length<si::kilometre, double> auto d1 = 123. * km; // si::length<si::kilometre, double>
auto d2 = 123 * km; // si::length<si::kilometre, int> auto d2 = 123 * km; // si::length<si::kilometre, int>
auto d3 = 123.f * km; // si::length<si::kilometre, float> auto d3 = 123.f * km; // si::length<si::kilometre, float>
@@ -194,7 +194,7 @@ UDLs are helpful but they also have some disadvantages compared to Unit Constant
The only issue we are aware of with Unit Constants is a potential problem of specifying The only issue we are aware of with Unit Constants is a potential problem of specifying
a quantity in denominator:: a quantity in denominator::
using namespace units::physical::si::unit_constants; using namespace units::isq::si::unit_constants;
Speed auto v = 220 * km / 2 * h; // FAILS TO COMPILE (not a quantity of a speed dimension) Speed auto v = 220 * km / 2 * h; // FAILS TO COMPILE (not a quantity of a speed dimension)
The above code can be fixed in one of the below ways: The above code can be fixed in one of the below ways:
@@ -220,7 +220,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 requires quantity of a concrete dimension than dimension-specific concepts can
be used:: be used::
using namespace units::physical::si::literals; using namespace units::isq::si::literals;
constexpr Length auto d = 123_q_km; // si::length<si::kilometre, std::int64_t> constexpr Length auto d = 123_q_km; // si::length<si::kilometre, std::int64_t>
.. note:: .. note::
@@ -235,8 +235,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 be calculating the average speed based on provided distance and duration
quantities. The usage of such a function can look as follows:: quantities. The usage of such a function can look as follows::
using namespace units::physical::si::literals; using namespace units::isq::si::literals;
using namespace units::physical::si::international::literals; using namespace units::isq::si::international::literals;
constexpr Speed auto v1 = avg_speed(220_q_km, 2_q_h); constexpr Speed auto v1 = avg_speed(220_q_km, 2_q_h);
constexpr Speed auto v2 = avg_speed(140_q_mi, 2_q_h); constexpr Speed auto v2 = avg_speed(140_q_mi, 2_q_h);

View File

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

View File

@@ -388,7 +388,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 observe this type in case an unit/dimension conversion expression will end up with an
unknown/undefined unit type like in the below example:: unknown/undefined unit type like in the below example::
using namespace units::physical::si::literals; using namespace units::isq::si::literals;
Length auto l = 100_q_km_per_h * 10_q_s; Length auto l = 100_q_km_per_h * 10_q_s;

View File

@@ -3,11 +3,11 @@ Quick Start
Here is a small example of possible operations:: Here is a small example of possible operations::
#include <units/physical/si/area.h> #include <units/isq/si/area.h>
#include <units/physical/si/frequency.h> #include <units/isq/si/frequency.h>
#include <units/physical/si/speed.h> #include <units/isq/si/speed.h>
using namespace units::physical::si; using namespace units::isq::si;
// simple numeric operations // simple numeric operations
static_assert(10_q_km / 2 == 5_q_km); static_assert(10_q_km / 2 == 5_q_km);
@@ -38,12 +38,12 @@ performed without sacrificing on accuracy. Please see the below example for a qu
of basic library features:: of basic library features::
#include <units/format.h> #include <units/format.h>
#include <units/physical/si/speed.h> #include <units/isq/si/speed.h>
#include <units/physical/si/international/speed.h> #include <units/isq/si/international/speed.h>
#include <units/quantity_io.h> #include <units/quantity_io.h>
#include <iostream> #include <iostream>
using namespace units::physical; using namespace units::isq;
constexpr Speed auto avg_speed(Length auto d, Time auto t) constexpr Speed auto avg_speed(Length auto d, Time auto t)
{ {
@@ -52,8 +52,8 @@ of basic library features::
int main() int main()
{ {
using namespace units::physical::si::literals; using namespace units::isq::si::literals;
using namespace units::physical::si::unit_constants; using namespace units::isq::si::unit_constants;
constexpr Speed auto v1 = 110 * km / h; constexpr Speed auto v1 = 110 * km / h;
constexpr Speed auto v2 = avg_speed(220_q_km, 2_q_h); constexpr Speed auto v2 = avg_speed(220_q_km, 2_q_h);

View File

@@ -9,7 +9,7 @@ Systems
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
systems/physical systems/isq
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@@ -1,5 +1,5 @@
Physical International System of Quantities (ISQ)
======== ========================================
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2

View File

@@ -1,5 +1,5 @@
SI International System of Units (SI)
== ==================================
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2

View File

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

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