cee::vtfx::NodeBlock

class NodeBlock : public Block

A block for storing nodes with coordinates and, optionally, node ids.

A node block may be referenced by element blocks and result values blocks.

Public Functions

NodeBlock(int blockId, bool withNodeIds)

Constructs an empty node block.

blockId must be >= 0 and unique for all node blocks within a database. withNodeIds specifies if nodes will be supplied with node ids or not.

virtual ~NodeBlock()
size_t nodeCount() const

Returns the number of nodes in this block.

std::vector<int> nodeIds() const

Returns the array of node ids for this block.

Empty if no ids are present.

std::vector<Vec3f> nodes() const

Returns the array of nodes for this block.

bool setNodes(const std::vector<float> &coordinates, const std::vector<int> &nodeIds = std::vector<int>())

Sets the node data for this node block, optionally with node ids.

coordinates is a float array with interleaved coordinates. Each node is described by 3 floats in the array. (x,y,z,x,y,z,x,y,z, …) nodeIds are optional node ids. If supplied, the nodeIds array must contain one id for each node. (nodeIds.size() == coordinates.size() / 3)

Returns false if an error occurred. See the log for more information.

bool setNodes(const std::vector<Vec3f> &coordinates, const std::vector<int> &nodeIds = std::vector<int>())

Sets the node data for this node block, optionally with node ids.

coordinates is a vector array with coordinate nodes. nodeIds are optional node ids. If supplied, the nodeIds array must contain one id for each node.

Returns false if an error occurred. See the log for more information.

bool allocateNodes(size_t numNodes)

Sets the number of nodes to allocate space for.

Nodes are added afterwards using addNode().

Returns false if allocation failed.

bool addNode(float x, float y, float z, int nodeId = -1)

Adds a node to the block.

The number of nodes MUST be set by allocateNodes() prior to calling this method. Use this method if you do not have interleaved node coordinates available, as it is required by the more efficient method addNodes().

Returns false if an error occurred. See the log for more information.

bool addNode(Vec3f node, int nodeId = -1)

Adds a node to the block.

The number of nodes MUST be set by allocateNodes() prior to calling this method. Use this method if you do not have interleaved node coordinates available, as it is required by the more efficient method addNodes().

Returns false if an error occurred. See the log for more information.

int nodeIndex(int nodeId)

Returns the index of the node with the given id.

Will return the nodeId (which is the index) if there are no ids in the block.