Input/Outputs

vtkIO module of geos-mesh package contains generic methods to read and write different format of VTK meshes.

geos.mesh.io.vtkIO module

Input and Ouput methods for VTK meshes:
  • VTK, VTU, VTS, PVTU, PVTS readers

  • VTK, VTS, VTU writers

class geos.mesh.io.vtkIO.VtkOutput(output: str, is_data_mode_binary: bool)[source]

Bases: object

is_data_mode_binary
output
geos.mesh.io.vtkIO.read_mesh(vtk_input_file)[source]

Read vtk file and build either an unstructured grid or a structured grid from it.

Parameters:

vtk_input_file (str) – The file name. Extension will be used to guess file format If first guess fails, other available readers will be tried.

Raises:
  • ValueError – Invalid file path error

  • ValueError – No appropriate reader available for the file format

Returns:

Mesh read

Return type:

vtkPointSet

geos.mesh.io.vtkIO.write_mesh(mesh, vtk_output, canOverwrite=False)[source]

Write mesh to disk.

Nothing is done if file already exists.

Parameters:
  • mesh (vtkPointSet) – Grid to write

  • vtk_output (VtkOutput) – File path. File extension will be used to select VTK file format

  • canOverwrite (bool, optional) – Authorize overwriting the file. Defaults to False.

Raises:

ValueError – Invalid VTK format.

Returns:

0 if success

Return type:

int