![]() |
Shamrock 2025.10.0
Astrophysical Code
|
#include "ConversionConstants.hpp"#include "Names.hpp"#include "UnitSystem.hpp"#include "details/utils.hpp"#include <stdexcept>
Include dependency graph for Constants.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | shamunits::Constants< T > |
| Physical constants. More... | |
| struct | shamunits::Constants< T >::Si |
| Physical constant in SI units. More... | |
Namespaces | |
| namespace | shamunits |
| namespace containing the units library | |
Macros | |
| #define | addconstant(name) |
| Macro to add a constant to the shamunits::Constants class For example one can add a new constant by adding the following statement inside shamunits::Constants. | |
| #define | Uget(unitname, mult_pow) units.template get<None, units::unitname, (mult_pow) * power>() |
| Utility macro to get the value of a unit in the current unit system with its power. | |
| #define | Cget(constant_name, mult_pow) details::pow_constexpr_fast_inv<(mult_pow) * power>(constant_name, 1 / constant_name) |
| Utility macro to get the value of a constant in the current unit system with its power. | |
| #define | UNITS_CONSTANTS |
| X macro to list all constants conversion & bindings. | |
| #define | X(name, conv) addconstant(name) { return Cget(Si::name, 1) * conv; } |
| Define the constant conversions functions. | |
Variables | |
| template<class T > | |
| constexpr T | shamunits::pi = 3.141592653589793116 |
Value of pi Usage : auto pi = shamunits::pi<T>; | |
| template<class T > | |
| constexpr T | shamunits::fine_structure = 0.0072973525693 |
| Fine structure constant. | |
| template<class T > | |
| constexpr T | shamunits::proton_electron_ratio = 1836.1526734311 |
| Mass ration between the proton and electron. | |
| template<class T > | |
| constexpr T | shamunits::electron_proton_ratio = 1 / proton_electron_ratio<T> |
| Mass ration between the electron and proton. | |
Definition in file Constants.hpp.
| #define addconstant | ( | name | ) |
Macro to add a constant to the shamunits::Constants class For example one can add a new constant by adding the following statement inside shamunits::Constants.
Definition at line 32 of file Constants.hpp.
| #define Cget | ( | constant_name, | |
| mult_pow | |||
| ) | details::pow_constexpr_fast_inv<(mult_pow) * power>(constant_name, 1 / constant_name) |
Utility macro to get the value of a constant in the current unit system with its power.
Definition at line 40 of file Constants.hpp.
| #define Uget | ( | unitname, | |
| mult_pow | |||
| ) | units.template get<None, units::unitname, (mult_pow) * power>() |
Utility macro to get the value of a unit in the current unit system with its power.
Definition at line 37 of file Constants.hpp.
| #define UNITS_CONSTANTS |
X macro to list all constants conversion & bindings.
Definition at line 44 of file Constants.hpp.
| #define X | ( | name, | |
| conv | |||
| ) | addconstant(name) { return Cget(Si::name, 1) * conv; } |
Define the constant conversions functions.
Definition at line 173 of file Constants.hpp.