From 57f3fc2bf090809d1956f60a1b170a073b17b1c9 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 12 Jan 2007 19:47:52 +0000
Subject: [PATCH] better names for mesh algo #defines

---
 Common/CommandLine.cpp  | 12 ++++++------
 Common/DefaultOptions.h |  8 ++++----
 Common/GmshDefines.h    | 17 +++++++++--------
 Common/Options.cpp      | 17 ++++++-----------
 Fltk/Callbacks.cpp      | 10 ++++++----
 Mesh/meshGFace.cpp      | 10 +++++-----
 Mesh/meshGRegion.cpp    |  6 +++---
 7 files changed, 39 insertions(+), 41 deletions(-)

diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 2647001a4f..488a6cb6c9 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -1,4 +1,4 @@
-// $Id: CommandLine.cpp,v 1.89 2007-01-12 15:47:41 geuzaine Exp $
+// $Id: CommandLine.cpp,v 1.90 2007-01-12 19:47:52 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -407,15 +407,15 @@ void Get_Options(int argc, char *argv[])
         i++;
         if(argv[i] != NULL) {
           if(!strncmp(argv[i], "bds", 3) || !strncmp(argv[i], "iso", 3))
-            CTX.mesh.algo2d = MESHADAPT;
+            CTX.mesh.algo2d = ALGO_2D_MESHADAPT;
           else if(!strncmp(argv[i], "del", 3))
-            CTX.mesh.algo2d = DELAUNAY2D;
+            CTX.mesh.algo2d = ALGO_2D_DELAUNAY;
           else if(!strncmp(argv[i], "tri", 3))
-            CTX.mesh.algo2d = DELAUNAY_TRIANGLE;
+            CTX.mesh.algo2d = ALGO_2D_TRIANGLE;
           else if(!strncmp(argv[i], "netgen", 6))
-            CTX.mesh.algo3d = FRONTAL_NETGEN;
+            CTX.mesh.algo3d = ALGO_3D_NETGEN;
           else if(!strncmp(argv[i], "tetgen", 6))
-	    CTX.mesh.algo3d = DELAUNAY_TETGEN;
+	    CTX.mesh.algo3d = ALGO_3D_TETGEN;
           else {
             fprintf(stderr, ERROR_STR "Unknown mesh algorithm\n");
             exit(1);
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 08f9c12ece..e9cbe03a0a 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -836,15 +836,15 @@ StringXNumber GeometryOptions_Number[] = {
 } ;
 
 StringXNumber MeshOptions_Number[] = {
-  { F|O, "Algorithm" , opt_mesh_algo2d , MESHADAPT ,
+  { F|O, "Algorithm" , opt_mesh_algo2d , ALGO_2D_MESHADAPT ,
     "2D mesh algorithm (1=meshadapt, 2=delaunay)" }, 
   { F|O, "Algorithm3D" , opt_mesh_algo3d ,
 #if defined(HAVE_TETGEN)
-    DELAUNAY_ISO,
+    ALGO_3D_DELAUNAY,
 #else
-    FRONTAL_NETGEN,
+    ALGO_3D_NETGEN,
 #endif
-    "3D mesh algorithm (1=isotropic, 4=netgen, 5=tetgen)" }, 
+    "3D mesh algorithm (1=delaunay, 4=netgen)" }, 
   { F|O, "AngleSmoothNormals" , opt_mesh_angle_smooth_normals , 30.0 ,
     "Threshold angle below which normals are not smoothed" }, 
 
diff --git a/Common/GmshDefines.h b/Common/GmshDefines.h
index a35873417a..7b956b95db 100644
--- a/Common/GmshDefines.h
+++ b/Common/GmshDefines.h
@@ -60,14 +60,15 @@
 #define ENT_VOLUME   (1<<3)
 #define ENT_ALL      (ENT_POINT | ENT_LINE | ENT_SURFACE | ENT_VOLUME)
 
-// Mesh algorithms
-#define DELAUNAY_ISO 1
-#define DELAUNAY_ANISO 2
-#define DELAUNAY_TRIANGLE 3
-#define FRONTAL_NETGEN 4
-#define DELAUNAY_TETGEN 5
-#define MESHADAPT 6
-#define DELAUNAY2D 7
+// 2D mesh algorithms
+#define ALGO_2D_MESHADAPT 1
+#define ALGO_2D_DELAUNAY  2
+#define ALGO_2D_TRIANGLE  3
+
+// 3D mesh algorithms
+#define ALGO_3D_DELAUNAY  1
+#define ALGO_3D_NETGEN    4
+#define ALGO_3D_TETGEN    5
 
 #define TRANSFINI 1
 #define LIBRE     2
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 49be68dbe0..2c23df190a 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.325 2007-01-12 13:49:38 remacle Exp $
+// $Id: Options.cpp,v 1.326 2007-01-12 19:47:52 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -4638,10 +4638,10 @@ double opt_mesh_algo2d(OPT_ARGS_NUM)
 #if defined(HAVE_FLTK)
   if(WID && (action & GMSH_GUI)) {
     switch (CTX.mesh.algo2d) {
-    case DELAUNAY_ISO:
+    case ALGO_2D_DELAUNAY:
       WID->mesh_choice[2]->value(1);
       break;
-    case MESHADAPT:
+    case ALGO_2D_MESHADAPT:
     default:
       WID->mesh_choice[2]->value(0);
       break;
@@ -4681,20 +4681,15 @@ double opt_mesh_algo3d(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     int algo = (int)val;
-    if(algo != DELAUNAY_ISO && algo != FRONTAL_NETGEN && algo != DELAUNAY_TETGEN){
-      Msg(WARNING, "Unknown mesh algorithm: keeping existing value");
-    }
-    else{
-      CTX.mesh.algo3d = algo;
-    }
+    CTX.mesh.algo3d = algo;
   }
 #if defined(HAVE_FLTK)
   if(WID && (action & GMSH_GUI)) {
     switch (CTX.mesh.algo3d) {
-    case FRONTAL_NETGEN:
+    case ALGO_3D_NETGEN:
       WID->mesh_choice[3]->value(1);
       break;
-    case DELAUNAY_ISO:
+    case ALGO_3D_DELAUNAY:
     default:
       WID->mesh_choice[3]->value(0);
       break;
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index ef89031baf..4b26e78911 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.501 2007-01-12 13:49:38 remacle Exp $
+// $Id: Callbacks.cpp,v 1.502 2007-01-12 19:47:52 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -1092,11 +1092,13 @@ void mesh_options_ok_cb(CALLBACK_ARGS)
 
   opt_mesh_point_type(0, GMSH_SET, WID->mesh_choice[0]->value());
   opt_mesh_algo2d(0, GMSH_SET,
-		  (WID->mesh_choice[2]->value() == 0) ? MESHADAPT : DELAUNAY2D );
+		  (WID->mesh_choice[2]->value() == 0) ? ALGO_2D_MESHADAPT : 
+		  ALGO_2D_DELAUNAY);
+  opt_mesh_algo3d(0, GMSH_SET,
+		  (WID->mesh_choice[3]->value() == 0) ? ALGO_3D_DELAUNAY : 
+		  ALGO_3D_NETGEN);
   opt_mesh_recombine_algo(0, GMSH_SET,
 		  (WID->mesh_choice[5]->value() == 0) ? 1 : 2);
-  opt_mesh_algo3d(0, GMSH_SET,
-		  (WID->mesh_choice[3]->value() == 0) ? DELAUNAY_ISO : FRONTAL_NETGEN );
   opt_mesh_color_carousel(0, GMSH_SET, WID->mesh_choice[4]->value());
   opt_mesh_quality_type(0, GMSH_SET, WID->mesh_choice[6]->value());
   opt_mesh_label_type(0, GMSH_SET, WID->mesh_choice[7]->value());
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index 340e0c82bf..3ad90a14c9 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFace.cpp,v 1.46 2007-01-12 13:16:59 remacle Exp $
+// $Id: meshGFace.cpp,v 1.47 2007-01-12 19:47:52 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -809,7 +809,7 @@ bool gmsh2DMeshGenerator ( GFace *gf )
   m->del_point(m->find_point(-4));
 
   // start mesh generation
-  //  if (CTX.mesh.algo2d == MESHADAPT)
+  //  if (CTX.mesh.algo2d == ALGO_2D_MESHADAPT)
     {
       RefineMesh (gf,*m,100);
       if (gf->meshAttributes.recombine)
@@ -862,7 +862,7 @@ bool gmsh2DMeshGenerator ( GFace *gf )
   // the delaunay algo is based directly on internal gmsh structures
   // BDS mesh is passed in order not to recompute local coordinates
   // of vertices
-//   if (CTX.mesh.algo2d == DELAUNAY2D ||CTX.mesh.algo2d == DELAUNAY_ISO)
+//   if (CTX.mesh.algo2d == ALGO_2D_DELAUNAY || CTX.mesh.algo2d == ALGO_2D_DELAUNAY)
 //     {
 //       insertVerticesInFace (gf,m) ;
 //     }
@@ -1294,7 +1294,7 @@ bool gmsh2DMeshGeneratorPeriodic ( GFace *gf )
   // goto hhh;
   // start mesh generation
   
-  //  if (CTX.mesh.algo2d == MESHADAPT)
+  //  if (CTX.mesh.algo2d == ALGO_2D_MESHADAPT)
     {
       RefineMesh (gf,*m,100);
       if (gf->meshAttributes.recombine)
@@ -1351,7 +1351,7 @@ bool gmsh2DMeshGeneratorPeriodic ( GFace *gf )
    //    sprintf(name,"real%d.pos",gf->tag());
     //outputScalarField(m->triangles, name,0);
 
-//   if (CTX.mesh.algo2d == DELAUNAY2D ||CTX.mesh.algo2d == DELAUNAY_ISO)
+//   if (CTX.mesh.algo2d == ALGO_2D_DELAUNAY)
 //     {
 //       insertVerticesInFace (gf,m) ;
 //     }
diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp
index 88c139e05e..5204084413 100644
--- a/Mesh/meshGRegion.cpp
+++ b/Mesh/meshGRegion.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGRegion.cpp,v 1.21 2006-12-15 16:06:16 geuzaine Exp $
+// $Id: meshGRegion.cpp,v 1.22 2007-01-12 19:47:52 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -451,7 +451,7 @@ void meshGRegion::operator() (GRegion *gr)
     }
   }
 
-  if(CTX.mesh.algo3d == DELAUNAY_TETGEN || CTX.mesh.algo3d == DELAUNAY_ISO){
+  if(CTX.mesh.algo3d == ALGO_3D_DELAUNAY || CTX.mesh.algo3d == ALGO_3D_TETGEN){
 #if !defined(HAVE_TETGEN)
     Msg(GERROR, "Tetgen is not compiled in this version of Gmsh");
 #else
@@ -485,7 +485,7 @@ void meshGRegion::operator() (GRegion *gr)
 #endif
   }
   
-  if(CTX.mesh.algo3d == FRONTAL_NETGEN ){
+  if(CTX.mesh.algo3d == ALGO_3D_NETGEN ){
 #if !defined(HAVE_NETGEN)
     Msg(GERROR, "Netgen is not compiled in this version of Gmsh");
 #else
-- 
GitLab