20 std::fill(exponents_.begin(), exponents_.end(), 0);
101 ASSERT(is_def(),
"UnitSI object must be defined!");
102 std::stringstream output;
108 if (exponents_[
UnitSI::order_m ]!=1 || exponents_[ UnitSI::order_md ]) {
112 if (exponents_[ UnitSI::order_md ]>0) output <<
"+";
114 if (exponents_[ UnitSI::order_md ]) {
115 if (exponents_[ UnitSI::order_md ]==-1) output <<
"-";
116 else if (exponents_[ UnitSI::order_md ]!=1) output << exponents_[
UnitSI::order_md ];
124 for (
unsigned int i=1; i<7; i++)
126 if (exponents_[i] == 1) {
127 output << unit_symbols[i];
129 output << unit_symbols[i] <<
"^{" << exponents_[i] <<
"}";
133 if (output.str().size()==2) {
155 for (
unsigned int i=0; i<7; i++) {
168 for (
unsigned int i=0; i<7; i++) {
bool is_def() const
Return true if the unit is defined.
std::vector< int > exponents_
static UnitSI & Pa()
Returns Pascal.
std::string format() 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)