[Paraview] Merging Coincident Faces

Berk Geveci berk.geveci at kitware.com
Wed Jun 29 15:14:09 EDT 2011


The short answer is no. No such filter exists in ParaView or VTK.

However, this can be done efficiently (no for loops within Python) if
you have ParaView compiled with a Python that has NumPy. All official
3.10 binaries should have this.

Here is the recipe:

- Load data
- Apply programmable filter with the following to assign unique ids to cells:

output.ShallowCopy(inputs[0].VTKObject)
array = numpy.arange(0, output.GetNumberOfCells(), dtype=numpy.int32)
output.CellData.append(array, 'ids')

- Apply Cell Centers

- Apply Clean to merge duplicate cell centers

- Apply programmable filter (input 0 = reader, input 1 = Clean),
output type: unstructured grid, script:

from paraview import vtk
filter = vtk.vtkExtractSelection()
sel = vtk.vtkSelection()
selNode = vtk.vtkSelectionNode()
selNode.SetFieldType(vtk.vtkSelectionNode.CELL)
selNode.SetContentType(vtk.vtkSelectionNode.INDICES)
selNode.SetSelectionList(inputs[1].PointData['ids'].VTKObject)
selNode.GetSelectionList()
sel.AddNode(selNode)
filter.SetInput(1, sel)
filter.SetInput(0, inputs[0].VTKObject)
filter.Update()
output.ShallowCopy(filter.GetOutput())

This should produce an unstructured grid of 2D cells that are unique.
Works only in serial. In parallel, you need to reduce the polydata to
1 node using All to N.

-berk

On Wed, Jun 29, 2011 at 10:50 AM, Randall Hand <randall.hand at gmail.com> wrote:
> I'm working with an Xdmf dataset in ParaView 3.10.1 that has multiple
> unstructured-grid blocks with overlap regions, however doens't seem to
> actually have "ghost" cells.  This means when I extract an isosurface, I
> wind up with perfectly overlapping faces.
>
> I can use the Clean filter to eliminate coincident points, but but
> coincident faces.  As an example, if I use the "Select Cells Through"
> option to select 2 triangles on an overlapping border, I get 4 points
> (normal for 2 triangles) but 5 cells, with perfect overlap.  The results
> from an ASCII VTK File saved to disk:
>
> vtk output
> ASCII
> DATASET POLYDATA
> POINTS 4 float
> 1.37916 0.965356 0.21928
> 1.37129 0.964077 0.218481
> 1.37613 0.958331 0.219823
> 1.36947 0.958944 0.21948
> POLYGONS 5 20
> 3 0 1 2
> 3 2 1 3
> 3 0 1 2
> 3 2 1 3
> 3 2 1 3
>
> Is there any filter in ParaView capable of fixing this? Or does it have
> to be an arduously slow Python script to run in a Programmable Filter?
>
> --
> Randall Hand
> http://www.vizworld.com
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list