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);
Helper class. Defines basic factors of SI, non-SI and derived units.
UnitsMap units_map_
Define all base and derived units given by their symbol.
BasicFactors()
Constructor.
std::map< std::string, struct DerivedUnit > UnitsMap
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.
static const Input::Type::Record & get_input_type()
static const BasicFactors basic_factors
Define all base and derived units given by their symbol.
UnitConverter()
Constructor.
UnitSI unit_si() const
Return unit_si_.
double convert(std::string actual_unit)
UnitData read_unit(std::string s)
Parse and check unit defined in string format.
Class for representation SI units of Fields.
bool is_def() const
Return true if the unit is defined.
UnitSI unit_
derived SI unit
double coef_
multiplicative coeficient
Store structure given by parser.
Factor(std::string factor, int exponent, bool basic=true)
std::string factor_
string represantation of unit or user defined constant
bool basic_
unit is basic (strict defined in application) / derived (defined by user as formula)
TYPEDEF_ERR_INFO(EI_UnitDefinition, std::string)
std::map< std::string, struct Formula > UnitData
DECLARE_INPUT_EXCEPTION(ExcInvalidUnit,<< "Invalid definition of unit: "<< EI_UnitDefinition::qval<< "\n"<< EI_UnitError::val<< ".\n")