From f603fef130912956bee7233272f99557bb3e6b32 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Fri, 13 Sep 2024 13:18:58 +0200 Subject: [PATCH] Ensure sequential/parallel consistency in generated mesh --- libsrc/meshing/improve3.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libsrc/meshing/improve3.cpp b/libsrc/meshing/improve3.cpp index 9be87229..620a650b 100644 --- a/libsrc/meshing/improve3.cpp +++ b/libsrc/meshing/improve3.cpp @@ -546,9 +546,6 @@ double MeshOptimize3d :: SplitImproveEdge (Table & elem if (!mesh.LegalTet (oldel)) bad1 += GetLegalPenalty(); if (!mesh.LegalTet (newel1)) bad2 += GetLegalPenalty(); if (!mesh.LegalTet (newel2)) bad2 += GetLegalPenalty(); - - if( newel1.Volume(mesh.Points()) < 0.0 || newel2.Volume(mesh.Points()) < 0.0) - return 0.0; } d_badness = bad2-bad1; @@ -567,9 +564,6 @@ double MeshOptimize3d :: SplitImproveEdge (Table & elem Element newel1 = oldel; Element newel2 = oldel; - oldel.Touch(); - oldel.Delete(); - newel1.Touch(); newel2.Touch(); @@ -579,6 +573,12 @@ double MeshOptimize3d :: SplitImproveEdge (Table & elem if (newel2[l] == pi1) newel2[l] = pinew; } + if( newel1.Volume(mesh.Points()) < 0.0 || newel2.Volume(mesh.Points()) < 0.0) + return 0.0; + + oldel.Touch(); + oldel.Delete(); + mesh.AddVolumeElement (newel1); mesh.AddVolumeElement (newel2); }