Flow123d
JB_transport-9331eee
|
Go to the documentation of this file.
18 #ifndef UNIT_CONVERTER_HH_
19 #define UNIT_CONVERTER_HH_
42 <<
"Invalid definition of unit: " << EI_UnitDefinition::qval <<
"\n" << EI_UnitError::val <<
".\n");
44 <<
"Non-corresponding definition of unit: " << EI_UnitDefinition::qval <<
"\nExpected: unit with base format "
45 << EI_ExpectedUnit::qval <<
".\n");
112 double convert(std::string actual_unit);
UnitData read_unit(std::string s)
Parse and check unit defined in string format.
UnitSI unit_si() const
Return unit_si_.
Factor(std::string factor, int exponent, bool basic=true)
void add_converted_unit(Factor factor, UnitData &unit_data, UnitSI &unit_si, double &coef)
Calculates UnitSi and coeficient of Factor, recursively calls this method for user defined formula.
Helper class. Defines basic factors of SI, non-SI and derived units.
std::string factor_
string represantation of unit or user defined constant
std::map< std::string, struct Formula > UnitData
UnitSI unit_
derived SI unit
double coef_
multiplicative coeficient
UnitConverter()
Constructor.
DECLARE_INPUT_EXCEPTION(ExcInvalidUnit,<< "Invalid definition of unit: "<< EI_UnitDefinition::qval<< "\n"<< EI_UnitError::val<< ".\n")
Class for representation SI units of Fields.
std::map< std::string, struct DerivedUnit > UnitsMap
double convert(std::string actual_unit)
static const Input::Type::Record & get_input_type()
bool basic_
unit is basic (strict defined in application) / derived (defined by user as formula)
BasicFactors()
Constructor.
static const BasicFactors basic_factors
Define all base and derived units given by their symbol.
TYPEDEF_ERR_INFO(EI_UnitDefinition, std::string)
Store structure given by parser.
UnitsMap units_map_
Define all base and derived units given by their symbol.
bool is_def() const
Return true if the unit is defined.