cee::ug::DataResultGroup
-
class DataResultGroup : public RefCountedObject
Result group binding a geometry and results (scalar, vector, displacement and/or transformation)
A state owns a set of geometries and a DataResultGroup is the binding between a geometry and it’s results. Each geometry in the state have one (and only one) corresponding result group.
DataResultGroup has no public constructor and will always exist for each geometry in a state. Get the requested result group by calling DataState::results(const DataGeometry* geometry).
Get the data result group for a given geometry:
// Get geometry with global index 0 cee::ug::DataGeometry* geometry = state->DataGeometry(0); // Get corresponding result group cee::ug::DataResultGroup* resultGroup = state->results(geometry);
The DataResultGroup object contains all available results for a given geometry. Result types are:
Scalar results: DataResultScalar
Vector results: DataResultVector
Displacement results: DataResultDisplacement
Visibility results:DataResultVisibility
Transformation result: DataResultTransformation
Symmetric Tensor result: DataResultSymmetricTensor
Add a scalar result using addScalar(). Remove all using removeAllScalars(). Use scalarCount() to return number of scalar results for this result group. Access individual scalar results using scalar() with the requested index. To convert from a scalar id to a scalar index, use scalarIndex(). Vector results, Displacement results and Symmetric Tensor results use the same structure and naming convention as shown above for scalar. Transformation and visibility results differ slightly from the other since a result group only can have one of each of these results. Set the transformation result using setTransformation() and get the existing one using transformation(). Same syntax applies to visibility results.
Note! The class is reference counted and can be shared between multiple states. Remember that since this object to is reference counted it should never be created on the stack.
Example
Example of how to add a node based scalar result to a geometry consisting of only one triangle.
Create a scalar result object with a unique id and node based result mapping.
int scalarResultId = 1; cee::PtrRef<cee::ug::DataResultScalar> scalarResult = new cee::ug::DataResultScalar(scalarResultId, cee::ug::PER_NODE);
The result array must have one value for each node coordinate in the triangle. Remember that the array must be resized before inserting the results.
cee::PtrRef<cee::ug::DataPartScalar> scalarPart = new cee::ug::DataPartScalar(); scalarPart->resize(3); scalarPart->setValue(0, 1.0); scalarPart->setValue(1, 2.0); scalarPart->setValue(2, 3.0);
Number of parts in the DataResultScalar must match number of parts in the geometry. Scalar values must also fit the corresponding part in the geometry. Here the part is a single triangle with three nodes and a node mapped result, hence a results array with three values will fit.
scalarResult->addPart(scalarPart.get());
For each geometry in a state there is a result group binding the geometry and results.
Add the result scalar to the state’s result group for the corresponding geometry (DataGeometry) geo
state->results(geo.get())->addScalar(scalarResult.get());
Tutorials UnstructGrid: A simple model with results
See also
DataResultScalar, DataResultVector, DataResultDisplacement, DataResultTransformation, and DataState
Public Functions
-
const DataGeometry *geometry() const
Returns the geometry associated with this results group.
-
size_t scalarCount() const
Returns number of scalar results for this group.
-
const DataResultScalar *scalar(size_t resultIndex) const
Returns the scalar result at the given index.
Use scalarIndex() to map from a scalar id if needed.
-
DataResultScalar *scalar(size_t resultIndex)
Returns the scalar result at the given index.
Use scalarIndex() to map from a scalar id if needed.
-
size_t scalarIndex(int resultId) const
Returns the index of the result with the given id.
Returns cee::UNDEFINED_SIZE_T if no matching id was found.
-
void addScalar(DataResultScalar *scalarResult)
Adds a scalar result object to the group.
Warning
The added object is reference counted and should never be created on the stack or deleted!
-
void removeAllScalars()
Removes all scalar results from the group.
-
size_t vectorCount() const
Returns number of vector results for this group.
-
const DataResultVector *vector(size_t resultIndex) const
Returns the vector result at the given index.
Use vectorIndex() to map from a vector id if needed.
-
DataResultVector *vector(size_t resultIndex)
Returns the vector result at the given index.
Use vectorIndex() to map from a vector id if needed.
-
size_t vectorIndex(int resultId) const
Returns the index of the result with the given id.
Returns cee::UNDEFINED_SIZE_T if no matching id was found.
-
void addVector(DataResultVector *vectorResult)
Adds a vector result object to the group.
Warning
The added object is reference counted and should never be created on the stack or deleted!
-
void removeAllVectors()
Removes all vector results from the group.
-
size_t displacementCount() const
Returns number of displacement results for this group.
-
const DataResultDisplacement *displacement(size_t resultIndex) const
Returns the displacement result at the given index.
Use displacementIndex() to map from a displacement id if needed.
-
DataResultDisplacement *displacement(size_t resultIndex)
Returns the displacement result at the given index.
Use displacementIndex() to map from a displacement id if needed.
-
size_t displacementIndex(int resultId) const
Returns the index of the result with the given id.
Returns cee::UNDEFINED_SIZE_T if no matching id was found.
-
void addDisplacement(DataResultDisplacement *displacementResult)
Adds a displacement result object to the group.
Warning
The added object is reference counted and should never be created on the stack or deleted!
-
void removeAllDisplacements()
Removes all displacement results from the group.
-
size_t symmetricTensorCount() const
Returns number of symmetricTensor results for this group.
-
const DataResultSymmetricTensor *symmetricTensor(size_t resultIndex) const
Returns the symmetricTensor result at the given index.
Use symmetricTensorIndex() to map from a symmetricTensor id if needed.
-
DataResultSymmetricTensor *symmetricTensor(size_t resultIndex)
Returns the symmetricTensor result at the given index.
Use symmetricTensorIndex() to map from a symmetricTensor id if needed.
-
size_t symmetricTensorIndex(int resultId) const
Returns the index of the result with the given id.
Returns cee::UNDEFINED_SIZE_T if no matching id was found.
-
void addSymmetricTensor(DataResultSymmetricTensor *symmetricTensorResult)
Adds a symmetricTensor result object to the group.
Warning
The added object is reference counted and should never be created on the stack or deleted!
-
void removeAllSymmetricTensors()
Removes all symmetricTensor results from the group.
-
const DataResultTransformation *transformation() const
Returns the transformation result.
-
DataResultTransformation *transformation()
Returns the transformation result.
-
void setTransformation(DataResultTransformation *transformationResult)
Sets the transformation result.
Warning
The added object is reference counted and should never be created on the stack or deleted!
-
void removeTransformation()
Removes the transformation result form the group.
Same effect as doing setTransformation(NULL).
-
const DataResultVisibility *visibility() const
Returns the visibility result.
-
DataResultVisibility *visibility()
Returns visibility result.
-
void setVisibility(DataResultVisibility *visibilityResult)
Sets the visibility result.
-
void removeVisibility()
Removes the visibility result form the group.
Same effect as doing setVisibility(NULL).