# vtkmCleanGrid - non VTK-m version?

**URL:** https://discourse.vtk.org/t/vtkmcleangrid-non-vtk-m-version/1483
**Category:** Support
**Created:** [August 4, 2019, 8:09pm UTC](https://discourse.vtk.org/t/vtkmcleangrid-non-vtk-m-version/1483 "2019-08-04T20:09:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 4, 2019, 8:09pm UTC](https://discourse.vtk.org/t/vtkmcleangrid-non-vtk-m-version/1483/1 "2019-08-04T20:09:30Z")

</div>

Is there a non-VTK-m version of [`vtkmCleanGrid`](https://vtk.org/doc/nightly/html/classvtkmCleanGrid.html)?

I’m looking for a standard VTK algorithm to clean unstructured grids

---

<div class="post-metadata">

### Author: ![RobertMaynard](https://discourse.vtk.org/user_avatar/discourse.vtk.org/robertmaynard/32/24_2.png) [@RobertMaynard](https://discourse.vtk.org/u/RobertMaynard)
#### Post date: [August 6, 2019, 7:17pm UTC](https://discourse.vtk.org/t/vtkmcleangrid-non-vtk-m-version/1483/2 "2019-08-06T19:17:02Z")

</div>

I know that ParaView has `vtkCleanUnstructuredGrid` which supports cleaning input unstructured grids in a single filter.

For VTK I think the easiest approach is chaining `vtkMergePoints` and `vtkMergeCells`.

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 6, 2019, 10:09pm UTC](https://discourse.vtk.org/t/vtkmcleangrid-non-vtk-m-version/1483/3 "2019-08-06T22:09:46Z")

</div>

Thanks for that tip! I’ll check out the source code for ParaViews clean filter and try out the chain you suggest

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 7, 2019, 12:57am UTC](https://discourse.vtk.org/t/vtkmcleangrid-non-vtk-m-version/1483/4 "2019-08-07T00:57:09Z")

</div>

I just implemented a rough clean algorithm for UnstructuredGrids over in [https://github.com/pyvista/pyvista/pull/355](https://github.com/pyvista/pyvista/pull/355)

It’s in Python and has some `for` loops that need to be vectorized but it works!!

I put an example in that pull request
