mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
Documentation for quantity constants added
This commit is contained in:
@@ -73,6 +73,7 @@ add_custom_command(OUTPUT "${SPHINX_INDEX_FILE}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/faq.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/basic_concepts.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/constants.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/conversions_and_casting.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/dimensions.rst"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/framework/quantities.rst"
|
||||
|
@@ -14,5 +14,6 @@ Framework
|
||||
framework/quantities
|
||||
framework/dimensions
|
||||
framework/units
|
||||
framework/constants
|
||||
framework/conversions_and_casting
|
||||
framework/text_output
|
||||
|
33
docs/framework/constants.rst
Normal file
33
docs/framework/constants.rst
Normal file
@@ -0,0 +1,33 @@
|
||||
.. namespace:: units
|
||||
|
||||
Quantity Constants
|
||||
==================
|
||||
|
||||
In the **mp-units** library quantity constants are implemented as variable
|
||||
templates of `quantity` types parametrized by the quantity's representation
|
||||
type.
|
||||
|
||||
Additionally, in case of the :term:`SI` its physical constants are put in
|
||||
separate namespaces named after the official release of the :term:`SI`
|
||||
specification. This is needed to be able to provide backward and forward
|
||||
compatibility as exact values of physical constants tend to change with time
|
||||
(in most cases they are getting more and more accurate with every
|
||||
specification release).
|
||||
|
||||
For example the speed of light constant in :term:`SI` is defined as::
|
||||
|
||||
namespace si::si2019 {
|
||||
|
||||
template<Scalar Rep = double>
|
||||
inline constexpr auto speed_of_light = velocity<metre_per_second, Rep>(299792458);
|
||||
|
||||
}
|
||||
|
||||
The same constant defined for natural units may be provided as::
|
||||
|
||||
namespace natural {
|
||||
|
||||
template<Scalar Rep = double>
|
||||
inline constexpr auto speed_of_light = velocity<unitless, Rep>(1);
|
||||
|
||||
}
|
@@ -30,9 +30,7 @@
|
||||
#include <units/physical/si/temperature.h>
|
||||
#include <units/physical/si/velocity.h>
|
||||
|
||||
namespace units::si {
|
||||
|
||||
namespace si2019 {
|
||||
namespace units::si::si2019 {
|
||||
|
||||
template<Scalar Rep = double>
|
||||
inline constexpr auto planck_constant = energy<joule, Rep>(6.62607015e-34) * time<second, Rep>(1);
|
||||
@@ -61,6 +59,4 @@ inline constexpr auto hyperfine_structure_transition_frequency = frequency<hertz
|
||||
template<Scalar Rep = double>
|
||||
inline constexpr auto standard_gravity = acceleration<metre_per_second_sq, Rep>(9.80665);
|
||||
|
||||
} // namespace si2019
|
||||
|
||||
} // namespace units::si
|
||||
} // namespace units::si::si2019
|
||||
|
Reference in New Issue
Block a user