I have a 2D numpy array that I wish to export and write as a VTK file. I have tried the vtk package as well as PyEVTK package but am running into issues with both.
Thanks.
I have a 2D numpy array that I wish to export and write as a VTK file. I have tried the vtk package as well as PyEVTK package but am running into issues with both.
Thanks.
I believe this is what you're looking for:
from vtk.util import numpy_support
numpy_to_vtk(num_array, deep=0, array_type=None)
Is this what you asking for? It is easy to use but you have to know the connectivity of yourElements
import meshio
yourNodes = np.array([...])
yourElements = np.array([...])
cells = [("triangle", yourElements )]
mesh = meshio.Mesh(yourNodes , cells )
mesh.write("foo.vtk")
yourElements start at 0 and not at 1!