CellArray.from_regular_cells#
- classmethod CellArray.from_regular_cells(cells: MatrixLike[int], deep: bool = False) CellArray[source]#
Construct a
CellArrayfrom cells which all have the same size.Use this method when every cell has the same number of points, e.g. an array of triangles or an array of quads. The cell offsets are computed directly from the cell size, and the input array is used as the connectivity array. Use
from_irregular_cells()instead if the cells have varying sizes.- Parameters:
- Returns:
pyvista.CellArrayConstructed
CellArray.
See also
from_irregular_cellsEquivalent method for cells with varying sizes.
regular_cellsRead the cells back as a (n_cells, cell_size) array.
Examples#
Download Python source code | Download Jupyter notebook
Create a cell array of two triangles.
>>> import pyvista as pv
>>> cells = pv.CellArray.from_regular_cells([[0, 1, 2], [1, 2, 3]])
>>> cells.n_cells
2
>>> cells.regular_cells
array([[0, 1, 2],
[1, 2, 3]]...)