![]() |
Cantera
3.0.0
|
A representation of the units associated with a dimensional quantity. More...
#include <Units.h>
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).
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. | |
Units (const string &units, bool force_unity=false) | |
Create an object with the specified 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. | |
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. | |
Units | pow (double exponent) const |
Raise these Units to a power, changing both the conversion factor and the dimensions of these Units. | |
bool | operator== (const Units &other) const |
double | dimension (const string &primary) const |
Return dimension of primary unit component ("mass", "length", "time", "temperature", "current", or "quantity") | |
Private Member Functions | |
void | scale (double k) |
Scale the unit by the factor k | |
Private Attributes | |
double | m_factor = 1.0 |
conversion factor to Cantera base units | |
double | m_mass_dim = 0.0 |
double | m_length_dim = 0.0 |
double | m_time_dim = 0.0 |
double | m_temperature_dim = 0.0 |
double | m_current_dim = 0.0 |
double | m_quantity_dim = 0.0 |
double | m_pressure_dim = 0.0 |
pseudo-dimension to track explicit pressure units | |
double | m_energy_dim = 0.0 |
pseudo-dimension to track explicit energy units | |
Friends | |
class | UnitSystem |
|
explicit |
|
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 |
bool convertible | ( | const Units & | other | ) | const |
|
inline |
string str | ( | bool | skip_unity = true | ) | const |
Units pow | ( | double | exponent | ) | const |
double dimension | ( | const string & | primary | ) | const |
|
inlineprivate |
|
friend |
|
private |
|
private |
|
private |