get all cells using a certain point id

In Paraview, is there a way to get a list of all cells which use a certain point id? To extend this, given a list of multiple point ids, I would like to get all cells which use any of these points.


Through the UI, you could open up a SpreadSheet view, switch the Attribute you are viewing to “Cell Data”, then click the “Toggle cell connectivity visibility”. This will show you the point IDs used by cells split up into columns corresponding to the point ID within the cell, e.g., triangles will have three columns, one for each point defining the triangle. You can sort by these columns to find the ID of interest, then note the cell ID in the “Cell ID” column that contains the point index of interest. That’s a lot of work and a fairly manual process.

If that is too manual, you can use add a Programmable Filter with a script like the following to create a field data with the cell point IDs:

ptId = 3
cellIdList = vtk.vtkIdList() 
self.GetInput().GetPointCells(ptId, cellIdList)
idArray = vtk.vtkIdTypeArray()
for i in range(cellIdList.GetNumberOfIds()):
  idArray.SetValue(i, cellIdList.GetId(i))

The extension to all cells which use any of a set of input points shouldn’t be too hard - just iterate with some of the above code and keep a set of unique cell IDs that you put into the field data array.

Thanks! That’s useful.


While currently not exposed in the UI, it should be easy to add support for “Find Data” to find cells containing chosen points. We can add that if you think that’d be useful.

In a way, this functionality sounds somewhat familiar to the Grow functionality for selection. What about just having the cell ids shown and doing a grow operation? That will be somewhat similar.

Maybe a new functionality where grow for a point selection would also include cells? Maybe that breaks the selection rules though.

Thanks for the suggestions. For more context, we have developers of a simulation code that want to debug the mesh. They will get an error message from the code about a point or group of points, and they want to see the cells which use those points. But it’s the simulation code’s point id, not Paraview’s point id, so another step of indirection. That may be too complicated for “Find Data”, though that would make my life easier.

Perhaps in “Find Data”, if you had points selected through a query, there would be a button for “Select Cells which use these Points”, and vice-versa.

Currently, I’m taking Cory’s suggestion and writing a programmable filter that can be loaded as a plugin filter in Paraview. I’m not sure if this will be enough, or they would like something more convenient. We can revisit later if something more is needed.

If anyone is interested, here is the script I came up with. It will create a filter that lets you list one or more point ids, then take any cell using those points, and extracts those cells into a new grid. (4.7 KB)

1 Like