runmat_meshing_core/quality/
mod.rs1pub mod boundary;
2pub mod predicate;
3pub mod spatial_index;
4pub mod tolerance;
5
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9pub struct ElementQuality {
10 pub element_id: String,
11 pub scaled_jacobian: f64,
12 #[serde(default)]
13 pub exact_scaled_jacobian: f64,
14 pub aspect_ratio: f64,
15 pub volume_m3: f64,
16}
17
18#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
19pub struct AnalysisMeshQualityReport {
20 pub min_scaled_jacobian: f64,
21 #[serde(default)]
22 pub min_exact_scaled_jacobian: f64,
23 pub mean_aspect_ratio: f64,
24 pub max_aspect_ratio: f64,
25 pub inverted_element_count: usize,
26 #[serde(default)]
27 pub mean_boundary_projection_error_m: f64,
28 #[serde(default)]
29 pub max_boundary_projection_error_m: f64,
30 #[serde(default)]
31 pub elements: Vec<ElementQuality>,
32}
33
34impl Default for AnalysisMeshQualityReport {
35 fn default() -> Self {
36 Self {
37 min_scaled_jacobian: 1.0,
38 min_exact_scaled_jacobian: 1.0,
39 mean_aspect_ratio: 1.0,
40 max_aspect_ratio: 1.0,
41 inverted_element_count: 0,
42 mean_boundary_projection_error_m: 0.0,
43 max_boundary_projection_error_m: 0.0,
44 elements: Vec::new(),
45 }
46 }
47}
48
49#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
50pub struct QualityThresholds {
51 pub min_scaled_jacobian: f64,
52 pub max_aspect_ratio: f64,
53 #[serde(default = "default_max_boundary_projection_error_m")]
54 pub max_boundary_projection_error_m: f64,
55 pub allow_inverted_elements: bool,
56}
57
58impl Default for QualityThresholds {
59 fn default() -> Self {
60 Self {
61 min_scaled_jacobian: 0.15,
62 max_aspect_ratio: 20.0,
63 max_boundary_projection_error_m: default_max_boundary_projection_error_m(),
64 allow_inverted_elements: false,
65 }
66 }
67}
68
69fn default_max_boundary_projection_error_m() -> f64 {
70 1.0e-6
71}