diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp
index dd28bb8c79abe3d928b46dbff7a483c64b86c672..df692d1e2844cae37c627dd77b64eab05bd08cd0 100644
--- a/Geo/MElement.cpp
+++ b/Geo/MElement.cpp
@@ -249,15 +249,12 @@ double MElement::specialQuality()
 #if defined(HAVE_MESH)
   double minJ, maxJ;
   jacobianBasedQuality::minMaxJacobianDeterminant(this, minJ, maxJ);
-  if (minJ < 0 && maxJ >= 0) { // accept -inf as a answer
-    return minJ/maxJ;
-  }
-  if (minJ < 0 && maxJ < 0) {
-    return -std::numeric_limits<double>::infinity();
-  }
+  if (minJ == 0.) return 0;
+  if (minJ < 0 && maxJ >= 0) return minJ/maxJ; // accept -inf as an answer
+  if (minJ < 0 && maxJ < 0) return -std::numeric_limits<double>::infinity();
   return jacobianBasedQuality::minAnisotropyMeasure(this);
 #else
-  return 0.;
+  return 0;
 #endif
 }
 
@@ -527,6 +524,22 @@ bool MElement::setVolumePositive()
   return true;
 }
 
+int MElement::getValidity()
+{
+#if defined(HAVE_MESH)
+  double jmin, jmax;
+  jacobianBasedQuality::minMaxJacobianDeterminant(this, jmin, jmax);
+  if (jmin > .0 && jmax > .0) return 1; // valid
+  if (jmax >= .0) return 0; // invalid
+  // Here, jmin < 0 and jmax < 0. The element validity is quite indeterminate.
+  // It can be valid but with a wrong numbering of the nodes,
+  // or it can be invalid, i.e. with nodes that are incorrectly located.
+  return -1;
+#else
+  return 0;
+#endif
+}
+
 std::string MElement::getInfoString()
 {
   char tmp[256];
diff --git a/Geo/MElement.h b/Geo/MElement.h
index 21ef1d7afed945662941a07b7ab80db6f0d34c01..ae1b55eb44daf77f0eae245926cd04b94bf6a5e6 100644
--- a/Geo/MElement.h
+++ b/Geo/MElement.h
@@ -255,6 +255,12 @@ class MElement
   // volume (return false if element has zero volume)
   virtual bool setVolumePositive();
 
+  // compute the extrema of the Jacobian determinant
+  // return  1 if the element is valid,
+  //         0 if the element is invalid,
+  //        -1 if the element is reversed
+  int getValidity();
+
   // return an information string for the element
   virtual std::string getInfoString();