A block for storing finite elements and optional element ids. More...
Public Types | |
enum | ElementType { POINTS, BEAMS, BEAMS_3, TRIANGLES, TRIANGLES_6, QUADS, QUADS_8, QUADS_9, PYRAMIDS, PYRAMIDS_13, TETRAHEDRONS, TETRAHEDRONS_10, HEXAHEDRONS, HEXAHEDRONS_20, PENTAHEDRONS, PENTAHEDRONS_15, POLYHEDRONS, UNKNOWN_ELEMENT } |
Global element type constants used by Ceetron Export. These constants are used for various methods of ElementBlock. More... | |
![]() | |
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... | |
Public Member Functions | |
ElementBlock (int blockId, bool withElementIds, bool referNodesByIds) | |
Constructs a new element block. More... | |
size_t | elementCount () const |
Returns the total number of elements in this block. More... | |
size_t | elementNodeCount () const |
Returns the total number of element nodes in this block. More... | |
bool | hasElementIds () const |
Returns true if this element block has been configured for storing element ids. More... | |
bool | referNodesByIds () const |
Returns true if element nodes refer to nodes by id. Returns false if element nodes are using zero-based index. More... | |
size_t | elementGroupCount () const |
Returns the number of element groups in the element block. More... | |
ElementType | elementGroupType (size_t groupIndex) const |
Returns the element type of the element group at index groupIndex. More... | |
size_t | elementGroupElementCount (size_t groupIndex) const |
Returns the number of element in the element group at index groupIndex. More... | |
size_t | elementGroupElementNodeCount (size_t groupIndex) const |
Returns the number of element nodes in the element group at index groupIndex. More... | |
bool | elementGroup (size_t groupIndex, std::vector< int > *elementNodes, std::vector< int > *elementIds) const |
Returns the element nodes and optionally the ids of an element group. More... | |
bool | elementIndices (size_t groupIndex, std::vector< int > *elementIndices) const |
Get the "block-global" indices of the element in the given group. More... | |
bool | polyhedronsFaceCounts (size_t groupIndex, std::vector< int > *faceCounts) |
Number of faces per polyhedron. Size: Number of elements. More... | |
bool | polyhedronsFaceNodeCounts (size_t groupIndex, std::vector< int > *faceNodeCounts) |
Number of nodes per polyhedron face. Size: Total number of faces. More... | |
bool | polyhedronsLocalNodes (size_t groupIndex, std::vector< int > *localNodes) |
Local nodes for all the polyhedron faces in all elements. Size: Total number of face nodes. More... | |
bool | polyhedronsElementNodeCounts (size_t groupIndex, std::vector< int > *elementNodeCounts) |
Number of element nodes per polyhedron. Size: Number of elements. More... | |
void | setElements (const std::vector< ElementType > &elementTypes, const std::vector< int > &elementNodes, const std::vector< int > &elementIds=std::vector< int >()) |
Sets all elements in one batch. More... | |
bool | addElements (ElementType elementType, const std::vector< int > &elementNodes, const std::vector< int > &elementIds=std::vector< int >()) |
Adds the given elements of given element type to this element block,. More... | |
bool | addElements (ElementType elementType, const int *elementNodes, size_t elementNodeCount, const int *elementIds=NULL) |
Adds the given elements of given element type to this element block,. More... | |
bool | addElement (ElementType elementType, const std::vector< int > &elementNodes, int elementId=-1) |
Adds the given element of given element type to this element block,. More... | |
bool | addElement (ElementType elementType, const int *elementNodes, size_t count, int elementId=-1) |
Adds the given elements of given element type to this element block,. More... | |
int | nodeBlockId () const |
Returns the id of the node block that contains the nodes referenced by this element block. More... | |
void | setNodeBlockId (int nodeBlockId) |
Sets the node block associated with this element block. More... | |
bool | checkValidity () const |
Returns false if the weak validity check fails. More... | |
![]() | |
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... | |
![]() | |
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... | |
Static Public Member Functions | |
static size_t | nodesPerElement (ElementType elementType) |
Returns number of element nodes for the specified element type. More... | |
static bool | isVolumeElement (ElementType elementType) |
Returns true if the element type is a volume element. More... | |
static size_t | surfacesPerElement (ElementType elementType) |
Returns number of element surfaces for the specified element type. More... | |
static std::vector< unsigned int > | elementSurface (ElementType elementType, size_t surfaceIndex) |
Returns the indices defining the element surface with index surfaceIndex of an element of type elementType. More... | |
A block for storing finite elements and optional element ids.
Each element block references one node block, specified using the setNodeBlockId() method. An element block may contain elements of just one or also of multiple types of finite elements. See the documentation for more information about the different element types.
It is strongly recommended to supply elements in batches using the addElements() method.
Use the geometry block (GeometryBlock) to reference element blocks in order to define element parts of a database.
Global element type constants used by Ceetron Export. These constants are used for various methods of ElementBlock.
cee::vtfx::ElementBlock::ElementBlock | ( | int | blockId, |
bool | withElementIds, | ||
bool | referNodesByIds | ||
) |
Constructs a new element block.
The block id must be unique within a database. Set withElementIds to true if element ids are supplied. Set referNodesByIds to true if element nodes are referenced by node ids, otherwise element nodes are referenced by zero-based indices.
Note: For performance reasons, we strongly recommend to specify nodes as zero-based indices. VTFx files with referNodesByIds = true will take a lot longer to open as we need to map node ids to indices. You can still have nodes with ids even if you refer them by index.
bool cee::vtfx::ElementBlock::addElement | ( | ElementType | elementType, |
const std::vector< int > & | elementNodes, | ||
int | elementId = -1 |
||
) |
Adds the given element of given element type to this element block,.
Use this method to add a single element to this element block. The method can be called multiple times on one block. See the documentation for more information about the different element types. A new element group will be created if elementType differs from the previous call. It is strongly recommended to supply elements of the same type in as large batches as possible.
If you have multiple element types and the elements are not ordered by element type, we strongly recommend to use the setElements() method where you specify all elements in one go. This is the fastest method and the one that will produce the most compact and fast to load VTFx file.
elementNodes is the array with the element nodes for this element. The element nodes can be either zero-based or node ids depending on if referNodesByIds was set when this element this block was created.
Note: For performance reasons, we strongly recommend to specify nodes as zero-based indices. VTFx files with referNodesByIds = true will take a lot longer to open as we need to map node ids to indices. You can still have nodes with ids even if you refer them by index.
elementId contains the id of the element and should be -1 if element ids are not used. (Only specify element id if the element block was created with withElementIds = true.)
Returns false if an error occurred when adding the elements. Check the log for further description on the error.
bool cee::vtfx::ElementBlock::addElement | ( | ElementType | elementType, |
const int * | elementNodes, | ||
size_t | elementNodeCount, | ||
int | elementId = -1 |
||
) |
Adds the given elements of given element type to this element block,.
Overload of previous method using const integer pointers and array sizes to provide the element nodes and the optional element ids. As there size checking is not possible, elementNodeCount and optional elementCount must correctly provide the size of the arrays.
Provided for efficiency.
bool cee::vtfx::ElementBlock::addElements | ( | ElementType | elementType, |
const std::vector< int > & | elementNodes, | ||
const std::vector< int > & | elementIds = std::vector<int>() |
||
) |
Adds the given elements of given element type to this element block,.
Use this method to add elements to this element block. The method can be called multiple times on one block. See the documentation for more information about the different element types. A new element group will be created if elementType differs from the previous call. It is strongly recommended to supply elements of the same type in as large batches as possible.
If you have multiple element types and the elements are not ordered by element type, we strongly recommend to use the setElements() method where you specify all elements in one go. This is the fastest method and the one that will produce the most compact and fast to load VTFx file.
elementNodes is the array with the element nodes for these elements. The element nodes can be either zero-based or node ids if referNodesByIds was set when this element this block was created.
Note: For performance reasons, we strongly recommend to specify nodes as zero-based indices. VTFx files with referNodesByIds = true will take a lot longer to open as we need to map node ids to indices. You can still have nodes with ids even if you refer them by index.
elementIds contains the ids of the elements and should be empty if element ids are not used. (Only specify element ids if the element block was created with withElementIds = true.)
Returns false if an error occurred when adding the elements. Check the log for further description on the error.
bool cee::vtfx::ElementBlock::addElements | ( | ElementType | elementType, |
const int * | elementNodes, | ||
size_t | elementNodeCount, | ||
const int * | elementIds = NULL |
||
) |
Adds the given elements of given element type to this element block,.
Overload of previous method using const integer pointers and array sizes to provide the element nodes and the optional element ids. As there size checking is not possible, elementNodeCount must correctly provide the size of the elementNodes array and optional elementIds must be correctly sized to the number of elements.
Provided for efficiency.
|
virtual |
Returns false if the weak validity check fails.
Reimplemented from cee::vtfx::Block.
size_t cee::vtfx::ElementBlock::elementCount | ( | ) | const |
Returns the total number of elements in this block.
bool cee::vtfx::ElementBlock::elementGroup | ( | size_t | groupIndex, |
std::vector< int > * | elementNodes, | ||
std::vector< int > * | elementIds | ||
) | const |
Returns the element nodes and optionally the ids of an element group.
The elements in an element block are organized into groups. A group consists of elements of the same element type. Use this method to get the element nodes and optionally the element ids of all the elements in the specified group.
Returns false if an invalid group index was specified or a NULL pointer for element nodes was supplied.
size_t cee::vtfx::ElementBlock::elementGroupCount | ( | ) | const |
Returns the number of element groups in the element block.
The elements in an element block are organized into groups. A group consists of elements of the same element type.
size_t cee::vtfx::ElementBlock::elementGroupElementCount | ( | size_t | groupIndex | ) | const |
Returns the number of element in the element group at index groupIndex.
The elements in an element block are organized into groups. A group consists of elements of the same element type. Use this method to obtain information on the specified element group. The information can be used to pre-allocate memory for reading element nodes and ids using elementGroup().
Returns false if an invalid group index was specified or one of the pointer parameters is NULL.
size_t cee::vtfx::ElementBlock::elementGroupElementNodeCount | ( | size_t | groupIndex | ) | const |
Returns the number of element nodes in the element group at index groupIndex.
The elements in an element block are organized into groups. A group consists of elements of the same element type. Use this method to obtain information on the specified element group. The information can be used to pre-allocate memory for reading element nodes and ids using elementGroup().
Returns false if an invalid group index was specified or one of the pointer parameters is NULL.
cee::vtfx::ElementBlock::ElementType cee::vtfx::ElementBlock::elementGroupType | ( | size_t | groupIndex | ) | const |
Returns the element type of the element group at index groupIndex.
The elements in an element block are organized into groups. A group consists of elements of the same element type. Use this method to obtain information on the specified element group. The information can be used to pre-allocate memory for reading element nodes and ids using elementGroup().
Returns false if an invalid group index was specified.
bool cee::vtfx::ElementBlock::elementIndices | ( | size_t | groupIndex, |
std::vector< int > * | elementIndices | ||
) | const |
Get the "block-global" indices of the element in the given group.
This is used when a file contains elements that are grouped together for performance reasons (batching together elements of the same type) while wanting to maintain the original element ordering.
size_t cee::vtfx::ElementBlock::elementNodeCount | ( | ) | const |
Returns the total number of element nodes in this block.
|
static |
Returns the indices defining the element surface with index surfaceIndex of an element of type elementType.
bool cee::vtfx::ElementBlock::hasElementIds | ( | ) | const |
Returns true if this element block has been configured for storing element ids.
|
static |
Returns true if the element type is a volume element.
int cee::vtfx::ElementBlock::nodeBlockId | ( | ) | const |
Returns the id of the node block that contains the nodes referenced by this element block.
|
static |
Returns number of element nodes for the specified element type.
bool cee::vtfx::ElementBlock::polyhedronsElementNodeCounts | ( | size_t | groupIndex, |
std::vector< int > * | elementNodeCounts | ||
) |
Number of element nodes per polyhedron. Size: Number of elements.
bool cee::vtfx::ElementBlock::polyhedronsFaceCounts | ( | size_t | groupIndex, |
std::vector< int > * | faceCounts | ||
) |
Number of faces per polyhedron. Size: Number of elements.
bool cee::vtfx::ElementBlock::polyhedronsFaceNodeCounts | ( | size_t | groupIndex, |
std::vector< int > * | faceNodeCounts | ||
) |
Number of nodes per polyhedron face. Size: Total number of faces.
bool cee::vtfx::ElementBlock::polyhedronsLocalNodes | ( | size_t | groupIndex, |
std::vector< int > * | localNodes | ||
) |
Local nodes for all the polyhedron faces in all elements. Size: Total number of face nodes.
bool cee::vtfx::ElementBlock::referNodesByIds | ( | ) | const |
Returns true if element nodes refer to nodes by id. Returns false if element nodes are using zero-based index.
Note: For performance reasons, we strongly recommend to specify nodes as zero-based indices. VTFx files with referNodesByIds = true will take a lot longer to open as we need to map node ids to indices. You can still have nodes with ids even if you refer them by index.
void cee::vtfx::ElementBlock::setElements | ( | const std::vector< ElementType > & | elementTypes, |
const std::vector< int > & | elementNodes, | ||
const std::vector< int > & | elementIds = std::vector<int>() |
||
) |
Sets all elements in one batch.
This is the most optimal method if you have multiple element types that might not be ordered by element type. It is the fastest way to set the element data and also the one that produces the most compact files.
void cee::vtfx::ElementBlock::setNodeBlockId | ( | int | nodeBlockId | ) |
Sets the node block associated with this element block.
|
static |
Returns number of element surfaces for the specified element type.