Flow123d
JS_before_hm-2158-g8a5161593
|
Go to the documentation of this file.
31 std::fill(exponents_.begin(), exponents_.end(), 0);
61 return dimensionless();
139 return unit_symbols[idx];
145 ASSERT(is_def()).error(
"UnitSI object must be defined!");
147 std::stringstream output;
170 if (output.str().size() > 0) output << form.
delimiter;
171 output << unit_symbol(i);
172 if (exponents_[i] != 1) output << form.
exp_open << exponents_[i] << form.
exp_close;
175 if (output.str().size()==0) {
186 for(
unsigned int i=0; i < n_base_units; i++ ) {
187 if (i!=0) ss <<
", ";
206 for(
unsigned int i=0; i < n_base_units; i++ ) {
213 std::fill(exponents_.begin(), exponents_.end(), 0);
219 double coef = converter.
convert(actual_unit);
221 if ( converter.
unit_si() == (*
this) ) {
224 THROW( ExcNoncorrespondingUnit() << EI_UnitDefinition(actual_unit) << EI_ExpectedUnit(this->format_text()) );
240 for (
unsigned int i=0; i<7; i++) {
253 for (
unsigned int i=0; i<7; i++) {
manipulators::Array< T, Delim > format(T const &deduce, Delim delim=", ")
static const std::string & unit_symbol(unsigned int idx)
static UnitSI & dimensionless()
Returns dimensionless unit.
UnitSI unit_si() const
Return unit_si_.
UnitSI & md(int exp=-1)
The dimension dependent meter: md^y = m^(yd), where 'd' is dimension.
std::string format_text() const
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
void multiply(const UnitSI &other, int exp=1)
Multiply with power of given unit.
std::string format_latex() const
std::vector< int > exponents_
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
UnitSI operator*(const UnitSI &a, const UnitSI &b)
Product of two units.
double convert_unit_from(std::string actual_unit) const
Convert and check user-defined unit.
UnitSI & m(int exp=1)
Methods set values of exponents for SI units with similar name.
static UnitSI & W()
Returns Watt.
Class for representation SI units of Fields.
UnitSI operator/(const UnitSI &a, const UnitSI &b)
Proportion of two units.
double convert(std::string actual_unit)
static UnitSI & one()
Returns dimensionless unit.
static UnitSI & Pa()
Returns Pascal.
void reset()
Reset UnitSI object (set vector of exponents to zeros and set undef flag)
void undef(bool val=true)
static UnitSI & J()
Returns Joule.
std::string format(OutputFormat form) const
Generic output formating method.
bool is_def() const
Return true if the unit is defined.
bool operator==(const UnitSI &other) const
Comparison operator.