mesh: renumber nodes and elements in the model, every reference following (#234)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-15 11:11:14 -04:00
1 parent b5e54cb802
commit 1a91bb324d
2 files changed
+131

No files matched your search

+7
View File
@@ -266,6 +266,13 @@ impl Classification {
pub(crate) fn forget_node(&mut self, label: u32) {
self.nodes.remove(&label);
}
/// Give tagged nodes and elements their new labels (labels `node` or `element` leaves alone
/// keep theirs; the caller checked the new labels are distinct).
pub(crate) fn relabel(&mut self, node: &dyn Fn(u32) -> u32, element: &dyn Fn(u32) -> u32) {
self.nodes = std::mem::take(&mut self.nodes).into_iter().map(|(l, t)| (node(l), t)).collect();
self.elements = std::mem::take(&mut self.elements).into_iter().map(|(l, t)| (element(l), t)).collect();
}
}
impl Model {