UnstructuredGrid.polyhedron_face_offsets

UnstructuredGrid.polyhedron_face_offsets#

property UnstructuredGrid.polyhedron_face_offsets: NumpyArray[int][source]#

Return the offsets array of the polyhedron faces.

Every POLYHEDRON in the grid contributes its faces to one shared cell array. The offsets array has one value per face plus one, and stores the index into polyhedron_face_connectivity at which each face begins. The point ids of face i run from polyhedron_face_offsets[i] to polyhedron_face_offsets[i + 1] in polyhedron_face_connectivity.

The faces are shared across the whole grid, so which of them belong to which cell is recorded separately in polyhedron_face_location_offsets and polyhedron_face_location_connectivity.

A grid holding no polyhedron has no faces for VTK to store, and the array is [0].

Added in version 0.49.

Returns:
numpy.ndarray

Array of face offsets with one value per polyhedron face plus one.

Raises:
pyvista.core.errors.VTKVersionError

If VTK is older than 9.4, which stores polyhedra as a single padded face stream instead.

Notes#

This property is read-only. VTK can only replace the faces together with the cells, the cell types and the face locations, so there is no way to assign the faces alone without leaving the grid inconsistent. Build a new grid instead.

Examples#

Download Python source code | Download Jupyter notebook

>>> import pyvista as pv
>>> from pyvista import examples
>>> grid = examples.cells.Polyhedron()
>>> grid.polyhedron_face_offsets
array([ 0,  3,  6,  9, 12]...)

The single tetrahedral polyhedron has four triangular faces.

The offsets and connectivity together describe each face.

See Also#

polyhedron_face_connectivity

Point ids that define the faces.

polyhedron_face_location_offsets

Index into the face ids at which each cell begins.

polyhedron_faces

Faces in the legacy padded format.

cell_offsets

Offsets of the cells themselves, which do not describe a polyhedron.