Cantera 2.6.0
|
A representation of the units associated with a dimensional quantity. More...
#include <Units.h>
Public Member Functions | |
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. More... | |
Units (const std::string &units, bool force_unity=false) | |
Create an object with the specified dimensions. More... | |
bool | convertible (const Units &other) const |
Returns true if the specified Units are dimensionally consistent. More... | |
double | factor () const |
Return the factor for converting from this unit to Cantera's base units. More... | |
Units & | operator*= (const Units &other) |
Multiply two Units objects, combining their conversion factors and dimensions. More... | |
std::string | str (bool skip_unity=true) const |
Provide a string representation of these Units. More... | |
Units | pow (double exponent) const |
Raise these Units to a power, changing both the conversion factor and the dimensions of these Units. More... | |
bool | operator== (const Units &other) const |
double | dimension (const std::string &primary) const |
Return dimension of primary unit component ("mass", "length", "time", "temperature", "current" or "quantity") More... | |
Private Member Functions | |
void | scale (double k) |
Scale the unit by the factor k More... | |
Private Attributes | |
double | m_factor |
conversion factor to Cantera base units More... | |
double | m_mass_dim |
double | m_length_dim |
double | m_time_dim |
double | m_temperature_dim |
double | m_current_dim |
double | m_quantity_dim |
double | m_pressure_dim |
pseudo-dimension to track explicit pressure units More... | |
double | m_energy_dim |
pseudo-dimension to track explicit energy units More... | |
Friends | |
class | UnitSystem |
A representation of the units associated with a dimensional quantity.
Used for converting quantities between unit systems and checking for dimensional consistency. Units objects are mainly used within UnitSystem class to convert values from a user-specified Unit system to Cantera's base units (SI + kmol).
|
explicit |
Create a Units object with the specified dimensions.
Definition at line 109 of file Units.cpp.
References Units::m_energy_dim, and Units::m_pressure_dim.
Referenced by Units::pow().
|
explicit |
Create an object with the specified dimensions.
units | A string representation of the units. See UnitSystem for a description of the formatting options. |
force_unity | ensure that conversion factor is equal to one |
Definition at line 133 of file Units.cpp.
References Units::factor(), Cantera::fpValueCheck(), Units::m_factor, Cantera::npos, Units::pow(), Units::scale(), Cantera::SmallNumber, Units::str(), and Cantera::trimCopy().
bool convertible | ( | const Units & | other | ) | const |
Returns true
if the specified Units are dimensionally consistent.
Definition at line 210 of file Units.cpp.
Referenced by UnitSystem::convertActivationEnergy(), UnitSystem::convertActivationEnergyFrom(), UnitSystem::setDefaultActivationEnergy(), and UnitSystem::setDefaults().
|
inline |
Return the factor for converting from this unit to Cantera's base units.
Definition at line 48 of file Units.h.
References Units::m_factor.
Referenced by UnitSystem::convertActivationEnergy(), UnitSystem::convertActivationEnergyFrom(), Arrhenius2::getParameters(), ChebyshevRate::getParameters(), ArrheniusBase::getRateParameters(), UnitSystem::setDefaultActivationEnergy(), UnitSystem::setDefaults(), ChebyshevRate::setParameters(), Units::str(), and Units::Units().
Multiply two Units objects, combining their conversion factors and dimensions.
Definition at line 220 of file Units.cpp.
References Units::m_energy_dim, Units::m_factor, and Units::m_pressure_dim.
std::string str | ( | bool | skip_unity = true | ) | const |
Provide a string representation of these Units.
skip_unity | do not print '1' if conversion factor is equal to one |
Definition at line 245 of file Units.cpp.
References Units::factor(), Units::m_factor, and Cantera::SmallNumber.
Referenced by UnitSystem::setDefaults(), and Units::Units().
Units pow | ( | double | exponent | ) | const |
Raise these Units to a power, changing both the conversion factor and the dimensions of these Units.
Definition at line 234 of file Units.cpp.
References Units::m_factor, and Units::Units().
Referenced by Reaction::calculateRateCoeffUnits(), ThreeBodyReaction2::calculateRateCoeffUnits(), FalloffReaction2::calculateRateCoeffUnits(), UnitStack::product(), and Units::Units().
double dimension | ( | const std::string & | primary | ) | const |
Return dimension of primary unit component ("mass", "length", "time", "temperature", "current" or "quantity")
Definition at line 314 of file Units.cpp.
Referenced by ArrheniusBase::setRateUnits().
|
inlineprivate |
Scale the unit by the factor k
Definition at line 70 of file Units.h.
References Units::m_factor.
Referenced by Units::Units().
|
friend |
|
private |
conversion factor to Cantera base units
Definition at line 72 of file Units.h.
Referenced by Units::factor(), Units::operator*=(), Units::pow(), Units::scale(), Units::str(), and Units::Units().
|
private |
pseudo-dimension to track explicit pressure units
Definition at line 79 of file Units.h.
Referenced by Units::operator*=(), and Units::Units().
|
private |
pseudo-dimension to track explicit energy units
Definition at line 80 of file Units.h.
Referenced by Units::operator*=(), and Units::Units().