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
CellTypesupported by each one. Defaults to computing thescaled_jacobianquality measure.Cell Quality Measures# Measure
areaaspect_frobeniusaspect_gammaaspect_ratiocollapse_ratioconditiondiagonaldimensiondistortionjacobianmax_anglemax_aspect_frobeniusmax_edge_ratiomed_aspect_frobeniusmin_angleoddyradius_ratiorelative_size_squaredscaled_jacobianshapeshape_and_sizeshearshear_and_sizeskewstretchtapervolumewarpageNote
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 measures 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 types.
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, for example, 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:
- output
DataSet|MultiBlock Dataset with the computed mesh quality. Return type matches input. Cell data arrays with the computed quality measures are included.
- output
Examples#
Download Python source code | Download Jupyter notebook
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 Also#
cell_quality_info()Return information about a cell’s quality measure, e.g. acceptable range.
cell_validator()validate_mesh()
Used In#
API Examples
vtk_verbosity(1 use)
Gallery Examples