cee::ug::DataResultDisplacement Class Reference

Displacements results for all parts in the geometry. More...

Public Member Functions

 DataResultDisplacement (int resultId)
 Constructs an empty object. A unique id are set upon construction. More...
 
int resultId () const
 Returns the result id. More...
 
size_t partCount () const
 Returns number of displacement parts in this displacement result. More...
 
const DataPartDisplacementpart (size_t partIndex) const
 Returns the part at the given index. More...
 
DataPartDisplacementpart (size_t partIndex)
 Returns the part at the given index. More...
 
void addPart (DataPartDisplacement *part)
 Adds a displacement part to the displacement scalar. More...
 
void removeAllParts ()
 Removes all scalar parts. More...
 
bool deriveScalar (DeriveOperation deriveOperation, DataResultScalar *derivedScalar, const DataGeometry *geometry) const
 Gets a derived scalar. More...
 
bool deriveVector (DeriveOperation deriveOperation, DataResultVector *derivedVector, const DataGeometry *geometry) const
 Gets a derived vector. More...
 
- Public Member Functions inherited from cee::RefCountedObject
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...
 
Inheritance diagram for cee::ug::DataResultDisplacement:
cee::RefCountedObject

Detailed Description

Displacements results for all parts in the geometry.

The DataResultDisplacement holds a collection of DataPartDisplacement objects, each containing an array of displacement values for the belonging part.

Each DataResultDisplacement has a unique id. The number of parts in the displacement result and in the geometry must be the same. And the number of result values in each displacement part must match the number of nodes/elements in the part. Displacement results are always node based.

The id is set upon construction of the object and cannot be changed afterwards. The existing id can be found by calling resultId().

DataPartDisplacement objects can be added using addPart(). Get the number of parts in the displacement with partCount() and accessed individual parts by calling part() with the requested index. All parts can be removed using removeAllParts().

Set which displacement result to show using UnstructGridModel::modelSpec().

To configure the setting for a displacement result, use DisplacementSettings.

Get the displacement settings by calling UnstructGridModel::displacementSettings() with the requested result id.

Note
The class is reference counted and can be shared between multiple result groups. Remember that since this object is reference counted it should never be created on the stack.
Example

Example of how to add a displacement result to a geometry consisting of only one triangle.

Create the DataResultDisplacement object with a unique id.

int dispResultId = 1;

The result array must have one value for each node in the triangle. Resize the array before inserting the results.

dispPart->resize(3);
dispPart->setValue(0, cee::Vec3d(1.0, 0.0, 0.0));
dispPart->setValue(1, cee::Vec3d(0.0, 0.0, 0.0));
dispPart->setValue(2, cee::Vec3d(0.0, 1.0, 0.0));

Add the displacement part to the displacement result. The displacement result must contain the same number of parts as the corresponding geometry.

dispResult->addPart(dispPart.get());

For each geometry there is a result group binding the geometry and results. Add the displacement result to the state's result group for the corresponding geometry (DataGeometry) geo

state->results(geo.get())->addDisplacement(dispResult.get());

The result is now created and added to the model. To tell the model to use this result, you must set the current scalar result in the model's model specification.

ugModel->modelSpec().setDisplacementResultId(dispResultId);

To visualize the displacement result, you have to toggle the visibility of displacements in the part settings for each part.

ugModel->partSettings(geometryIndex, partId)->setDisplacementVisible(true);

See the complete source code at: UnstructGrid: A simple model with results

See also
DataPartDisplacement
ModelSpec
UnstructGridModel
DisplacementSettings
Tutorials
UnstructGrid: A simple model with results

Constructor & Destructor Documentation

cee::ug::DataResultDisplacement::DataResultDisplacement ( int  resultId)

Constructs an empty object. A unique id are set upon construction.

Member Function Documentation

void cee::ug::DataResultDisplacement::addPart ( DataPartDisplacement part)

Adds a displacement part to the displacement scalar.

Number of parts must match the number of parts in the corresponding geometry.

Warning
The added object is reference counted and should never be created on the stack or deleted!
bool cee::ug::DataResultDisplacement::deriveScalar ( DeriveOperation  deriveOperation,
DataResultScalar derivedScalar,
const DataGeometry geometry 
) const

Gets a derived scalar.

bool cee::ug::DataResultDisplacement::deriveVector ( DeriveOperation  deriveOperation,
DataResultVector derivedVector,
const DataGeometry geometry 
) const

Gets a derived vector.

const DataPartDisplacement * cee::ug::DataResultDisplacement::part ( size_t  partIndex) const

Returns the part at the given index.

DataPartDisplacement * cee::ug::DataResultDisplacement::part ( size_t  partIndex)

Returns the part at the given index.

size_t cee::ug::DataResultDisplacement::partCount ( ) const

Returns number of displacement parts in this displacement result.

void cee::ug::DataResultDisplacement::removeAllParts ( )

Removes all scalar parts.

int cee::ug::DataResultDisplacement::resultId ( ) const

Returns the result id.