cee::vtfx::ResultBlock

class ResultBlock : public Block

A block defining a result (scalars, vectors, or displacements) in a VTFx database.

The result block defines the result meta data and references result values blocks which contain the actual result values.

A VTFx database can contain many result blocks. The meta data consists of the result type - either scalars, vectors, or displacements - and the result mapping describing the association of result values with dataset items - either per node, per element, per element node, or per element face.

The result meta data also contains a “result id” which shall not be confused with the block id. The result id must be unique within all results of the same result type in a database, i.e. scalar ID1/ID2/…, vector ID1/ID2/…, displacement ID1/ID2/… However, the block id for all result blocks within a database has to be unique. The result id is being used to reference results while defining result properties, such as fringe color properties (see Case).

For a static dataset, it is sufficient to define result values blocks for one state (using stateId = 1). For adaptive results, one has to define the results for every state. If result values do not change for a particular state, one can reuse those result values blocks that had already been assigned to previous states.

For further information on states and adaptive results, please see the API documentation and StateInfoBlock.

Displacement results are either “relative”, i.e. added as vectors onto node coordinates, or “absolute”, i.e. replacing the node coordinates (see setRelativeDisplacementResults() method).

See the base class (Block) for more info on VTFx blocks in general.

Public Types

enum ResultType

Global result type constants used by the VTFx component.

These constants are used for various methods of ResultBlock.

Values:

enumerator UNKNOWN_TYPE
enumerator SCALAR

Scalar result (1D)

enumerator VECTOR

Vector result (3D)

enumerator DISPLACEMENT

Displacement result (3D)

enumerator TENSOR

Symmetric tensor result (6D)

enum ResultMapping

Global result mapping type constants used by the VTFx component.

These constants are used for various methods of ResultBlock.

Values:

enumerator UNKNOWN_MAPPING
enumerator NODE_MAPPING

Result values map on nodes.

enumerator ELEMENT_MAPPING

Result values map on elements.

enumerator ELEMENT_NODE_MAPPING

Result values map on element nodes.

enumerator ELEMENT_FACE_MAPPING

Result values map on element faces.

enum StrainType

Values:

enumerator STRAINTYPE_NONE
enumerator STRAINTYPE_ENGINEERING
enumerator STRAINTYPE_STANDARD

Public Functions

ResultBlock(int blockId, ResultType resultType, ResultMapping resultMapping)

Constructs an empty result block.

blockId must be >= 0 and unique for all result blocks within a database.

~ResultBlock()
Str name() const

Returns the result name.

void setName(const Str &resultName)

Sets the name of this result.

Recommended to be unique amongst results of the same type. The result name must be a single line string.

int resultId() const

Returns the result id of the result defined in this block.

void setResultId(int resultId)

Sets the result id.

Must be unique among results of the same type.

If no result name has yet been set, a default name will be assigned to the result depending on the result type : “Scalar/Vector/Displacement result #result id#”. This default name can be overridden using setName(), of course.

The result id is referenced when specifying properties for the result.

std::vector<int> resultValuesBlocks(size_t stateIndex) const

Returns an array containing ids of result values blocks defined for the given state index.

stateIndex is the zero-based index of the state definition (not to be mixed up with state id!).

bool setResultValuesBlocks(const std::vector<int> &resultValuesBlockIds, int stateId = 1)

Defines which result values blocks are referenced by this result block, optionally for the specified state.

resultValuesBlockIds is an array with result values block ids. stateId is the state id for which the result values blocks apply (default = 1 for single state).

Result values blocks does not need to be defined at all states. The rule is that result values blocks need to be defined for every state, but blocks can be re-used in multiple states if required.

bool addResultValuesBlock(int resultValuesBlockId, int stateId = 1)

Adds a result values block reference for this result block, optionally for the specified state.

The state id defines for which state the result values block applies (default = 1 for single state).

Result values blocks do not need to be defined at all states. The rule is that result values blocks need to be defined for every state, but blocks can be re-used in multiple states if required.

bool relativeDisplacementResults() const

Returns true if the displacement results are relative, false if they are absolute.

void setRelativeDisplacementResults(bool relative)

Sets if the displacement results are relative to the non-displaced nodes or absolute new node coordinates.

relative set to true means displacement results are relative to non-displaced nodes, false (default) means displacement results are absolute new node coordinates

void setDefaultDisplacementScaleFactor(float scale)

Sets the default displacement scale factor.

Only applies to absolute displacement results. See setRelativeDisplacementResults().

float defaultDisplacementScaleFactor() const

Gets the default displacement scale factor.

StrainType strainType() const

Returns the strain type of this result.

void setStrainType(StrainType type)

Sets the strain type of this result. Allows to specify if strain tensor in engineering or not.

Str unit() const

Returns the unit of the result.

void setUnit(const Str &unit)

Sets the unit of the result.

The unit will be shown on the color legend and be available in the result info.

void addAttribute(const Str &attributeName, const Str &attributeValue)

Adds an attribute to the result block definition.

Str attribute(const Str &attributeName) const

Returns the value of the given attribute.

std::vector<Str> attributeNames() const

Returns the list of attribute names of this block.

ResultType resultType() const

Returns the result type for this result block.

ResultMapping resultMapping() const

Returns the result mapping for this result block.

size_t stateCount() const

Returns the number of states defined for this result.

size_t stateIndex(int stateId) const

Returns the zero-based state index for the given state id.

int stateId(size_t stateIndex) const

Returns the state id for the given state index.

stateIndex is the zero-based index of the state definition within this block (not to be mixed with state id!)

virtual bool checkValidity() const

Returns false if the weak validity check fails.