From 09337203c575d55904cbdff82b2650f0314205ab Mon Sep 17 00:00:00 2001
From: Thomas Toulorge <thomas.toulorge@mines-paristech.fr>
Date: Wed, 9 Apr 2014 15:36:28 +0000
Subject: [PATCH] Check & fix inverted 3D elements at the end of RefineMesh

---
 Mesh/meshRefine.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Mesh/meshRefine.cpp b/Mesh/meshRefine.cpp
index 37d4f8295a..2654ffc2a1 100644
--- a/Mesh/meshRefine.cpp
+++ b/Mesh/meshRefine.cpp
@@ -388,6 +388,9 @@ void RefineMesh(GModel *m, bool linear, bool splitIntoQuads, bool splitIntoHexas
   for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); ++it)
     Subdivide(*it, splitIntoHexas, faceVertices);
 
+  // Check all 3D elements for negative volume and reverse if needed
+  m->setAllVolumesPositive();
+
   double t2 = Cpu();
   Msg::StatusBar(true, "Done refining mesh (%g s)", t2 - t1);
 }
-- 
GitLab