57 inline static double convert(
double unitToConvert,
double to,
double from){
59 if (to > 0 && from > 0){
61 return unitToConvert*(to/from);
64 else if (to < 0 && from < 0){
66 return unitToConvert*(from/to);
71 throw std::logic_error(
"Incorrect unit conversion.");
80 inline static double convert(
double unitToConvert,
int specificCase){
85 return unitToConvert/1.054;
87 return unitToConvert*1.054;
89 return unitToConvert*1.01325e5;
93 throw std::invalid_argument(
"Specific case not implemented");
static double PER_P_UNIT
Definition: fcst_units.h:108
static double PER_N_UNIT3
Definition: fcst_units.h:121
static double PER_K_UNIT
Definition: fcst_units.h:102
static double N_UNIT2
Definition: fcst_units.h:137
static double C_UNIT3
Definition: fcst_units.h:141
static double PER_MILLI_UNIT
Definition: fcst_units.h:105
static double C_UNIT
Definition: fcst_units.h:127
static double MILLI_UNIT3
Definition: fcst_units.h:142
static double PER_C_UNIT3
Definition: fcst_units.h:118
static double MICRO_UNIT
Definition: fcst_units.h:129
static double PER_UNIT
Definition: fcst_units.h:103
static double PER_C_UNIT2
Definition: fcst_units.h:111
static double MICRO_UNIT2
Definition: fcst_units.h:136
static double MILLI_UNIT
Definition: fcst_units.h:128
static double UNIT
Definition: fcst_units.h:126
static double PER_N_UNIT2
Definition: fcst_units.h:114
static double MILLI_UNIT2
Definition: fcst_units.h:135
static const unsigned int KJ_to_BTU
Definition: fcst_units.h:97
static double N_UNIT
Definition: fcst_units.h:130
static double PER_P_UNIT3
Definition: fcst_units.h:122
static double K_UNIT
Definition: fcst_units.h:125
static double C_UNIT2
Definition: fcst_units.h:134
static double MICRO_UNIT3
Definition: fcst_units.h:143
static double PER_MICRO_UNIT3
Definition: fcst_units.h:120
static double PER_MILLI_UNIT2
Definition: fcst_units.h:112
static double PER_P_UNIT2
Definition: fcst_units.h:115
static double UNIT2
Definition: fcst_units.h:133
Class used to convert units using a standard convention.
Definition: fcst_units.h:49
static double PER_N_UNIT
Definition: fcst_units.h:107
static double PER_MILLI_UNIT3
Definition: fcst_units.h:119
static double N_UNIT3
Definition: fcst_units.h:144
static double P_UNIT3
Definition: fcst_units.h:145
static double PER_C_UNIT
Definition: fcst_units.h:104
static double PER_UNIT3
Definition: fcst_units.h:117
static const unsigned int BTU_to_KJ
Definition: fcst_units.h:98
static double convert(double unitToConvert, int specificCase)
Convert using on a case by case basis.
Definition: fcst_units.h:80
static double UNIT3
Definition: fcst_units.h:140
static const unsigned int ATM_to_PA
Definition: fcst_units.h:99
static double P_UNIT
Definition: fcst_units.h:131
static double PER_UNIT2
Definition: fcst_units.h:110
static double P_UNIT2
Definition: fcst_units.h:138
static double PER_MICRO_UNIT2
Definition: fcst_units.h:113
static double PER_MICRO_UNIT
Definition: fcst_units.h:106
static double convert(double unitToConvert, double to, double from)
The conversion routine convert(unitToConvert, X, Y) should be read as:
Definition: fcst_units.h:57