# Examples from pyvista.DataSet.max_cell_dimensionality
# =====================================================

# `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

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

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

# A `UnstructuredGrid` with 3D cells such as `SolidSphere()`
# has max and min cell dimensionality of `3`.
mesh = pv.SolidSphere()
mesh.max_cell_dimensionality
mesh.min_cell_dimensionality

# 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
mesh.min_cell_dimensionality

# A curvilinear `StructuredGrid` such as the one from
# `download_wavy()` has 2D cells.
mesh = examples.download_wavy()[0]
mesh.max_cell_dimensionality
mesh.min_cell_dimensionality

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

# The dimensionality can vary if there are mixed cell types. E.g. load
# `download_prostar()`.
mesh = examples.download_prostar()
sorted(mesh.distinct_cell_types)

# There are 3D volumetric cells, so the max dimensionality is `3`.
mesh.max_cell_dimensionality

# And since there are `VERTEX` cells its
# `min_cell_dimensionality` is `0`.
mesh.min_cell_dimensionality

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code

