cee::ug::DataResultVector Class Reference

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

Public Member Functions

 DataResultVector (int resultId, ResultMapping mappingType)
 Constructs an empty object. More...
 
int resultId () const
 Returns the result id. More...
 
size_t partCount () const
 Returns number of vector parts in this vector result. More...
 
const DataPartVectorpart (size_t partIndex) const
 Returns the part at the given index. More...
 
DataPartVectorpart (size_t partIndex)
 Returns the part at the given index. More...
 
ResultMapping resultMapping () const
 Returns the result mapping for this result. More...
 
void addPart (DataPartVector *part)
 Adds a vector part to the result vector. More...
 
void removeAllParts ()
 Removes all vector parts. More...
 
bool deriveScalar (DeriveOperation deriveOperation, DataResultScalar *derivedScalar) const
 Gets a derived scalar. More...
 
void computeNodeAverage (const DataGeometry *geometry)
 Computes node average values of the vector result. 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::DataResultVector:
cee::RefCountedObject

Detailed Description

Vector results for all parts in the geometry.

The DataResultVector holds a collection of DataPartVector objects, each containing an array of vector values for the belonging part. The DataResultVector has a result mapping type (per node, per element, per element node or per element surface) which applies to all its vector parts.

Each data result vector has a unique id.

The number of parts in the result vector and in the geometry must be the same. And the result values in each vector part must match the number of nodes/elements in the part (depending on mapping type). For instance, a node mapped result will need the same number of result values in the vector part as there are nodes in the part.

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.

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

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

Set which vector results to show on the model using UnstructGridModel::modelSpec().

To configure the setting for a vector result, use VectorSettings. Get the vector settings by calling UnstructGridModel::vectorSettings() with the requested result id.

cee::ug::VectorSettings* settings = ugModel->vectorSettings(42);
Example

Example of how to add a node based vector result to a geometry consisting of only one triangle.

Create the DataResultVector object with a unique id and node based result mapping.

int vectorResultId = 1;

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

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

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

vectorResult->addPart(vectorPart.get());

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

state->results(geo.get())->addVector(vectorResult.get());

The result is now created and added to the model.

To tell the model to use this result, you must set the current vector result in the model's model specification.

ugModel->modelSpec().setVectorResultId(vectorResultId);

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

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

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

See also
DataPartVector
ModelSpec
UnstructGridModel
VectorSettings
Tutorials
UnstructGrid: A simple model with results

Constructor & Destructor Documentation

cee::ug::DataResultVector::DataResultVector ( int  resultId,
ResultMapping  mappingType 
)

Constructs an empty object.

A unique id and the mapping type are decided upon construction.

See also
ResultMapping

Member Function Documentation

void cee::ug::DataResultVector::addPart ( DataPartVector part)

Adds a vector part to the result vector.

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!
void cee::ug::DataResultVector::computeNodeAverage ( const DataGeometry geometry)

Computes node average values of the vector result.

This method will compute a nodal result with the average vector value for each node in the geometry.

bool cee::ug::DataResultVector::deriveScalar ( DeriveOperation  deriveOperation,
DataResultScalar derivedScalar 
) const

Gets a derived scalar.

const DataPartVector * cee::ug::DataResultVector::part ( size_t  partIndex) const

Returns the part at the given index.

DataPartVector * cee::ug::DataResultVector::part ( size_t  partIndex)

Returns the part at the given index.

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

Returns number of vector parts in this vector result.

void cee::ug::DataResultVector::removeAllParts ( )

Removes all vector parts.

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

Returns the result id.

ResultMapping cee::ug::DataResultVector::resultMapping ( ) const

Returns the result mapping for this result.