# 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`

      Point element, 1 element node

    enumerator `BEAMS`

      Beam element with 2 nodes.

    enumerator `BEAMS_3`

      Higher order beam element with 2 nodes.

    enumerator `TRIANGLES`

      Triangle shell element with 3 nodes.

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

    enumerator `TRIANGLES_6`

      Higher order triangle shell element with 6 nodes.

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

    enumerator `QUADS`

      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`

      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`

      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`

      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`

      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`

      Tetrahedron volume element with 4 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`

      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`

      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`

      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`

      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`

      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`

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

  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.

  virtual bool `checkValidity`() const

    Returns false if the weak validity check fails.

  int `crossSectionsBlockId`() const

    Returns the id of the cross sections block associated with this element block.

  void `setCrossSectionsBlockId`(int crossSectionsBlockId)

    Sets the cross sections block associated with this element block.

    See CrossSectionsBlock for more information on cross sections.

  std::vector<int> `crossSectionsElementMapping`(size_t groupIndex)

    Returns an array with per element cross section indices indicating per element which of the cross sections in the associated CrossSectionsBlock to use for that element.

    Set the associated CrossSectionsBlock by calling setCrossSectionsBlockId().

  std::vector<Vec3f> `crossSectionsDirections`(size_t groupIndex)

    Returns per element the cross section directions for the specified element group.

  std::vector<Vec3f> `crossSectionsEccentricities`(size_t groupIndex)

    Returns per element node cross section eccentricities for the specified element group.

  bool `addElementsWithCrossSections`(ElementType elementType, const std::vector<int> &elementNodes, const std::vector<int> &mappings, const std::vector<Vec3f> directions, const std::vector<Vec3f> eccentricities = std::vector<Vec3f>(), const std::vector<int> &elementIds = std::vector<int>())

    Adds the given elements of given element type to this element block with cross sections.

    Use this method when you want to add elements with cross sections to this element block. Got to CrossSectionsBlock for more information about cross sections and mappings.

    Cross sections can only be added to beam elements (BEAMS, BEAMS_3). The cross sections are specified using the mappings, directions and eccentricities parameters. The mappings array specifies the mapping of the element to the cross section in the cross sections block. Create a cross section block and connect this by calling setCrossSectionsBlockId().

    See addElements() for more information on the parameters used for adding the elements.

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

    Parameters: | elementType – The element type of the elements to add. Must be either BEAMS or BEAMS_3. elementNodes – Array of element nodes for the elements. The element nodes can be either zero-based or node ids depending on if referNodesByIds was set when this element this block was created. elementIds – Array of element ids for the elements. The element ids can be used to reference the elements in the VTFx file. The array can be empty if no element ids are used. crossSectionIndices – Array of indices specifying the mapping of the element to the cross section in the cross sections block. Cross section indices are set per element. directions – Array of directions (up vector) for the cross sections. The directions are used to orient the cross sections.Directions must be specified per element. eccentricities – (Optional) Array of eccentricities for the cross sections. The eccentricities are used to offset the cross sections. Eccentricities are specified per element node. The eccentricities array can be empty if no eccentricities are used.

  bool `addElementsWithCrossSections`(ElementType elementType, const int *elementNodes, size_t elementNodeCount, const int *mappings, size_t mappingCount, const Vec3f *directions, size_t directionsCount, const Vec3f *eccentricities = NULL, size_t eccentricitiesCount = 0, const int *elementIds = NULL)

    Adds the given elements with cross sections 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.

  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.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...