docs: documentation updated with recent changes

This commit is contained in:
Mateusz Pusz
2020-09-11 23:32:41 +02:00
parent c5cf329ed0
commit caae7675d6
9 changed files with 60 additions and 50 deletions

View File

@@ -26,6 +26,10 @@ analysis and unit/quantity manipulation. The basic idea and design heavily bases
Here is a small example of possible operations:
```cpp
#include <units/physical/si/si.h>
using namespace units::physical::si;
// simple numeric operations
static_assert(10_q_km / 2 == 5_q_km);
@@ -53,8 +57,8 @@ and dimensional analysis can be performed without sacrificing on accuracy. Pleas
the below example for a quick preview of basic library features:
```cpp
#include <units/physical/si/speed.h>
#include <units/physical/si/international/speed.h>
#include <units/physical/si/si.h>
#include <units/physical/si/international/international.h>
#include <units/format.h>
#include <iostream>

View File

@@ -1,7 +1,7 @@
# Release notes
- **0.6.0 WIP**
- gcc-9 is no longer supported (at least gcc-10 is required)
- (!) gcc-9 is no longer supported (at least gcc-10 is required)
- Visual Studio 16.7 support added
- linear_algebra updated to 0.7.0/stable
- fmt updated to 7.0.3
@@ -9,17 +9,19 @@
- catch2 updated to 2.13.0
- doxygen updated to 1.8.18
- ms-gsl 3.1.0 dependency added
- Removed the dependency on a git submodule with common CMake scripts
- (!) Refactored and cleaned up the library file tree
- (!) `q_*` UDL renamed to `_q_*`
- (!) `ratio` changed to the NTTP kind
- (!) `exp` and `Exp` renamed to `exponent` and `Exponent`
- (!) `Scalar` concept renamed to `ScalableNumber`
- (!) Dimensionless quantities redesigned to be of `quantity` type
- Added angle as SI base dimension (thanks [@kwikius](https://github.com/kwikius))
- Added STL random number distribution wrappers (thanks [@yasamoka](https://github.com/yasamoka))
- `math.h` function signatures refactored to use a `Quantity` concept (thanks [@kwikius](https://github.com/kwikius))
- FPS system added (thanks [@mikeford3](https://github.com/mikeford3))
- `quantity_point` support added (thanks [@johelegp](https://github.com/johelegp))
- `ratio` changed to the NTTP kind
- `exp` and `Exp` renamed to `exponent` and `Exponent`
- Added support for `exp()` mathematical support
- Dimensionless quantities redesigned to be of `quantity` type
- `Scalar` concept renamed to `ScalableNumber`
- `q_*` UDL renamed to `_q_*`
- Added support for mathematical function `exp(quantity)`
- **0.5.0 May 17, 2020**
- Major refactoring and rewrite of the library

View File

@@ -9,6 +9,7 @@ Library Directories Structure
├── bits
│ └── external
├── data
├── generic
└── physical
├── natural
└── si
@@ -37,6 +38,11 @@ Library Directories Structure
library or should be (or already are) the subject of separate standardization
proposals not related to a Physical Units library proposal.
- *./units/generic*
- Provides quantity types not related to any :term:`system of quantities`
(e.g. `dimensionless`, `angle`).
- *./units/physical*
- Contains the definition of physical units dimensions.
@@ -52,3 +58,9 @@ Library Directories Structure
More information on provided :term:`systems of units <system of units>` can be
found in :ref:`Systems` chapter.
.. important::
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
(e.g. *units/physical/si/si.h*).

View File

@@ -73,7 +73,7 @@ This is why it was decided to go with the current approach.
Why do we spell ``metre`` instead of ``meter``?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Well, this is how [ISO-80000]_ defines it (British English spelling by default).
Well, this is how [ISO80000]_ defines it (British English spelling by default).
User Defined Literals (UDLs)
@@ -82,7 +82,7 @@ User Defined Literals (UDLs)
Why all UDLs are prefixed with ``_q_`` instead of just using unit symbol?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
..note ..
.. note::
Every ``_q_*`` UDL will be replaced by the ``q_*`` literal when/if **mp-units**
will become a part of the C++ Standard Library.
@@ -104,7 +104,7 @@ Text formatting
Why Unicode quantity symbols are used by default instead of ASCII-only characters?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Both C++ and :term:`SI` ([ISO-80000]_) are standardized by the
Both C++ and :term:`SI` ([ISO80000]_) are standardized by the
:abbr:`ISO (International Organization for Standardization)`. :term:`SI` standard
specifies Unicode symbols as the official unit names for some quantities (i.e. ``Ω``
symbol for the resistance quantity). As **mp-units** library
@@ -127,20 +127,3 @@ Unfortunately, if `using-directives <https://en.cppreference.com/w/cpp/language/
(i.e. ``using namespace units::physical::si``) are being used, `units::physical::si::time` 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) namespace names.
.. rubric:: Footnotes:
.. [ISO-80000] ISO 80000 or IEC 80000 is an international standard promulgated jointly
by the :abbr:`ISO (International Organization for Standardization)` and the
:abbr:`IEC (International Electrotechnical Commission)`. The standard introduces the
:term:`International System of Quantities`. It is a style guide for the use of
physical quantities and units of measurement, formulas involving them, and their
corresponding units, in scientific and educational documents for worldwide use.
Read more on `Wikipedia <ISO/IEC 80000 https://en.wikipedia.org/wiki/ISO/IEC_80000>`_.

View File

@@ -205,7 +205,7 @@ Other definitions
.. rubric:: Footnotes:
.. [1] [ISO-80000]_ gives general information and definitions concerning quantities, systems of quantities,
.. [1] [ISO80000]_ gives general information and definitions concerning quantities, systems of quantities,
units, quantity and unit symbols, and coherent unit systems, especially the International System
of Quantities, ISQ, and the International System of Units, SI. The principles laid down in
ISO 80000-1:2009 are intended for general use within the various fields of science and technology

View File

@@ -3,6 +3,10 @@ Quick Start
Here is a small example of possible operations::
#include <units/physical/si/si.h>
using namespace units::physical::si;
// simple numeric operations
static_assert(10_q_km / 2 == 5_q_km);
@@ -31,8 +35,8 @@ but still easy to use interface where all unit conversions and dimensional analy
performed without sacrificing on accuracy. Please see the below example for a quick preview
of basic library features::
#include <units/physical/si/speed.h>
#include <units/physical/si/international/speed.h>
#include <units/physical/si/si.h>
#include <units/physical/si/international/international.h>
#include <units/format.h>
#include <iostream>

View File

@@ -1,6 +1,6 @@
References
==========
.. [ISO-80000] `ISO 80000-1:2009(E) "Quantities and units — Part 1: General" <https://www.iso.org/standard/30669.html>`_, International Organization for Standardization.
.. [ISO80000] `ISO 80000-1:2009(E) "Quantities and units — Part 1: General" <https://www.iso.org/standard/30669.html>`_, International Organization for Standardization.
.. [P0847] `"Deducing this" <https://wg21.link/P0847>`_, Programming Language C++ proposal.

View File

@@ -21,7 +21,7 @@ and pass it to the library's output:
.. code-block::
#include "legacy.h"
#include <units/physical/si/speed.h>
#include <units/physical/si/si.h>
#include <units/quantity_point.h>
using namespace units::physical;

View File

@@ -18,37 +18,42 @@ definition is included in the current translation unit) :ref:`The Downcasting Fa
will determine its type. The same applies to the resulting unit. For example:
.. code-block::
:emphasize-lines: 3,7-9
:emphasize-lines: 1,7,9
#include <units/physical/si/length.h>
#include <units/physical/si/time.h>
#include <units/physical/si/speed.h>
#include <units/physical/si/si.h>
using namespace units::physical::si;
constexpr auto result = 144_q_km / 2_q_h;
static_assert(is_same_v<decltype(result)::dimension, dim_speed>);
static_assert(is_same_v<decltype(result)::unit, kilometre_per_hour>);
static_assert(std::is_same_v<decltype(result)::dimension,
dim_speed>);
static_assert(std::is_same_v<decltype(result)::unit,
kilometre_per_hour>);
However, if the resulting dimension is not predefined by the user the library framework
However, if the resulting dimension is not predefined by the user, the library framework
will create an instance of an `unknown_dimension`. The coherent unit of such an unknown
dimension is an `unknown_coherent_unit`. Let's see what happens with our example when
we forget to include a header file with the resulting dimension definition:
instead including the header with all :term:`SI` definitions we will just provide base
dimensions used in the division operation:
.. code-block::
:emphasize-lines: 3,9,11
:emphasize-lines: 1-2,8,10
#include <units/physical/si/length.h>
#include <units/physical/si/time.h>
// #include <units/physical/si/speed.h>
#include <units/physical/si/base/length.h>
#include <units/physical/si/base/time.h>
using namespace units::physical::si;
constexpr auto result = 144_q_km / 2_q_h;
static_assert(is_same_v<decltype(result)::dimension,
unknown_dimension<exponent<dim_length, 1>, exponent<dim_time, -1>>>);
static_assert(is_same_v<decltype(result)::unit,
scaled_unit<ratio(1, 36, 1), unknown_coherent_unit>>);
static_assert(std::is_same_v<decltype(result)::dimension,
unknown_dimension<exponent<dim_length, 1>, exponent<dim_time, -1>>>);
static_assert(std::is_same_v<decltype(result)::unit,
scaled_unit<ratio(1, 36, 1), unknown_coherent_unit>>);
.. important::
To limit the possibility of an ODR violation please always include a header file
with all the definitions for the current system (e.g. *units/physical/si/si.h*).
Operations On Unknown Dimensions And Their Units