From bd641228808588d5488c501c402817ac06c729ff Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 14 Jun 2022 11:18:29 +0200 Subject: [PATCH] docs: "Quantity-like Types" chapter added Refers to #365 --- docs/CMakeLists.txt | 2 ++ docs/_static/img/quantity_like.svg | 37 ++++++++++++++++++++++ docs/framework.rst | 1 + docs/framework/quantity_like.rst | 51 ++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 docs/_static/img/quantity_like.svg create mode 100644 docs/framework/quantity_like.rst diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 657bbdd5..04c7fc08 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -44,6 +44,7 @@ set(unitsSphinxDocs "${CMAKE_CURRENT_SOURCE_DIR}/_static/img/downcast_1.png" "${CMAKE_CURRENT_SOURCE_DIR}/_static/img/downcast_2.png" "${CMAKE_CURRENT_SOURCE_DIR}/_static/img/units.svg" + "${CMAKE_CURRENT_SOURCE_DIR}/_static/img/quantity_like.svg" "${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md" "${CMAKE_CURRENT_SOURCE_DIR}/design.rst" "${CMAKE_CURRENT_SOURCE_DIR}/design/directories.rst" @@ -88,6 +89,7 @@ set(unitsSphinxDocs "${CMAKE_CURRENT_SOURCE_DIR}/framework/dimensions.rst" "${CMAKE_CURRENT_SOURCE_DIR}/framework/quantities.rst" "${CMAKE_CURRENT_SOURCE_DIR}/framework/quantity_kinds.rst" + "${CMAKE_CURRENT_SOURCE_DIR}/framework/quantity_like.rst" "${CMAKE_CURRENT_SOURCE_DIR}/framework/quantity_points.rst" "${CMAKE_CURRENT_SOURCE_DIR}/framework/text_output.rst" "${CMAKE_CURRENT_SOURCE_DIR}/framework/units.rst" diff --git a/docs/_static/img/quantity_like.svg b/docs/_static/img/quantity_like.svg new file mode 100644 index 00000000..bcc1c0ff --- /dev/null +++ b/docs/_static/img/quantity_like.svg @@ -0,0 +1,37 @@ +quantityquantity_pointquantity_kindquantity_point_kindRepnumber()relative()common()relative() diff --git a/docs/framework.rst b/docs/framework.rst index ba17d2e2..cacfa71b 100644 --- a/docs/framework.rst +++ b/docs/framework.rst @@ -12,6 +12,7 @@ Framework Basics :maxdepth: 2 framework/basic_concepts + framework/quantity_like framework/quantities framework/quantity_points framework/quantity_kinds diff --git a/docs/framework/quantity_like.rst b/docs/framework/quantity_like.rst new file mode 100644 index 00000000..f963fdc7 --- /dev/null +++ b/docs/framework/quantity_like.rst @@ -0,0 +1,51 @@ +.. namespace:: units + +Quantity-like Types +=================== + +.. raw:: html + + + +.. + https://www.planttext.com + + @startuml + + skinparam monochrome true + skinparam shadowing false + skinparam backgroundColor #fcfcfc + + hide members + hide circle + + class quantity [[../framework/quantities.html]] + class quantity_point [[../framework/quantity_points.html]] + class quantity_kind [[../framework/quantity_kinds.html]] + class quantity_point_kind [[../framework/quantity_kinds.html#quantity-point-kinds]] + + Rep <-- quantity : number() + quantity <-- quantity_point : relative() + quantity <-- quantity_kind : common() + quantity_kind <-- quantity_point_kind : relative() + + @enduml + + +[ISO80000]_ defines a :term:`quantity` as a: + + Property of a phenomenon, body, or substance, where the property has a magnitude that can be expressed by + means of a number and a reference. + +You can use `quantity::number()` member function to get a concrete amount of a unit expressed with a specific +representation type ``Rep``. + +:term:`Kind of quantity ` is defined as: + + Aspect common to mutually comparable quantities. + +We can obtain a `quantity` with a `quantity_kind::common()` member function. + +`quantity_point` and `quantity_point_kind` are absolute quantities and quantity kinds relative to some +specific origin. `quantity` and `quantity_point` types can be obtained from them using a ``relative()`` member +function (`quantity_point::relative()`, `quantity_point_kind::relative()`).