Skip to content

Commit 44e7922

Browse files
committed
Warn user when cell attributes are removed due to tri -> quad conversion
1 parent 1565b2f commit 44e7922

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

splashsurf/src/reconstruction.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{io, logging};
33
use anyhow::{Context, anyhow};
44
use clap::value_parser;
55
use indicatif::{ProgressBar, ProgressStyle};
6-
use log::{error, info};
6+
use log::{error, info, warn};
77
use rayon::prelude::*;
88
use splashsurf_lib::mesh::{AttributeData, Mesh3d, MeshAttribute, MeshWithData};
99
use splashsurf_lib::nalgebra::{Unit, Vector3};
@@ -1256,7 +1256,7 @@ pub(crate) fn reconstruction_pipeline_generic<I: Index, R: Real>(
12561256
}
12571257
}
12581258

1259-
// Remove and clamp cells outside of AABB
1259+
// Remove and clamp cells outside AABB
12601260
let mesh_with_data = if let Some(mesh_aabb) = &postprocessing.mesh_aabb {
12611261
profile!("clamp mesh to aabb");
12621262
info!("Post-processing: Clamping mesh to AABB...");
@@ -1288,6 +1288,21 @@ pub(crate) fn reconstruction_pipeline_generic<I: Index, R: Real>(
12881288
max_interior_angle,
12891289
);
12901290

1291+
let mut mesh_with_data = mesh_with_data;
1292+
// Remove any cell attributes if present (they would have to be interpolated/merged)
1293+
if !mesh_with_data.cell_attributes.is_empty() {
1294+
warn!(
1295+
"Post-processing: Cell attributes are not supported when converting triangle meshes to quad meshes. The following cell attribute(s) will be discarded: {}.",
1296+
mesh_with_data
1297+
.cell_attributes
1298+
.iter()
1299+
.map(|a| a.name.clone())
1300+
.collect::<Vec<_>>()
1301+
.join(", ")
1302+
);
1303+
}
1304+
mesh_with_data.cell_attributes.clear();
1305+
12911306
(None, Some(mesh_with_data.with_mesh(tri_quad_mesh)))
12921307
} else {
12931308
(Some(mesh_with_data), None)

0 commit comments

Comments
 (0)