cee::vtfx::NodeBlock Class Reference

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

Public Member Functions

 NodeBlock (int blockId, bool withNodeIds)
 Constructs an empty node block. More...
 
size_t nodeCount () const
 Returns the number of nodes in this block. More...
 
std::vector< int > nodeIds () const
 Returns the array of node ids for this block. More...
 
std::vector< Vec3fnodes () const
 Returns the array of nodes for this block. More...
 
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. More...
 
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. More...
 
bool allocateNodes (size_t numNodes)
 Sets the number of nodes to allocate space for. More...
 
bool addNode (float x, float y, float z, int nodeId=-1)
 Adds a node to the block. More...
 
bool addNode (Vec3f node, int nodeId=-1)
 Adds a node to the block. More...
 
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. More...
 
- Public Member Functions inherited from cee::vtfx::Block
 Block (int blockId)
 Constructs an empty block with given block id. More...
 
int blockId () const
 Returns the block id. More...
 
BlockType blockType () const
 Returns the block type. More...
 
virtual bool checkValidity () const
 Does a weak check for valid block contents just before the block is being written. 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...
 

Additional Inherited Members

- Public Types inherited from cee::vtfx::Block
enum  BlockType {
  NODES, ELEMENTS, GEOMETRY, GEOMETRYINFO,
  RESULT, RESULTVALUES, TRANSFORMATIONRESULT, TRANSFORMATIONRESULTVALUES,
  STATEINFO, SET, ILLEGAL
}
 Global block type constants used by Ceetron Export. Normally users do not need these, except for some methods of TransformationResultValuesBlock. More...
 
Inheritance diagram for cee::vtfx::NodeBlock:
cee::vtfx::Block cee::RefCountedObject

Detailed Description

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

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

Constructor & Destructor Documentation

cee::vtfx::NodeBlock::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.

Member Function Documentation

bool cee::vtfx::NodeBlock::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 cee::vtfx::NodeBlock::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.

bool cee::vtfx::NodeBlock::allocateNodes ( size_t  numNodes)

Sets the number of nodes to allocate space for.

Nodes are added afterwards using addNode().

Returns false if allocation failed.

size_t cee::vtfx::NodeBlock::nodeCount ( ) const

Returns the number of nodes in this block.

std::vector< int > cee::vtfx::NodeBlock::nodeIds ( ) const

Returns the array of node ids for this block.

Empty if no ids are present.

int cee::vtfx::NodeBlock::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.

std::vector< Vec3f > cee::vtfx::NodeBlock::nodes ( ) const

Returns the array of nodes for this block.

bool cee::vtfx::NodeBlock::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 cee::vtfx::NodeBlock::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.