Go to the source code of this file.
|
| class | MooseUnits |
| | Physical unit management class with runtime unit string parsing, unit checking, unit conversion, and output. More...
|
| |
◆ operator<<()
| std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const MooseUnits & |
u |
|
) |
| |
Definition at line 568 of file Units.C.
570{
572 static const std::vector<std::string> base_unit = {"m", "kg", "s", "A", "K", "at", "cd"};
573
575 {
577 if (!u.
_base.empty())
578 os << ' ';
579 }
580
582 {
583 os << (i ? (latex ? "\\cdot " : "*") : "");
584
585 const auto & unit = base_unit[
int(u.
_base[i].first)];
586 if (latex)
587 os << "\\text{" << unit << "}";
588 else
589 os << unit;
590
591 if (u.
_base[i].second != 1)
592 {
593 if (latex)
594 os <<
"^{" << u.
_base[i].second <<
'}';
595 else
596 os <<
'^' << u.
_base[i].second;
597 }
598 }
599
600 return os;
601}
void ErrorVector unsigned int
static int geti()
iosteam manipulator helper to toggle latex / text output
std::vector< std::pair< BaseUnit, int > > _base
base SI units and their exponents
Real _factor
conversion factor w.r.t. the base SI units
auto index_range(const T &sizable)