pyvista.ImageData.max_cell_dimensionality

pyvista.ImageData.max_cell_dimensionality#

property ImageData.max_cell_dimensionality: _Dimensionality[source]#

Return the maximum spatial dimensionality of all cells in this mesh.

Added in version 0.47.

Returns:
int

The maximum dimensionality of the dataset’s cells.

Notes

max_cell_dimensionality:

Examples

PointSet has no cells, so its max_cell_dimensionality is always 0.

>>> import pyvista as pv
>>> from pyvista import examples
>>> mesh = pv.Sphere().cast_to_pointset()
>>> mesh.max_cell_dimensionality
0

A PolyData surface mesh with 2D polygonal cells such as Sphere() has max cell dimensionality of 2.

>>> mesh = pv.Sphere()
>>> mesh.max_cell_dimensionality
2

Since there are no 1D LINE or 0D VERTEX cells, the min_cell_dimensionality is also 2 in this case.

>>> mesh.min_cell_dimensionality
2

A UnstructuredGrid with 3D cells such as SolidSphere() has max and min cell dimensionality of 3.

>>> mesh = pv.SolidSphere()
>>> mesh.max_cell_dimensionality
3
>>> mesh.min_cell_dimensionality
3

A Line() or Spline() with 1D cells has a max and min cell dimensionality of 1.

>>> mesh = pv.Line([0.0, 0.0, 0.0], [1.0, 1.0, 1.0])
>>> mesh.max_cell_dimensionality
1
>>> mesh.min_cell_dimensionality
1

A curvilinear StructuredGrid such as the one from download_wavy() has 2D cells.

>>> mesh = examples.download_wavy()[0]
>>> mesh.max_cell_dimensionality
2
>>> mesh.min_cell_dimensionality
2

But it has a spatial dimensionality of 3 since its points span three dimensions.

>>> mesh.dimensionality
3

The dimensionality can vary if there are mixed cell types. E.g. load download_prostar().

>>> mesh = examples.download_prostar()
>>> sorted(mesh.distinct_cell_types)
[<CellType.VERTEX: 1>, <CellType.LINE: 3>, <CellType.TRIANGLE: 5>, <CellType.POLYGON: 7>,
 <CellType.QUAD: 9>, <CellType.TETRA: 10>, <CellType.HEXAHEDRON: 12>, <CellType.WEDGE: 13>,
 <CellType.PYRAMID: 14>, <CellType.POLYHEDRON: 42>]

There are 3D volumetric cells, so the max dimensionality is 3.

>>> mesh.max_cell_dimensionality
3

And since there are VERTEX cells its min_cell_dimensionality is 0.

>>> mesh.min_cell_dimensionality
0