Cantera  3.1.0a1
Loading...
Searching...
No Matches
CachedValue< T > Struct Template Reference

A cached property value and the state at which it was evaluated. More...

#include <ValueCache.h>

Detailed Description

template<class T>
struct Cantera::CachedValue< T >

A cached property value and the state at which it was evaluated.

This struct stores the value of some property evaluated at a particular thermodynamic state. The value can be either a real scalar or an array, depending on the template parameter T. The exact meaning of state1, state2, and stateNum is determined by the function using the cached value, which can check any combination of these variables before deciding whether to recompute the cached values.

References to CachedValue objects are returned by the "get" methods of ValueCache, for example ValueCache::getScalar. Functions accessing cached values should use the typedefs CachedScalar and CachedArray. See ValueCache for details on how these classes should be used together.

Definition at line 33 of file ValueCache.h.

Public Member Functions

bool validate (double state1New)
 Check whether the currently cached value is valid based on a single state variable.
 
bool validate (double state1New, double state2New)
 Check whether the currently cached value is valid based on state1 and state2.
 
bool validate (double state1New, int stateNumNew)
 Check whether the currently cached value is valid based on state1 and stateNum.
 
bool validate (int stateNumNew)
 Check whether the currently cached value is valid based on stateNum.
 
bool validate (double state1New, double state2New, int stateNumNew)
 Check whether the currently cached value is valid based on state1, state2, and stateNum.
 

Public Attributes

double state1 = std::numeric_limits<double>::quiet_NaN()
 Value of the first state variable for the state at which value was evaluated, for example temperature.
 
double state2 = std::numeric_limits<double>::quiet_NaN()
 Value of the second state variable for the state at which value was evaluated, for example density or pressure.
 
int stateNum = std::numeric_limits<int>::min()
 A surrogate for the composition.
 
value = T()
 The value of the cached property.
 

Member Function Documentation

◆ validate() [1/5]

template<class T >
bool validate ( double  state1New)
inline

Check whether the currently cached value is valid based on a single state variable.

If it is not valid it updates the stored state to the new state in addition to returning false.

Definition at line 39 of file ValueCache.h.

◆ validate() [2/5]

template<class T >
bool validate ( double  state1New,
double  state2New 
)
inline

Check whether the currently cached value is valid based on state1 and state2.

If it is not valid it updates the stored state to the new state in addition to returning false.

Definition at line 51 of file ValueCache.h.

◆ validate() [3/5]

template<class T >
bool validate ( double  state1New,
int  stateNumNew 
)
inline

Check whether the currently cached value is valid based on state1 and stateNum.

If it is not valid it updates the stored state to the new state in addition to returning false.

Definition at line 64 of file ValueCache.h.

◆ validate() [4/5]

template<class T >
bool validate ( int  stateNumNew)
inline

Check whether the currently cached value is valid based on stateNum.

If it is not valid it updates the stored state to the new state in addition to returning false.

Definition at line 77 of file ValueCache.h.

◆ validate() [5/5]

template<class T >
bool validate ( double  state1New,
double  state2New,
int  stateNumNew 
)
inline

Check whether the currently cached value is valid based on state1, state2, and stateNum.

If it is not valid it updates the stored state to the new state in addition to returning false.

Definition at line 89 of file ValueCache.h.

Member Data Documentation

◆ state1

template<class T >
double state1 = std::numeric_limits<double>::quiet_NaN()

Value of the first state variable for the state at which value was evaluated, for example temperature.

Definition at line 102 of file ValueCache.h.

◆ state2

template<class T >
double state2 = std::numeric_limits<double>::quiet_NaN()

Value of the second state variable for the state at which value was evaluated, for example density or pressure.

Definition at line 106 of file ValueCache.h.

◆ stateNum

template<class T >
int stateNum = std::numeric_limits<int>::min()

A surrogate for the composition.

For cached properties of Phase, this should be set to Phase::stateMFNumber()

Definition at line 110 of file ValueCache.h.

◆ value

template<class T >
T value = T()

The value of the cached property.

Definition at line 113 of file ValueCache.h.


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