From 69bc02a74da6ce90c475437e4e3f95d39417523f Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 17 Mar 2021 17:35:30 +0100 Subject: [PATCH 1/2] Increase bounding box for curved elements by 20% in element search tree --- libsrc/meshing/meshclass.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index 3aff354b..efa24e4a 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -4851,6 +4851,11 @@ namespace netgen for (auto pi : volelements[ei].PNums()) box.Add (points[pi]); + auto & el = volelements[ei]; + if(el.IsCurved()) + box.Increase(1.2*box.Diam()); + + elementsearchtree -> Insert (box, ei+1); } } From bcd86a18fdf741c22227c2cd556b9c8038943a32 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 17 Mar 2021 17:36:39 +0100 Subject: [PATCH 2/2] FindSurfaceElementOfPoint - use barycentric coordinates of already found volume element Increases robustness for finding curved surface elements --- libsrc/meshing/meshclass.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index efa24e4a..9ca15f76 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -5712,6 +5712,26 @@ namespace netgen if(faces[i] == 0) continue; + auto & el = VolumeElement(velement); + + if (el.GetType() == TET) + { + double lam4[4] = { vlam[0], vlam[1], vlam[2], 1.0-vlam[0]-vlam[1]-vlam[2] }; + double face_lam = lam4[i]; + if(face_lam < 1e-5) + { + // found volume point very close to a face -> use barycentric coordinates directly + lami[2] = 0.0; + auto sel = SurfaceElement(faces[i]); + + for(auto j : Range(1,3)) + for(auto k : Range(4)) + if(sel[j] == el[k]) + lami[j-1] = lam4[k]/(1.0-face_lam); + return faces[i]; + } + } + if(indices && indices->Size() != 0) { if(indices->Contains(SurfaceElement(faces[i]).GetIndex()) &&