pyvista.DataObjectFilters.cell_quality#
- DataObjectFilters.cell_quality(
- quality_measure: Literal['all', 'all_valid'] | _CellQualityLiteral | Sequence[_CellQualityLiteral] = 'scaled_jacobian',
- *,
- null_value: float = -1.0,
- progress_bar: bool = False,
Compute a function of (geometric) quality for each cell of a mesh.
The per-cell quality is added to the mesh’s cell data, in an array with the same name as the quality measure. Cell types not supported by this filter or undefined quality of supported cell types will have an entry of
-1
.See the Cell Quality Measures below for all measures and the
CellType
supported by each one. Defaults to computing thescaled_jacobian
quality measure.Cell Quality Measures# Measure
area
aspect_frobenius
aspect_gamma
aspect_ratio
collapse_ratio
condition
diagonal
dimension
distortion
jacobian
max_angle
max_aspect_frobenius
max_edge_ratio
med_aspect_frobenius
min_angle
oddy
radius_ratio
relative_size_squared
scaled_jacobian
shape
shape_and_size
shear
shear_and_size
skew
stretch
taper
volume
warpage
Note
Refer to the Verdict Library Reference Manual for low-level technical information about how each metric is computed.
Added in version 0.45.
- Parameters:
- quality_measure
str
| sequence[str
], default: ‘scaled_jacobian’ The cell quality measure(s) to use. May be either:
A single measure or a sequence of measures listed in Cell Quality Measures.
'all'
to compute all measures.'all_valid'
to only keep quality measures that are valid for the mesh’s cell type(s).
A separate array is created for each measure.
- null_value
float
, default: -1.0 Float value for undefined quality. Undefined quality are qualities that could be addressed by this filter but is not well defined for the particular geometry of cell in question, e.g. a volume query for a triangle. Undefined quality will always be undefined. The default value is -1.
- progress_barbool, default:
False
Display a progress bar to indicate progress.
- quality_measure
- Returns:
DataSet
|MultiBlock
Dataset with the computed mesh quality. Return type matches input. Cell data array(s) with the computed quality measure(s) are included.
See also
cell_quality_info()
Return information about a cell’s quality measure, e.g. acceptable range.
Examples
Compute and plot the minimum angle of a sample sphere mesh.
>>> import pyvista as pv >>> sphere = pv.Sphere(theta_resolution=20, phi_resolution=20) >>> cqual = sphere.cell_quality('min_angle') >>> cqual.plot(show_edges=True)
Quality measures like
'volume'
do not apply to 2D cells, and a null value of-1
is returned.>>> qual = sphere.cell_quality('volume') >>> qual.get_data_range('volume') (np.float64(-1.0), np.float64(-1.0))
Compute all valid quality measures for the sphere. These measures all return non-null values for
TRIANGLE
cells.>>> cqual = sphere.cell_quality('all_valid') >>> valid_measures = cqual.cell_data.keys() >>> valid_measures ['area', 'aspect_frobenius', 'aspect_ratio', 'condition', 'distortion', 'max_angle', 'min_angle', 'radius_ratio', 'relative_size_squared', 'scaled_jacobian', 'shape', 'shape_and_size']
See Computing Mesh Quality for more examples using this filter.