# How to merge points with multiple processes.

**URL:** https://discourse.vtk.org/t/how-to-merge-points-with-multiple-processes/13880
**Category:** Support
**Created:** [May 14, 2024, 8:17am UTC](https://discourse.vtk.org/t/how-to-merge-points-with-multiple-processes/13880 "2024-05-14T08:17:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Florian\_Maurin1](https://discourse.vtk.org/user_avatar/discourse.vtk.org/florian_maurin1/32/8853_2.png) [@Florian\_Maurin1](https://discourse.vtk.org/u/Florian_Maurin1)
#### Post date: [May 14, 2024, 8:17am UTC](https://discourse.vtk.org/t/how-to-merge-points-with-multiple-processes/13880/1 "2024-05-14T08:17:30Z")

</div>

I have a kind of discontinuous Galerkin Finite Element Mesh, and I would like to convert it into a continuous mesh using a cleaning/merging filter. By discontinuous mesh, I mean that the points between two adjacent cells are duplicated, resulting in the cells initially not being linked together by their connectivity.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/f/f15a4d1e5d3176462d7fae0de9091fdefb73d5fb.png)

What I’m attempting to do is to reconnect the cells together, and the main reason is to not render the internal element faces (see picture below). I have it working in serial, but in parallel with MPI, if cells are on different processes, the clean filter only filter the cells of the current process. Consequently, the points at the interface between the two processes are not merged. To address this issue, I would like to use ghost cells. The question is, what is the workflow in VTK to automatically create those ghost cells? I’ve drafted what the workflow could look like, but I’m not 100% certain this would work and which VTK classes to use. Is vtkPartitionedDataSetCollection appropriate? I know the D3 filter can be used to partition some data, but can it also be employed to create ghost cells on an already partitioned mesh?

 ![image](https://discourse.vtk.org/uploads/default/original/2X/b/b6350f4e3b39c321a139da87920ddd26c5a18e0d.png)

Any advice is welcome.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 14, 2024, 10:08pm UTC](https://discourse.vtk.org/t/how-to-merge-points-with-multiple-processes/13880/2 "2024-05-14T22:08:59Z")

</div>

Hello,

You can try using `vtkStaticCleanUnstructuredGrid` to merge those coincident vertexes: [VTK: vtkStaticCleanUnstructuredGrid Class Reference](https://vtk.org/doc/nightly/html/classvtkStaticCleanUnstructuredGrid.html) . Unfortunately, I couldn’t find any usage examples.

best,

PC

---

<div class="post-metadata">

### Author: ![Florian\_Maurin1](https://discourse.vtk.org/user_avatar/discourse.vtk.org/florian_maurin1/32/8853_2.png) [@Florian\_Maurin1](https://discourse.vtk.org/u/Florian_Maurin1)
#### Post date: [May 15, 2024, 8:32am UTC](https://discourse.vtk.org/t/how-to-merge-points-with-multiple-processes/13880/3 "2024-05-15T08:32:55Z")

</div>

Thank you for your response.  
I am already using `vtkStaticCleanUnstructuredGrid`, which allows me to remove the internal surfaces of cells distributed on the same process (refer to the left part of my image above). So, do you mean that I can use `vtkStaticCleanUnstructuredGrid` across multiple processes?

I also found a filter named `vtkGhostCellsGenerator`. This might do what I am looking for, except that when detecting coincident points, there is no option to set the geometry tolerance, and there is also no option to set the `PointDataWeighingStrategy`.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 15, 2024, 5:59pm UTC](https://discourse.vtk.org/t/how-to-merge-points-with-multiple-processes/13880/4 "2024-05-15T17:59:38Z")

</div>

> [@Florian\_Maurin1](#):
>
> across multiple processes?

What do you mean by “multiple processes”? Code running in parallel?

---

<div class="post-metadata">

### Author: ![Florian\_Maurin1](https://discourse.vtk.org/user_avatar/discourse.vtk.org/florian_maurin1/32/8853_2.png) [@Florian\_Maurin1](https://discourse.vtk.org/u/Florian_Maurin1)
#### Post date: [May 15, 2024, 6:30pm UTC](https://discourse.vtk.org/t/how-to-merge-points-with-multiple-processes/13880/6 "2024-05-15T18:30:53Z")

</div>

> [@Paulo\_Carvalho](#):
>
> What do you mean by “multiple processes”? Code running in parallel?

yes

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 15, 2024, 6:34pm UTC](https://discourse.vtk.org/t/how-to-merge-points-with-multiple-processes/13880/7 "2024-05-15T18:34:24Z")

</div>

In that case, just wait for all processes to finish and use `vtkStaticCleanUnstructuredGrid` to merge the coincident vertexes as a post-processing step.
