The per state property cache of a Gas. More...
#include <cl_GM_Statevals.hpp>
Public Member Functions | |
| Statevals ()=default | |
| ~Statevals ()=default | |
| void | update_Tp (const real T, const real p) |
| update temperature and pressure | |
| void | update_Tv (const real T, const real v) |
| update temperature and inverse density | |
| void | update_pv (const real p, const real v) |
| update pressure and inverse density | |
| void | reset () |
| reset all flags of this state | |
| bool | test (const index_t aIndex) const |
| test if a value is up do date | |
| const real & | get (const index_t aIndex) const |
| get a value of the state | |
| void | set (const index_t aIndex, const real aValue) |
| set a value of the state | |
The per state property cache of a Gas.
A thermodynamic state is fixed by ( T, p ), and the properties that follow from it are expensive - a real gas equation of state solves for v by Newton iteration before anything else can be evaluated. This class holds one value slot per property together with a bit that says whether the slot is valid. Changing the state clears every bit at once, so each property is computed at most once per state and callers may ask for them in any order.
Two consequences are easy to get wrong. A slot that was never written reads as its default rather than as an error, so a property must always be requested through its accessor and never read from the array directly. And anything that invalidates the state without clearing the bits - changing the mixture composition, for instance - leaves the cache holding values that belong to a gas that no longer exists; remix() therefore has to reset it.
|
default |
|
default |
get a value of the state
|
inline |
reset all flags of this state
set a value of the state
|
inline |
test if a value is up do date
update pressure and inverse density
update temperature and pressure
update temperature and inverse density