diff --git a/README.md b/README.md index 30fbc74e..1aaa2f99 100644 --- a/README.md +++ b/README.md @@ -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 + +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 -#include +#include +#include #include #include diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ccc83c47..379c2ac4 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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 diff --git a/docs/design/directories.rst b/docs/design/directories.rst index cecb7843..954058ec 100644 --- a/docs/design/directories.rst +++ b/docs/design/directories.rst @@ -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 ` 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*). diff --git a/docs/faq.rst b/docs/faq.rst index f16191e7..8c09b563 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -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 `_ 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 `_. diff --git a/docs/glossary.rst b/docs/glossary.rst index cc9f4def..748feda8 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -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 diff --git a/docs/quick_start.rst b/docs/quick_start.rst index efa5482a..5ef379e5 100644 --- a/docs/quick_start.rst +++ b/docs/quick_start.rst @@ -3,6 +3,10 @@ Quick Start Here is a small example of possible operations:: + #include + + 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 - #include + #include + #include #include #include diff --git a/docs/references.rst b/docs/references.rst index 6018b3ca..5e7c5842 100644 --- a/docs/references.rst +++ b/docs/references.rst @@ -1,6 +1,6 @@ References ========== -.. [ISO-80000] `ISO 80000-1:2009(E) "Quantities and units — Part 1: General" `_, International Organization for Standardization. +.. [ISO80000] `ISO 80000-1:2009(E) "Quantities and units — Part 1: General" `_, International Organization for Standardization. .. [P0847] `"Deducing this" `_, Programming Language C++ proposal. diff --git a/docs/use_cases/legacy_interfaces.rst b/docs/use_cases/legacy_interfaces.rst index d27b26c3..1f099753 100644 --- a/docs/use_cases/legacy_interfaces.rst +++ b/docs/use_cases/legacy_interfaces.rst @@ -21,7 +21,7 @@ and pass it to the library's output: .. code-block:: #include "legacy.h" - #include + #include #include using namespace units::physical; diff --git a/docs/use_cases/unknown_dimensions.rst b/docs/use_cases/unknown_dimensions.rst index 58764028..be269b3e 100644 --- a/docs/use_cases/unknown_dimensions.rst +++ b/docs/use_cases/unknown_dimensions.rst @@ -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 - #include - #include + #include using namespace units::physical::si; constexpr auto result = 144_q_km / 2_q_h; - static_assert(is_same_v); - static_assert(is_same_v); + static_assert(std::is_same_v); + static_assert(std::is_same_v); -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 - #include - // #include + #include + #include using namespace units::physical::si; constexpr auto result = 144_q_km / 2_q_h; - static_assert(is_same_v, exponent>>); - static_assert(is_same_v>); + static_assert(std::is_same_v, exponent>>); + static_assert(std::is_same_v>); + +.. 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