From 955c04deaa6c6d1208bdd14c9a819e8b5f18d31b Mon Sep 17 00:00:00 2001 From: Jan Ellmenreich Date: Fri, 19 Sep 2025 14:53:30 +0200 Subject: [PATCH] [ADD] Copy identifications when extracting submesh --- libsrc/meshing/meshclass.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index 6e1faf08..3f4ac514 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -7323,7 +7323,7 @@ namespace netgen { // Copy the mesh into a new one, then delete unwanted elements // Unused points are deleted by the Compress() function at the end - auto mesh_ptr = make_unique(); + auto mesh_ptr = make_shared(); auto & mesh = *mesh_ptr; mesh = (*this); @@ -7401,6 +7401,14 @@ namespace netgen if(!keep_point[pel.pnum]) mesh.pointelements.DeleteElement(npointelements-i-1); } + + // Copy identifications to submesh. Redundant identifications are removed in Compress() + auto & ident_to = mesh.GetIdentifications(); + const auto & ident_from = this->GetIdentifications(); + for(const auto pair : ident_from.GetPairs()) + { + ident_to.Add(pair.I1(), pair.I2(), ident_from.GetName(pair.I3()), ident_from.GetType(pair.I3())); + } mesh.Compress(); return mesh_ptr;