From 9bc380b27dd861d17e5c1dd54f596e47f23e6528 Mon Sep 17 00:00:00 2001
From: Thomas Toulorge <thomas.toulorge@mines-paristech.fr>
Date: Thu, 17 Jan 2013 21:50:41 +0000
Subject: [PATCH] Uniformized definition of distortion (now only minimum scaled
 Jacobian)

---
 Fltk/statisticsWindow.cpp  | 6 ++----
 Geo/GModelVertexArrays.cpp | 6 ++----
 Mesh/Generator.cpp         | 2 +-
 Mesh/HighOrder.cpp         | 3 +--
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/Fltk/statisticsWindow.cpp b/Fltk/statisticsWindow.cpp
index a4d37393c9..f7e5fc511f 100644
--- a/Fltk/statisticsWindow.cpp
+++ b/Fltk/statisticsWindow.cpp
@@ -76,10 +76,8 @@ static void statistics_histogram_cb(Fl_Widget *w, void *data)
 	  d[e->getNum()].push_back(e->etaShapeMeasure());
 	else if(name == "Rho3D")
 	  d[e->getNum()].push_back(e->rhoShapeMeasure());
-	else{
-	  double jmin,jmax; e->scaledJacRange(jmin,jmax);
-	  d[e->getNum()].push_back(std::min(jmin,1./jmax));
-	}
+	else
+	  d[e->getNum()].push_back(e->distoShapeMeasure());
       }
     }
     name.resize(name.size() - 2);
diff --git a/Geo/GModelVertexArrays.cpp b/Geo/GModelVertexArrays.cpp
index 9b27846206..233a90bb76 100644
--- a/Geo/GModelVertexArrays.cpp
+++ b/Geo/GModelVertexArrays.cpp
@@ -99,10 +99,8 @@ bool isElementVisible(MElement *ele)
   if(!ele->getVisibility()) return false;
   if(CTX::instance()->mesh.qualitySup) {
     double q;
-    if(CTX::instance()->mesh.qualityType == 3){
-      double jmin,jmax; ele->scaledJacRange(jmin,jmax);
-      q = jmin;
-    }
+    if(CTX::instance()->mesh.qualityType == 3)
+      q = ele->distoShapeMeasure();
     else if(CTX::instance()->mesh.qualityType == 2)
       q = ele->rhoShapeMeasure();
     else if(CTX::instance()->mesh.qualityType == 1)
diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index ff5bf7c35b..a7bd69269e 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -189,7 +189,7 @@ static void GetQualityMeasure(std::vector<T*> &ele,
     rhoMin = std::min(rhoMin, r);
     rhoMax = std::max(rhoMax, r);
     double jmin,jmax; ele[i]->scaledJacRange(jmin,jmax);
-    double d = std::min(jmin,1./jmax);
+    double d = jmin;
     disto += d;
     distoMin = std::min(distoMin, d);
     distoMax = std::max(distoMax, d);
diff --git a/Mesh/HighOrder.cpp b/Mesh/HighOrder.cpp
index f4111dfe55..f2b0a738d3 100644
--- a/Mesh/HighOrder.cpp
+++ b/Mesh/HighOrder.cpp
@@ -1280,8 +1280,7 @@ static void checkHighOrderTetrahedron(const char* cc, GModel *m,
   for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); ++it){
     for(unsigned int i = 0; i < (*it)->tetrahedra.size(); i++){
       MTetrahedron *t = (*it)->tetrahedra[i];
-      double jmin,jmax; t->scaledJacRange(jmin,jmax);
-      double disto_ = jmin;
+      double disto_ = t->distoShapeMeasure();
       minJGlob = std::min(minJGlob, disto_);
       avg += disto_; count++;
       if (disto_ < 0) bad.push_back(t);
-- 
GitLab