pyvista.ExplicitStructuredGrid.cell_id#

ExplicitStructuredGrid.cell_id(coords: ndarray[Any, dtype[integer]] | Sequence[ndarray[Any, dtype[integer]] | Sequence[int]] | Sequence[Sequence[ndarray[Any, dtype[integer]] | Sequence[int]]]) int | ndarray | None[source]#

Return the cell ID.

Parameters:
coordsIntArray

Cell structured coordinates.

Returns:
int, numpy.ndarray, or 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))
19
>>> coords = [(3, 4, 0), (3, 2, 1), (1, 0, 2), (2, 3, 2)]
>>> grid.cell_id(coords)
array([19, 31, 41, 54])