# Cell merging in porous materials

**URL:** https://discourse.paraview.org/t/cell-merging-in-porous-materials/15115
**Category:** ParaView Support
**Created:** [July 24, 2024, 2:14pm UTC](https://discourse.paraview.org/t/cell-merging-in-porous-materials/15115 "2024-07-24T14:14:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Puraxx](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@Puraxx](https://discourse.paraview.org/u/Puraxx)
#### Post date: [July 24, 2024, 2:14pm UTC](https://discourse.paraview.org/t/cell-merging-in-porous-materials/15115/1 "2024-07-24T14:14:25Z")

</div>

Hi everyone ! So I wanna know if it’s possible to merge cell by using Paravie. What I mean is that I visualize pores in my material as shown in this picture

 ![image](https://discourse.paraview.org/uploads/default/original/2X/9/9cfa72aa652153d097d3ce3b61ff67f8fb0184c1.jpeg)  
And these pore sometimes touch each other and when this happen I want them to merge and make like an 8 shape. I’m not sure if I am pretty clear but thanks in advance !

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [August 8, 2024, 7:22am UTC](https://discourse.paraview.org/t/cell-merging-in-porous-materials/15115/2 "2024-08-08T07:22:55Z")

</div>

@Charles_Gueunet

---

<div class="post-metadata">

### Author: ![Charles\_Gueunet](https://discourse.paraview.org/user_avatar/discourse.paraview.org/charles_gueunet/32/40_2.png) [@Charles\_Gueunet](https://discourse.paraview.org/u/Charles_Gueunet)
#### Post date: [August 9, 2024, 3:54pm UTC](https://discourse.paraview.org/t/cell-merging-in-porous-materials/15115/3 "2024-08-09T15:54:19Z")

</div>

Hello @Puraxx ,

Could you by any chance share a dataset corresponding to your use case ?  
Usually, when I have to merge surfaces intersecting each other I use the [Alpha Wrapping](https://doc.cgal.org/latest/Alpha_wrap_3/index.html) from [Vespa](https://www.kitware.com/vespa-advanced-mesh-processing-based-on-cgal-for-vtk-and-paraview/).  
However, I am not sure it will completely work here, as it seems your dataset may have internal holes in some cases that would be missed.

Anyway, if you can share it, I would be happy to play around with it to try to find a solution

---

<div class="post-metadata">

### Author: ![Puraxx](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/p/a87d85/32.png) [@Puraxx](https://discourse.paraview.org/u/Puraxx)
#### Post date: [September 9, 2024, 8:36am UTC](https://discourse.paraview.org/t/cell-merging-in-porous-materials/15115/4 "2024-09-09T08:36:40Z")

</div>

Hi,  
Thank you for your answer !  
Im sorry, I could not reply earlier. here you can find attached to this message a dataset.

Thanks in advance !  
[Donnees\_bulles.csv](https://discourse.paraview.org/uploads/short-url/ssmCoXhMqGJ81KxfnqjQR0Srqzb.csv) (858.0 KB)

---

<div class="post-metadata">

### Author: ![Charles\_Gueunet](https://discourse.paraview.org/user_avatar/discourse.paraview.org/charles_gueunet/32/40_2.png) [@Charles\_Gueunet](https://discourse.paraview.org/u/Charles_Gueunet)
#### Post date: [September 10, 2024, 11:55am UTC](https://discourse.paraview.org/t/cell-merging-in-porous-materials/15115/5 "2024-09-10T11:55:53Z")

</div>

Hello @Puraxx

The good solution for your mesh would be to apply a boolean operation between all disconnected spheres.  
This is not (yet) trivially doable in ParaView. The pipeline I have in mind would be:

- apply a **Connected Component** filter to identify each shpere
- use the resulting field to drive a redistribute dataset, need [this branch](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11010/) to be merged in VTK and then ParaView, so not possible yet. This would result in a multiblock with one block per sphere.
- Use a [vtkForEach](https://discourse.vtk.org/t/introduce-vtkforeach-filter/12448) (need to beexposed in ParaView) or a [ttkForEach](https://topology-tool-kit.github.io/doc/html/ttkForEach_8cpp.html) to traverse each block
  - apply a **VESPA Boolean Operation** filter to merge all these sphere into a final mesh.

As you can see, several part are missing for this clean pipeline.  
For a quick a dirty version, I have tried the alpha wrapping and generated [porous\_merged.vtp](https://send.kitware.io/download.php?id=2350&token=mUtTKppJzODzYOKiTja1zguQLTicKryB).  
I used an **Alpha** of 0.21\*\* and an **Offset** of 0.01.  
Due to how the alpha wrapping works, the result is 1% larger than the original mesh. You can try to compensate this by reducing the initial radius of each sphere by as much as you add with the alpha wrapping.  
Aslo, this result has a lot of triangle and leads to quite a heavy dataset compared to the initial file.

Hope that helps
