UnstructuredGrid.polyhedron_face_offsets#
- property UnstructuredGrid.polyhedron_face_offsets: NumpyArray[int][source]#
Return the offsets array of the polyhedron faces.
Every
POLYHEDRONin the grid contributes its faces to one shared cell array. The offsets array has one value per face plus one, and stores the index intopolyhedron_face_connectivityat which each face begins. The point ids of faceirun frompolyhedron_face_offsets[i]topolyhedron_face_offsets[i + 1]inpolyhedron_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_offsetsandpolyhedron_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.ndarrayArray of face offsets with one value per polyhedron face plus one.
- Raises:
pyvista.core.errors.VTKVersionErrorIf 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.
>>> len(grid.polyhedron_face_offsets) - 1
4
The offsets and connectivity together describe each face.
>>> start, stop = grid.polyhedron_face_offsets[:2]
>>> grid.polyhedron_face_connectivity[start:stop]
array([0, 2, 1]...)
See Also#
polyhedron_face_connectivityPoint ids that define the faces.
polyhedron_face_location_offsetsIndex into the face ids at which each cell begins.
polyhedron_facesFaces in the legacy padded format.
cell_offsetsOffsets of the cells themselves, which do not describe a polyhedron.
Used In#
Docstring Examples