33 explicit Units(
double factor=1.0,
double mass=0,
double length=0,
34 double time=0,
double temperature=0,
double current=0,
38 explicit Units(
const std::string& name);
52 std::string
str()
const;
66 double m_temperature_dim;
68 double m_quantity_dim;
104 UnitSystem(std::initializer_list<std::string> units);
117 void setDefaults(std::initializer_list<std::string> units);
132 void setDefaults(
const std::map<std::string, std::string>& units);
139 double convert(
double value,
const std::string& src,
140 const std::string& dest)
const;
141 double convert(
double value,
const Units& src,
const Units& dest)
const;
148 double convert(
double value,
const std::string& dest)
const;
149 double convert(
double value,
const Units& dest)
const;
155 double convert(
const AnyValue& val,
const std::string& dest)
const;
156 double convert(
const AnyValue& val,
const Units& dest)
const;
162 const std::string& dest)
const;
164 const Units& dest)
const;
169 const std::string& dest)
const;
183 const std::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 m_time_factor
Factor to convert time from this unit system to seconds.
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 m_length_factor
Factor to convert length from this unit system to meters.
double convert(double value, const std::string &src, const std::string &dest) const
Convert value from the units of src to the units of dest.
void setDefaultActivationEnergy(const std::string &e_units)
Set the default units to convert from when using the convertActivationEnergy function.
double convertActivationEnergy(double value, const std::string &src, const std::string &dest) const
Convert value from the units of src to the units of dest, allowing for the different dimensions that ...
double m_mass_factor
Factor to convert mass from this unit system to kg.
double m_quantity_factor
Factor to convert quantity from this unit system to kmol.
void setDefaults(std::initializer_list< std::string > units)
Set the default units to convert from when explicit units are not provided.
A representation of the units associated with a dimensional quantity.
Units pow(double expoonent) const
Raise these Units to a power, changing both the conversion factor and the dimensions of these Units.
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.
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.
std::string str() const
Provide a string representation of these Units.
Units(double factor=1.0, double mass=0, double length=0, double time=0, double temperature=0, double current=0, double quantity=0)
Create a Units object with the specified dimensions.
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Namespace for the Cantera kernel.