Celeritas
0.5.0-86+4a8eea4
|
#include <type_traits>
#include "corecel/Macros.hh"
#include "corecel/Types.hh"
#include "detail/QuantityImpl.hh"
Classes | |
class | celeritas::Quantity< UnitT, ValueT > |
A numerical value tagged with a unit. More... | |
Macros | |
#define | CELER_DEFINE_QACCESS(FUNC, QUAL) |
Functions | |
CELER_CONSTEXPR_FUNCTION auto | celeritas::zero_quantity () noexcept |
Get a zero quantity (analogous to nullptr). | |
CELER_CONSTEXPR_FUNCTION auto | celeritas::max_quantity () noexcept |
Get a quantitity greater than any other numeric quantity. | |
CELER_CONSTEXPR_FUNCTION auto | celeritas::neg_max_quantity () noexcept |
Get a quantitity less than any other numeric quantity. | |
template<class U , class V > | |
CELER_CONSTEXPR_FUNCTION void | celeritas::swap (Quantity< U, V > &a, Quantity< U, V > &b) noexcept |
Swap two Quantities. | |
template<class UnitT , class ValueT > | |
CELER_CONSTEXPR_FUNCTION auto | celeritas::native_value_from (Quantity< UnitT, ValueT > quant) noexcept |
Convert the given quantity into the native Celeritas unit system. More... | |
template<class Q > | |
CELER_CONSTEXPR_FUNCTION Q | celeritas::native_value_to (typename Q::value_type value) noexcept |
Create a quantity from a value in the Celeritas unit system. More... | |
template<class Q , class SrcUnitT , class ValueT > | |
CELER_CONSTEXPR_FUNCTION auto | celeritas::value_as (Quantity< SrcUnitT, ValueT > quant) noexcept -> ValueT |
Use the value of a Quantity. More... | |
template<class T > | |
char const * | celeritas::accessor_unit_label () |
Get the label for a unit returned from a class accessor. More... | |
#define CELER_DEFINE_QACCESS | ( | FUNC, | |
QUAL | |||
) |
Access the underlying numeric value, discarding units
|
inline |
Get the label for a unit returned from a class accessor.
Example:
|
noexcept |
Convert the given quantity into the native Celeritas unit system.
|
noexcept |
Create a quantity from a value in the Celeritas unit system.
This function can be used for defining a constant for use in another unit system (typically a "natural" unit system for use in physics kernels).
|
noexcept |
Use the value of a Quantity.
The redundant unit type in the function signature is to make coupling safer across different parts of the code and to make the user code more readable.