From 3c6772a6921db1dc55f79fd1de92c8de78bbcf08 Mon Sep 17 00:00:00 2001
From: Tristan Carrier Baudouin <tristan.carrier@uclouvain.be>
Date: Fri, 13 Sep 2013 08:18:32 +0000
Subject: [PATCH] avoid optimizing twice the same face

---
 Mesh/meshGFaceLloyd.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Mesh/meshGFaceLloyd.cpp b/Mesh/meshGFaceLloyd.cpp
index 8facfabae5..f803e229bd 100644
--- a/Mesh/meshGFaceLloyd.cpp
+++ b/Mesh/meshGFaceLloyd.cpp
@@ -418,6 +418,8 @@ smoothing::smoothing(int param1,int param2){
 }
 
 void smoothing::optimize_face(GFace* gf){
+  if(gf->getNumMeshElements()==0 || gf->getCompound()) return;
+	
   std::set<MVertex*> all;
 
   // get all the points of the face ...
@@ -590,6 +592,8 @@ void smoothing::optimize_face(GFace* gf){
 	
   free(initial_conditions);
   free(variables_scales);
+	
+  backgroundMesh::unset();
 }
 
 void smoothing::optimize_model(){
-- 
GitLab