forked from 1b-agent/fieldcraft-upstream
Model: remove one body's mesh, and list the sets that named its labels
Model::remove_body_mesh drops the elements that fill a body and the nodes no other element uses, with their tags; Model::sets_using names the sets that listed any of them by label. The base of per-body remeshing (#267). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
0bbdd463ea
commit
ed2541170a
3 files changed
+96
-2
No files matched your search
@@ -112,6 +112,22 @@ impl Model {
|
||||
replace_existing(&mut self.sets, "set", name, set)
|
||||
}
|
||||
|
||||
/// The sets that list, by label, a node or an element of `removed` (after a remesh they
|
||||
/// name labels that are gone or now mean other mesh entities; sets by geometry re-resolve).
|
||||
pub fn sets_using(&self, removed: &crate::BodyMesh) -> Vec<String> {
|
||||
let element = |e: &u32| removed.elements.contains(e);
|
||||
self.sets
|
||||
.iter()
|
||||
.filter(|(_, s)| {
|
||||
s.nodes.iter().any(|n| removed.nodes.contains(n))
|
||||
|| s.elements.iter().any(element)
|
||||
|| s.faces.iter().any(|f| element(&f.element))
|
||||
|| s.edges.iter().any(|e| element(&e.element))
|
||||
})
|
||||
.map(|(name, _)| name.clone())
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn remove_set(&mut self, name: &str) -> Result<()> {
|
||||
not_in_use("set", name, self.set_users(name))?;
|
||||
remove_existing(&mut self.sets, "set", name).map(|_| ())
|
||||
|
||||
Reference in new issue
Block a user