Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
UnitSystem.hpp File Reference
#include "ConversionConstants.hpp"
#include "Names.hpp"
#include <cmath>
Include dependency graph for UnitSystem.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  shamunits::UnitSystem< T >
 Defines a unit system. More...

Namespaces

namespace  shamunits
 namespace containing the units library

Macros

#define addget(uname)
 Macro to add a unit getter.
#define Uget(unitname, mult_pow)
 Shorthand for unit getter.
#define Cget(constant_name, mult_pow)
 Shorthand for constant getter.
#define PREF   Cget((get_prefix_val<T, pref>()), 1)
 Shorthand for prefix handling.

Detailed Description

Macro Definition Documentation

◆ addget

#define addget ( uname)
Value:
template< \
UnitPrefix pref = None, \
units::UnitName u, \
int power = 1, \
std::enable_if_t<u == units::uname, int> = 0> \
inline constexpr T get() const noexcept

Macro to add a unit getter.

Definition at line 24 of file UnitSystem.hpp.

◆ Cget

#define Cget ( constant_name,
mult_pow )
Value:
details::pow_constexpr_fast_inv<(mult_pow) * power>(constant_name, T(1) / constant_name)

Shorthand for constant getter.

Definition at line 35 of file UnitSystem.hpp.

◆ PREF

#define PREF   Cget((get_prefix_val<T, pref>()), 1)

Shorthand for prefix handling.

Definition at line 38 of file UnitSystem.hpp.

◆ Uget

#define Uget ( unitname,
mult_pow )
Value:
get<pref, units::unitname, (mult_pow) * power>()

Shorthand for unit getter.

Definition at line 33 of file UnitSystem.hpp.