Mesh utilities

The utils module of geos-mesh package contains various utilities for VTK meshes.

geos.mesh.utils.genericHelpers module

Generic VTK utilities.

These methods include:
  • extraction of a surface from a given elevation

  • conversion from a list to vtkIdList

  • conversion of vtk container into iterable

geos.mesh.utils.genericHelpers.createMultiCellMesh(cellTypes, cellPtsCoord, sharePoints=True)[source]

Create a mesh that consists of multiple cells.

Warning

the mesh is not check for conformity.

Parameters:
  • cellTypes (list[int]) – cell type

  • cellPtsCoord (list[1DArray[np.float64]]) – list of cell point coordinates

  • sharePoints (bool) – if True, cells share points, else a new point is created for each cell vertex

Returns:

output mesh

Return type:

vtkUnstructuredGrid

geos.mesh.utils.genericHelpers.createSingleCellMesh(cellType, ptsCoord)[source]

Create a mesh that consists of a single cell.

Parameters:
  • cellType (int) – cell type

  • ptsCoord (1DArray[np.float64]) – cell point coordinates

Returns:

output mesh

Return type:

vtkUnstructuredGrid

geos.mesh.utils.genericHelpers.createVertices(cellPtsCoord, shared=True)[source]

Create vertices from cell point coordinates list.

Parameters:
  • cellPtsCoord (list[npt.NDArray[np.float64]]) – list of cell point coordinates

  • shared (bool, optional) – If True, collocated points are merged. Defaults to True.

Returns:

tuple containing points and the

map of cell point ids

Return type:

tuple[vtkPoints, list[tuple[int, …]]]

geos.mesh.utils.genericHelpers.extractSurfaceFromElevation(mesh, elevation)[source]

Extract surface at a constant elevation from a mesh.

Parameters:
  • mesh (vtkUnstructuredGrid) – input mesh

  • elevation (float) – elevation at which to extract the surface

Returns:

output surface

Return type:

vtkPolyData

geos.mesh.utils.genericHelpers.getBounds(input)[source]

Get bounds of either single of composite data set.

Parameters:

input (Union[vtkUnstructuredGrid, vtkMultiBlockDataSet]) – input mesh

Returns:

tuple containing

bounds (xmin, xmax, ymin, ymax, zmin, zmax)

Return type:

tuple[float, float, float, float, float, float]

geos.mesh.utils.genericHelpers.getBoundsFromPointCoords(cellPtsCoord)[source]

Compute bounding box coordinates of the list of points.

Parameters:

cellPtsCoord (list[npt.NDArray[np.float64]]) – list of points

Returns:

bounding box coordinates (xmin, xmax, ymin, ymax, zmin, zmax)

Return type:

Sequence[float]

geos.mesh.utils.genericHelpers.getMonoBlockBounds(input)[source]

Get boundary box extrema coordinates for a vtkUnstructuredGrid.

Parameters:

input (vtkMultiBlockDataSet) – input single block mesh

Returns:

tuple containing

bounds (xmin, xmax, ymin, ymax, zmin, zmax)

Return type:

tuple[float, float, float, float, float, float]

geos.mesh.utils.genericHelpers.getMultiBlockBounds(input)[source]

Get boundary box extrema coordinates for a vtkMultiBlockDataSet.

Parameters:

input (vtkMultiBlockDataSet) – input multiblock mesh

Returns:

bounds.

Return type:

tuple[float, float, float, float, float, float]

geos.mesh.utils.genericHelpers.to_vtk_id_list(data)[source]

Utility function transforming a list of ids into a vtkIdList.

Parameters:

data (list[int]) – Id list

Returns:

Vtk Id List corresponding to input data

Return type:

result (vtkIdList)

geos.mesh.utils.genericHelpers.vtk_iter(vtkContainer)[source]

Utility function transforming a vtk “container” into an iterable.

Parameters:

vtkContainer (vtkIdList | vtkCellTypes) – A vtk container

Returns:

The iterator

Return type:

Iterator[ Any ]

geos.mesh.utils.arrayHelpers module

ArrayHelpers module contains several utilities methods to get information on arrays in VTK datasets.

These methods include:
  • array getters, with conversion into numpy array or pandas dataframe

  • boolean functions to check whether an array is present in the dataset

  • bounds getter for vtu and multiblock datasets

geos.mesh.utils.arrayHelpers.AsDF(surface, attributeNames)[source]

Get attribute values from input surface.

Parameters:
  • surface (vtkPolyData) – mesh where to get attribute values

  • attributeNames (tuple[str,...]) – tuple of attribute names to get the values.

Returns:

DataFrame containing property names as columns.

Return type:

pd.DataFrame

geos.mesh.utils.arrayHelpers.computeCellCenterCoordinates(mesh)[source]

Get the coordinates of Cell center.

Parameters:

mesh (vtkDataSet) – input surface

Returns:

cell center coordinates

Return type:

vtkPoints

geos.mesh.utils.arrayHelpers.getArrayByName(data, name)[source]

Get the vtkDataArray corresponding to the given name.

Parameters:
  • data (vtkFieldData) – vtk field data

  • name (str) – array name

Returns:

The vtkDataArray associated with the name given. None if not found.

Return type:

Optional[ vtkDataArray ]

geos.mesh.utils.arrayHelpers.getArrayInObject(object, attributeName, onPoints)[source]

Return the numpy array corresponding to input attribute name in table.

Parameters:
  • object (PointSet or UnstructuredGrid) – input object

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

the array corresponding to input attribute name.

Return type:

ArrayLike[float]

geos.mesh.utils.arrayHelpers.getArrayNames(data)[source]

Get the names of all arrays stored in a “vtkFieldData”, “vtkCellData” or “vtkPointData”.

Parameters:

data (vtkFieldData) – vtk field data

Returns:

The array names in the order that they are stored in the field data.

Return type:

list[ str ]

geos.mesh.utils.arrayHelpers.getAttributeSet(object, onPoints)[source]

Get the set of all attributes from an object on points or on cells.

Parameters:
  • object (Any) – object where to find the attributes.

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

set of attribute names present in input object.

Return type:

set[str]

geos.mesh.utils.arrayHelpers.getAttributeValuesAsDF(surface, attributeNames)[source]

Get attribute values from input surface.

Parameters:
  • surface (vtkPolyData) – mesh where to get attribute values

  • attributeNames (tuple[str,...]) – tuple of attribute names to get the values.

Returns:

DataFrame containing property names as columns.

Return type:

pd.DataFrame

geos.mesh.utils.arrayHelpers.getAttributesFromDataSet(object, onPoints)[source]

Get the dictionnary of all attributes of a vtkDataSet on points or cells.

Parameters:
  • object (vtkDataSet) – object where to find the attributes.

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

list of the names of the attributes.

Return type:

dict[str, int]

geos.mesh.utils.arrayHelpers.getAttributesFromMultiBlockDataSet(object, onPoints)[source]

Get the dictionnary of all attributes of object on points or on cells.

Parameters:
  • object (vtkMultiBlockDataSet | vtkCompositeDataSet) – object where to find the attributes.

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

Dictionnary of the names of the attributes as keys, and

number of components as values.

Return type:

dict[str, int]

geos.mesh.utils.arrayHelpers.getAttributesWithNumberOfComponents(object, onPoints)[source]

Get the dictionnary of all attributes from object on points or cells.

Parameters:
  • object (Any) – object where to find the attributes.

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

dictionnary where keys are the names of the attributes

and values the number of components.

Return type:

dict[str, int]

geos.mesh.utils.arrayHelpers.getBounds(input)[source]

Get bounds of either single of composite data set.

Parameters:

input (Union[vtkUnstructuredGrid, vtkMultiBlockDataSet]) – input mesh

Returns:

tuple containing

bounds (xmin, xmax, ymin, ymax, zmin, zmax)

Return type:

tuple[float, float, float, float, float, float]

geos.mesh.utils.arrayHelpers.getComponentNames(dataSet, attributeName, onPoints)[source]

Get the name of the components of attribute attributeName in dataSet.

Parameters:
  • dataSet (vtkDataSet | vtkMultiBlockDataSet | vtkCompositeDataSet | vtkDataObject) – dataSet where the attribute is.

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

names of the components.

Return type:

tuple[str,…]

geos.mesh.utils.arrayHelpers.getComponentNamesDataSet(dataSet, attributeName, onPoints)[source]

Get the name of the components of attribute attributeName in dataSet.

Parameters:
  • dataSet (vtkDataSet) – dataSet where the attribute is.

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

names of the components.

Return type:

tuple[str,…]

geos.mesh.utils.arrayHelpers.getComponentNamesMultiBlock(dataSet, attributeName, onPoints)[source]

Get the name of the components of attribute in MultiBlockDataSet.

Parameters:
  • dataSet (vtkMultiBlockDataSet | vtkCompositeDataSet) – dataSet where the attribute is.

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

names of the components.

Return type:

tuple[str,…]

geos.mesh.utils.arrayHelpers.getCopyArrayByName(data, name)[source]

Get the copy of a vtkDataArray corresponding to the given name.

Parameters:
  • data (vtkFieldData) – vtk field data

  • name (str) – array name

Returns:

The copy of the vtkDataArray associated with the name given. None if not found.

Return type:

Optional[ vtkDataArray ]

geos.mesh.utils.arrayHelpers.getFieldType(data)[source]

Returns whether the data is “vtkFieldData”, “vtkCellData” or “vtkPointData”.

A vtk mesh can contain 3 types of field data: - vtkFieldData (parent class) - vtkCellData (inheritance of vtkFieldData) - vtkPointData (inheritance of vtkFieldData)

Parameters:

data (vtkFieldData) – vtk field data

Returns:

“vtkFieldData”, “vtkCellData” or “vtkPointData”

Return type:

str

geos.mesh.utils.arrayHelpers.getMonoBlockBounds(input)[source]

Get boundary box extrema coordinates for a vtkUnstructuredGrid.

Parameters:

input (vtkMultiBlockDataSet) – input single block mesh

Returns:

tuple containing

bounds (xmin, xmax, ymin, ymax, zmin, zmax)

Return type:

tuple[float, float, float, float, float, float]

geos.mesh.utils.arrayHelpers.getMultiBlockBounds(input)[source]

Get boundary box extrema coordinates for a vtkMultiBlockDataSet.

Parameters:

input (vtkMultiBlockDataSet) – input multiblock mesh

Returns:

bounds.

Return type:

tuple[float, float, float, float, float, float]

geos.mesh.utils.arrayHelpers.getNumberOfComponents(dataSet, attributeName, onPoints)[source]

Get the number of components of attribute attributeName in dataSet.

Parameters:
  • dataSet (vtkMultiBlockDataSet | vtkCompositeDataSet | vtkDataSet) – dataSet where the attribute is.

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

number of components.

Return type:

int

geos.mesh.utils.arrayHelpers.getNumberOfComponentsDataSet(dataSet, attributeName, onPoints)[source]

Get the number of components of attribute attributeName in dataSet.

Parameters:
  • dataSet (vtkDataSet) – dataSet where the attribute is.

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

number of components.

Return type:

int

geos.mesh.utils.arrayHelpers.getNumberOfComponentsMultiBlock(dataSet, attributeName, onPoints)[source]

Get the number of components of attribute attributeName in dataSet.

Parameters:
  • dataSet (vtkMultiBlockDataSet | vtkCompositeDataSet) – multi block data Set where the attribute is.

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

number of components.

Return type:

int

geos.mesh.utils.arrayHelpers.getNumpyArrayByName(data, name, sorted=False)[source]

Get the numpy array of a given vtkDataArray found by its name.

If sorted is selected, this allows the option to reorder the values wrt GlobalIds. If not GlobalIds was found, no reordering will be perform.

Parameters:
  • data (vtkCellData | vtkPointData) – vtk field data.

  • name (str) – Array name to sort

  • sorted (bool, optional) – Sort the output array with the help of GlobalIds. Defaults to False.

Returns:

Sorted array

Return type:

Optional[ npt.NDArray ]

geos.mesh.utils.arrayHelpers.getNumpyGlobalIdsArray(data)[source]

Get a numpy array of the GlobalIds.

Parameters:

data (Union[ vtkCellData, vtkPointData ]) – Cell or point array.

Returns:

The numpy array of GlobalIds.

Return type:

Optional[ npt.NDArray[ np.int64 ] ]

geos.mesh.utils.arrayHelpers.getVtkArrayInObject(object, attributeName, onPoints)[source]

Return the array corresponding to input attribute name in table.

Parameters:
  • object (PointSet or UnstructuredGrid) – input object

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

the vtk array corresponding to input attribute name.

Return type:

vtkDoubleArray

geos.mesh.utils.arrayHelpers.has_array(mesh, array_names)[source]

Checks if input mesh contains at least one of input data arrays.

Parameters:
  • mesh (vtkUnstructuredGrid) – An unstructured mesh.

  • array_names (list[str]) – List of array names.

Returns:

True if at least one array is found, else False.

Return type:

bool

geos.mesh.utils.arrayHelpers.isAttributeInObject(object, attributeName, onPoints)[source]

Check if an attribute is in the input object.

Parameters:
  • object (vtkMultiBlockDataSet | vtkDataSet) – input object

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

True if the attribute is in the table, False otherwise

Return type:

bool

geos.mesh.utils.arrayHelpers.isAttributeInObjectDataSet(object, attributeName, onPoints)[source]

Check if an attribute is in the input object.

Parameters:
  • object (vtkDataSet) – input object

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

True if the attribute is in the table, False otherwise

Return type:

bool

geos.mesh.utils.arrayHelpers.isAttributeInObjectMultiBlockDataSet(object, attributeName, onPoints)[source]

Check if an attribute is in the input object.

Parameters:
  • object (vtkMultiBlockDataSet) – input multiblock object

  • attributeName (str) – name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

True if the attribute is in the table, False otherwise

Return type:

bool

geos.mesh.utils.arrayHelpers.sortArrayByGlobalIds(data, arr)[source]

Sort an array following global Ids.

Parameters:
  • data (vtkFieldData) – Global Ids array

  • arr (npt.NDArray[ np.float64 ]) – Array to sort

geos.mesh.utils.arrayModifiers module

ArrayModifiers contains utilities to process VTK Arrays objects.

These methods include:
  • filling partial VTK arrays with nan values (useful for block merge)

  • creation of new VTK array, empty or with a given data array

  • transfer from VTK point data to VTK cell data

geos.mesh.utils.arrayModifiers.copyAttribute(objectFrom, objectTo, attributNameFrom, attributNameTo)[source]

Copy a cell attribute from objectFrom to objectTo.

Parameters:
  • objectFrom (vtkMultiBlockDataSet) – object from which to copy the attribute.

  • objectTo (vtkMultiBlockDataSet) – object where to copy the attribute.

  • attributNameFrom (str) – attribute name in objectFrom.

  • attributNameTo (str) – attribute name in objectTo.

Returns:

True if copy successfully ended, False otherwise

Return type:

bool

geos.mesh.utils.arrayModifiers.copyAttributeDataSet(objectFrom, objectTo, attributNameFrom, attributNameTo)[source]

Copy a cell attribute from objectFrom to objectTo.

Parameters:
  • objectFrom (vtkDataSet) – object from which to copy the attribute.

  • objectTo (vtkDataSet) – object where to copy the attribute.

  • attributNameFrom (str) – attribute name in objectFrom.

  • attributNameTo (str) – attribute name in objectTo.

Returns:

True if copy successfully ended, False otherwise

Return type:

bool

geos.mesh.utils.arrayModifiers.createAttribute(dataSet, array, attributeName, componentNames, onPoints)[source]

Create an attribute from the given array.

Parameters:
  • dataSet (vtkDataSet) – dataSet where to create the attribute

  • array (npt.NDArray[np.float64]) – array that contains the values

  • attributeName (str) – name of the attribute

  • componentNames (tuple[str,...]) – name of the components for vectorial attributes

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

True if the attribute was correctly created

Return type:

bool

geos.mesh.utils.arrayModifiers.createCellCenterAttribute(mesh, cellCenterAttributeName)[source]

Create elementCenter attribute if it does not exist.

Parameters:
  • mesh (vtkMultiBlockDataSet | vtkDataSet) – input mesh

  • cellCenterAttributeName (str) – Name of the attribute

Raises:
  • TypeError – Raised if input mesh is not a vtkMultiBlockDataSet or a

  • vtkDataSet.

Returns:

True if calculation successfully ended, False otherwise.

Return type:

bool

geos.mesh.utils.arrayModifiers.createConstantAttribute(object, values, attributeName, componentNames, onPoints)[source]

Create an attribute with a constant value everywhere if absent.

Parameters:
  • object (vtkDataObject) – object (vtkMultiBlockDataSet, vtkDataSet) where to create the attribute

  • values (list[float]) – list of values of the attribute for each components

  • attributeName (str) – name of the attribute

  • componentNames (tuple[str,...]) – name of the components for vectorial attributes

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

True if the attribute was correctly created

Return type:

bool

geos.mesh.utils.arrayModifiers.createConstantAttributeDataSet(dataSet, values, attributeName, componentNames, onPoints)[source]

Create an attribute with a constant value everywhere.

Parameters:
  • dataSet (vtkDataSet) – vtkDataSet where to create the attribute

  • values (list[float]) – list of values of the attribute for each components

  • attributeName (str) – name of the attribute

  • componentNames (tuple[str,...]) – name of the components for vectorial attributes

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

True if the attribute was correctly created

Return type:

bool

geos.mesh.utils.arrayModifiers.createConstantAttributeMultiBlock(multiBlockDataSet, values, attributeName, componentNames, onPoints)[source]

Create an attribute with a constant value everywhere if absent.

Parameters:
  • multiBlockDataSet (vtkMultiBlockDataSet | vtkCompositeDataSet) – vtkMultiBlockDataSet where to create the attribute

  • values (list[float]) – list of values of the attribute for each components

  • attributeName (str) – name of the attribute

  • componentNames (tuple[str,...]) – name of the components for vectorial attributes

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

True if the attribute was correctly created

Return type:

bool

geos.mesh.utils.arrayModifiers.createEmptyAttribute(attributeName, componentNames, dataType)[source]

Create an empty attribute.

Parameters:
  • attributeName (str) – name of the attribute

  • componentNames (tuple[str,...]) – name of the components for vectorial attributes

  • dataType (int) – data type.

Returns:

True if the attribute was correctly created

Return type:

bool

geos.mesh.utils.arrayModifiers.doCreateCellCenterAttribute(block, cellCenterAttributeName)[source]

Create elementCenter attribute in a vtkDataSet if it does not exist.

Parameters:
  • block (vtkDataSet) – input mesh that must be a vtkDataSet

  • cellCenterAttributeName (str) – Name of the attribute

Returns:

True if calculation successfully ended, False otherwise.

Return type:

bool

geos.mesh.utils.arrayModifiers.fillAllPartialAttributes(multiBlockMesh, onPoints=False)[source]

Fill all the partial attributes of multiBlockMesh with nan values.

Parameters:
  • multiBlockMesh (vtkMultiBlockDataSet | vtkCompositeDataSet | vtkDataObject) – multiBlockMesh where to fill the attribute

  • onPoints (bool, optional) –

    Attribute is on Points (False) or on Cells.

    Defaults to False.

Returns:

True if calculation successfully ended, False otherwise

Return type:

bool

geos.mesh.utils.arrayModifiers.fillPartialAttributes(multiBlockMesh, attributeName, nbComponents, onPoints=False)[source]

Fill input partial attribute of multiBlockMesh with nan values.

Parameters:
  • multiBlockMesh (vtkMultiBlockDataSet | vtkCompositeDataSet | vtkDataObject) – multiBlock mesh where to fill the attribute

  • attributeName (str) – attribute name

  • nbComponents (int) – number of components

  • onPoints (bool, optional) –

    Attribute is on Points (False) or on Cells.

    Defaults to False.

Returns:

True if calculation successfully ended, False otherwise

Return type:

bool

geos.mesh.utils.arrayModifiers.renameAttribute(object, attributeName, newAttributeName, onPoints)[source]

Rename an attribute.

Parameters:
  • object (vtkMultiBlockDataSet) – object where the attribute is

  • attributeName (str) – name of the attribute

  • newAttributeName (str) – new name of the attribute

  • onPoints (bool) – True if attributes are on points, False if they are on cells.

Returns:

True if renaming operation successfully ended.

Return type:

bool

geos.mesh.utils.arrayModifiers.transferPointDataToCellData(mesh)[source]

Transfer point data to cell data.

Parameters:

mesh (vtkPointSet) – Input mesh.

Returns:

Output mesh where point data were transferred to cells.

Return type:

vtkPointSet

geos.mesh.utils.multiblockHelpers module

Functions to explore VTK multiblock datasets.

Methods include:
  • getters for blocks names and indexes

  • block extractor

geos.mesh.utils.multiblockHelpers.extractBlock(multiBlockDataSet, blockIndex)[source]

Extract the block with index blockIndex from multiBlockDataSet.

Parameters:
  • multiBlockDataSet (vtkMultiBlockDataSet) – multiblock dataset from which to extract the block

  • blockIndex (int) – block index to extract

Returns:

extracted block

Return type:

vtkMultiBlockDataSet

geos.mesh.utils.multiblockHelpers.getBlockElementIndexes(input)[source]

Get a list of list that contains flat indexes of elementary blocks.

Each sublist contains the indexes of elementary blocks that belongs to a same parent node.

Parameters:

input (vtkMultiBlockDataSet | vtkCompositeDataSet) – input multi block object.

Returns:

list of list of flat indexes

Return type:

list[list[int]]

geos.mesh.utils.multiblockHelpers.getBlockElementIndexesFlatten(input)[source]

Get a flatten list that contains flat indexes of elementary blocks.

Parameters:

input (vtkMultiBlockDataSet | vtkCompositeDataSet) – input multi block object.

Returns:

list of flat indexes

Return type:

list[int]

geos.mesh.utils.multiblockHelpers.getBlockFromFlatIndex(multiBlock, blockIndex)[source]

Get the block with blockIndex from input vtkMultiBlockDataSet.

Parameters:
  • multiBlock (vtkMultiBlockDataSet | vtkCompositeDataSet) – input multi block

  • blockIndex (int) – block index

Returns:

block if it exists, None otherwise

Return type:

vtkMultiBlockDataSet

geos.mesh.utils.multiblockHelpers.getBlockFromName(multiBlock, blockName)[source]

Get the block named blockName from input vtkMultiBlockDataSet.

Parameters:
  • multiBlock (vtkMultiBlockDataSet | vtkCompositeDataSet) – input multi block

  • blockName (str) – block name

Returns:

block if it exists, None otherwise

Return type:

vtkDataObject

geos.mesh.utils.multiblockHelpers.getBlockIndexFromName(input, name)[source]

Get block flat index from name of node in the vtkMultiBlockDataSet tree.

Parameters:
  • input (vtkMultiBlockDataSet | vtkCompositeDataSet) – input multi block object.

  • name (str) – name of the block to get the index in the tree.

Returns:

index of the block if found, -1 otherwise.

Return type:

int

geos.mesh.utils.multiblockHelpers.getBlockName(input)[source]

Get the name of input block.

If input is a vtkMultiBlockDataSet or vtkCompositeDataSet, returns the name of the lowest level unique child block.

Parameters:

input (vtkMultiBlockDataSet | vtkCompositeDataSet) – input multi block object.

Returns:

name of the block in the tree.

Return type:

str

geos.mesh.utils.multiblockHelpers.getBlockNameFromIndex(input, index)[source]

Get the name of a block from input multiblock and block flat index.

Parameters:
  • input (vtkMultiBlockDataSet | vtkCompositeDataSet) – input multi block object.

  • index (int) – flat index of the block to get the name

Returns:

name of the block in the tree.

Return type:

str

geos.mesh.utils.multiblockHelpers.getElementaryCompositeBlockIndexes(input)[source]

Get indexes of composite block that contains elementrary blocks.

Parameters:

input (vtkMultiBlockDataSet | vtkCompositeDataSet) – input multi block object.

Returns:

dictionary that contains names as keys and flat indices as values of the parent composite blocks of elementary blocks.

Return type:

dict[str, int]

geos.mesh.utils.multiblockModifiers module

Contains a method to merge blocks of a VTK multiblock dataset.

geos.mesh.utils.multiblockModifiers.mergeBlocks(input, keepPartialAttributes=False)[source]

Merge all blocks of a multi block mesh.

Parameters:
  • input (vtkMultiBlockDataSet | vtkCompositeDataSet) – composite object to merge blocks

  • keepPartialAttributes (bool) –

    if True, keep partial attributes after merge.

    Defaults to False.

Returns:

merged block object

Return type:

vtkUnstructuredGrid