class DataResultDisplacement : public RefCountedObject

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


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.

cee::ug::DisplacementSettings* settings = ugModel->displacementSettings(42);

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 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;
cee::PtrRef<cee::ug::DataResultDisplacement> dispResult = new cee::ug::DataResultDisplacement(dispResultId);

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

cee::PtrRef<cee::ug::DataPartDisplacement> dispPart = new cee::ug::DataPartDisplacement();
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.


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


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.


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

Tutorials UnstructGrid: A simple model with results

Public Functions

DataResultDisplacement(int resultId)

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

int resultId() const

Returns the result id.

size_t partCount() const

Returns number of displacement parts in this displacement result.

const DataPartDisplacement *part(size_t partIndex) const

Returns the part at the given index.

DataPartDisplacement *part(size_t partIndex)

Returns the part at the given index.

void addPart(DataPartDisplacement *part)

Adds a displacement part to the displacement scalar.

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


The added object is reference counted and should never be created on the stack or deleted!

void removeAllParts()

Removes all scalar parts.

bool deriveScalar(DeriveOperation deriveOperation, DataResultScalar *derivedScalar, const DataGeometry *geometry) const

Gets a derived scalar.

bool deriveVector(DeriveOperation deriveOperation, DataResultVector *derivedVector, const DataGeometry *geometry) const

Gets a derived vector.