From ddf33280b015b36f5bd8514b0960524f31ff95e3 Mon Sep 17 00:00:00 2001
From: Tristan Carrier Baudouin <tristan.carrier@uclouvain.be>
Date: Wed, 17 Jul 2013 19:36:49 +0000
Subject: [PATCH] Lloyd's algorithm corrections

---
 Mesh/Generator.cpp | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index 1e2410e235..f3769ba278 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -520,20 +520,21 @@ static void Mesh2D(GModel *m)
   }
 
 #if defined(HAVE_BFGS)
-  // lloyd optimization
-  if (CTX::instance()->mesh.optimizeLloyd){
+  //lloyd optimization
+  if(CTX::instance()->mesh.optimizeLloyd){
     for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){
-      if((*it)->geomType()==GEntity::CompoundSurface || (*it)->geomType()==GEntity::Plane){
-	smoothing smm(CTX::instance()->mesh.optimizeLloyd,6);
-	m->writeMSH("beforeLLoyd.msh");
-	smm.optimize_face(*it);
-	//int rec = 1;//(CTX::instance()->mesh.recombineAll ||
-        //              (*it)->meshAttributes.recombine);
-	m->writeMSH("afterLLoyd.msh");
-	//if(rec) recombineIntoQuads(*it);
-	//m->writeMSH("afterRecombine.msh");
-      }
-    }
+	  if((*it)->geomType()==GEntity::CompoundSurface || (*it)->geomType()==GEntity::Plane){
+		if((*it)->meshAttributes.method != MESH_TRANSFINITE){
+	      smoothing smm(CTX::instance()->mesh.optimizeLloyd,6);
+		  //m->writeMSH("beforeLLoyd.msh");
+		  smm.optimize_face(*it);
+		  int rec = ((CTX::instance()->mesh.recombineAll || (*it)->meshAttributes.recombine) && !CTX::instance()->mesh.recombine3DAll);
+		  //m->writeMSH("afterLLoyd.msh");
+		  if(rec) recombineIntoQuads(*it);
+		  //m->writeMSH("afterRecombine.msh");
+		}
+	  }
+	}
     /*
     for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){
       GFace *gf = *it;
-- 
GitLab