Muscat.Bridges.vtkBridge module

AddCellsFromVtkCellArrayToMesh(cells, cellTypesArray: _SupportsArray[dtype] | _NestedSequence[_SupportsArray[dtype]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None, out: Mesh, originalIdsOffset=0)[source]

Function to migrate cells from a vtkCellArray to a Muscattured Mesh

  • cells (vtkCellArray) – the cell to be created in the mesh

  • cellTypesArray (ArrayLike) – the vtk cell type to use for in the vtkCellArray. In the case is none we infer the type of cell from the number of nodes (for the polys in a vtkPolyData)

  • out (Mesh) – the output mesh

  • originalIdsOffset (offset to apply to the original ids) –

ApplyVtkPipeline(mesh: Mesh, op: Callable) Mesh[source]
CellDataToPoint(mesh: Mesh, cellfields: ndarray) ndarray[source]

Applies the CellDataToPointData from vtk. Supported only for the dimensionality of the mesh (no mix of elements of different dimensions)

  • mesh (Mesh) – Mesh containing the cells and vertices concerned by the conversion.

  • cellfield (np.ndarray) – of size (number of fields, number of elements). Cell fields to convert to Point field.


of size (number of points, number of fields). Field converted at the vertices of the mesh.

Return type:


CheckIntegrity(GUI: bool = False) str[source]
CheckIntegrity_CellDataToPoint(GUI: bool = False) str[source]
CheckIntegrity_ConstantRectilinearMesh(GUI: bool = False) str[source]
CheckIntegrity_Empty(GUI: bool = False) str[source]
CheckIntegrity_MeshToVtk(GUI: bool = False) str[source]
CheckIntegrity_Pixel(GUI: bool = False) str[source]
CheckIntegrity_Poly(GUI: bool = False) str[source]
CheckIntegrity_RectilinearMesh(GUI: bool = False) str[source]
CheckIntegrity_VtkToMesh(GUI: bool = False) str[source]
CheckIntegrity_VtkToMesh2D(GUI: bool = False) str[source]
CheckIntegrity_VtkToPartitionedMesh(GUI: bool = False) str[source]
GetInputMuscat(request, inInfoVec, outInfoVec, FieldsAsTags=False, port=0) Mesh[source]
GetInputVtk(request, inInfoVec, outInfoVec, port=0) vtkPolyData | vtkUnstructuredGrid[source]
GetOutputVtk(request, inInfoVec, outInfoVec, copyAttr: bool = True, outputNumber=0) vtkPolyData | vtkUnstructuredGrid[source]
MeshToVtk(mesh: Mesh, vtkobject=None, TagsAsFields=False) vtkPolyData | vtkUnstructuredGrid[source]
NumpyFieldToVtkField(fieldData: ndarray, fieldName: str)[source]
PlotMesh(mesh: Mesh | vtkPolyData | vtkUnstructuredGrid, TagsAsFields: bool = False)[source]

Plot the input mesh using vtk,

  • mesh (Union[Mesh, "vtkPolyData", "vtkUnstructuredGrid"]) – mesh to be plotted

  • TagsAsFields (bool, optional) – if the mesh is a Muscat mesh (Mesh) then this option can be used to control if the tags are converted to field before plotting , by default False

ReadMeshAndPopulateVtkObject(filename, vtkobject=None, TagsAsFields=False)[source]
SetOutputMuscat(request, inInfoVec, outInfoVec, outMesh: Mesh, TagsAsFields: bool = False) None[source]
VtkFieldToNumpyField(vtkField) Tuple[str, ndarray][source]
VtkToMesh(vtkmesh: vtkPolyData | vtkUnstructuredGrid, meshobject=None, FieldsAsTags=True)[source]
VtkToMeshOnlyMeta(vtkmesh: vtkPolyData | vtkUnstructuredGrid | None, FieldsAsTags=False)[source]
VtkToPartitionedMesh(vtkObject, OP: ~typing.Callable[[~vtkmodules.vtkCommonDataModel.vtkPolyData | ~vtkmodules.vtkCommonDataModel.vtkUnstructuredGrid], ~Muscat.Containers.Mesh.Mesh] = <function VtkToMesh>)[source]

Experimental, Vtk To PartitionedMesh

  • vtkObject (vtkMultiBlockDataSet) – _description_

  • OP (Callable[[Union[vtkPolyData, vtkUnstructuredGrid]], Mesh], default VtkToMesh() function) – call operator to convert vtk mesh to mesh


A partitioned mesh with every block as a Mesh

Return type:


checkIntegrity_ApplyVtkPipeline(GUI) str[source]