48 MooseUnits(Real f, Real s, std::vector<std::pair<MooseUnits::BaseUnit, int>> b)
60 void parse(
const std::string & unit_string);
67 static const std::vector<std::pair<std::string, MooseUnits>>
_unit_table;
93 explicit operator Real()
const;
99 static std::ostream &
latex(std::ostream &
os);
100 static std::ostream &
text(std::ostream &
os);
105 template <
typename... Args>
106 void parseError(
const std::string & unit_string, std::string::const_iterator it, Args... args);
118 std::vector<std::pair<BaseUnit, int>>
_base;
124 template <
typename... Args>
127 std::string::const_iterator it,
130 auto d = std::distance(unit_string.begin(), it);
131 mooseError(
"At position ", d,
" in ", unit_string,
": ", std::forward<Args>(args)...);
MooseUnits operator*(const Real f) const
Unit prefactor scaling.
static const std::vector< std::pair< std::string, MooseUnits > > _unit_table
friend std::ostream & operator<<(std::ostream &os, const MooseUnits &dt)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
bool operator==(const MooseUnits &rhs) const
void parseError(const std::string &unit_string, std::string::const_iterator it, Args... args)
helper function to generate a pretty mooseError
bool isLength() const
query the nature of the unit
std::basic_ostream< charT, traits > * os
std::vector< std::pair< BaseUnit, int > > _base
base SI units and their exponents
static const std::map< std::string, Real > _si_prefix
data tables with SI prefixes and known units
bool isBase(const MooseUnits::BaseUnit) const
check if the unit has a pure base
static int geti()
iosteam manipulator helper to toggle latex / text output
MooseUnits(Real f, Real s, std::vector< std::pair< MooseUnits::BaseUnit, int >> b)
MooseUnits operator/(const MooseUnits &rhs) const
bool isTemperature() const
MooseUnits(const std::string &unit_string)
Physical unit management class with runtime unit string parsing, unit checking, unit conversion...
bool conformsTo(const MooseUnits &) const
checks if the units are dimensionally conforming (i.e. the describe the same physical quanitity) ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real _factor
conversion factor w.r.t. the base SI units
Real convert(Real from_value, const MooseUnits &from_unit) const
Converts from_value in units of from_units to value this units.
std::ostream & operator<<(std::ostream &os, const MooseUnits &u)
static std::ostream & text(std::ostream &os)
Real _shift
additive shift (for Celsius and Fahrenheit)
MooseUnits pow(const MooseUnits &, int)
void parse(const std::string &unit_string)
parse a unit string into a MooseUnits object
static std::ostream & latex(std::ostream &os)
iostream manipulators
void simplify()
simplify into the canonical form that permits comparisons