How to get the neighbour points of the current point in VTK?

Hello!

How to get the neighbour points of the current point in VTK?

I am aware of quering the Cell. which this point belongs to, and than quering the points of these cells, however, due to the existence of elements of next order, also the points which are not right next to this current point, are get this way.

I know VTK has an implicit knowledge of connectivity, but dont know how to use it

Thanks!

As far as I know, there is no concept of “point neighbors” in VTK. Instead, there are the concepts of cell-points and point-cells. The simplest implementation of point neighbors is to get the point-cells (all cells that contain that point) and then get all the points of those cells. From that, you have to get the neighbors. This is dependent on the cell topology and your definition of neighbor (sharing the same high order face, for example?). Based on these, you can create some sort of table that gives the neighbor ids for each point in a particular cell. Then you can use that table to lookup neighbors in each cell.

I found the following two tutorials to be very helpful:

https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors/

https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors/

It is useful to compare the source code – the two projects are very similar.

Also, “a picture is worth a thousand words”
image