# vtkGeometryFilter Update() speed

**URL:** https://discourse.vtk.org/t/vtkgeometryfilter-update-speed/8002
**Category:** Support
**Created:** [March 7, 2022, 11:50am UTC](https://discourse.vtk.org/t/vtkgeometryfilter-update-speed/8002 "2022-03-07T11:50:31Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Kevin\_Sweeney](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kevin_sweeney/32/3935_2.png) [@Kevin\_Sweeney](https://discourse.vtk.org/u/Kevin_Sweeney)
#### Post date: [March 7, 2022, 11:50am UTC](https://discourse.vtk.org/t/vtkgeometryfilter-update-speed/8002/1 "2022-03-07T11:50:31Z")

</div>

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?

```auto
...
triangulator = vtk.vtkDelaunay3D()

triangulator.SetAlpha(alphaValue)
triangulator.SetInputDataObject(polydata)

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

```

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [March 7, 2022, 11:56am UTC](https://discourse.vtk.org/t/vtkgeometryfilter-update-speed/8002/2 "2022-03-07T11:56:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Kevin\_Sweeney](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kevin_sweeney/32/3935_2.png) [@Kevin\_Sweeney](https://discourse.vtk.org/u/Kevin_Sweeney)
#### Post date: [March 7, 2022, 1:22pm UTC](https://discourse.vtk.org/t/vtkgeometryfilter-update-speed/8002/3 "2022-03-07T13:22:35Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [March 7, 2022, 1:29pm UTC](https://discourse.vtk.org/t/vtkgeometryfilter-update-speed/8002/4 "2022-03-07T13:29:14Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Kevin\_Sweeney](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kevin_sweeney/32/3935_2.png) [@Kevin\_Sweeney](https://discourse.vtk.org/u/Kevin_Sweeney)
#### Post date: [March 7, 2022, 3:04pm UTC](https://discourse.vtk.org/t/vtkgeometryfilter-update-speed/8002/5 "2022-03-07T15:04:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [March 7, 2022, 3:12pm UTC](https://discourse.vtk.org/t/vtkgeometryfilter-update-speed/8002/6 "2022-03-07T15:12:34Z")

</div>

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.
