8 #ifndef FFA_UNIT_CALCULATOR_H
9 #define FFA_UNIT_CALCULATOR_H
44 template <
class T>
bool convert(T& value,
const std::string& aName)
const
49 value *= it->second.factor;
54 bool convert(
double& value,
const std::string& aName,
int prec)
const;
57 template <
class T>
bool inverse(T& value,
const std::string& aName)
const
62 value /= it->second.factor;
75 return it ==
myConvFactors.end() ? std::string(
"") : it->second.origUnit;
81 return it ==
myConvFactors.end() ? std::string(
"") : it->second.convUnit;
85 const std::string& origUnit =
"",
86 const std::string& convUnit =
"");
119 std::map<std::string,FFaUnitCalculator>
myCalcs;
Template class for singleton classes.
Definition: FFaSingelton.H:20
static T * instance()
Returns the actual instance of this class.
Definition: FFaSingelton.H:32
Definition: FFaUnitCalculator.H:100
FFaUnitCalculatorProvider()
Definition: FFaUnitCalculator.H:115
virtual ~FFaUnitCalculatorProvider()
Definition: FFaUnitCalculator.H:116
void addCalculator(const FFaUnitCalculator &calc)
Definition: FFaUnitCalculator.C:167
std::map< std::string, FFaUnitCalculator > myCalcs
Definition: FFaUnitCalculator.H:119
bool readCalculatorDefs(const std::string &filename)
Reads/writes calculator data from file.
Definition: FFaUnitCalculator.C:177
bool printCalculatorDefs(const std::string &filename) const
Writes calculator data to file.
Definition: FFaUnitCalculator.C:214
void getCalculatorNames(std::vector< std::string > &definedCalcs) const
Definition: FFaUnitCalculator.C:159
std::vector< const FFaUnitCalculator * > getCalculators() const
Definition: FFaUnitCalculator.C:148
const FFaUnitCalculator * getCalculator(const std::string &calcName) const
Definition: FFaUnitCalculator.C:133
Definition: FFaUnitCalculator.H:19
bool inverse(T &value, const std::string &aName) const
Reversed conversion.
Definition: FFaUnitCalculator.H:57
std::string origGroup
Definition: FFaUnitCalculator.H:90
const std::string & getConvUnits() const
Definition: FFaUnitCalculator.H:42
bool operator==(const FFaUnitCalculator &cal) const
Definition: FFaUnitCalculator.C:16
std::string convUnitName(const std::string &aName) const
Definition: FFaUnitCalculator.H:78
bool convert(T &value, const std::string &aName) const
Definition: FFaUnitCalculator.H:44
std::map< std::string, SingleUnit > SingleUnitMap
Definition: FFaUnitCalculator.H:27
friend std::istream & operator>>(std::istream &is, FFaUnitCalculator &field)
Definition: FFaUnitCalculator.C:87
SingleUnitMap myConvFactors
Definition: FFaUnitCalculator.H:92
const std::string & getName() const
Definition: FFaUnitCalculator.H:40
std::string origUnitName(const std::string &aName) const
Definition: FFaUnitCalculator.H:72
std::string convGroup
Definition: FFaUnitCalculator.H:91
bool isValid() const
Definition: FFaUnitCalculator.H:38
FFaUnitCalculator(const char *n=NULL)
Definition: FFaUnitCalculator.H:31
SingleUnitMap::const_iterator SingleUnitMapIter
Definition: FFaUnitCalculator.H:28
double convFactor(const std::string &aName) const
Definition: FFaUnitCalculator.H:66
const std::string & getOrigUnits() const
Definition: FFaUnitCalculator.H:41
void addConversion(const std::string &propName, double sf, const std::string &origUnit="", const std::string &convUnit="")
Definition: FFaUnitCalculator.C:57
std::string name
Definition: FFaUnitCalculator.H:89
friend std::ostream & operator<<(std::ostream &os, const FFaUnitCalculator &field)
Definition: FFaUnitCalculator.C:67
character(lfnam_p) filename
Name of function data file.
Definition: initiateFunctionTypeModule.f90:34
Definition: FFaUnitCalculator.H:21
std::string origUnit
Definition: FFaUnitCalculator.H:23
double factor
Definition: FFaUnitCalculator.H:22
std::string convUnit
Definition: FFaUnitCalculator.H:24