vtkGeometryFilter Update() speed

I have a Delaunay mesh (Unstructured Grid) which I need to convert to a Polydata. However, this conversion can take quite a while (70,000 points takes approx 25 seconds). In my usage, I often need to regenerate this Delaunay mesh multiple times using different alpha values etc and so this time to run can become restrictive. Is there a quicker way of doing this conversion than what I am doing in the code below?

triangulator = vtk.vtkDelaunay3D()


# Needs to be converted to a PolyData (from unstructured Grid)
triangulator_polydata = vtk.vtkGeometryFilter()
triangulator_polydata.Update() # This step takes a long time ....

Are you building with SMP enabled? (i.e., using TBB for example).

No, I am not currently using SMP.
I have limited experience with this but will look into it more. Can you show an example of what may need to be changed to run this code in threads?

Is this the only way to speed the steps up? Are there different steps I can do that will improve?

Also try the vtkDataSetSurfaceFilter, in some cases (especially in serial) it can be faster.

Thanks for that, unfortunately no speed improvement with the vtkDataStSurfaceFilter. Will look into SMP

I don’t know what version of VTK you are running, but generally it is very simple in CMake to enable. Search for SMP, and set VTK_SMP_IMPLEMENTATION_TYPE to something like TBB or STDThread (TBB is generally faster). Make sure to build in release.

If this doesn’t work, with a little work it might be possible to directly output the “boundary” entities from the Delaunay filter since I believe the data structures encode this information. Also, please be wary of VTK’s Delaunay3D, it’s not as numerically stable as it should be.

1 Like