From 1eaac9198c6dcdeffa98bc97c443e6b4453d1232 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 12 Apr 2013 16:58:15 +0000
Subject: [PATCH] cleanup

---
 Common/Context.h                      |  1 -
 Common/DefaultOptions.h               |  2 --
 Common/Options.cpp                    |  7 -------
 Common/Options.h                      |  1 -
 Mesh/meshGRegion.cpp                  | 13 ++++++-------
 Mesh/meshGRegionDelaunayInsertion.cpp | 20 ++++++++++++--------
 doc/VERSIONS.txt                      |  4 ++--
 7 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index 093346e0b4..ee2f317935 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -46,7 +46,6 @@ struct contextMeshOptions {
   std::map<int,int> curvature_control_per_face;
   int bunin;
   int ignorePartBound;
-  double delaunayQ;
 };
 
 struct contextGeometryOptions {
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 19399b623f..a0a4327b06 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -900,8 +900,6 @@ StringXNumber MeshOptions_Number[] = {
   { F,   "CpuTime" , opt_mesh_cpu_time , 0. ,
     "CPU time (in seconds) for the generation of the current mesh (read-only)" },
 
-  { F|O, "DelaunayQ" , opt_mesh_delaunay_q , 3.5 ,
-    "Quality factor for initial Delaunay tetrahedralization" },
   { F|O, "DrawSkinOnly" , opt_mesh_draw_skin_only , 0. ,
     "Draw only the skin of 3D meshes?" },
   { F|O, "Dual" , opt_mesh_dual , 0. ,
diff --git a/Common/Options.cpp b/Common/Options.cpp
index d910c42fa2..fa1671862f 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -4586,13 +4586,6 @@ double opt_mesh_rand_factor(OPT_ARGS_NUM)
   return CTX::instance()->mesh.randFactor;
 }
 
-double opt_mesh_delaunay_q(OPT_ARGS_NUM)
-{
-  if(action & GMSH_SET)
-    CTX::instance()->mesh.delaunayQ = val;
-  return CTX::instance()->mesh.delaunayQ;
-}
-
 double opt_mesh_quality_type(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
diff --git a/Common/Options.h b/Common/Options.h
index 78cb4ecad1..834016f612 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -364,7 +364,6 @@ double opt_mesh_rand_factor(OPT_ARGS_NUM);
 double opt_mesh_quality_inf(OPT_ARGS_NUM);
 double opt_mesh_quality_sup(OPT_ARGS_NUM);
 double opt_mesh_quality_type(OPT_ARGS_NUM);
-double opt_mesh_delaunay_q(OPT_ARGS_NUM);
 double opt_mesh_radius_inf(OPT_ARGS_NUM);
 double opt_mesh_radius_sup(OPT_ARGS_NUM);
 double opt_mesh_label_type(OPT_ARGS_NUM);
diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp
index cbe2ba8c2f..9a6a454942 100644
--- a/Mesh/meshGRegion.cpp
+++ b/Mesh/meshGRegion.cpp
@@ -357,7 +357,7 @@ void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out,
     numberedV.push_back(v);
   }
 
-  Msg::Info("%d points %d edges and %d faces in the final mesh",
+  Msg::Info("%d points %d edges and %d faces in the initial mesh",
             out.numberofpoints, out.numberofedges, out.numberoftrifaces);
 
   // Tetgen modifies both surface & edge mesh, so we need to re-create
@@ -555,7 +555,7 @@ void MeshDelaunayVolume(std::vector<GRegion*> &regions)
        CTX::instance()->mesh.algo2d == ALGO_2D_BAMG){
       sprintf(opts, "Ype%c",  (Msg::GetVerbosity() < 3) ? 'Q':
 	      (Msg::GetVerbosity() > 6) ? 'V': '\0');
-      // removed -q because mesh sizes at vertices were wrong...
+      // removed -q because mesh sizes at new vertices are wrong
       // sprintf(opts, "-q1.5pY%c",  (Msg::GetVerbosity() < 3) ? 'Q':
       // 	 (Msg::GetVerbosity() > 6) ? 'V': '\0');
     }
@@ -564,12 +564,12 @@ void MeshDelaunayVolume(std::vector<GRegion*> &regions)
 	       (Msg::GetVerbosity() > 6) ? 'V': '\0');
     }
     else {
-      sprintf(opts, "-Ype%c",  
+      sprintf(opts, "-Ype%c",
               (Msg::GetVerbosity() < 3) ? 'Q':
               (Msg::GetVerbosity() > 6) ? 'V': '\0');
-      /*      sprintf(opts, "-q%gYpe%c",  CTX::instance()->mesh.delaunayQ,
-              (Msg::GetVerbosity() < 3) ? 'Q':
-              (Msg::GetVerbosity() > 6) ? 'V': '\0');*/
+      // removed -q because mesh sizes at new vertices are wrong
+      // sprintf(opts, "-q3.5Ype%c", (Msg::GetVerbosity() < 3) ? 'Q':
+      //        (Msg::GetVerbosity() > 6) ? 'V': '\0');*/
     }
     try{
       tetrahedralize(opts, &in, &out);
@@ -622,7 +622,6 @@ void MeshDelaunayVolume(std::vector<GRegion*> &regions)
 
   modifyInitialMeshForTakingIntoAccountBoundaryLayers(gr);
 
-
   // now do insertion of points
  if(CTX::instance()->mesh.algo3d == ALGO_3D_FRONTAL_DEL)
    bowyerWatsonFrontalLayers(gr, false);
diff --git a/Mesh/meshGRegionDelaunayInsertion.cpp b/Mesh/meshGRegionDelaunayInsertion.cpp
index 6fff65a549..da902af6ef 100644
--- a/Mesh/meshGRegionDelaunayInsertion.cpp
+++ b/Mesh/meshGRegionDelaunayInsertion.cpp
@@ -1150,7 +1150,7 @@ void insertVerticesInRegion (GRegion *gr)
       Msg::Debug("found %d tets with %d faces (%g sec for the classification)",
                  theRegion.size(), faces_bound.size(), _t2 - _t1);
       GRegion *myGRegion = getRegionFromBoundingFaces(gr->model(), faces_bound);
-       Msg::Info("a region is found %p",myGRegion);
+      Msg::Info("Found region %d", myGRegion->tag());
       if(myGRegion) // a geometrical region associated to the list of faces has been found
         for(std::list<MTet4*>::iterator it2 = theRegion.begin();
             it2 != theRegion.end(); ++it2) (*it2)->setOnWhat(myGRegion);
@@ -1192,7 +1192,7 @@ void insertVerticesInRegion (GRegion *gr)
     }
     else{
       if(ITER++ % 5000 == 0)
-        Msg::Info("%9d points created -- Worst tet radius is %8.3f (PTS removed %4d %4d)",
+        Msg::Info("%d points created - Worst tet radius is %g (PTS removed %d %d)",
                   vSizes.size(), worst->getRadius(), COUNT_MISS_1,COUNT_MISS_2);
       if(worst->getRadius() < 1) break;
       double center[3];
@@ -1290,11 +1290,16 @@ void insertVerticesInRegion (GRegion *gr)
   double t2 = Cpu();
   double dt = (t2-t1);
   int COUNT_MISS = COUNT_MISS_1+COUNT_MISS_2;
-  Msg::Info("3D Point Insertion Terminated : %9d Delaunay cavities modified for star shapeness",NB_CORRECTION_OF_CAVITY);
-  Msg::Info("                              : %9d points could not be inserted among %d",COUNT_MISS,vSizes.size() - COUNT_MISS);
-  Msg::Info("                              : %9d tetrahedra created in %8.2f sec. (%d tets/sec.)",allTets.size(),dt,(int)(allTets.size()/dt));
-
-    // relocate vertices
+  Msg::Info("3D point insertion terminated (%d points created):",
+            (int)vSizes.size());
+  Msg::Info(" - %d Delaunay cavities modified for star shapeness",
+            NB_CORRECTION_OF_CAVITY);
+  Msg::Info(" - %d points could not be inserted",
+            COUNT_MISS);
+  Msg::Info(" - %d tetrahedra created in %g sec. (%d tets/sec.)",
+            allTets.size(), dt, (int)(allTets.size() / dt));
+
+  // relocate vertices
   int nbReloc = 0;
   for (int SM=0;SM<CTX::instance()->mesh.nbSmoothing;SM++){
     for(MTet4Factory::iterator it = allTets.begin(); it != allTets.end(); ++it){
@@ -1308,7 +1313,6 @@ void insertVerticesInRegion (GRegion *gr)
     }
   }
 
-
   while(1){
     if(allTets.begin() == allTets.end()) break;
     MTet4 *worst = *allTets.begin();
diff --git a/doc/VERSIONS.txt b/doc/VERSIONS.txt
index f32125ad64..cc6865e5cd 100644
--- a/doc/VERSIONS.txt
+++ b/doc/VERSIONS.txt
@@ -1,5 +1,5 @@
-2.7.1: updated onelab; better Abaqus and UNV export; small bug and compilation
-fixes.
+2.7.1: improved Delaunay point insertion; updated onelab; better Abaqus and UNV
+export; small bug and compilation fixes.
 
 2.7.0 (March 9, 2013): new single-window GUI, with dynamically customizable
 widget tree; faster STEP/BRep import; arbitrary size image export; faster 2D
-- 
GitLab