Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shamunits::Constants< T > Struct Template Reference

Physical constants in a unit system. More...

#include <shamunits/include/shamunits/Constants.hpp>

Collaboration diagram for shamunits::Constants< T >:

Public Member Functions

constexpr Constants (const UnitSystem< T > units)
 Construct the shamunits::Constants class with a unit system.
template<Unit u, class Tret = T>
constexpr Tret get () const noexcept
template<class Tret = T, class Tu>
constexpr Tret get (Unit< Tu > u) const noexcept
 Value of a constant only known at run time, e.g. get(constants::from_name("G")).
template<class Tret = T, class Tu>
constexpr Tret get (Unit< Tu > u, int power) const noexcept
 get(u) raised to a runtime power: the Python path, Constants(usys).G(power=2)

Public Attributes

const UnitSystem< T > units
 Current unit system of the constants.

Detailed Description

template<class T>
struct shamunits::Constants< T >

Physical constants in a unit system.

f64 G = cte.get<shamunits::constants::G>();
double f64
Alias for double.
Unit from_name(std::string_view name)
Constant from its name; throws std::invalid_argument if unknown.
Physical constants in a unit system.
Definition Constants.hpp:58
constexpr Tret get() const noexcept
Definition Constants.hpp:69

Definition at line 58 of file Constants.hpp.

Constructor & Destructor Documentation

◆ Constants()

template<class T>
shamunits::Constants< T >::Constants ( const UnitSystem< T > units)
inlineexplicitconstexpr

Construct the shamunits::Constants class with a unit system.

Definition at line 64 of file Constants.hpp.

Member Function Documentation

◆ get() [1/3]

template<class T>
template<Unit u, class Tret = T>
Tret shamunits::Constants< T >::get ( ) const
inlineconstexprnoexcept

Value of the constant (or unit) u in this unit system, e.g. get<constants::G>(). Same as units.get<u, Tret>(); see UnitSystem::get.

Definition at line 69 of file Constants.hpp.

Here is the call graph for this function:

◆ get() [2/3]

template<class T>
template<class Tret = T, class Tu>
Tret shamunits::Constants< T >::get ( Unit< Tu > u) const
inlineconstexprnoexcept

Value of a constant only known at run time, e.g. get(constants::from_name("G")).

Definition at line 75 of file Constants.hpp.

Here is the call graph for this function:

◆ get() [3/3]

template<class T>
template<class Tret = T, class Tu>
Tret shamunits::Constants< T >::get ( Unit< Tu > u,
int power ) const
inlineconstexprnoexcept

get(u) raised to a runtime power: the Python path, Constants(usys).G(power=2)

Definition at line 81 of file Constants.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ units

template<class T>
const UnitSystem<T> shamunits::Constants< T >::units

Current unit system of the constants.

Definition at line 61 of file Constants.hpp.


The documentation for this struct was generated from the following file: