From 44d20c00b75d1b3ba25e937bd8dcd953da39c505 Mon Sep 17 00:00:00 2001
From: Emilie Marchandise <emilie.marchandise@uclouvain.be>
Date: Thu, 22 Dec 2011 16:34:07 +0000
Subject: [PATCH] Corrected meshMetric

---
 Geo/GModel.cpp      | 4 ++--
 Mesh/meshMetric.cpp | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index db5456a403..97175ff748 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -588,8 +588,7 @@ int GModel::adaptMesh(int technique, simpleFunction<double> *f, std::vector<doub
 	}
       }
 
-      nbElems = elements.size();
-      if (nbElems == 0)return -1;
+      if (elements.size() == 0)return -1;
  
       fields->reset();
       int id = fields->newId();
@@ -614,6 +613,7 @@ int GModel::adaptMesh(int technique, simpleFunction<double> *f, std::vector<doub
 	}
       }
      
+      nbElems = getNumMeshElements();
       if (++ITER >= niter) break;
       if (fabs((double)(nbElems - nbElemsOld)) < 0.01 * nbElemsOld) break;
 
diff --git a/Mesh/meshMetric.cpp b/Mesh/meshMetric.cpp
index ac01697be3..79c0e52a47 100644
--- a/Mesh/meshMetric.cpp
+++ b/Mesh/meshMetric.cpp
@@ -286,8 +286,7 @@ void meshMetric::computeMetric(){
       lambda3 = (_dim == 3)? S(2) : 1.; 
    //}
 
-    if (_technique == meshMetric::HESSIAN || (dist < _E && _technique == meshMetric::LEVELSET) 
-	|| (dist < _E && _technique == meshMetric::FREY)){
+    if (_technique == meshMetric::HESSIAN || (dist < _E && _technique == meshMetric::FREY)){
       lambda1 = std::min(std::max(fabs(S(0))/_epsilon,1./(hmax*hmax)),1./(hmin*hmin));
       lambda2 = std::min(std::max(fabs(S(1))/_epsilon,1./(hmax*hmax)),1./(hmin*hmin));
       lambda3 = (_dim == 3) ? std::min(std::max(fabs(S(2))/_epsilon,1./(hmax*hmax)),1./(hmin*hmin)) : 1.;
-- 
GitLab