From 9e5cdce08a6c43af93e1c6539afd07b9497c3d17 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 17 Mar 2016 19:20:28 +0000
Subject: [PATCH] tests

---
 Common/CommandLine.cpp               |  4 +-
 Mesh/delaunay3d.cpp                  | 80 ++++++++++++++--------------
 Mesh/meshGRegion.cpp                 | 54 +++++++++++--------
 Mesh/meshGRegionBoundaryRecovery.cpp | 63 ++++++++++++----------
 4 files changed, 111 insertions(+), 90 deletions(-)

diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 146b595b8b..e943375b40 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -837,7 +837,9 @@ void GetOptions(int argc, char *argv[])
             CTX::instance()->mesh.algo2d = ALGO_2D_FRONTAL;
           else if(!strncmp(argv[i], "bamg",4))
             CTX::instance()->mesh.algo2d = ALGO_2D_BAMG;
-          else if(!strncmp(argv[i], "del3d", 5) || !strncmp(argv[i], "tetgen", 6))
+          else if(!strncmp(argv[i], "del3d", 5))
+            CTX::instance()->mesh.algo3d = ALGO_3D_DELAUNAY_NEW;
+          else if(!strncmp(argv[i], "tetgen", 6))
             CTX::instance()->mesh.algo3d = ALGO_3D_DELAUNAY;
           else if(!strncmp(argv[i], "front3d", 7) || !strncmp(argv[i], "netgen", 6))
             CTX::instance()->mesh.algo3d = ALGO_3D_FRONTAL;
diff --git a/Mesh/delaunay3d.cpp b/Mesh/delaunay3d.cpp
index a50ea7076d..a009f20dec 100644
--- a/Mesh/delaunay3d.cpp
+++ b/Mesh/delaunay3d.cpp
@@ -324,7 +324,7 @@ void computeAdjacencies (Tet *t, int iFace, connContainer &faceToTet){
 /***********************************************************************
   Local mesh modifications
 
-  edgeSwap , faceSwap , 
+  edgeSwap , faceSwap ,
 
 ************************************************************************/
 
@@ -355,9 +355,9 @@ static void computeNeighboringTetsOfACavity(const std::vector<Tet*> &cavity,
   }
 }
 
-static bool buildEdgeCavity(Tet *t, int iLocalEdge, 
+static bool buildEdgeCavity(Tet *t, int iLocalEdge,
 			    Vertex **v1, Vertex **v2,
-			    std::vector<Tet*> &cavity, 
+			    std::vector<Tet*> &cavity,
 			    std::vector<Tet*> &outside,
 			    std::vector<Vertex*> &ring)
 {
@@ -366,7 +366,7 @@ static bool buildEdgeCavity(Tet *t, int iLocalEdge,
 
   *v1 = t->V[edges[iLocalEdge][0]];
   *v2 = t->V[edges[iLocalEdge][1]];
-  
+
   // the 5 - i th edge contains the other 2 points of the tet
   Vertex *lastinring = t->V[edges[5 - iLocalEdge][0]];
   ring.push_back(lastinring);
@@ -443,12 +443,12 @@ bool edgeSwap(Tet *tet, int iLocalEdge,  tetContainer &T, int myThread)
     Vertex *vx2 = cavity[i]->V[2];
     Vertex *vx3 = cavity[i]->V[3];
     double volume = robustPredicates::orient3d((double*)vx0, (double*)vx1, (double*)vx2, (double*)vx3);
-    const double a  = 
+    const double a  =
       SQR (vx0->x() - vx1->x()) + SQR (vx0->y() - vx1->y()) + SQR (vx0->z() - vx1->z()) +
-      SQR (vx0->x() - vx2->x()) + SQR (vx0->y() - vx2->y()) + SQR (vx0->z() - vx2->z()) + 
-      SQR (vx0->x() - vx3->x()) + SQR (vx0->y() - vx3->y()) + SQR (vx0->z() - vx3->z()) + 
-      SQR (vx1->x() - vx2->x()) + SQR (vx1->y() - vx2->y()) + SQR (vx1->z() - vx2->z()) + 
-      SQR (vx1->x() - vx3->x()) + SQR (vx1->y() - vx3->y()) + SQR (vx1->z() - vx3->z()) + 
+      SQR (vx0->x() - vx2->x()) + SQR (vx0->y() - vx2->y()) + SQR (vx0->z() - vx2->z()) +
+      SQR (vx0->x() - vx3->x()) + SQR (vx0->y() - vx3->y()) + SQR (vx0->z() - vx3->z()) +
+      SQR (vx1->x() - vx2->x()) + SQR (vx1->y() - vx2->y()) + SQR (vx1->z() - vx2->z()) +
+      SQR (vx1->x() - vx3->x()) + SQR (vx1->y() - vx3->y()) + SQR (vx1->z() - vx3->z()) +
       SQR (vx2->x() - vx3->x()) + SQR (vx2->y() - vx3->y()) + SQR (vx2->z() - vx3->z()) ;
     tetQualityRef = std::min(tetQualityRef, volume / a);
   }
@@ -462,16 +462,16 @@ bool edgeSwap(Tet *tet, int iLocalEdge,  tetContainer &T, int myThread)
     int p3 = sp.triangles[i][2];
     const double volume1 = robustPredicates::orient3d((double*)ring[p1], (double*)ring[p2], (double*)ring[p3], (double*) v1);
     const double volume2 = robustPredicates::orient3d((double*)ring[p1], (double*)ring[p2], (double*)ring[p3], (double*) v2);
-    const double a12 = SQR (ring[p1]->x() - ring[p2]->x())+SQR (ring[p1]->y() - ring[p2]->y())+SQR (ring[p1]->z() - ring[p2]->z()); 
-    const double a13 = SQR (ring[p1]->x() - ring[p3]->x())+SQR (ring[p1]->y() - ring[p3]->y())+SQR (ring[p1]->z() - ring[p3]->z()); 
-    const double a23 = SQR (ring[p2]->x() - ring[p3]->x())+SQR (ring[p2]->y() - ring[p3]->y())+SQR (ring[p2]->z() - ring[p3]->z()); 
-    const double a123 = a12 + a13 + a23; 
-    const double v11 = SQR (ring[p1]->x() - v1->x())+SQR (ring[p1]->y() - v1->y())+SQR (ring[p1]->z() - v1->z()); 
-    const double v12 = SQR (ring[p2]->x() - v1->x())+SQR (ring[p2]->y() - v1->y())+SQR (ring[p2]->z() - v1->z()); 
-    const double v13 = SQR (ring[p3]->x() - v1->x())+SQR (ring[p3]->y() - v1->y())+SQR (ring[p3]->z() - v1->z()); 
-    const double v21 = SQR (ring[p1]->x() - v2->x())+SQR (ring[p1]->y() - v2->y())+SQR (ring[p1]->z() - v2->z()); 
-    const double v22 = SQR (ring[p2]->x() - v2->x())+SQR (ring[p2]->y() - v2->y())+SQR (ring[p2]->z() - v2->z()); 
-    const double v23 = SQR (ring[p3]->x() - v2->x())+SQR (ring[p3]->y() - v2->y())+SQR (ring[p3]->z() - v2->z()); 
+    const double a12 = SQR (ring[p1]->x() - ring[p2]->x())+SQR (ring[p1]->y() - ring[p2]->y())+SQR (ring[p1]->z() - ring[p2]->z());
+    const double a13 = SQR (ring[p1]->x() - ring[p3]->x())+SQR (ring[p1]->y() - ring[p3]->y())+SQR (ring[p1]->z() - ring[p3]->z());
+    const double a23 = SQR (ring[p2]->x() - ring[p3]->x())+SQR (ring[p2]->y() - ring[p3]->y())+SQR (ring[p2]->z() - ring[p3]->z());
+    const double a123 = a12 + a13 + a23;
+    const double v11 = SQR (ring[p1]->x() - v1->x())+SQR (ring[p1]->y() - v1->y())+SQR (ring[p1]->z() - v1->z());
+    const double v12 = SQR (ring[p2]->x() - v1->x())+SQR (ring[p2]->y() - v1->y())+SQR (ring[p2]->z() - v1->z());
+    const double v13 = SQR (ring[p3]->x() - v1->x())+SQR (ring[p3]->y() - v1->y())+SQR (ring[p3]->z() - v1->z());
+    const double v21 = SQR (ring[p1]->x() - v2->x())+SQR (ring[p1]->y() - v2->y())+SQR (ring[p1]->z() - v2->z());
+    const double v22 = SQR (ring[p2]->x() - v2->x())+SQR (ring[p2]->y() - v2->y())+SQR (ring[p2]->z() - v2->z());
+    const double v23 = SQR (ring[p3]->x() - v2->x())+SQR (ring[p3]->y() - v2->y())+SQR (ring[p3]->z() - v2->z());
     tetQuality1[i] = volume1 / (a123 + v11 + v12 + v13);
     tetQuality2[i] = volume2 / (a123 + v21 + v22 + v23);
   }
@@ -499,7 +499,7 @@ bool edgeSwap(Tet *tet, int iLocalEdge,  tetContainer &T, int myThread)
   }
 
   if (best <= tetQualityRef) return false;
-  
+
   unsigned int counter = 0;
   for (int j = 0; j < sp.nbr_triangles_2; j++){
     int iT = sp.trianguls[iBest][j];
@@ -524,17 +524,17 @@ bool edgeSwap(Tet *tet, int iLocalEdge,  tetContainer &T, int myThread)
   }
 
   for(unsigned int i = counter; i < cavity.size(); i++) cavity[i]->V[0] = NULL;
-  
+
   connContainer ctnr;
-  for(unsigned int i = 0; i < outside.size(); i++) 
+  for(unsigned int i = 0; i < outside.size(); i++)
     for (int j=0;j<4;j++)
-      computeAdjacencies (outside[i],j,ctnr);      
-  
+      computeAdjacencies (outside[i],j,ctnr);
+
   return true;
 }
 
 static void edgeSwapPass (tetContainer &T) {
-  
+
 }
 
 
@@ -601,14 +601,14 @@ static void buildDelaunayBall (cavityContainer &cavity, connContainer &faceToTet
 
 static bool updateCavity(Tet *containsV,
 			 cavityContainer &cavity,
-			 connContainer &bndK, 
+			 connContainer &bndK,
 			 int myThread, int K){
   bndK.clear();
   cavityContainer cc;
   cc.push_back(containsV);
   std::stack<Tet*> _stack;
   _stack.push(containsV);
-  
+
   while (!_stack.empty()){
     Tet *t = _stack.top();
     _stack.pop();
@@ -636,7 +636,7 @@ static bool updateCavity(Tet *containsV,
 
 static bool removeIsolatedTets(Tet *containsV,
 			       cavityContainer &cavity,
-			       connContainer &bndK, 
+			       connContainer &bndK,
 			       int myThread, int K){
   cavityContainer cc;
   cc.push_back(containsV);
@@ -648,7 +648,7 @@ static bool removeIsolatedTets(Tet *containsV,
     _stack.pop();
     for (int i=0;i<4;i++){
       Tet *neigh = t->T[i];
-      if (neigh && 
+      if (neigh &&
 	  (std::find(cc.begin(),cc.end(),neigh) == cc.end()) &&
 	  (std::find(cavity.begin(),cavity.end(),neigh) != cavity.end())){
 	cc.push_back(neigh);
@@ -670,7 +670,7 @@ static Tet *tetInsideCavityWithFAce (Face &f, cavityContainer &cavity){
       if (t->getFace(iFace) == f) {
 	return t;
       }
-    }  
+    }
   }
   return NULL;
 }
@@ -682,8 +682,8 @@ static bool fixDelaunayCavity (double threshold,
 			       connContainer &bndK,
 			       int myThread, int K,
 			       std::vector<unsigned int> & _negatives){
-  
-  starShapeness (v, bndK, _negatives, threshold);  
+
+  starShapeness (v, bndK, _negatives, threshold);
 
   if (_negatives.empty())return false;
 
@@ -693,7 +693,7 @@ static bool fixDelaunayCavity (double threshold,
 
   Msg::Debug("Fixing cavity (%3ld,%3ld) : %ld negatives",
 	     cavity.size(),bndK.size(), _negatives.size());
-  
+
   Tet *containsV = tetContainsV (v,cavity);
 
   if (! containsV) return true;
@@ -712,7 +712,7 @@ static bool fixDelaunayCavity (double threshold,
     }
     removeIsolatedTets(containsV, cavity,bndK,myThread,K);
     buildDelaunayBall (cavity,bndK);
-    starShapeness (v, bndK, _negatives, threshold);  
+    starShapeness (v, bndK, _negatives, threshold);
   }
   return false;
 }
@@ -868,7 +868,7 @@ bool canWeProcessCavity (cavityContainer &cavity, unsigned int myThread, unsigne
 
 bool checkLocalDelaunayness(Tet* t){
   if (t->V[0]){
-    for (int i=0;i<4;i++){    
+    for (int i=0;i<4;i++){
       Tet *n = t->T[i];
       if (n && n->inSphere(t->getOppositeVertex(i),0))return false;
     }
@@ -896,11 +896,11 @@ static Tet* randomTet (int thread,  tetContainer &allocator ){
 
 
 //#define _VERBOSE 1
-void delaunayTrgl (const unsigned int numThreads, 
-		   const unsigned int NPTS_AT_ONCE, 
-		   unsigned int Npts, 
+void delaunayTrgl (const unsigned int numThreads,
+		   const unsigned int NPTS_AT_ONCE,
+		   unsigned int Npts,
 		   std::vector<Vertex*> assignTo[],
-		   tetContainer &allocator, 
+		   tetContainer &allocator,
 		   double threshold){
 #ifdef _VERBOSE
   double totSearchGlob=0;
@@ -938,7 +938,7 @@ void delaunayTrgl (const unsigned int numThreads,
     connContainer faceToTet;
     std::vector<Tet*> Choice(NPTS_AT_ONCE);
     for (unsigned int K=0;K<NPTS_AT_ONCE;K++)Choice[K] = randomTet (myThread, allocator);
-    
+
 
     invalidCavities [myThread] = 0;
     unsigned int locSize=0;
diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp
index c8e0758cc7..a57c1bdb5b 100644
--- a/Mesh/meshGRegion.cpp
+++ b/Mesh/meshGRegion.cpp
@@ -144,7 +144,8 @@ void getBoundingInfoAndSplitQuads(GRegion *gr,
   for (unsigned int i=0;i<gr->getNumMeshElements();i++){
     MElement *e = gr->getMeshElement(i);
     for (int j = 0; j < e->getNumFaces(); j++){
-      std::map<MFace, GEntity*, Less_Face>::iterator it = allBoundingFaces_temp.find(e->getFace(j));
+      std::map<MFace, GEntity*, Less_Face>::iterator it =
+        allBoundingFaces_temp.find(e->getFace(j));
       if (it == allBoundingFaces_temp.end()) allBoundingFaces_temp[e->getFace(j)] = gr;
       else allBoundingFaces_temp.erase(it);
     }
@@ -160,9 +161,10 @@ void getBoundingInfoAndSplitQuads(GRegion *gr,
       MVertex *v1 = f.getVertex(1);
       MVertex *v2 = f.getVertex(2);
       MVertex *v3 = f.getVertex(3);
-      MVertex *newv = new MVertex ((v0->x() + v1->x() + v2->x() + v3->x())*0.25,
-				   (v0->y() + v1->y() + v2->y() + v3->y())*0.25,
-				   (v0->z() + v1->z() + v2->z() + v3->z())*0.25,itx->second);
+      MVertex *newv = new MVertex((v0->x() + v1->x() + v2->x() + v3->x())*0.25,
+                                  (v0->y() + v1->y() + v2->y() + v3->y())*0.25,
+                                  (v0->z() + v1->z() + v2->z() + v3->z())*0.25,
+                                  itx->second);
       sqr.add(f,newv,itx->second);
       sqr._invmap[f] = newv;
       allBoundingFaces[MFace(v0,v1,newv)] = itx->second;
@@ -519,7 +521,7 @@ void MeshDelaunayVolumeTetgen(std::vector<GRegion*> &regions)
   }
 
 
-   // sort triangles in all model faces in order to be able to search in vectors
+  // sort triangles in all model faces in order to be able to search in vectors
   std::list<GFace*>::iterator itf =  allFaces.begin();
   while(itf != allFaces.end()){
     compareMTriangleLexicographic cmp;
@@ -539,15 +541,16 @@ void MeshDelaunayVolumeTetgen(std::vector<GRegion*> &regions)
     refineMeshMMG(gr);
   }
   else{
-      int nbvertices_filler = (old_algo_hexa()) ? Filler::get_nbr_new_vertices() : Filler3D::get_nbr_new_vertices();
-      if(!nbvertices_filler && !LpSmoother::get_nbr_interior_vertices()){
-        insertVerticesInRegion(gr,2000000000,true);
-      }
+    int nbvertices_filler = (old_algo_hexa()) ?
+      Filler::get_nbr_new_vertices() : Filler3D::get_nbr_new_vertices();
+    if(!nbvertices_filler && !LpSmoother::get_nbr_interior_vertices()){
+      insertVerticesInRegion(gr,2000000000,true);
     }
+  }
 
- if (sqr.buildPyramids (gr->model())){
-   RelocateVertices (regions);
- }
+  if (sqr.buildPyramids (gr->model())){
+    RelocateVertices (regions);
+  }
 }
 
 #else
@@ -580,7 +583,12 @@ static void MeshDelaunayVolumeNewCode(std::vector<GRegion*> &regions)
     meshGRegionBoundaryRecovery(gr);
   }
   catch(int err){
-    Msg::Error("Could not recover boundary: error %d", err);
+    if(err == 3){
+      Msg::Warning("Self-intersecting surface mesh: TODO!");
+    }
+    else{
+      Msg::Error("Could not recover boundary: error %d", err);
+    }
   }
 
   // sort triangles in all model faces in order to be able to search in vectors
@@ -594,19 +602,23 @@ static void MeshDelaunayVolumeNewCode(std::vector<GRegion*> &regions)
   // restore the initial set of faces
   gr->set(faces);
 
-  void edgeBasedRefinement (const int numThreads,
-			    const int nptsatonce,
-			    GRegion *gr);
+  // now do insertion of points
+#if 0
+  insertVerticesInRegion(gr, 2000000000, true);
+#else
+  void edgeBasedRefinement(const int numThreads,
+                           const int nptsatonce,
+                           GRegion *gr);
   // just to remove tets that are not to be meshed
-  insertVerticesInRegion(gr,0);
+  insertVerticesInRegion(gr, 0);
   for(unsigned int i = 0; i < regions.size(); i++){
     Msg::Info("Refining volume %d",regions[i]->tag());
-    edgeBasedRefinement (1,1,regions[i]);
+    edgeBasedRefinement(1, 1, regions[i]);
   }
-  //  RelocateVertices (regions,-1);
+  // RelocateVertices (regions,-1);
+#endif
 }
 
-
 void MeshDelaunayVolume(std::vector<GRegion*> &regions)
 {
   if(regions.empty()) return;
@@ -726,7 +738,7 @@ void TransferVolumeMesh(GRegion *gr, Ng_Mesh *ngmesh,
   for(int i = nbpts; i < nbv; i++){
     double tmp[3];
     Ng_GetPoint(ngmesh, i + 1, tmp);
-    MVertex *v = new MVertex (tmp[0], tmp[1], tmp[2], gr);
+    MVertex *v = new MVertex(tmp[0], tmp[1], tmp[2], gr);
     numberedV.push_back(v);
     gr->mesh_vertices.push_back(v);
   }
diff --git a/Mesh/meshGRegionBoundaryRecovery.cpp b/Mesh/meshGRegionBoundaryRecovery.cpp
index da4c9df363..80b92b18ba 100644
--- a/Mesh/meshGRegionBoundaryRecovery.cpp
+++ b/Mesh/meshGRegionBoundaryRecovery.cpp
@@ -105,7 +105,7 @@ bool tetgenmesh::reconstructmesh(void *p)
     std::list<GFace*> f = _gr->faces();
     for (std::list<GFace*>::iterator it = f.begin(); it != f.end(); ++it) {
       GFace *gf = *it;
-      for (unsigned int i = 0;i< gf->triangles.size(); i++){
+      for (unsigned int i = 0; i < gf->triangles.size(); i++){
         all.insert(gf->triangles[i]->getVertex(0));
         all.insert(gf->triangles[i]->getVertex(1));
         all.insert(gf->triangles[i]->getVertex(2));
@@ -212,7 +212,8 @@ bool tetgenmesh::reconstructmesh(void *p)
       if (ori > 0.0) {
 	// Swap the first two vertices.
 	q[0] = p[0]; p[0] = p[1]; p[1] = q[0];
-      } else if (ori == 0.0) {
+      }
+      else if (ori == 0.0) {
 	if (!b->quiet) {
 	  printf("Warning:  Tet #%d is degenerate.\n", i + in->firstnumber);
 	}
@@ -405,7 +406,7 @@ bool tetgenmesh::reconstructmesh(void *p)
 	for (j = 0; j < 2; j++) {
 	  p[j] = idx2verlist[ge->lines[i]->getVertex(j)->getIndex()];
 	  setpointtype(p[j], RIDGEVERTEX);
-      }
+        }
 	if (p[0] == p[1]) {
 	  // This is a potential problem in surface mesh.
 	  continue; // Skip this edge.
@@ -419,7 +420,8 @@ bool tetgenmesh::reconstructmesh(void *p)
 	  if (checkpt == p[1]) {
 	    searchsh = shperverlist[j];
 	    break; // Found.
-	  } else {
+	  }
+          else {
 	    checkpt = sapex(shperverlist[j]);
 	    if (checkpt == p[1]) {
 	      senext2(shperverlist[j], searchsh);
@@ -431,20 +433,22 @@ bool tetgenmesh::reconstructmesh(void *p)
 	if (searchsh.sh != NULL) {
 	  // Check if this edge is already a segment of the mesh.
 	  sspivot(searchsh, checkseg);
-        if (checkseg.sh != NULL) {
-          // This segment already exist.
-          newseg = checkseg;
-        } else {
-          // Create a new segment at this edge.
-          makeshellface(subsegs, &newseg);
-          setshvertices(newseg, p[0], p[1], NULL);
-          ssbond(searchsh, newseg);
-          spivot(searchsh, neighsh);
-          if (neighsh.sh != NULL) {
-            ssbond(neighsh, newseg);
+          if (checkseg.sh != NULL) {
+            // This segment already exist.
+            newseg = checkseg;
           }
-        }
-	} else {
+          else {
+            // Create a new segment at this edge.
+            makeshellface(subsegs, &newseg);
+            setshvertices(newseg, p[0], p[1], NULL);
+            ssbond(searchsh, newseg);
+            spivot(searchsh, neighsh);
+            if (neighsh.sh != NULL) {
+              ssbond(neighsh, newseg);
+            }
+          }
+	}
+        else {
 	  // It is a dangling segment (not belong to any facets).
 	  // Check if segment [p[0],p[1]] already exists.
 	  // TODO: Change the brute-force search. Slow!
@@ -473,8 +477,8 @@ bool tetgenmesh::reconstructmesh(void *p)
     delete [] shperverlist;
     delete [] idx2shlist;
 
-      Msg::Debug("  %ld (%ld) subfaces (segments).", subfaces->items,
-	     subsegs->items);
+    Msg::Debug("  %ld (%ld) subfaces (segments).", subfaces->items,
+               subsegs->items);
 
     // The total number of iunput segments.
     insegments = subsegs->items;
@@ -612,7 +616,7 @@ bool tetgenmesh::reconstructmesh(void *p)
           }
           if (ge != NULL) {
             MEdgeVertex *v = new MEdgeVertex(pointloop[0], pointloop[1],
-                                         pointloop[2], ge, 0);
+                                             pointloop[2], ge, 0);
             double uu = 0;
             if (reparamMeshVertexOnEdge(v, ge, uu)) {
               v->setParameter(0, uu);
@@ -635,7 +639,7 @@ bool tetgenmesh::reconstructmesh(void *p)
               }
               if (gf != NULL) {
                 MFaceVertex *v = new MFaceVertex(pointloop[0], pointloop[1],
-                                       pointloop[2], gf, 0, 0);
+                                                 pointloop[2], gf, 0, 0);
                 SPoint2 param;
                 if (reparamMeshVertexOnFace(v, gf, param)) {
                   v->setParameter(0, param.x());
@@ -661,7 +665,8 @@ bool tetgenmesh::reconstructmesh(void *p)
             _gr->mesh_vertices.push_back(v);
             _vertices.push_back(v);
           }
-        } else if (pointtype(pointloop) == FREEFACETVERTEX) {
+        }
+        else if (pointtype(pointloop) == FREEFACETVERTEX) {
           sdecode(point2sh(pointloop), parentsh);
           assert(parentsh.sh != NULL);
           l_faces.insert(shellmark(parentsh));
@@ -677,7 +682,7 @@ bool tetgenmesh::reconstructmesh(void *p)
           }
           if (gf != NULL) {
             MFaceVertex *v = new MFaceVertex(pointloop[0], pointloop[1],
-                                         pointloop[2], gf, 0, 0);
+                                             pointloop[2], gf, 0, 0);
             SPoint2 param;
             if (reparamMeshVertexOnFace(v, gf, param)) {
               v->setParameter(0, param.x());
@@ -686,14 +691,16 @@ bool tetgenmesh::reconstructmesh(void *p)
             v->setIndex(pointmark(pointloop));
             _gr->mesh_vertices.push_back(v);
             _vertices.push_back(v);
-          } else {
+          }
+          else {
             // Create a mesh vertex.
             MVertex *v = new MVertex(pointloop[0], pointloop[1], pointloop[2], _gr);
             v->setIndex(pointmark(pointloop));
             _gr->mesh_vertices.push_back(v);
             _vertices.push_back(v);
           }
-        } else {
+        }
+        else {
           MVertex *v = new MVertex(pointloop[0], pointloop[1], pointloop[2], _gr);
           v->setIndex(pointmark(pointloop));
           _gr->mesh_vertices.push_back(v);
@@ -709,7 +716,7 @@ bool tetgenmesh::reconstructmesh(void *p)
     // There are Steiner points on segments!
     face segloop;
     // Re-create the segment mesh in the corresponding GEdges.
-    for (std::set<int>::iterator it=l_edges.begin(); it!=l_edges.end(); ++it) {
+    for (std::set<int>::iterator it = l_edges.begin(); it!=l_edges.end(); ++it) {
       // Find the GFace with tag = *it.
       GEdge *ge = NULL;
       int etag = *it;
@@ -748,7 +755,7 @@ bool tetgenmesh::reconstructmesh(void *p)
     // There are Steiner points on facets!
     face subloop;
     // Re-create the surface mesh in the corresponding GFaces.
-    for (std::set<int>::iterator it=l_faces.begin(); it!=l_faces.end(); ++it) {
+    for (std::set<int>::iterator it = l_faces.begin(); it != l_faces.end(); ++it) {
       // Find the GFace with tag = *it.
       GFace *gf = NULL;
       int ftag = *it;
@@ -761,7 +768,7 @@ bool tetgenmesh::reconstructmesh(void *p)
       }
       assert(gf != NULL);
       // Delete the old triangles.
-      Msg::Info("Steiner points exist on GFace %d",gf->tag());
+      Msg::Info("Steiner points exist on GFace %d", gf->tag());
       for(i = 0; i < gf->triangles.size(); i++)
         delete gf->triangles[i];
       //for(i = 0; i < gf->quadrangles.size(); i++)
-- 
GitLab