How to extract boundary cells from a vtkUnstructuredGrid of solid cells


I am trying to extract all cells that touch the free surface of a solid mesh in a vtkUnstrucuredGrid - basically to ge the first layer of cells on the bondary.

I figured I’d get all of the points on the free surface using a geomery filter and then find all of the cells that reference these points.

So Getting the points on the free surafce is easy using vtkUnstructuredGridGeometryFilter()

But I can’t find any way to find Cells that reference Points?

I’m currently thinking about creating a PointData array and assigning values to the points on the boundary and NaNs or 0’s elsewhere, then using PointDataToCellData to transfer the field to the Cells and the usinga Threshiold filter to find cells with a non NaN/0 value - these would be te boundary cells. But this seems like it’s more work than it shoyuld be?

Any ideas will be geratefully received.


I suspect that VTK must support this case via Ghost cells - but I can’t find any examples of generating ghost cells from an unstructured grid, and the documentation of the vtkDistributedDataFilter and associated classes is not so clear…