cee::vtfx::ResultValuesBlock

class ResultValuesBlock : public Block

A block containing the actual result values for a specific result.

Public Types

enum ResultValueDimension

Global dimension constants used by the VTFx component.

These constants are used for various methods of ResultValuesBlock to indicate the dimension of result values.

Values:

enumerator SCALAR1D

Scalar result values (1D)

enumerator VECTOR3D

Vector result values (3D)

enumerator TENSOR6D

Symmetric tensor (6 values)

Public Functions

ResultValuesBlock(int blockId, ResultValueDimension dimension, bool mapToItemIds)

Constructs an empty results value block of the given dimension type.

blockId is the id of the result values block. Must be >= 0 and unique for all result values blocks within a database. Dimension type is either scalar (1D) or vector (3D). Set mapToItemIds to true if element or node ids are specified for each result item. If false, element or node indexes are specified for each result item.

Setting mapToItemIds to true is only valid if the “result block” that references this “result values block” uses a node or element mapping.

~ResultValuesBlock()
int mapToBlockId() const

Returns the id of the node or element block these result values map to.

bool setMapToBlockId(int blockId, BlockType blockType)

Sets the id of the node or element to map results to.

blockId specifies the id of the node or element block these results apply to and blockType specifies type of block, either NODES or ELEMENTS.

Returns false if an error occurred.

std::vector<int> mapToItemIds() const

Returns an array containing item ids defining the association of result values with elements or nodes.

Use this method to get an array of node or element ids. The first result in the array returned by resultValues() maps to the node or element with the id found at the beginning of the returned array.

bool hasMapToItemIds() const

Returns true if the result values map to item ids, false if the result values map by corresponding index.

ResultValueDimension dimension() const

Returns the dimension of this result values block (scalar of vector)

std::vector<float> resultValues() const

Returns an array of result values defined in this block.

If the result is a vector or displacement result (3D), the returned array contains interleaved vector values (x,y,z,x,y,z,…).

bool setResultValues(const std::vector<float> &resultValues, const std::vector<int> &mapToItemIds = std::vector<int>())

Sets the result values data, optionally with id mapping.

Use this to set result values data for both 1D results (scalar) and 3D results (vectors and displacements). The result values array must consist of single floats for 1D results or interleaved float triplets (x,y,z,x,y,z,…) for 3D results. For 1D, the size of resultValues must be the same as number of result values and for 3D results resultValues’ size must be “number of result values” * 3.

The dimension here must ALWAYS match the dimension set when creating the block!

mapToItemIds is an array of node or element ids to map the result values to. Default is an empty array, and then the result values are mapped to items elements/nodes/elements nodes/…) by index. If the item mapping is used for 1D results, the mapToItemIds.size() must be equal to resultValues.size(). And if the item mapping us used for 3D results, the mapToItemIds.size() must be equal to resultValues.size() / 3.

A call to this method overwrites any prior specifications of result values.

Returns false if an error occurred.

bool allocateResultValues(int numResultValues)

Sets the number of result values to allocate.

This allocates space for result values added afterwards using addResultValue1d() or addResultValue3d().

The number set here is the number of result values, either 1D or 3D. Do NOT multiply by 3 when allocating for a 3D result. This is handled internally.

Returns false if an error occurred.

bool addResultValue1d(float scalarResultValue, int mapToItemId = -1)

Adds the given scalar result value to the block.

Only use this for adding 1D (scalar results). Use addResultValue3d() for 3D results (vector and displacement).

mapToItemId is the id of the node/element to map the results to (default is -1, i.e. no id mapping).

Returns false if an error occurred.

bool addResultValue3d(float vectorResultValueX, float vectorResultValueY, float vectorResultValueZ, int mapToItemId = -1)

Adds the given vector or displacement (3D) result value to the block.

Only use this for adding 3D results (vector and displacement). Use addResultValue1d() for 1D (scalar results).

mapToItemId is the id of the node/element to map the results to (default is -1, i.e. no id mapping).

Note that displacement result values can map only to nodes.

Returns false if an error occurred.

virtual bool checkValidity() const

Returns false if the weak validity check fails.