From e8a848e12e95134ac82ad1930f08de5bb28bfd18 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 23 Nov 2016 11:33:22 +0000
Subject: [PATCH] better check for MAX_LC

---
 Mesh/BackgroundMeshTools.cpp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/Mesh/BackgroundMeshTools.cpp b/Mesh/BackgroundMeshTools.cpp
index 4795e374f0..bbb080625d 100644
--- a/Mesh/BackgroundMeshTools.cpp
+++ b/Mesh/BackgroundMeshTools.cpp
@@ -193,14 +193,17 @@ static double LC_MVertex_PNTS(GEntity *ge, double U, double V)
       GVertex *v1 = ged->getBeginVertex();
       GVertex *v2 = ged->getEndVertex();
       if (v1 && v2){
+        double lc1 = v1->prescribedMeshSizeAtVertex();
+        double lc2 = v2->prescribedMeshSizeAtVertex();
+        if (lc1 >= MAX_LC && lc2 >= MAX_LC){
+          // FIXME we might want to remove this to make all lc treatment consistent
+          return CTX::instance()->lc / 10.;
+        }
+        else{
         Range<double> range = ged->parBounds(0);
         double a = (U - range.low()) / (range.high() - range.low());
-        double lc = (1 - a) * v1->prescribedMeshSizeAtVertex() +
-          (a) * v2->prescribedMeshSizeAtVertex() ;
-
-        // FIXME we might want to remove this to make all lc treatment consistent
-        if(lc >= MAX_LC) return CTX::instance()->lc / 10.;
-        return lc;
+          return (1 - a) * lc1 + (a)* lc2;
+      }
       }
       else
         return MAX_LC;
-- 
GitLab