File: mesh-quality.py

package info (click to toggle)
python-pyvista 0.44.1-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 159,804 kB
  • sloc: python: 72,164; sh: 118; makefile: 68
file content (32 lines) | stat: -rw-r--r-- 910 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
.. _mesh_quality_example:

Computing Mesh Quality
~~~~~~~~~~~~~~~~~~~~~~

Leverage powerful VTK algorithms for computing mesh quality.

Here we will use the :func:`pyvista.DataSetFilters.compute_cell_quality` filter
to compute the cell qualities. For a full list of the various quality metrics
available, please refer to the documentation for that filter.
"""

from __future__ import annotations

from pyvista import examples

mesh = examples.download_cow().triangulate().decimate(0.7)

cpos = [
    (10.10963531890468, 4.61130688407898, -4.503884867626516),
    (1.2896420468715433, -0.055387528972708225, 1.1228250502811408),
    (-0.2970769821136617, 0.9100381451936025, 0.2890948650371137),
]

# %%
# Compute the cell quality. Note that there are many different quality measures
qual = mesh.compute_cell_quality(quality_measure='scaled_jacobian')
qual

# %%
qual.plot(cpos=cpos, scalars='CellQuality')