38 explicit Units(
double factor=1.0,
double mass=0,
double length=0,
39 double time=0,
double temperature=0,
double current=0,
46 explicit Units(
const string& units,
bool force_unity=
false);
61 string str(
bool skip_unity=
true)
const;
65 Units pow(
double exponent)
const;
67 bool operator==(
const Units& other)
const;
71 double dimension(
const string& primary)
const;
78 double m_mass_dim = 0.0;
79 double m_length_dim = 0.0;
80 double m_time_dim = 0.0;
81 double m_temperature_dim = 0.0;
82 double m_current_dim = 0.0;
83 double m_quantity_dim = 0.0;
112 UnitStack(std::initializer_list<pair<Units, double>> units)
131 void join(
double exponent);
172 UnitSystem(std::initializer_list<string> units);
179 map<string, string>
defaults()
const;
188 void setDefaults(std::initializer_list<string> units);
203 void setDefaults(
const map<string, string>& units);
210 double convert(
double value,
const string& src,
const string& dest)
const;
211 double convert(
double value,
const Units& src,
const Units& dest)
const;
215 double convertTo(
double value,
const string& dest)
const;
216 double convertTo(
double value,
const Units& dest)
const;
220 double convertFrom(
double value,
const string& src)
const;
221 double convertFrom(
double value,
const Units& src)
const;
227 double convert(
const AnyValue& val,
const string& dest)
const;
228 double convert(
const AnyValue& val,
const Units& dest)
const;
240 vector<double>
convert(
const vector<AnyValue>& vals,
const string& dest)
const;
241 vector<double>
convert(
const vector<AnyValue>& vals,
const Units& dest)
const;
246 const string& dest)
const;
double m_activation_energy_factor
Factor to convert activation energy from this unit system to J/kmol.
bool m_explicit_activation_energy
True if activation energy units are set explicitly, rather than as a combination of energy and quanti...
double convertFrom(double value, const string &src) const
Convert value from the specified src units to units appropriate for this unit system (defined by setD...
double convertActivationEnergyTo(double value, const string &dest) const
Convert value to the units specified by dest from the default activation energy units.
double m_time_factor
Factor to convert time from this unit system to seconds.
double convertTo(double value, const string &dest) const
Convert value to the specified dest units from the appropriate units for this unit system (defined by...
double m_pressure_factor
Factor to convert pressure from this unit system to Pa.
UnitSystem()
Default constructor for unit system (needed as VS2019 does not recognize an optional argument with a ...
double m_energy_factor
Factor to convert energy from this unit system to J.
double convertRateCoeff(const AnyValue &val, const Units &dest) const
Convert a generic AnyValue node representing a reaction rate coefficient to the units specified in de...
double m_length_factor
Factor to convert length from this unit system to meters.
double convertActivationEnergyFrom(double value, const string &src) const
Convert value from the units specified by src to the default activation energy units.
map< string, string > m_defaults
Map of dimensions (mass, length, etc.) to names of specified default units.
double convertActivationEnergy(double value, const string &src, const string &dest) const
Convert value from the units of src to the units of dest, allowing for the different dimensions that ...
void setDefaults(std::initializer_list< string > units)
Set the default units to convert from when explicit units are not provided.
double m_mass_factor
Factor to convert mass from this unit system to kg.
double convert(double value, const string &src, const string &dest) const
Convert value from the units of src to the units of dest.
double m_quantity_factor
Factor to convert quantity from this unit system to kmol.
AnyMap getDelta(const UnitSystem &other) const
Get the changes to the defaults from other to this UnitSystem.
map< string, string > defaults() const
Return default units used by the unit system.
void setDefaultActivationEnergy(const string &e_units)
Set the default units to convert from when using the convertActivationEnergy function.
A representation of the units associated with a dimensional quantity.
double m_energy_dim
pseudo-dimension to track explicit energy units
double m_pressure_dim
pseudo-dimension to track explicit pressure units
void scale(double k)
Scale the unit by the factor k
double m_factor
conversion factor to Cantera base units
Units & operator*=(const Units &other)
Multiply two Units objects, combining their conversion factors and dimensions.
string str(bool skip_unity=true) const
Provide a string representation of these Units.
double dimension(const string &primary) const
Return dimension of primary unit component ("mass", "length", "time", "temperature",...
bool convertible(const Units &other) const
Returns true if the specified Units are dimensionally consistent.
double factor() const
Return the factor for converting from this unit to Cantera's base units.
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.
Unit aggregation utility.
double standardExponent() const
Effective exponent of standard unit.
size_t size() const
Size of UnitStack.
UnitStack(std::initializer_list< pair< Units, double > > units)
Alternative constructor allows for direct assignment of vector.
void update(const Units &units, double exponent)
Update exponent of item with matching units; if it does not exist, add unit-exponent pair at end of s...
Units standardUnits() const
Get standard unit used by UnitStack.
Units product() const
Calculate product of units-exponent stack.
void join(double exponent)
Join (update) exponent of standard units, where the updated exponent is the sum of the pre-existing e...
vector< pair< Units, double > > stack
Stack uses vector of pairs.
void setStandardUnits(Units &standardUnits)
Set standard units.