ExplicitStructuredGrid.cell_coords#
- ExplicitStructuredGrid.cell_coords(ind: int | VectorLike[int]) MatrixLike[int] | None[source]#
Return the cell structured coordinates.
The cell structured coordinates are the
(i, j, k)index of a cell along the grid’s three structured axes, with(0, 0, 0)being the first cell. This method is the inverse ofcell_id(), mapping a flat cell ID back to its structured coordinates.- Parameters:
- ind
int|VectorLike[int] Cell IDs.
- ind
- Returns:
- output
numpy.ndarray|None Cell structured coordinates.
Noneifindis outside the grid extent.
- output
See also
pyvista.ExplicitStructuredGrid.cell_idReturn the cell ID.
Examples#
Download Python source code | Download Jupyter notebook
>>> from pyvista import examples
>>> grid = examples.load_explicit_structured()
>>> grid.cell_coords(19)
array([3, 4, 0])
>>> grid.cell_coords((19, 31, 41, 54))
array([[3, 4, 0],
[3, 2, 1],
[1, 0, 2],
[2, 3, 2]])