# cee::vtfx::GeometryBlock

class `GeometryBlock` : public Block

  A block defining all the geometries in a VTFx database.

  There must be only one GeometryBlock in each database defining all the geometries.

  In a given database, the unique GeometryBlock contains one or more geometries. Each geometry is a collection of ElementBlocks, and each ElementBlock is defined by a collection of elements based on a collection of nodes. In other words, an ElementBlock defines a finite element mesh, a geometry is a collection of meshes, and the unique GeometryBlock is defined by all the meshes in the database. Bear in mind that each state of the database must have the same number of geometries. The total number of geometries in the unique GeometryBlock is thus, (number of states) x (number of geometries per state).

  Furthermore, an element block is associated to a part, which also has a name, an id, and visual properties. A part is what will be displayed in the Envision VTFx Viewer or Envision-based application when the file is opened. You specify the id of the part when setting or adding element blocks to a geometry, in the setElementBlocks or addElementBlock methods. The part id is used to define part properties, such as rendering properties (see CaseBlock), or to define its name (see GeometryInfoBlock).

  Geometries with a constant topology

  A widespread scenario is that of a geometry in which the elements in its element blocks are the same in every state. In this case, you use the setElementBlocks/addElementBlock methods to specify the unique element blocks used by the geometry in each and every state.

  Geometries with changing topologies

  If some or all of the elements in the element blocks of a geometry change from one state to another, all element blocks of this geometry need to be defined for each state. This is done using methods setElementBlocksForState() or addElementBlockForState() for each state. Of course, if some of the elements of the element blocks do not vary from state to state, the element block ids can be reused when calling these methods: there is no need to create a separate copy of them for each state.

  Please note that it is mandatory to specify the geometry for all states.

  Using multiple geometries

  In most cases, a single geometry containing all element blocks will fulfill your needs. However, there may be cases where defining multiple geometries is the best solution:

  1. You have a combination of static and adaptive topologies in your model, and would like to represent this as efficiently as possible. One example is in material forging, where the dies might have a static topology whereas the billet is remeshed for every increment.
  2. You are going to open this file in an application (e.g. your app based on HOOPS Envision) and you like have multiple cee::ug::DataGeometry in your data model.

  For further information on states and geometries with changing topologies, please see the documentation and StateInfoBlock.

  See also

  cee::vtfx::GeometryBlock and cee::vtfx::StateInfoBlock

  Public Functions

  `GeometryBlock`(size_t geometryCountPerState)

    Constructs an empty geometry block.

    Only one geometry block per database is needed and allowed.

    Set the number of geometries per state upon construction. The number of geometries must be identical for GeometryInfoBlock and GeometryBlock.

  virtual `~GeometryBlock`()
  size_t `geometryCountPerState`() const

    Returns the number of geometries per state.

    GeometryBlock::geometryCountPerState() and GeometryInfoBlock::geometryCountPerState() must always be equal!

  size_t `stateCount`() const

    Returns the number of states.

  size_t `partCount`(size_t geometryIndex, size_t stateIndex) const

    Returns the number of parts for the given geometry.

    This is the number of element blocks.

    Returns cee::UNDEFINED_SIZE_T if geometryIndex or stateIndex was invalid. Check the log for more information.

  std::vector<int> `elementBlockIds`(size_t geometryIndex, size_t stateIndex) const

    Returns the array of element block ids for the given geometry.

    Returns an empty array if no blocks were found or if geometryIndex or stateIndex was invalid. Check the log for more information.

  bool `setElementBlocks`(size_t geometryIndex, const std::vector<int> &elementBlockIds, const std::vector<int> &partIds)

    Sets the element blocks of the geometry at index geometryIndex.

    Use this method to set the element blocks of a geometry for each and every state in the database. The order of the supplied block ids defines the order of parts as displayed in the viewer. A call to this method overwrites any prior element block specifications. As the order of blocks in a VTFx database is insignificant, there is no requirement for element blocks to be written before a geometry block that references them.

    This method is tailored for constant-topology geometries where element blocks do not change from state to state.

    elementBlockIds is an array of the element block ids. partIds is an array of part ids, one for each supplied element block id. A part can only contain one element block.

    Returns false if the element block id array was empty or there were invalid ids. See the log for further information.

  bool `addElementBlock`(size_t geometryIndex, int elementBlockId, int partId)

    Adds an element block to the geometry at index geometryIndex in each and every state of the database.

    Use this method to add an element block to a geometry for each and every state in the database. As the order of blocks in a VTFx database is insignificant, there is no requirement for element blocks to be written before a geometry block that references them.

    This method is tailored for constant-topology geometries where element blocks do not change from state to state.

    elementBlockId is the id of the element block to add. partId is used to specify the id of the part that uses the element block. A part can only contain one element block.

    Returns false if an invalid block id was specified.

  bool `setElementBlocksForState`(size_t geometryIndex, const std::vector<int> &elementBlockIds, int stateId, const std::vector<int> &partIds)

    Sets the element blocks of the geometry at index geometryIndex for state stateId.

    Use this method to set the element blocks of a geometry at a specific state of the database. The order of the supplied block ids defines the order of parts as displayed in the viewer. A call to this method overwrites any prior element block specifications. As the order of blocks in a VTFx database is insignificant, there is no requirement for element blocks to be written before a geometry block that references them.

    Do not use this method if only the node coordinates used by the element blocks change, but element definitions stay the same. Displacement results are used in that case: rigid body transformations can be defined using transformation result blocks.

    This method is tailored for datasets where the elements of an element block of a geometry change from state to state.

    elementBlockIds is an array of the element block ids. partIds is an array of part ids, one for each supplied block id. A part can only contain one element block.

    Returns false if the element block id array was empty or there were invalid ids. See the log for further information.

  bool `addElementBlockForState`(size_t geometryIndex, int elementBlockId, int stateId, int partId)

    Adds the given element block to the geometry at index geometryIndex for state stateId.

    Use this method to add an element block to a geometry at a specific state of the database. As the order of blocks in a VTFx database is insignificant, there is no requirement for the element block to be written before the geometry block that references it.

    Do not use this method if only the node coordinates used by the element block change, but element definitions stay the same. Displacement results are used in that case: rigid body transformations can be defined using transformation result blocks.

    This method is tailored for datasets where the elements of an element block change from state to state.

    elementBlock is the id of the element block to add. The block will be valid for the state specified by stateId. partId is used to specify the id of the part that uses the element block. A part can only contain one element block.

  virtual bool `checkValidity`() const

    Returns false if the weak validity check fails.

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