20 std::fill(exponents_.begin(), exponents_.end(), 0);
123 ASSERT(is_def(),
"UnitSI object must be defined!");
128 std::stringstream output;
133 if (exponents_[
UnitSI::order_m ]!=1 || exponents_[ UnitSI::order_md ]) {
137 if (exponents_[ UnitSI::order_md ]>0) output <<
"+";
139 if (exponents_[ UnitSI::order_md ]) {
140 if (exponents_[ UnitSI::order_md ]==-1) output <<
"-";
141 else if (exponents_[ UnitSI::order_md ]!=1) output << exponents_[
UnitSI::order_md ];
151 if (output.str().size() > 0) output << form.
delimiter;
152 output << unit_symbols[i];
153 if (exponents_[i] != 1) output << form.
exp_open << exponents_[i] << form.
exp_close;
156 if (output.str().size()==0) {
177 for (
unsigned int i=0; i<7; i++) {
190 for (
unsigned int i=0; i<7; i++) {
std::string format(OutputFormat form) const
Generic output formating mtehod.
bool is_def() const
Return true if the unit is defined.
std::string format_text() const
std::vector< int > exponents_
static UnitSI & Pa()
Returns Pascal.
std::string format_latex() const
I/O functions with filename storing, able to track current line in opened file. All standard stdio fu...
UnitSI operator*(const UnitSI &a, const UnitSI &b)
Product of two units.
UnitSI operator/(const UnitSI &a, const UnitSI &b)
Proportion of two units.
static UnitSI & W()
Returns Watt.
static UnitSI & J()
Returns Joule.
UnitSI & m(int exp=1)
Methods set values of exponents for SI units with similar name.
Class for representation SI units of Fields.
UnitSI & md(int exp=-1)
Method sets value of exponent for m^{-d}, where d is dimension of region.
static UnitSI & dimensionless()
Returns dimensionless unit.
void undef(bool val=true)