Cells#

The cell pyvista.Cell class is the PyVista representation of the vtkGenericCell and can be used to inspect a pyvista.DataSet’s cells, faces, and edges.

Note

While methods and classes are quite effective at inspecting and plotting parts of a dataset, they are inefficient and should be used only for interactive exploration and debugging. When working with larger datasets or working with multiple cells it is generally more efficient to use bulk methods like pyvista.DataSetFilters.extract_cells().

Here’s a quick example to demonstrate the usage of pyvista.DataSet.get_cell() by extracting a hexahedral cell from an example pyvista.UnstructuredGrid.

from pyvista import examples
mesh = examples.load_hexbeam()
cell = mesh.get_cell(0)
cell
Cell (0x7f2aa1d7e980)
  Type:        <CellType.HEXAHEDRON: 12>
  Linear:      True
  Dimension:   3
  N Points:    8
  N Faces:     6
  N Edges:     12
  X Bounds:    0.000e+00, 5.000e-01
  Y Bounds:    0.000e+00, 5.000e-01
  Z Bounds:    0.000e+00, 5.000e-01
You can then extract a single face of that cell.
Cell (0x7f2aa1ae7e80)
  Type:        <CellType.QUAD: 9>
  Linear:      True
  Dimension:   2
  N Points:    4
  N Faces:     0
  N Edges:     4
  X Bounds:    0.000e+00, 0.000e+00
  Y Bounds:    0.000e+00, 5.000e-01
  Z Bounds:    0.000e+00, 5.000e-01
Afterwards, you can extract an edge or edges from the face.
Cell (0x7f2aa1ae7b80)
  Type:        <CellType.LINE: 3>
  Linear:      True
  Dimension:   1
  N Points:    2
  N Faces:     0
  N Edges:     0
  X Bounds:    0.000e+00, 0.000e+00
  Y Bounds:    0.000e+00, 0.000e+00
  Z Bounds:    0.000e+00, 5.000e-01
Each pyvista.Cell can be individually plotted for convenience.
cell.plot(show_edges=True, line_width=3)
../../_images/cells_4_0.png

Class Definition#

pyvista.Cell(*args, **kwargs)

Wrapping of vtkCell.

pyvista.CellArray(*args, **kwargs)

PyVista wrapping of vtkCellArray.

Enumerations#

pyvista.CellStatus(*values)

Cell status bits used by cell_validator().

pyvista.CellType(*values)

Define types of cells.

See also

Linear Cells

Build one cell of each linear cell type.

cell_validator()

The filter that reports CellStatus bits.

Cell Quality#

pyvista.cell_quality_info(cell_type, ...)

Return information about a cell's quality measure.

See also

cell_quality()

Compute cell quality measures for a dataset.

Computing Mesh Quality

Compute and plot mesh quality.