Cantera  3.0.0
Loading...
Searching...
No Matches
UnitStack Struct Reference

Unit aggregation utility. More...

#include <Units.h>

Detailed Description

Unit aggregation utility.

Provides functions for updating and calculating effective units from a stack of unit-exponent pairs. Matching units are aggregated, where a standard unit simplifies access when joining exponents. The utility is used in the context of effective reaction rate units.

Note
Helper utility class for internal use within Cantera.
Warning
This class is an experimental part of the Cantera API and may be changed or removed without notice.

Definition at line 104 of file Units.h.

Public Member Functions

 UnitStack (const Units &standardUnits)
 
 UnitStack (std::initializer_list< pair< Units, double > > units)
 Alternative constructor allows for direct assignment of vector.
 
size_t size () const
 Size of UnitStack.
 
Units standardUnits () const
 Get standard unit used by UnitStack.
 
void setStandardUnits (Units &standardUnits)
 Set standard units.
 
double standardExponent () const
 Effective exponent of standard unit.
 
void join (double exponent)
 Join (update) exponent of standard units, where the updated exponent is the sum of the pre-existing exponent and the exponent passed as the argument.
 
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 stack.
 
Units product () const
 Calculate product of units-exponent stack.
 

Public Attributes

vector< pair< Units, double > > stack
 Stack uses vector of pairs.
 

Constructor & Destructor Documentation

◆ UnitStack() [1/2]

UnitStack ( const Units standardUnits)
inline

Definition at line 106 of file Units.h.

◆ UnitStack() [2/2]

UnitStack ( std::initializer_list< pair< Units, double > >  units)
inline

Alternative constructor allows for direct assignment of vector.

Definition at line 112 of file Units.h.

Member Function Documentation

◆ size()

size_t size ( ) const
inline

Size of UnitStack.

Definition at line 118 of file Units.h.

◆ standardUnits()

Units standardUnits ( ) const

Get standard unit used by UnitStack.

Definition at line 323 of file Units.cpp.

◆ setStandardUnits()

void setStandardUnits ( Units standardUnits)

Set standard units.

Definition at line 331 of file Units.cpp.

◆ standardExponent()

double standardExponent ( ) const

Effective exponent of standard unit.

Definition at line 344 of file Units.cpp.

◆ join()

void join ( double  exponent)

Join (update) exponent of standard units, where the updated exponent is the sum of the pre-existing exponent and the exponent passed as the argument.

Definition at line 352 of file Units.cpp.

◆ update()

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 stack.

Definition at line 362 of file Units.cpp.

◆ product()

Units product ( ) const

Calculate product of units-exponent stack.

Definition at line 377 of file Units.cpp.

Member Data Documentation

◆ stack

vector<pair<Units, double> > stack

Stack uses vector of pairs.

Definition at line 140 of file Units.h.


The documentation for this struct was generated from the following files: