From d4599e985671c440e27269a1fa578147bff16fab Mon Sep 17 00:00:00 2001
From: Jean-Francois Remacle <jean-francois.remacle@uclouvain.be>
Date: Thu, 13 Feb 2014 14:57:16 +0000
Subject: [PATCH] oooooooooooopsssssssss bug in delaunay 3D

---
 Mesh/meshGRegionDelaunayInsertion.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/Mesh/meshGRegionDelaunayInsertion.cpp b/Mesh/meshGRegionDelaunayInsertion.cpp
index 79cc083c8e..8c45a2ce55 100644
--- a/Mesh/meshGRegionDelaunayInsertion.cpp
+++ b/Mesh/meshGRegionDelaunayInsertion.cpp
@@ -1781,6 +1781,13 @@ bool tetOnBox (MTetrahedron *t, MVertex *box[8]){
   return false;
 }
 
+
+void sanityCheck1(MTet4 *t)
+{
+}
+
+
+
  void delaunayMeshIn3D(std::vector<MVertex*> &v, std::vector<MTetrahedron*> &result, bool removeBox)
 {
   std::vector<MTet4*> t;
@@ -1853,10 +1860,10 @@ bool tetOnBox (MTetrahedron *t, MVertex *box[8]){
     if (fabs(Vb-V) > 1.e-8 * (Vb+V))printf("%12.5E %12.5E\n",Vb,V);
     
     // reuse memory --> reinitialize MTet4s
-    for (unsigned int k=0;k<cavity.size();k++){
+    for (unsigned int k=0;k<std::min(cavity.size(),shell.size());k++){
       cavity[k]->setDeleted(false);
       for (unsigned int l=0;l<4;l++){
-	cavity[k]->setNeigh(l,0);
+    	cavity[k]->setNeigh(l,0);
       }
     }
     //    T = Cpu();
-- 
GitLab