cell_id

ExplicitStructuredGrid.cell_id(coords)

Return the cell ID.

Parameters
coordstuple(int), list(tuple(int)) or numpy.ndarray

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])