Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Classes | Namespaces | Macros
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)   get<pref, units::unitname, (mult_pow) * power>()
 Shorthand for unit getter.
 
#define Cget(constant_name, mult_pow)    details::pow_constexpr_fast_inv<(mult_pow) * power>(constant_name, T(1) / constant_name)
 Shorthand for constant getter.
 
#define PREF   Cget((get_prefix_val<T, pref>()), 1)
 Shorthand for prefix handling.
 

Detailed Description

Author
David Fang (david.nosp@m..fan.nosp@m.g@ikm.nosp@m.ail..nosp@m.com)
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file UnitSystem.hpp.

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 
)     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 
)    get<pref, units::unitname, (mult_pow) * power>()

Shorthand for unit getter.

Definition at line 33 of file UnitSystem.hpp.