Note
Go to the end to download the full example code
Parallel Files#
The VTK library supports parallel file formats. Reading meshes broken up into several files is natively supported by VTK and PyVista.
import os
import pyvista as pv
from pyvista import examples
Let’s go ahead and download the sample dataset containing an
pyvista.UnstructuredGrid
broken up into several files.
Let’s inspect where this downloaded our dataset by setting load=False
and
looking at the directory containing the file we downloaded.
filename = examples.download_blood_vessels(load=False)
path = os.path.dirname(filename)
os.listdir(path)
['T0000000500', 'T0000000500.pvtu']
os.listdir(os.path.join(path, "T0000000500"))
['000.vtu', '003.vtu', '002.vtu', '001.vtu']
Note that a .pvtu
file is available alongside 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.
mesh = pv.read(filename)
mesh
Plot the pieced together mesh
mesh.plot(scalars="node_value", categories=True)
mesh.plot(scalars="density")
Total running time of the script: (0 minutes 1.581 seconds)