From 44be77a014604fc2079a35b3a29bd8ce57e19b02 Mon Sep 17 00:00:00 2001
From: Emilie Marchandise <emilie.marchandise@uclouvain.be>
Date: Thu, 11 Mar 2010 09:29:13 +0000
Subject: [PATCH]

---
 Geo/GFaceCompound.cpp        | 15 ++++++++-------
 Geo/GFaceCompound.h          |  2 +-
 Geo/discreteEdge.cpp         |  7 ++++---
 Mesh/meshGFace.cpp           |  2 +-
 Mesh/multiscalePartition.cpp |  2 +-
 Solver/multiscaleLaplace.cpp |  3 +++
 6 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp
index 300bba8c1d..cc843299dd 100644
--- a/Geo/GFaceCompound.cpp
+++ b/Geo/GFaceCompound.cpp
@@ -531,10 +531,11 @@ bool GFaceCompound::parametrize() const
     buildOct();
   }
 
-  if (checkAspectRatio() > AR_MAX){
-    Msg::Warning("Geometrical aspect ratio too high");
-    exit(1);
-    paramOK = false;
+  double AR = checkAspectRatio();
+  if (floor(AR)  > AR_MAX){
+    Msg::Warning("Geometrical aspect ratio too high %d ", AR);
+    //exit(1);
+    paramOK = true; //false;
   }
 
   return paramOK;
@@ -1806,9 +1807,9 @@ bool GFaceCompound::checkTopology() const
   double H = getSizeH();
   double D = H; 
   if (_interior_loops.size() > 0)    D =  getSizeBB(_U0); 
-  int AR = (int) checkAspectRatio();
-  //int AR2 = (int) ceil(H/D);
-  //int AR = std::min(AR, AR2);
+  int AR1 = (int) checkAspectRatio();
+  int AR2 = (int) ceil(H/D);
+  int AR = std::min(AR1, AR2);
 
   if (G != 0 || Nb < 1){
     correctTopo = false;
diff --git a/Geo/GFaceCompound.h b/Geo/GFaceCompound.h
index 1314e92ca8..73ce7eacf7 100644
--- a/Geo/GFaceCompound.h
+++ b/Geo/GFaceCompound.h
@@ -19,7 +19,7 @@
 #include "meshGFaceOptimize.h"
 #include "linearSystem.h"
 
-#define AR_MAX 5 //maximal geometrical spacte ratio
+#define AR_MAX 5 //maximal geometrical aspect ratio
 
 /*
 A GFaceCompound is a model face that is the compound of model faces.
diff --git a/Geo/discreteEdge.cpp b/Geo/discreteEdge.cpp
index bda5879bec..bcba5b0c13 100644
--- a/Geo/discreteEdge.cpp
+++ b/Geo/discreteEdge.cpp
@@ -296,9 +296,7 @@ void discreteEdge::parametrize( std::map<GFace*,  std::map<MVertex*, MVertex*, s
      }
    }
 
-  //computeNormals();
-
- }
+}
 
 void discreteEdge::computeNormals () const
 {
@@ -383,6 +381,9 @@ GPoint discreteEdge::point(double par) const
   }
   else{
     //curved PN triangle
+
+    if (_normals.empty() ) computeNormals();
+
     const SVector3 n1 = _normals[vB];
     const SVector3 n2 = _normals[vE];
     
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index e15e9ba386..e9fd4023b8 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1487,7 +1487,7 @@ void partitionAndRemesh(GFaceCompound *gf)
   Msg::Info("*** Mesh of surface %d done by assembly remeshed faces", gf->tag());
   Msg::Info("-----------------------------------------------------------");
  
-  gf->coherenceNormals();
+  //gf->coherenceNormals();
   gf->meshStatistics.status = GFace::DONE; 
 
   //CreateOutputFile("toto.msh", CTX::instance()->mesh.format);
diff --git a/Mesh/multiscalePartition.cpp b/Mesh/multiscalePartition.cpp
index 4767606e9e..0ea08b12a2 100644
--- a/Mesh/multiscalePartition.cpp
+++ b/Mesh/multiscalePartition.cpp
@@ -212,7 +212,7 @@ static int getAspectRatio(std::vector<MElement *> &elements,
   }
   int AR2 = (int)ceil(H/D);
   
-  return std::min(AR, AR2);
+  return std::max(AR, AR2);
 }
 
 static void getGenusAndRatio(std::vector<MElement *> &elements, int & genus, int &AR, int &NB)
diff --git a/Solver/multiscaleLaplace.cpp b/Solver/multiscaleLaplace.cpp
index a3e871fc9a..60575ca8d5 100644
--- a/Solver/multiscaleLaplace.cpp
+++ b/Solver/multiscaleLaplace.cpp
@@ -1076,6 +1076,9 @@ void multiscaleLaplace::cut (std::vector<MElement *> &elements)
 
   std::vector<MElement*> left,right;
   recur_cut_ (1.0, M_PI, 0.0, root,left,right);
+  if ( elements.size() != left.size()+right.size()) 
+    Msg::Error("Cutting laplace wrong nb elements (%d) != left + right (%d)",  elements.size(), left.size()+right.size());
+
   connected_left_right(left, right);
 
   if ( elements.size() != left.size()+right.size()) {
-- 
GitLab