CellArray.from_irregular_cells#
- classmethod CellArray.from_irregular_cells(cells: MatrixLike[int]) CellArray[source]#
Construct a
CellArrayfrom cells which may have different sizes.Use this method when the cells have varying numbers of points, for example, a mix of triangles and quads. The cell offsets are computed from the length of each cell, and the connectivity array is built by concatenating the cells. Use
from_regular_cells()instead if all cells have the same size.Unlike
from_regular_cells(), this method has nodeepparameter, since building the connectivity array always makes a copy of the input.- Parameters:
- cells
Sequence[Sequence[int]] Sequence of length
n_cellswhere each item is a sequence of the point indices for that cell. The cells may have different lengths.
- cells
- Returns:
pyvista.CellArrayConstructed
CellArray.
Examples#
Download Python source code | Download Jupyter notebook
Create a cell array from a triangle and a quad.
>>> import pyvista as pv
>>> cells = pv.CellArray.from_irregular_cells([[0, 1, 2], [1, 2, 3, 4]])
>>> cells.n_cells
2
>>> cells.cell_connectivity
array([0, 1, 2, 1, 2, 3, 4]...)
>>> cells.cell_offsets
array([0, 3, 7]...)
See Also#
from_regular_cellsEquivalent method for cells which all have the same size.
cell_offsetsOffsets marking where each cell begins in the connectivity array.
Used In#
Docstring Examples
PolyData(1 use)