72 doublereal
toSI(
const std::string& units_) {
79 doublereal f = 1.0, fctr;
80 std::string u = units_, tok, tsub;
81 std::string::size_type k;
88 k = u.find_first_of(
"/-");
94 size_t tsize = tok.size();
97 }
else if (tok[tsize - 1] ==
'2') {
98 tsub = tok.substr(0,tsize-1);
101 }
else if (tok[tsize - 1] ==
'3') {
102 tsub = tok.substr(0,tsize-1);
105 }
else if (tok[tsize - 1] ==
'4') {
106 tsub = tok.substr(0,tsize-1);
108 fctr *= fctr*fctr*fctr;
109 }
else if (tok[tsize - 1] ==
'5') {
110 tsub = tok.substr(0,tsize-1);
112 fctr *= fctr*fctr*fctr*fctr;
113 }
else if (tok[tsize - 1] ==
'6') {
114 tsub = tok.substr(0,tsize-1);
116 fctr *= fctr*fctr*fctr*fctr*fctr;
129 }
else if (action ==
'/') {
136 u = u.substr(k+1,u.size());
151 std::map<std::string, doublereal>
m_u;
175 m_u[
"micron"] = 1.0e-6;
178 m_u[
"Angstrom"] = 1.0e-10;
179 m_u[
"Angstroms"] = 1.0e-10;
185 m_u[
"kcal"] = 4184.0;
193 m_u[
"gmol"] = 1.0e-3;
194 m_u[
"mole"] = 1.0e-3;
210 m_u[
"atm"] = 1.01325e5;
224 m_u[
"coulomb"] = 1.0;
239 m_u[
"centipoise"] = 0.001;
245 m_u[
"liter"] = 0.001;
std::map< std::string, doublereal > m_u
Map between a string and a units double value.
doublereal actEnergyToSI(const std::string &units_)
Return the multiplier required to convert an activation energy to SI units.
Unit()
Units class constructor, containing the default mappings between strings and units.
virtual ~Unit()
Empty Destructor.
const size_t npos
index returned by functions to indicate "no position"
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
static Unit * s_u
pointer to the single instance of Unit
doublereal toSI(const std::string &units_)
Return the multiplier required to convert a dimensional quantity with units specified by string 'unit...
std::map< std::string, doublereal > m_act_u
Map between a string and a units double value for activation energy units.
static Unit * units()
Initialize the static Unit class.
Base class for exceptions thrown by Cantera classes.
const doublereal Avogadro
Avogadro's Number [number/kmol].
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
static mutex_t units_mutex
Decl for static locker for Units singleton.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
static void deleteUnit()
Destroy the static Unit class.