mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 19:04:27 +02:00
refactor: systems defined in terms of SI moved under si
namespace
This commit is contained in:
@@ -54,7 +54,7 @@ the below example for a quick preview of basic library features:
|
||||
|
||||
```cpp
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/international/speed.h>
|
||||
#include <units/physical/si/international/speed.h>
|
||||
#include <units/format.h>
|
||||
#include <iostream>
|
||||
|
||||
@@ -69,7 +69,7 @@ int main()
|
||||
{
|
||||
using namespace units::physical::si::literals;
|
||||
Speed auto v1 = avg_speed(220_q_km, 2_q_h);
|
||||
Speed auto v2 = avg_speed(si::length<international::mile>(140), si::time<si::hour>(2));
|
||||
Speed auto v2 = avg_speed(si::length<si::international::mile>(140), si::time<si::hour>(2));
|
||||
Speed auto v3 = quantity_cast<si::metre_per_second>(v2);
|
||||
Speed auto v4 = quantity_cast<int>(v3);
|
||||
|
||||
|
@@ -143,54 +143,54 @@ add_custom_command(OUTPUT "${SPHINX_INDEX_FILE}"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/acceleration.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/area.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/energy.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/force.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/mass.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/power.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/pressure.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/speed.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/cgs/time.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/dimensions_and_concepts.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/acceleration.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/area.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/density.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/energy.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/force.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/mass.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/power.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/pressure.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/speed.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/time.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/fps/volume.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/iau.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/iau/length.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/imperial.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/imperial/length.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/international.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/international/area.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/international/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/international/speed.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/international/volume.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/natural.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/natural/constants.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/natural/dimensions.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/natural/units.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/acceleration.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/area.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/energy.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/force.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/mass.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/power.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/pressure.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/speed.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/cgs/time.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/dimensions_and_concepts.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/acceleration.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/area.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/density.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/energy.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/force.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/mass.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/power.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/pressure.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/speed.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/time.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/fps/volume.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/iau.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/iau/length.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/imperial.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/imperial/length.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/international.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/international/area.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/international/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/international/speed.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/international/volume.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/si.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/absorbed_dose.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/acceleration.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/area.rst"
|
||||
@@ -234,11 +234,11 @@ add_custom_command(OUTPUT "${SPHINX_INDEX_FILE}"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/voltage.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/volume.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/typographic.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/typographic/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/typographic.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/typographic/length.rst"
|
||||
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/us.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/us/length.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/us.rst"
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/reference/systems/physical/si/us/length.rst"
|
||||
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/references.rst"
|
||||
|
||||
|
@@ -10,14 +10,15 @@ Library Directories Structure
|
||||
│ └── external
|
||||
├── data
|
||||
└── physical
|
||||
├── cgs
|
||||
├── iau
|
||||
├── imperial
|
||||
├── international
|
||||
├── natural
|
||||
├── si
|
||||
├── typographic
|
||||
└── us
|
||||
└── si
|
||||
├── cgs
|
||||
├── fps
|
||||
├── iau
|
||||
├── imperial
|
||||
├── international
|
||||
├── typographic
|
||||
└── us
|
||||
|
||||
- *./units*
|
||||
|
||||
|
@@ -82,7 +82,7 @@ be calculating the average speed based on provided distance and duration
|
||||
quantities. The usage of such a function can look as follows::
|
||||
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::physical::international::literals;
|
||||
using namespace units::physical::si::international::literals;
|
||||
constexpr Speed auto v1 = avg_speed(220_q_km, 2_q_h);
|
||||
constexpr Speed auto v2 = avg_speed(140_q_mi, 2_q_h);
|
||||
|
||||
|
@@ -17,7 +17,7 @@ The easiest way to print a quantity is to provide its object to the output
|
||||
stream::
|
||||
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::physical::international::literals;
|
||||
using namespace units::physical::si::international::literals;
|
||||
constexpr Speed auto v1 = avg_speed(220._q_km, 2_q_h);
|
||||
constexpr Speed auto v2 = avg_speed(140._q_mi, 2_q_h);
|
||||
std::cout << v1 << '\n'; // 110 km/h
|
||||
|
@@ -70,16 +70,16 @@ it really easy to define other systems of units. For example length in the
|
||||
`CGS <https://en.wikipedia.org/wiki/Centimetre%E2%80%93gram%E2%80%93second_system_of_units>`_
|
||||
could be defined as::
|
||||
|
||||
namespace cgs {
|
||||
namespace si::cgs {
|
||||
|
||||
struct dim_length : base_dimension<"L", si::centimetre> {};
|
||||
|
||||
}
|
||||
|
||||
The fact that both base dimensions use the same identifier ``"L"`` tells
|
||||
the library that bot definitions refer to the same physical dimension of
|
||||
the library that both definitions refer to the same physical dimension of
|
||||
length. The only difference is the measurement unit used to define their
|
||||
base dimensions. Thanks to using `si::centimetre` in the `cgs::dim_length`
|
||||
base dimensions. Thanks to using `si::centimetre` in the `si::cgs::dim_length`
|
||||
definition we also enabled the ability to easily convert between those
|
||||
2 base dimensions (as the library knows how to convert `si::metre` to
|
||||
`si::centimetre` and vice versa).
|
||||
@@ -308,7 +308,7 @@ In case the deduced unit should served as a named one we can use ether a
|
||||
by him/her-self or `noble_deduced_unit` where the symbol is the deduced name
|
||||
based on the ingredients::
|
||||
|
||||
namespace fps {
|
||||
namespace si::fps {
|
||||
|
||||
struct nautical_mile_per_hour : named_deduced_unit<nautical_mile_per_hour, dim_speed,
|
||||
"knot", no_prefix, nautical_mile, hour>{};
|
||||
|
@@ -32,7 +32,7 @@ performed without sacrificing on accuracy. Please see the below example for a qu
|
||||
of basic library features::
|
||||
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/international/speed.h>
|
||||
#include <units/physical/si/international/speed.h>
|
||||
#include <units/format.h>
|
||||
#include <iostream>
|
||||
|
||||
@@ -47,7 +47,7 @@ of basic library features::
|
||||
{
|
||||
using namespace units::physical::si::literals;
|
||||
Speed auto v1 = avg_speed(220_q_km, 2_q_h);
|
||||
Speed auto v2 = avg_speed(si::length<international::mile>(140), si::time<si::hour>(2));
|
||||
Speed auto v2 = avg_speed(si::length<si::international::mile>(140), si::time<si::hour>(2));
|
||||
Speed auto v3 = quantity_cast<si::metre_per_second>(v2);
|
||||
Speed auto v4 = quantity_cast<int>(v3);
|
||||
|
||||
|
@@ -6,11 +6,11 @@ Physical
|
||||
|
||||
physical/dimensions_and_concepts
|
||||
physical/si
|
||||
physical/cgs
|
||||
physical/international
|
||||
physical/us
|
||||
physical/imperial
|
||||
physical/fps
|
||||
physical/iau
|
||||
physical/typographic
|
||||
physical/si_cgs
|
||||
physical/si_international
|
||||
physical/si_us
|
||||
physical/si_imperial
|
||||
physical/si_fps
|
||||
physical/si_iau
|
||||
physical/si_typographic
|
||||
physical/natural
|
||||
|
@@ -1,16 +0,0 @@
|
||||
CGS
|
||||
===
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
cgs/acceleration
|
||||
cgs/area
|
||||
cgs/energy
|
||||
cgs/force
|
||||
cgs/length
|
||||
cgs/mass
|
||||
cgs/power
|
||||
cgs/pressure
|
||||
cgs/speed
|
||||
cgs/time
|
@@ -1,4 +0,0 @@
|
||||
Acceleration
|
||||
============
|
||||
|
||||
.. doxygenfile:: cgs/acceleration.h
|
@@ -1,4 +0,0 @@
|
||||
Area
|
||||
====
|
||||
|
||||
.. doxygenfile:: cgs/area.h
|
@@ -1,4 +0,0 @@
|
||||
Energy
|
||||
======
|
||||
|
||||
.. doxygenfile:: cgs/energy.h
|
@@ -1,4 +0,0 @@
|
||||
Force
|
||||
=====
|
||||
|
||||
.. doxygenfile:: cgs/force.h
|
@@ -1,4 +0,0 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: cgs/length.h
|
@@ -1,4 +0,0 @@
|
||||
Mass
|
||||
====
|
||||
|
||||
.. doxygenfile:: cgs/mass.h
|
@@ -1,4 +0,0 @@
|
||||
Power
|
||||
=====
|
||||
|
||||
.. doxygenfile:: cgs/power.h
|
@@ -1,4 +0,0 @@
|
||||
Pressure
|
||||
========
|
||||
|
||||
.. doxygenfile:: cgs/pressure.h
|
@@ -1,4 +0,0 @@
|
||||
Speed
|
||||
=====
|
||||
|
||||
.. doxygenfile:: cgs/speed.h
|
@@ -1,4 +0,0 @@
|
||||
Time
|
||||
====
|
||||
|
||||
.. doxygenfile:: cgs/time.h
|
@@ -1,18 +0,0 @@
|
||||
FPS
|
||||
===
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
fps/acceleration
|
||||
fps/area
|
||||
fps/density
|
||||
fps/energy
|
||||
fps/force
|
||||
fps/length
|
||||
fps/mass
|
||||
fps/power
|
||||
fps/pressure
|
||||
fps/speed
|
||||
fps/time
|
||||
fps/volume
|
@@ -1,4 +0,0 @@
|
||||
Acceleration
|
||||
============
|
||||
|
||||
.. doxygenfile:: fps/acceleration.h
|
@@ -1,4 +0,0 @@
|
||||
Area
|
||||
====
|
||||
|
||||
.. doxygenfile:: fps/area.h
|
@@ -1,4 +0,0 @@
|
||||
Density
|
||||
=======
|
||||
|
||||
.. doxygenfile:: fps/density.h
|
@@ -1,4 +0,0 @@
|
||||
Energy
|
||||
======
|
||||
|
||||
.. doxygenfile:: fps/energy.h
|
@@ -1,4 +0,0 @@
|
||||
Force
|
||||
=====
|
||||
|
||||
.. doxygenfile:: fps/force.h
|
@@ -1,4 +0,0 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: fps/length.h
|
@@ -1,4 +0,0 @@
|
||||
Mass
|
||||
====
|
||||
|
||||
.. doxygenfile:: fps/mass.h
|
@@ -1,4 +0,0 @@
|
||||
Power
|
||||
=====
|
||||
|
||||
.. doxygenfile:: fps/power.h
|
@@ -1,4 +0,0 @@
|
||||
Pressure
|
||||
========
|
||||
|
||||
.. doxygenfile:: fps/pressure.h
|
@@ -1,4 +0,0 @@
|
||||
Speed
|
||||
=====
|
||||
|
||||
.. doxygenfile:: fps/speed.h
|
@@ -1,4 +0,0 @@
|
||||
Time
|
||||
====
|
||||
|
||||
.. doxygenfile:: fps/time.h
|
@@ -1,4 +0,0 @@
|
||||
Volume
|
||||
======
|
||||
|
||||
.. doxygenfile:: fps/volume.h
|
@@ -1,4 +0,0 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: iau/length.h
|
@@ -1,4 +0,0 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: imperial/length.h
|
@@ -1,10 +0,0 @@
|
||||
International
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
international/area
|
||||
international/length
|
||||
international/speed
|
||||
international/volume
|
@@ -1,4 +0,0 @@
|
||||
Area
|
||||
====
|
||||
|
||||
.. doxygenfile:: international/area.h
|
@@ -1,4 +0,0 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: international/length.h
|
@@ -1,4 +0,0 @@
|
||||
Volume
|
||||
======
|
||||
|
||||
.. doxygenfile:: international/volume.h
|
@@ -0,0 +1,4 @@
|
||||
Acceleration
|
||||
============
|
||||
|
||||
.. doxygenfile:: si/cgs/acceleration.h
|
4
docs_disabled/reference/systems/physical/si/cgs/area.rst
Normal file
4
docs_disabled/reference/systems/physical/si/cgs/area.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
Area
|
||||
====
|
||||
|
||||
.. doxygenfile:: si/cgs/area.h
|
@@ -0,0 +1,4 @@
|
||||
Energy
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/cgs/energy.h
|
@@ -0,0 +1,4 @@
|
||||
Force
|
||||
=====
|
||||
|
||||
.. doxygenfile:: si/cgs/force.h
|
@@ -0,0 +1,4 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/cgs/length.h
|
4
docs_disabled/reference/systems/physical/si/cgs/mass.rst
Normal file
4
docs_disabled/reference/systems/physical/si/cgs/mass.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
Mass
|
||||
====
|
||||
|
||||
.. doxygenfile:: si/cgs/mass.h
|
@@ -0,0 +1,4 @@
|
||||
Power
|
||||
=====
|
||||
|
||||
.. doxygenfile:: si/cgs/power.h
|
@@ -0,0 +1,4 @@
|
||||
Pressure
|
||||
========
|
||||
|
||||
.. doxygenfile:: si/cgs/pressure.h
|
@@ -0,0 +1,4 @@
|
||||
Speed
|
||||
=====
|
||||
|
||||
.. doxygenfile:: si/cgs/speed.h
|
4
docs_disabled/reference/systems/physical/si/cgs/time.rst
Normal file
4
docs_disabled/reference/systems/physical/si/cgs/time.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
Time
|
||||
====
|
||||
|
||||
.. doxygenfile:: si/cgs/time.h
|
@@ -0,0 +1,4 @@
|
||||
Acceleration
|
||||
============
|
||||
|
||||
.. doxygenfile:: si/fps/acceleration.h
|
4
docs_disabled/reference/systems/physical/si/fps/area.rst
Normal file
4
docs_disabled/reference/systems/physical/si/fps/area.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
Area
|
||||
====
|
||||
|
||||
.. doxygenfile:: si/fps/area.h
|
@@ -0,0 +1,4 @@
|
||||
Density
|
||||
=======
|
||||
|
||||
.. doxygenfile:: si/fps/density.h
|
@@ -0,0 +1,4 @@
|
||||
Energy
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/fps/energy.h
|
@@ -0,0 +1,4 @@
|
||||
Force
|
||||
=====
|
||||
|
||||
.. doxygenfile:: si/fps/force.h
|
@@ -0,0 +1,4 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/fps/length.h
|
4
docs_disabled/reference/systems/physical/si/fps/mass.rst
Normal file
4
docs_disabled/reference/systems/physical/si/fps/mass.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
Mass
|
||||
====
|
||||
|
||||
.. doxygenfile:: si/fps/mass.h
|
@@ -0,0 +1,4 @@
|
||||
Power
|
||||
=====
|
||||
|
||||
.. doxygenfile:: si/fps/power.h
|
@@ -0,0 +1,4 @@
|
||||
Pressure
|
||||
========
|
||||
|
||||
.. doxygenfile:: si/fps/pressure.h
|
@@ -0,0 +1,4 @@
|
||||
Speed
|
||||
=====
|
||||
|
||||
.. doxygenfile:: si/fps/speed.h
|
4
docs_disabled/reference/systems/physical/si/fps/time.rst
Normal file
4
docs_disabled/reference/systems/physical/si/fps/time.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
Time
|
||||
====
|
||||
|
||||
.. doxygenfile:: si/fps/time.h
|
@@ -0,0 +1,4 @@
|
||||
Volume
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/fps/volume.h
|
@@ -0,0 +1,4 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/iau/length.h
|
@@ -0,0 +1,4 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/imperial/length.h
|
@@ -0,0 +1,4 @@
|
||||
Area
|
||||
====
|
||||
|
||||
.. doxygenfile:: si/international/area.h
|
@@ -0,0 +1,4 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/international/length.h
|
@@ -0,0 +1,4 @@
|
||||
Volume
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/international/volume.h
|
@@ -0,0 +1,4 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/typographic/length.h
|
@@ -0,0 +1,4 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: si/us/length.h
|
16
docs_disabled/reference/systems/physical/si_cgs.rst
Normal file
16
docs_disabled/reference/systems/physical/si_cgs.rst
Normal file
@@ -0,0 +1,16 @@
|
||||
CGS
|
||||
===
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
si/cgs/acceleration
|
||||
si/cgs/area
|
||||
si/cgs/energy
|
||||
si/cgs/force
|
||||
si/cgs/length
|
||||
si/cgs/mass
|
||||
si/cgs/power
|
||||
si/cgs/pressure
|
||||
si/cgs/speed
|
||||
si/cgs/time
|
18
docs_disabled/reference/systems/physical/si_fps.rst
Normal file
18
docs_disabled/reference/systems/physical/si_fps.rst
Normal file
@@ -0,0 +1,18 @@
|
||||
FPS
|
||||
===
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
si/fps/acceleration
|
||||
si/fps/area
|
||||
si/fps/density
|
||||
si/fps/energy
|
||||
si/fps/force
|
||||
si/fps/length
|
||||
si/fps/mass
|
||||
si/fps/power
|
||||
si/fps/pressure
|
||||
si/fps/speed
|
||||
si/fps/time
|
||||
si/fps/volume
|
@@ -4,4 +4,4 @@ IAU
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
iau/length
|
||||
si/iau/length
|
@@ -4,4 +4,4 @@ Imperial
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
imperial/length
|
||||
si/imperial/length
|
@@ -0,0 +1,10 @@
|
||||
International
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
si/international/area
|
||||
si/international/length
|
||||
si/international/speed
|
||||
si/international/volume
|
@@ -4,4 +4,4 @@ Typographic
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
typographic/length
|
||||
si/typographic/length
|
@@ -4,4 +4,4 @@ US
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
us/length
|
||||
si/us/length
|
@@ -1,4 +0,0 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: typographic/length.h
|
@@ -1,4 +0,0 @@
|
||||
Length
|
||||
======
|
||||
|
||||
.. doxygenfile:: us/length.h
|
@@ -25,7 +25,7 @@
|
||||
#include "./units_str.h"
|
||||
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::physical::international;
|
||||
using namespace units::physical::si::international;
|
||||
using namespace units::experimental;
|
||||
|
||||
void simple_quantities()
|
||||
|
@@ -3,11 +3,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/physical/imperial/length.h>
|
||||
#include <units/physical/international/length.h>
|
||||
#include <units/physical/typographic/length.h>
|
||||
#include <units/physical/us/length.h>
|
||||
#include <units/physical/iau/length.h>
|
||||
#include <units/physical/si/imperial/length.h>
|
||||
#include <units/physical/si/international/length.h>
|
||||
#include <units/physical/si/typographic/length.h>
|
||||
#include <units/physical/si/us/length.h>
|
||||
#include <units/physical/si/iau/length.h>
|
||||
|
||||
namespace units{
|
||||
namespace experimental{
|
||||
@@ -30,55 +30,55 @@ template<typename Rep = double>
|
||||
using AU = units::physical::si::length<units::physical::si::astronomical_unit, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using in = units::physical::si::length<units::physical::international::inch, Rep>;
|
||||
using in = units::physical::si::length<units::physical::si::international::inch, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using angstrom = units::physical::si::length<units::physical::iau::angstrom, Rep>;
|
||||
using angstrom = units::physical::si::length<units::physical::si::iau::angstrom, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using ch = units::physical::si::length<units::physical::imperial::chain, Rep>;
|
||||
using ch = units::physical::si::length<units::physical::si::imperial::chain, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using fathom = units::physical::si::length<units::physical::international::fathom, Rep>;
|
||||
using fathom = units::physical::si::length<units::physical::si::international::fathom, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using fathom_us = units::physical::si::length<units::physical::us::fathom, Rep>;
|
||||
using fathom_us = units::physical::si::length<units::physical::si::us::fathom, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using ft = units::physical::si::length<units::physical::international::foot, Rep>;
|
||||
using ft = units::physical::si::length<units::physical::si::international::foot, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using ft_us = units::physical::si::length<units::physical::us::foot, Rep>;
|
||||
using ft_us = units::physical::si::length<units::physical::si::us::foot, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using ly = units::physical::si::length<units::physical::iau::light_year, Rep>;
|
||||
using ly = units::physical::si::length<units::physical::si::iau::light_year, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using mi = units::physical::si::length<units::physical::international::mile, Rep>;
|
||||
using mi = units::physical::si::length<units::physical::si::international::mile, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using mi_naut = units::physical::si::length<units::physical::international::nautical_mile, Rep>;
|
||||
using mi_naut = units::physical::si::length<units::physical::si::international::nautical_mile, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using pc = units::physical::si::length<units::physical::iau::parsec, Rep>;
|
||||
using pc = units::physical::si::length<units::physical::si::iau::parsec, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using pica_comp = units::physical::si::length<units::physical::typographic::pica_comp, Rep>;
|
||||
using pica_comp = units::physical::si::length<units::physical::si::typographic::pica_comp, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using pica_prn = units::physical::si::length<units::physical::typographic::pica_prn, Rep>;
|
||||
using pica_prn = units::physical::si::length<units::physical::si::typographic::pica_prn, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using point_comp = units::physical::si::length<units::physical::typographic::point_comp, Rep>;
|
||||
using point_comp = units::physical::si::length<units::physical::si::typographic::point_comp, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using point_prn = units::physical::si::length<units::physical::typographic::point_prn, Rep>;
|
||||
using point_prn = units::physical::si::length<units::physical::si::typographic::point_prn, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using rd = units::physical::si::length<units::physical::imperial::rod, Rep>;
|
||||
using rd = units::physical::si::length<units::physical::si::imperial::rod, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using yd = units::physical::si::length<units::physical::international::yard, Rep>;
|
||||
using yd = units::physical::si::length<units::physical::si::international::yard, Rep>;
|
||||
|
||||
|
||||
} // namespace length
|
||||
|
@@ -20,9 +20,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/physical/cgs/speed.h>
|
||||
#include <units/physical/si/cgs/speed.h>
|
||||
#include <units/physical/si/international/speed.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/international/speed.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
@@ -97,7 +97,7 @@ void example()
|
||||
|
||||
// Customary Units (int)
|
||||
{
|
||||
using namespace units::physical::international::literals;
|
||||
using namespace units::physical::si::international::literals;
|
||||
constexpr Length auto distance = 140_q_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::physical::international::literals;
|
||||
using namespace units::physical::si::international::literals;
|
||||
constexpr Length auto distance = 140._q_mi; // constructed from a UDL
|
||||
constexpr si::time<si::hour> duration(2); // constructed from a value
|
||||
|
||||
@@ -131,9 +131,9 @@ void example()
|
||||
|
||||
// CGS (int)
|
||||
{
|
||||
using namespace units::physical::cgs::literals;
|
||||
using namespace units::physical::si::cgs::literals;
|
||||
constexpr Length auto distance = 22'000'000_q_cm; // constructed from a UDL
|
||||
constexpr cgs::time<si::hour, int> duration(2); // constructed from a value
|
||||
constexpr si::cgs::time<si::hour, int> duration(2); // constructed from a value
|
||||
|
||||
std::cout << "\nCGS units with 'int' as representation\n";
|
||||
|
||||
@@ -150,9 +150,9 @@ void example()
|
||||
|
||||
// CGS (double)
|
||||
{
|
||||
using namespace units::physical::cgs::literals;
|
||||
using namespace units::physical::si::cgs::literals;
|
||||
constexpr Length auto distance = 22'000'000._q_cm; // constructed from a UDL
|
||||
constexpr cgs::time<si::hour> duration(2); // constructed from a value
|
||||
constexpr si::cgs::time<si::hour> duration(2); // constructed from a value
|
||||
|
||||
std::cout << "\nCGS units with 'double' as representation\n";
|
||||
|
||||
|
@@ -15,16 +15,16 @@
|
||||
along with this program. If not, see http://www.gnu.org/licenses./
|
||||
*/
|
||||
|
||||
#include <units/physical/iau/length.h>
|
||||
#include <units/physical/imperial/length.h>
|
||||
#include <units/physical/international/length.h>
|
||||
#include <units/format.h>
|
||||
#include <units/physical/si/area.h>
|
||||
#include <units/physical/si/iau/length.h>
|
||||
#include <units/physical/si/imperial/length.h>
|
||||
#include <units/physical/si/international/length.h>
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/physical/si/typographic/length.h>
|
||||
#include <units/physical/si/us/length.h>
|
||||
#include <units/physical/si/volume.h>
|
||||
#include <units/physical/typographic/length.h>
|
||||
#include <units/physical/us/length.h>
|
||||
#include <units/format.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
@@ -34,7 +34,7 @@ using namespace units;
|
||||
void simple_quantities()
|
||||
{
|
||||
using namespace units::physical::si;
|
||||
using namespace units::physical::international;
|
||||
using namespace units::physical::si::international;
|
||||
|
||||
using distance = length<metre>;
|
||||
using duration = physical::si::time<second>;
|
||||
@@ -59,7 +59,7 @@ void quantities_with_typed_units()
|
||||
{
|
||||
using namespace units::physical;
|
||||
using namespace units::physical::si;
|
||||
using namespace units::physical::international;
|
||||
using namespace units::physical::si::international;
|
||||
|
||||
constexpr length<kilometre> km = 1.0_q_km;
|
||||
constexpr length<mile> miles = 1.0_q_mi;
|
||||
@@ -84,23 +84,23 @@ void quantities_with_typed_units()
|
||||
std::cout << meter << '\n';
|
||||
|
||||
std::cout << " = " << quantity_cast<si::astronomical_unit>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<iau::angstrom>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<imperial::chain>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<international::fathom>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<us::fathom>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<international::foot>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<us::foot>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<international::inch>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<iau::light_year>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<international::mile>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<international::nautical_mile>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<iau::parsec>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<typographic::pica_comp>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<typographic::pica_prn>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<typographic::point_comp>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<typographic::point_prn>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<imperial::rod>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<international::yard>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::iau::angstrom>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::imperial::chain>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::international::fathom>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::us::fathom>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::international::foot>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::us::foot>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::international::inch>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::iau::light_year>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::international::mile>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::international::nautical_mile>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::iau::parsec>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::typographic::pica_comp>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::typographic::pica_prn>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::typographic::point_comp>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::typographic::point_prn>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::imperial::rod>(meter) << '\n';
|
||||
std::cout << " = " << quantity_cast<si::international::yard>(meter) << '\n';
|
||||
}
|
||||
|
||||
void calcs_comparison()
|
||||
|
@@ -20,22 +20,20 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/format.h>
|
||||
#include <units/physical/fps/density.h>
|
||||
#include <units/physical/fps/length.h>
|
||||
#include <units/physical/fps/mass.h>
|
||||
#include <units/physical/fps/power.h>
|
||||
#include <units/physical/fps/speed.h>
|
||||
#include <units/physical/fps/volume.h>
|
||||
#include <units/physical/si/fps/density.h>
|
||||
#include <units/physical/si/fps/length.h>
|
||||
#include <units/physical/si/fps/mass.h>
|
||||
#include <units/physical/si/fps/power.h>
|
||||
#include <units/physical/si/fps/speed.h>
|
||||
#include <units/physical/si/fps/volume.h>
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/physical/si/mass.h>
|
||||
#include <units/physical/si/power.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/si/volume.h>
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace units::physical;
|
||||
@@ -43,17 +41,17 @@ using namespace units::physical;
|
||||
|
||||
// Some basic specs for the warship
|
||||
struct Ship {
|
||||
fps::length<fps::foot> length;
|
||||
fps::length<fps::foot> draft;
|
||||
fps::length<fps::foot> beam;
|
||||
si::fps::length<si::fps::foot> length;
|
||||
si::fps::length<si::fps::foot> draft;
|
||||
si::fps::length<si::fps::foot> beam;
|
||||
|
||||
fps::speed<fps::foot_per_second> speed;
|
||||
fps::mass<fps::pound> mass;
|
||||
si::fps::speed<si::fps::foot_per_second> speed;
|
||||
si::fps::mass<si::fps::pound> mass;
|
||||
|
||||
fps::length<fps::inch> mainGuns;
|
||||
fps::mass<fps::pound> shellMass;
|
||||
fps::speed<fps::foot_per_second> shellSpeed;
|
||||
fps::power<fps::foot_poundal_per_second> power;
|
||||
si::fps::length<si::fps::inch> mainGuns;
|
||||
si::fps::mass<si::fps::pound> shellMass;
|
||||
si::fps::speed<si::fps::foot_per_second> shellSpeed;
|
||||
si::fps::power<si::fps::foot_poundal_per_second> power;
|
||||
};
|
||||
|
||||
// Print 'a' in its current units and print its value cast to the units in each of Args
|
||||
@@ -63,28 +61,28 @@ auto fmt_line(const Q a)
|
||||
return fmt::format("{:22}", a) + (fmt::format(",{:20}", units::quantity_cast<Args>(a)) + ...);
|
||||
}
|
||||
|
||||
// Print the ship details in the units as defined in the Ship struct, in other imperial units, and in SI
|
||||
// Print the ship details in the units as defined in the Ship struct, in other si::imperial units, and in SI
|
||||
void print_details(std::string_view description, const Ship& ship)
|
||||
{
|
||||
using namespace units::physical::fps::literals;
|
||||
using namespace units::physical::si::fps::literals;
|
||||
const auto waterDensity = 62.4_q_lb_per_ft3;
|
||||
std::cout << fmt::format("{}\n", description);
|
||||
std::cout << fmt::format("{:20} : {}\n", "length", fmt_line<fps::length<fps::yard>, si::length<si::metre>>(ship.length))
|
||||
<< fmt::format("{:20} : {}\n", "draft", fmt_line<fps::length<fps::yard>, si::length<si::metre>>(ship.draft))
|
||||
<< fmt::format("{:20} : {}\n", "beam", fmt_line<fps::length<fps::yard>, si::length<si::metre>>(ship.beam))
|
||||
<< fmt::format("{:20} : {}\n", "mass", fmt_line<fps::mass<fps::long_ton>, si::mass<si::tonne>>(ship.mass))
|
||||
<< fmt::format("{:20} : {}\n", "speed", fmt_line<fps::speed<fps::knot>, si::speed<si::kilometre_per_hour>>(ship.speed))
|
||||
<< fmt::format("{:20} : {}\n", "power", fmt_line<fps::power<fps::horse_power>, si::power<si::kilowatt>>(ship.power))
|
||||
<< fmt::format("{:20} : {}\n", "main guns", fmt_line<fps::length<fps::inch>, si::length<si::millimetre>>(ship.mainGuns))
|
||||
<< fmt::format("{:20} : {}\n", "fire shells weighing",fmt_line<fps::mass<fps::long_ton>, si::mass<si::kilogram>>(ship.shellMass))
|
||||
<< fmt::format("{:20} : {}\n", "fire shells at",fmt_line<fps::speed<fps::mile_per_hour>, si::speed<si::kilometre_per_hour>>(ship.shellSpeed))
|
||||
std::cout << fmt::format("{:20} : {}\n", "length", fmt_line<si::fps::length<si::fps::yard>, si::length<si::metre>>(ship.length))
|
||||
<< fmt::format("{:20} : {}\n", "draft", fmt_line<si::fps::length<si::fps::yard>, si::length<si::metre>>(ship.draft))
|
||||
<< fmt::format("{:20} : {}\n", "beam", fmt_line<si::fps::length<si::fps::yard>, si::length<si::metre>>(ship.beam))
|
||||
<< fmt::format("{:20} : {}\n", "mass", fmt_line<si::fps::mass<si::fps::long_ton>, si::mass<si::tonne>>(ship.mass))
|
||||
<< fmt::format("{:20} : {}\n", "speed", fmt_line<si::fps::speed<si::fps::knot>, si::speed<si::kilometre_per_hour>>(ship.speed))
|
||||
<< fmt::format("{:20} : {}\n", "power", fmt_line<si::fps::power<si::fps::horse_power>, si::power<si::kilowatt>>(ship.power))
|
||||
<< fmt::format("{:20} : {}\n", "main guns", fmt_line<si::fps::length<si::fps::inch>, si::length<si::millimetre>>(ship.mainGuns))
|
||||
<< fmt::format("{:20} : {}\n", "fire shells weighing",fmt_line<si::fps::mass<si::fps::long_ton>, si::mass<si::kilogram>>(ship.shellMass))
|
||||
<< fmt::format("{:20} : {}\n", "fire shells at",fmt_line<si::fps::speed<si::fps::mile_per_hour>, si::speed<si::kilometre_per_hour>>(ship.shellSpeed))
|
||||
<< fmt::format("{:20} : {}\n", "volume underwater", fmt_line<si::volume<si::cubic_metre>, si::volume<si::litre>>(ship.mass / waterDensity));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::physical::fps::literals;
|
||||
using namespace units::physical::si::fps::literals;
|
||||
|
||||
// KMS Bismark, using the units the Germans would use, taken from Wiki
|
||||
auto bismark = Ship{.length{251._q_m}, .draft{9.3_q_m}, .beam{36_q_m}, .speed{56_q_km_per_h}, .mass{50'300_q_t}, .mainGuns{380_q_mm}, .shellMass{800_q_kg}, .shellSpeed{820._q_m_per_s}, .power{110.45_q_kW}};
|
||||
|
@@ -20,14 +20,14 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/international/length.h>
|
||||
#include <units/math.h>
|
||||
#include <units/format.h>
|
||||
#include <units/math.h>
|
||||
#include <units/physical/si/international/length.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/quantity_point.h>
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <compare>
|
||||
#include <iostream>
|
||||
|
||||
// horizontal/vertical vector
|
||||
namespace {
|
||||
@@ -202,7 +202,7 @@ struct fmt::formatter<altitude> : formatter<si::length<si::metre>> {
|
||||
namespace {
|
||||
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::physical::international::literals;
|
||||
using namespace units::physical::si::international::literals;
|
||||
|
||||
struct glider {
|
||||
struct polar_point {
|
||||
|
@@ -20,9 +20,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/international/speed.h>
|
||||
#include <units/format.h>
|
||||
#include <units/physical/si/international/speed.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace units::physical;
|
||||
@@ -36,7 +36,7 @@ int main()
|
||||
{
|
||||
using namespace units::physical::si::literals;
|
||||
Speed auto v1 = avg_speed(220_q_km, 2_q_h);
|
||||
Speed auto v2 = avg_speed(si::length<international::mile>(140), si::time<si::hour>(2));
|
||||
Speed auto v2 = avg_speed(si::length<si::international::mile>(140), si::time<si::hour>(2));
|
||||
#if DOWNCAST_MODE == 0
|
||||
Speed auto v3 = quantity_cast<si::dim_speed, si::metre_per_second>(v2);
|
||||
#else
|
||||
|
@@ -23,10 +23,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/cgs/speed.h>
|
||||
#include <units/physical/si/cgs/speed.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::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
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -23,11 +23,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/cgs/length.h>
|
||||
#include <units/physical/si/cgs/length.h>
|
||||
#include <units/physical/si/area.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::cgs {
|
||||
|
||||
using si::square_centimetre;
|
||||
|
||||
@@ -44,4 +44,4 @@ constexpr auto operator"" _q_cm2(long double l) { return area<square_centimetre,
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -23,11 +23,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/cgs/force.h>
|
||||
#include <units/physical/si/cgs/force.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::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::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -23,12 +23,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/cgs/acceleration.h>
|
||||
#include <units/physical/cgs/mass.h>
|
||||
#include <units/physical/si/cgs/acceleration.h>
|
||||
#include <units/physical/si/cgs/mass.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::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::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -26,7 +26,7 @@
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::cgs {
|
||||
|
||||
using si::centimetre;
|
||||
|
||||
@@ -43,4 +43,4 @@ constexpr auto operator"" _q_cm(long double l) { return length<centimetre, long
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -26,7 +26,7 @@
|
||||
#include <units/physical/si/mass.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::cgs {
|
||||
|
||||
using si::gram;
|
||||
|
||||
@@ -43,4 +43,4 @@ constexpr auto operator"" _q_g(long double l) { return mass<gram, long double>(l
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -23,11 +23,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/cgs/energy.h>
|
||||
#include <units/physical/si/cgs/energy.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::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_sec
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -23,12 +23,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/cgs/area.h>
|
||||
#include <units/physical/cgs/force.h>
|
||||
#include <units/physical/si/cgs/area.h>
|
||||
#include <units/physical/si/cgs/force.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::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 dou
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -23,11 +23,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/cgs/length.h>
|
||||
#include <units/physical/cgs/time.h>
|
||||
#include <units/physical/si/cgs/length.h>
|
||||
#include <units/physical/si/cgs/time.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::cgs {
|
||||
|
||||
struct centimetre_per_second : unit<centimetre_per_second> {};
|
||||
struct dim_speed : physical::dim_speed<dim_speed, centimetre_per_second, dim_length, dim_time> {};
|
||||
@@ -43,4 +43,4 @@ constexpr auto operator"" _q_cm_per_s(long double l) { return speed<centimetre_p
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -26,7 +26,7 @@
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::cgs {
|
||||
namespace units::physical::si::cgs {
|
||||
|
||||
using si::second;
|
||||
|
||||
@@ -39,4 +39,4 @@ using si::literals::operator"" _q_s;
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::cgs
|
||||
} // namespace units::physical::si::cgs
|
@@ -23,10 +23,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/speed.h>
|
||||
#include <units/physical/si/fps/speed.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
namespace units::physical::si::fps {
|
||||
|
||||
struct foot_per_second_sq : unit<foot_per_second_sq> {};
|
||||
struct dim_acceleration : physical::dim_acceleration<dim_acceleration, foot_per_second_sq, dim_length, dim_time> {};
|
||||
@@ -42,4 +42,4 @@ constexpr auto operator"" _q_ft_per_s2(long double l) { return acceleration<foot
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
} // namespace units::physical::si::fps
|
@@ -23,11 +23,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/length.h>
|
||||
#include <units/physical/si/fps/length.h>
|
||||
// #include <units/physical/si/area.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
namespace units::physical::si::fps {
|
||||
|
||||
struct square_foot : unit<square_foot> {};
|
||||
struct dim_area : physical::dim_area<dim_area, square_foot, dim_length> {};
|
||||
@@ -44,4 +44,4 @@ constexpr auto operator"" _q_ft2(long double l) { return area<square_foot, long
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::fps
|
||||
} // namespace units::physical::si::fps
|
@@ -23,11 +23,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/mass.h>
|
||||
#include <units/physical/fps/length.h>
|
||||
#include <units/physical/si/fps/mass.h>
|
||||
#include <units/physical/si/fps/length.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
namespace units::physical::si::fps {
|
||||
|
||||
struct pound_per_foot_cub : unit<pound_per_foot_cub> {};
|
||||
|
||||
@@ -43,4 +43,4 @@ constexpr auto operator"" _q_lb_per_ft3(long double l) { return density<pound_pe
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
} // namespace units::physical::si::fps
|
@@ -23,11 +23,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/force.h>
|
||||
#include <units/physical/si/fps/force.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
namespace units::physical::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot-poundal
|
||||
struct foot_poundal : unit<foot_poundal> {};
|
||||
@@ -54,4 +54,4 @@ constexpr auto operator"" _q_ft_lbf(long double l) { return energy<foot_pound_fo
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
} // namespace units::physical::si::fps
|
@@ -23,12 +23,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/dimensions.h>
|
||||
#include <units/physical/fps/acceleration.h>
|
||||
#include <units/physical/fps/mass.h>
|
||||
#include <units/physical/si/fps/acceleration.h>
|
||||
#include <units/physical/si/fps/mass.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
namespace units::physical::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Poundal
|
||||
struct poundal : named_unit<poundal, "pdl", no_prefix> {};
|
||||
@@ -62,4 +62,4 @@ constexpr auto operator"" _q_klbf(long double l) { return force<kilopound_force,
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::physical::fps
|
||||
} // namespace units::physical::si::fps
|
@@ -26,7 +26,7 @@
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace units::physical::fps {
|
||||
namespace units::physical::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio(3'048, 1'000, -1), si::metre> {};
|
||||
@@ -95,4 +95,4 @@ constexpr auto operator"" _q_naut_mi(long double l) { return length<nautical_mil
|
||||
|
||||
}
|
||||
|
||||
} // namespace units::physical::fps
|
||||
} // namespace units::physical::si::fps
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user