Cantera 2.6.0

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Unit Class Reference
Input File Handling

Unit conversion utility. More...

`#include <units.h>`

Collaboration diagram for Unit:
[legend]

## Public Member Functions
virtual | ~Unit ()
| Empty Destructor. More...
doublereal | actEnergyToSI (const std::string &units_)
| Return the multiplier required to convert an activation energy to SI units. More...
doublereal | toSI (const std::string &units_)
| Return the multiplier required to convert a dimensional quantity with units specified by string 'units' to SI units. More...

## Static Public Member Functions
static Unit * | units ()
| Initialize the static Unit class. More...
static void | deleteUnit ()
| Destroy the static Unit class. More...

## Private Member Functions
| Unit ()
| Units class constructor, containing the default mappings between strings and units. More...

## Private Attributes
std::map< std::string, doublereal > | m_u
| Map between a string and a units double value. More...
std::map< std::string, doublereal > | m_act_u
| Map between a string and a units double value for activation energy units. More...

## Static Private Attributes
static Unit * | s_u = 0
| pointer to the single instance of Unit More...
static std::mutex | units_mutex
| Decl for static locker for Units singleton. More...

## Detailed Description

Unit conversion utility.

Deprecated:
  To be removed after Cantera 2.6. Used only with XML input.

Definition at line 26 of file units.h.

## Constructor & Destructor Documentation

## ◆ ~Unit()

virtual ~Unit | ( |  | ) |
| inline virtual

Empty Destructor.

Definition at line 49 of file units.h.

## ◆ Unit()

Unit | ( |  | ) |
| inline private

Units class constructor, containing the default mappings between strings and units.

Definition at line 163 of file units.h.

References Cantera::Avogadro, Cantera::Faraday, Cantera::GasConstant, Unit::m_act_u, and Unit::m_u.

Referenced by Unit::units().

## Member Function Documentation

## ◆ units()

static Unit * units | ( |  | ) |
| inline static

Initialize the static Unit class.

Definition at line 30 of file units.h.

References Unit::s_u, Unit::Unit(), and Unit::units_mutex.

Referenced by Cantera::actEnergyToSI(), Application::Application(), and Cantera::toSI().

## ◆ deleteUnit()

static void deleteUnit | ( |  | ) |
| inline static

Destroy the static Unit class.

Note this can't be done in a destructor.

Definition at line 42 of file units.h.

References Unit::s_u, and Unit::units_mutex.

Referenced by Cantera::appdelete().

## ◆ actEnergyToSI()

doublereal actEnergyToSI | ( | const std::string & | units_ | ) |
| inline

Return the multiplier required to convert an activation energy to SI units.

Parameters

  units_ | activation energy units

Definition at line 56 of file units.h.

References Unit::m_act_u, and Unit::toSI().

Referenced by Cantera::actEnergyToSI().

## ◆ toSI()

doublereal toSI | ( | const std::string & | units_ | ) |
| inline

Return the multiplier required to convert a dimensional quantity with units specified by string 'units' to SI units.

The list of recognized units is stored as a stl map <string, doublereal>called m_u[] and m_act_u for activity coefficients. These maps are initialized with likely values.

Parameters

  units_ | String containing the units description

Definition at line 72 of file units.h.

References Unit::m_u, and Cantera::npos.

Referenced by Unit::actEnergyToSI(), and Cantera::toSI().

## Member Data Documentation

## ◆ s_u

Unit * s_u = 0
| static private

pointer to the single instance of Unit

Definition at line 141 of file units.h.

Referenced by Unit::deleteUnit(), and Unit::units().

## ◆ m_u

std::map<std::string, doublereal> m_u
| private

Map between a string and a units double value.

This map maps the dimension string to the units value adjustment. Example

- m_u["m"] = 1.0;
- m_u["cm"] = 0.01;

Definition at line 149 of file units.h.

Referenced by Unit::toSI(), and Unit::Unit().

## ◆ m_act_u

std::map<std::string, doublereal> m_act_u
| private

Map between a string and a units double value for activation energy units.

This map maps the dimension string to the units value adjustment. Example

- m_act_u["K"] = GasConstant;

Definition at line 156 of file units.h.

Referenced by Unit::actEnergyToSI(), and Unit::Unit().

## ◆ units_mutex

std::mutex units_mutex
| static private

Decl for static locker for Units singleton.

Definition at line 159 of file units.h.

Referenced by Unit::deleteUnit(), and Unit::units().

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

- units.h
- global.cpp