pyvista.ExplicitStructuredGrid.cell_id

pyvista.ExplicitStructuredGrid.cell_id#

ExplicitStructuredGrid.cell_id(coords: ArrayLike[int]) int | NumpyArray[int] | None[source]#

Return the cell ID.

Parameters:
coordsArrayLike[int]

Cell structured coordinates.

Returns:
int | numpy.ndarray | None

Cell IDs. None if coords is outside the grid extent.

See also

pyvista.ExplicitStructuredGrid.cell_coords

Return the cell structured coordinates.

Examples

>>> from pyvista import examples
>>> grid = examples.load_explicit_structured()
>>> grid.cell_id((3, 4, 0))
np.int64(19)
>>> coords = [(3, 4, 0), (3, 2, 1), (1, 0, 2), (2, 3, 2)]
>>> grid.cell_id(coords)
array([19, 31, 41, 54])