cee::vtfx::ElementBlock

class ElementBlock : public Block

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.

Public Types

enum ElementType

Global element type constants used by the VTFx component.

These constants are used for various methods of ElementBlock.

Values:

enumerator POINTS

../_images/Point1.png

Point element, 1 element node

enumerator BEAMS

../_images/Beam1.png

Beam element with 2 nodes.

enumerator BEAMS_3

../_images/Beam_31.png

Higher order beam element with 2 nodes.

enumerator TRIANGLES

../_images/Triangle1.png

Triangle shell element with 3 nodes.

edge    nodes
  1     1, 2
  2     2, 3
  3     3, 1

../_images/Triangle1.png

enumerator TRIANGLES_6

../_images/Triangle_61.png

Higher order triangle shell element with 6 nodes.

edge    nodes
  1     1, 2
  2     2, 3
  3     3, 1

enumerator QUADS

../_images/Quad1.png

Quad shell element with 4 nodes.

edge    nodes   |   face    nodes
  1     1, 2    |     1     1, 2, 3, 4
  2     2, 3    |
  3     3, 4    |
  4     4, 1    |

enumerator QUADS_8

../_images/Quad_81.png

Higher order quad shell element with 8 nodes.

edge    nodes   |   face    nodes
  1     1, 2    |     1     1, 5, 2, 6, 3, 7, 4, 8
  2     2, 3    |
  3     3, 4    |
  4     4, 1    |

enumerator QUADS_9

../_images/Quad_91.png

Quad shell element, 9 element nodes (as QUADS_8 but one extra internal node)

edge    nodes   |   face    nodes
  1     1, 2    |     1     1, 5, 2, 6, 3, 7, 4, 8
  2     2, 3    |
  3     3, 4    |
  4     4, 1    |

enumerator PYRAMIDS

../_images/Pyramid1.png

Pyramid volume element with 5 nodes.

edge   nodes   edge   nodes   |   face    nodes
  1    1, 2      5    1, 5    |     1     1, 4, 3, 2
  2    2, 3      6    2, 5    |     2     1, 2, 5
  3    3, 4      7    3, 5    |     3     2, 3, 5
  4    4, 1      8    4, 5    |     4     3, 4, 5
                              |     5     1, 5, 4

enumerator PYRAMIDS_13

../_images/Pyramid_131.png

Higher order pyramid volume element with 13 nodes.

edge   nodes   edge   nodes   |   face    nodes
  1    1, 2      5    1, 5    |     1     1,  9, 4,  8, 3,  7, 2, 6
  2    2, 3      6    2, 5    |     2     1,  6, 2, 11, 5, 10
  3    3, 4      7    3, 5    |     3     2,  7, 3, 12, 5, 11
  4    4, 1      8    4, 5    |     4     3,  8, 4, 13, 5, 12
                              |     5     1, 10, 5, 13, 4,  9

enumerator TETRAHEDRONS

../_images/Tetrahedron1.png

Tetrahedron volume element with 6 nodes.

edge   nodes   edge   nodes   |   face   nodes
  1    1, 2      4    1, 4    |     1    1, 3, 2
  2    2, 3      5    2, 4    |     2    1, 2, 4
  3    3, 1      6    3, 4    |     3    2, 3, 4
                              |     4    1, 4, 3

enumerator TETRAHEDRONS_10

../_images/Tetrahedron_101.png

Higher order tetrahedron volume element with 10 nodes.

edge   nodes   edge   nodes   |   face   nodes
  1    1, 2      4    1, 4    |     1    1, 7, 3,  6, 2, 5
  2    2, 3      5    2, 4    |     2    1, 5, 2,  9, 4, 8
  3    3, 1      6    3, 4    |     3    2, 6, 3, 10, 4, 9
                              |     4    1, 8, 4, 10, 3, 7

enumerator HEXAHEDRONS

../_images/Hexahedron1.png

Hexahedron volume element with 8 nodes.

edge   nodes   edge   nodes   |   face    nodes
  1    2, 6      7    6, 7    |     1     1, 4, 3, 2
  2    1, 2      8    5, 6    |     2     5, 6, 7, 8
  3    1, 5      9    5, 8    |     3     1, 2, 6, 5
  4    1, 4     10    4, 8    |     4     2, 3, 7, 6
  5    2, 3     11    7, 8    |     5     3, 4, 8, 7
  6    3, 7     12    3, 4    |     6     1, 5, 8, 4

enumerator HEXAHEDRONS_20

../_images/Hexahedron_201.png

Higher order hexahedron volume element with 20 nodes.

edge   nodes   edge   nodes   |   face    nodes
  1    2, 6      7    6, 7    |     1     1, 12, 4, 11, 3, 10, 2,  9
  2    1, 2      8    5, 6    |     2     5, 13, 6, 14, 7, 15, 8, 16
  3    1, 5      9    5, 8    |     3     1,  9, 2, 18, 6, 13, 5, 17
  4    1, 4     10    4, 8    |     4     2, 10, 3, 19, 7, 14, 6, 18
  5    2, 3     11    7, 8    |     5     3, 11, 4, 20, 8, 15, 7, 19
  6    3, 7     12    3, 4    |     6     1, 17, 5, 16, 8, 20, 4, 12

enumerator PENTAHEDRONS

../_images/Pentahedron1.png

Pentahedron volume element (Wedge volume element) with 6 nodes.

edge   nodes   edge   nodes   |   face    nodes
  1    1, 2      6    6, 4    |     1     1, 3, 2
  2    2, 3      7    1, 4    |     2     4, 5, 6
  3    3, 1      8    2, 5    |     3     1, 2, 5, 4
  4    4, 5      9    3, 6    |     4     2, 3, 6, 5
  5    5, 6                   |     5     1, 4, 6, 3

enumerator PENTAHEDRONS_15

../_images/Pentahedron_151.png

Higher order pentahedron volume element with 15 nodes.

edge   nodes   edge   nodes   |   face    nodes
  1    1, 2      6    6, 4    |     1     1,  9, 3,  8, 2,  7
  2    2, 3      7    1, 4    |     2     4, 10, 5, 11, 6, 12
  3    3, 1      8    2, 5    |     3     1,  7, 2, 14, 5, 10, 4, 13
  4    4, 5      9    3, 6    |     4     2,  8, 3, 15, 6, 11, 5, 14
  5    5, 6                   |     5     1, 13, 4, 12, 6, 15, 3,  9

enumerator POLYHEDRONS

../_images/Polyhedron1.png

Polyhedron element

enumerator UNKNOWN_ELEMENT

Unknown element type, used for element types not supported by the VTFx Component.

Public Functions

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.

virtual ~ElementBlock()
size_t elementCount() const

Returns the total number of elements in this block.

size_t elementNodeCount() const

Returns the total number of element nodes in this block.

bool hasElementIds() const

Returns true if this element block has been configured for storing element ids.

bool 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.

size_t 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.

ElementType 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.

size_t 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 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.

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.

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.

bool elementIndices(size_t groupIndex, std::vector<int> *elementIndices) const

Gets 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.

bool polyhedronsFaceCounts(size_t groupIndex, std::vector<int> *faceCounts)

Returns number of faces per polyhedron.

Size: Number of elements

bool polyhedronsFaceNodeCounts(size_t groupIndex, std::vector<int> *faceNodeCounts)

Returns number of nodes per polyhedron face.

Size: Total number of faces

bool polyhedronsLocalNodes(size_t groupIndex, std::vector<int> *localNodes)

Returns local nodes for all the polyhedron faces in all elements.

Size: Total number of face nodes

bool polyhedronsElementNodeCounts(size_t groupIndex, std::vector<int> *elementNodeCounts)

Returns number of element nodes per polyhedron.

Size: Number of elements

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.

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.

Note: Does not support polyhedron elements, which are added by addPolyhedronElements.

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.

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.)

Note: Does not support polyhedron elements, which are added by addPolyhedronElements.

Returns false if an error occurred when adding the elements. Check the log for further description on the error.

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.

Overload of previous method using const integer pointers and array sizes to provide the element nodes and the optional element ids. As 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.

bool 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.)

Note: Does not support polyhedron elements, which are added by addPolyhedronElements.

Returns false if an error occurred when adding the elements. Check the log for further description on the error.

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.

Overload of previous method using const integer pointers and array sizes to provide the element nodes and the optional element ids. As size checking is not possible, elementNodeCount and optional elementCount must correctly provide the size of the arrays.

Provided for efficiency.

bool addPolyhedronElements(const std::vector<int> &elementNodes, const std::vector<int> &numNodesPerPolyhedron, const std::vector<int> &numFacesPerPolyhedron, const std::vector<int> &numNodesPerFace, const std::vector<int> &globalFaceNodeIndices, const std::vector<int> &elementIds = std::vector<int>())

Adds the given polyhedron elements to this element block.

Use this method to add polyhedron 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.

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.

numNodesPerPolyhedron contains how many nodes each polyhedron consists of. numFacesPerPolyhedron contains how many faces each polyhedron consists of. numNodesPerFace contains a list of values describing how many nodes are used per face for each polyhedron element. The size of the array is as such the same as the sum of all values in numNodesPerPolyhedron. globalFaceNodeIndices contains a list of nodes building up each face for each polyhedron elements. The size of the array is as such the same as the sum of all values in numNodesPerFace. Note that these are global indices which will be converted to local indices in the VTFx file. 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 addPolyhedronElements(const int *elementNodes, size_t elementNodesCount, const int *numNodesPerPolyhedron, size_t numNodesPerPolyhedronCount, const int *numFacesPerPolyhedron, size_t numFacesPerPolyhedronCount, const int *numNodesPerFace, size_t numNodesPerFaceCount, const int *globalFaceNodeIndices, size_t globalFaceNodeIndicesCount, const int *elementIds = NULL)

Adds the given polyhedron elements 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 size checking is not possible, elementNodesCount must correctly provide the size of the elementNodes array and optional elementIds must be correctly sized to the number of elements.

Provided for efficiency.

int nodeBlockId() const

Returns the id of the node block that contains the nodes referenced by this element block.

void setNodeBlockId(int nodeBlockId)

Sets the node block associated with this element block.

virtual bool checkValidity() const

Returns false if the weak validity check fails.

Public Static Functions

static size_t nodesPerElement(ElementType elementType)

Returns number of element nodes for the specified element type.

static bool isVolumeElement(ElementType elementType)

Returns true if the element type is a volume element.

static size_t surfacesPerElement(ElementType elementType)

Returns number of element surfaces for the specified element type.

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.