From 4010c896aba9c4cfc666db33ec80615cfc0226db Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 14 Apr 2015 14:49:43 +0000
Subject: [PATCH] revert r21160

---
 Mesh/Generator.cpp | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index e10df280c0..daeaf2f3f9 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -255,9 +255,6 @@ static void Mesh1D(GModel *m)
     if(nIter++ > 10) break;
   }
 
-  // re-orient according to geometrical/user constraints
-  std::for_each(m->firstEdge(), m->lastEdge(), orientMeshGEdge());
-
   double t2 = Cpu();
   CTX::instance()->meshTimer[0] = t2 - t1;
   Msg::StatusBar(true, "Done meshing 1D (%g s)", CTX::instance()->meshTimer[0]);
@@ -427,10 +424,6 @@ static void Mesh2D(GModel *m)
 
   // collapseSmallEdges(*m);
 
-  // re-orient according to geometrical/user constraints
-  std::for_each(m->firstEdge(), m->lastEdge(), orientMeshGEdge());
-  std::for_each(m->firstFace(), m->lastFace(), orientMeshGFace());
-
   double t2 = GetTimeInSeconds();
   CTX::instance()->meshTimer[1] = t2 - t1;
   Msg::StatusBar(true, "Done meshing 2D (%g s)", CTX::instance()->meshTimer[1]);
@@ -572,12 +565,6 @@ static void Mesh3D(GModel *m)
   // Ensure that all volume Jacobians are positive
   m->setAllVolumesPositive();
 
-  // Ensure that all edge/surface meshes that could have been changed by the 3D
-  // algo (e.g. the Frontal), are re-oriented according to the geometrical/user
-  // constraints
-  std::for_each(m->firstEdge(), m->lastEdge(), orientMeshGEdge());
-  std::for_each(m->firstFace(), m->lastFace(), orientMeshGFace());
-
   double t2 = Cpu();
   CTX::instance()->meshTimer[2] = t2 - t1;
   Msg::StatusBar(true, "Done meshing 3D (%g s)", CTX::instance()->meshTimer[2]);
@@ -679,6 +666,13 @@ void GenerateMesh(GModel *m, int ask)
     Mesh3D(m);
   }
 
+  // Orient the line and surface meshes so that they match the orientation of
+  // the geometrical entities and/or the user orientation constraints
+  if(m->getMeshStatus() >= 1)
+    std::for_each(m->firstEdge(), m->lastEdge(), orientMeshGEdge());
+  if(m->getMeshStatus() >= 2)
+    std::for_each(m->firstFace(), m->lastFace(), orientMeshGFace());
+
   // Optimize quality of 3D tet mesh
   if(m->getMeshStatus() == 3){
     for(int i = 0; i < std::max(CTX::instance()->mesh.optimize,
-- 
GitLab