Cantera 2.6.0

Public Member Functions | Public Attributes | List of all members
UnitStack Struct Reference

Unit aggregation utility. More...

`#include <Units.h>`

## Public Member Functions
| UnitStack (const Units &standardUnits)
| UnitStack (std::initializer_list< std::pair< Units, double > > units)
| Alternative constructor allows for direct assignment of vector. More...
size_t | size () const
| Size of UnitStack. More...
Units | standardUnits () const
| Get standard unit used by UnitStack. More...
void | setStandardUnits (Units &standardUnits)
| Set standard units. More...
double | standardExponent () const
| Effective exponent of standard unit. More...
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. More...
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. More...
Units | product () const
| Calculate product of units-exponent stack. More...

## Public Attributes
std::vector< std::pair< Units, double > > | stack
| Stack uses vector of pairs. More...

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

Helper utility class.

Warning
  This class is an experimental part of the Cantera API and may be changed or removed without notice.

Definition at line 98 of file Units.h.

## Constructor & Destructor Documentation

## ◆ UnitStack() [1/2]

UnitStack | ( | const Units & | standardUnits | ) |
| inline

Definition at line 100 of file Units.h.

## ◆ UnitStack() [2/2]

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

Alternative constructor allows for direct assignment of vector.

Definition at line 106 of file Units.h.

## Member Function Documentation

## ◆ size()

size_t size | ( |  | ) | const
| inline

Size of UnitStack.

Definition at line 110 of file Units.h.

References UnitStack::stack.

Referenced by FalloffRate::setParameters(), and ArrheniusBase::setRateUnits().

## ◆ standardUnits()

Units standardUnits | ( |  | ) | const

Get standard unit used by UnitStack.

Definition at line 334 of file Units.cpp.

References UnitStack::stack.

Referenced by ArrheniusBase::setRateUnits(), and UnitStack::setStandardUnits().

## ◆ setStandardUnits()

void setStandardUnits | ( | Units & | standardUnits | ) |

Set standard units.

Definition at line 342 of file Units.cpp.

References UnitStack::stack, and UnitStack::standardUnits().

## ◆ standardExponent()

double standardExponent | ( |  | ) | const

Effective exponent of standard unit.

Definition at line 355 of file Units.cpp.

References UnitStack::stack.

## ◆ 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 363 of file Units.cpp.

References UnitStack::stack.

Referenced by FalloffRate::setParameters().

## ◆ 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 373 of file Units.cpp.

References UnitStack::stack.

## ◆ product()

Units product | ( |  | ) | const

Calculate product of units-exponent stack.

Definition at line 388 of file Units.cpp.

References Units::pow(), and UnitStack::stack.

Referenced by ChebyshevRate::setParameters(), and ArrheniusBase::setRateUnits().

## Member Data Documentation

## ◆ stack

std::vector<std::pair<Units, double> > stack

Stack uses vector of pairs.

Definition at line 132 of file Units.h.

Referenced by UnitStack::join(), UnitStack::product(), UnitStack::setStandardUnits(), UnitStack::size(), UnitStack::standardExponent(), UnitStack::standardUnits(), and UnitStack::update().

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

- Units.h
- Units.cpp