A state contains all data available for one time step, load case or frequency. More...
Public Member Functions | |
DataState (int id, size_t geometryCount) | |
Constructs an empty state. More... | |
int | id () const |
Returns the id of the state. More... | |
size_t | geometryCount () const |
Returns number of geometries. More... | |
const DataGeometry * | geometry (size_t globalGeometryIndex) const |
Returns the geometry at the requested index. More... | |
DataGeometry * | geometry (size_t globalGeometryIndex) |
Returns the geometry at the requested index. More... | |
const DataGeometry * | firstGeometry () const |
Returns the first geometry. More... | |
DataGeometry * | firstGeometry () |
Returns the first geometry. More... | |
void | setGeometry (size_t globalGeometryIndex, DataGeometry *geometry) |
Adds a geometry to the state and given index. More... | |
const DataResultGroup * | results (const DataGeometry *geometry) const |
Returns the result group for the given geometry. More... | |
DataResultGroup * | results (const DataGeometry *geometry) |
Returns the result group for the given geometry. More... | |
const DataResultGroup * | resultsFirstGeometry () const |
Returns the result group for the first geometry. More... | |
DataResultGroup * | resultsFirstGeometry () |
Returns the result group for the first geometry. More... | |
const DataPart * | findPart (size_t globalGeometryIndex, int partId) const |
Returns the part specified by a geometry index and a part id. More... | |
DataPart * | findPart (size_t globalGeometryIndex, int partId) |
Returns the part specified by a geometry index and a part id. More... | |
![]() | |
void | addRef () const |
Increments the reference count for this object. More... | |
void | release () const |
Decrements the reference count for this object. More... | |
int | refCount () const |
Returns the reference count for this object. More... | |
void | setRefCountZero () const |
Sets the ref count to zero, but DOES NOT delete the object. More... | |
A state contains all data available for one time step, load case or frequency.
The state owns one or more geometries and corresponding results. For each geometry there is a result group binding the geometry and results. A data source must contain one or more states. Which state is current is set in the model specification (ModelSpec).
A unique id and the number of geometries for a state is set upon construction of the state and cannot be changes afterwards. To query number of geometries for a state, call geometryCount() and use id() to get the id for the current state.
Geometries are added to the state using setGeometry() with an index that must be within the number of geometries given when constructing the object. To get a pointer to a DataGeometry object in a state, call geometry() with the requested index. For convenience, the function firstGeometry() will always return the geometry and index 0.
A DataResultGroup is a binding between a geometry and it's results. Find the correct result group calling results() and passing the corresponding geometry as a parameter. The function resultsFirstGeometry() is implemented for convenience and will return the result group for the first geometry in the state. resultsFirstGeometry() equals results(firstGeometry()).
Example on building your data source and geometry.
Create a model and a data source.
Create the state. Set number of geometries to 1 in the constructor.
Set the newly created state to current in the model specification.
Create the geometry and add it to the state at index 0.
See the complete source code at: UnstructGrid: Simple model with two triangles
cee::ug::DataState::DataState | ( | int | id, |
size_t | geometryCount | ||
) |
Constructs an empty state.
Specify number of geometries (geometryCount) for the new state and give it a unique id.
const DataPart * cee::ug::DataState::findPart | ( | size_t | globalGeometryIndex, |
int | partId | ||
) | const |
Returns the part specified by a geometry index and a part id.
Returns NULL if no part was found.
DataPart * cee::ug::DataState::findPart | ( | size_t | globalGeometryIndex, |
int | partId | ||
) |
Returns the part specified by a geometry index and a part id.
Returns NULL if no part was found.
const DataGeometry * cee::ug::DataState::firstGeometry | ( | ) | const |
Returns the first geometry.
Equals geometry(0). Provided for convenience. Returns NULL if no geometries exists.
DataGeometry * cee::ug::DataState::firstGeometry | ( | ) |
Returns the first geometry.
Equals geometry(0). Provided for convenience. Returns NULL if no geometries exists.
const DataGeometry * cee::ug::DataState::geometry | ( | size_t | globalGeometryIndex | ) | const |
Returns the geometry at the requested index.
DataGeometry * cee::ug::DataState::geometry | ( | size_t | globalGeometryIndex | ) |
Returns the geometry at the requested index.
size_t cee::ug::DataState::geometryCount | ( | ) | const |
Returns number of geometries.
int cee::ug::DataState::id | ( | ) | const |
Returns the id of the state.
const DataResultGroup * cee::ug::DataState::results | ( | const DataGeometry * | geometry | ) | const |
Returns the result group for the given geometry.
For each geometry there is a result group binding the geometry and results.
DataResultGroup * cee::ug::DataState::results | ( | const DataGeometry * | geometry | ) |
Returns the result group for the given geometry.
For each geometry there is a result group binding the geometry and results.
const DataResultGroup * cee::ug::DataState::resultsFirstGeometry | ( | ) | const |
Returns the result group for the first geometry.
Equals results(firstGeometry())
. Returns NULL if no geometries exists. For each geometry there is a result group binding the geometry and results.
DataResultGroup * cee::ug::DataState::resultsFirstGeometry | ( | ) |
Returns the result group for the first geometry.
Equals results(firstGeometry())
. Returns NULL if no geometries exists. For each geometry there is a result group binding the geometry and results.
void cee::ug::DataState::setGeometry | ( | size_t | globalGeometryIndex, |
DataGeometry * | geometry | ||
) |
Adds a geometry to the state and given index.
The globalGeometryIndex must be within the number of geometries specified upon construction of the state.