pyvista.ExplicitStructuredGrid.neighbors#
- ExplicitStructuredGrid.neighbors( ) list[int] [source]#
Return the indices of neighboring cells.
- Parameters:
- ind
int
|VectorLike
[int
] Cell IDs.
- rel
str
, default: “connectivity” Defines the neighborhood relationship. If
'topological'
, returns the(i-1, j, k)
,(i+1, j, k)
,(i, j-1, k)
,(i, j+1, k)
,(i, j, k-1)
and(i, j, k+1)
cells. If'connectivity'
(default), returns only the topological neighbors considering faces connectivity. If'geometric'
, returns the cells in the(i-1, j)
,(i+1, j)
,(i,j-1)
and(i, j+1)
vertical cell groups whose faces intersect.
- ind
- Returns:
Examples
>>> import pyvista as pv >>> from pyvista import examples >>> grid = examples.load_explicit_structured() >>> cell = grid.extract_cells(31) >>> ind = grid.neighbors(31) >>> neighbors = grid.extract_cells(ind) >>> plotter = pv.Plotter() >>> _ = plotter.add_axes() >>> _ = plotter.add_mesh(cell, color='r', show_edges=True) >>> _ = plotter.add_mesh(neighbors, color='w', show_edges=True) >>> plotter.show()