# vtkResampleWithDataSet is taking too much time

**URL:** https://discourse.vtk.org/t/vtkresamplewithdataset-is-taking-too-much-time/10922
**Category:** Support
**Tags:** python, code
**Created:** [March 8, 2023, 6:33pm UTC](https://discourse.vtk.org/t/vtkresamplewithdataset-is-taking-too-much-time/10922 "2023-03-08T18:33:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ashishgupta79](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ashishgupta79/32/6543_2.png) [@ashishgupta79](https://discourse.vtk.org/u/ashishgupta79)
#### Post date: [March 8, 2023, 6:33pm UTC](https://discourse.vtk.org/t/vtkresamplewithdataset-is-taking-too-much-time/10922/1 "2023-03-08T18:33:08Z")

</div>

Hi

In my python script, I am using vtkResampleWithDataSet to resample one structured grid points data on to the coordinates of the other structured grid. My code snippet is shown below:

```
   resampler = vtk.vtkResampleWithDataSet()
   resampler.SetCellLocatorPrototype(vtk.vtkStaticCellLocator())
   resampler.MarkBlankPointsAndCellsOff() # ghost arrays are not generated
   resampler.AddInputData(unifiedGrid)
   resampler.SetSourceData(attrGrid)   
   
   resamplingStart = time.time()
   resampler.Update()
   resamplingEnd = time.time()
   print("time taken in resampling (seconds) : ", resamplingEnd-resamplingStart)

```

When resampling a 680X281X1 grid to a 681x281x1 grid, it is taking on an average about 9 seconds to resample, which itself is quiet high. And if I resample 680x281x2 grid to 681x281x2 grid the time taken goes up to about 40 seconds or so.

At the same time, if I do it resampling in paraview, that too of a 681x281x20 structured grid to 6810x281x20 structured grid it only takes a fraction of a second.

Any idea what am I missing, and what would be a way to fix this. I am using vtk 9.2.6 in python.

Thanks  
Ashish

---

<div class="post-metadata">

### Author: ![Christos\_Tsolakis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/christos_tsolakis/32/2076_2.png) [@Christos\_Tsolakis](https://discourse.vtk.org/u/Christos_Tsolakis)
#### Post date: [March 8, 2023, 11:47pm UTC](https://discourse.vtk.org/t/vtkresamplewithdataset-is-taking-too-much-time/10922/2 "2023-03-08T23:47:19Z")

</div>

ParaView builds VTK with thread parallelization support while the official python wheels of VTK have this option turned off see [here](https://discourse.vtk.org/t/are-there-any-prebuilt-python-wheel-with-openmp-support). This is why ParaView is faster. You can try the same script in `pvpython` the python interpreter that comes with ParaView itself.
