Parallel Files

The VTK library supports parallel file formats. Reading meshes broken up into several files is natively supported by VTK and PyVista.

# sphinx_gallery_thumbnail_number = 1
import pyvista as pv
from pyvista import examples
import os

Let’s go ahead and download the sample dataset containing an pyvista.UnstructuredGrid broken up into several files.

# Do not capture output because we'll demo how to read the file

The above code downloaded a dataset containing a set of parallel files for a blood vessel mesh and returned an pyvista.UnstructuredGrid - we did not grab that UnstructuredGrid, so that we could demo how to use these types of files.

Let’s inspect where this downloaded our dataset:

path = os.path.join(pv.EXAMPLES_PATH, "blood_vessels")


['T0000000500', 'T0000000500.pvtu']
print(os.listdir(os.path.join(path, "T0000000500")))


['003.vtu', '001.vtu', '002.vtu', '000.vtu']

Note that a .pvtu file is available along side a directory. This directory contains all the parallel files or pieces that make the whole mesh. We can simply read the .pvtu file and VTK will handle putting the mesh together.

filename = os.path.join(path, "T0000000500.pvtu")
mesh =


UnstructuredGrid (0x7efc309ccb28)
  N Cells:      39353
  N Points:     48823
  X Bounds:     5.300e+01, 1.210e+02
  Y Bounds:     5.000e+01, 9.700e+01
  Z Bounds:     6.400e+01, 1.820e+02
  N Arrays:     5

Plot the pieced together mesh

mesh.plot(scalars="node_value", categories=True)

Total running time of the script: ( 0 minutes 3.942 seconds)

Gallery generated by Sphinx-Gallery