From 0f038614792fc45aa11160dcc2a7dbb7e94d8abf Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 24 Aug 2001 06:58:19 +0000
Subject: [PATCH] -initial cmd line option

---
 Common/Context.h          |  2 +-
 Common/GetOptions.cpp     | 10 +++++++++-
 Common/Options.cpp        |  3 ++-
 Mesh/2D_Mesh.cpp          |  4 ++--
 Mesh/2D_Mesh_Shewchuk.cpp |  7 ++++++-
 Mesh/3D_Coherence.cpp     | 20 ++++++++++++++++++--
 Mesh/3D_Mesh.cpp          | 10 +++++++++-
 benchmarks/3d/Sphere.geo  |  2 +-
 8 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index c4ebf39cfb..6ddae28511 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -132,7 +132,7 @@ public :
     int hidden, shade;
     int format, nb_smoothing, algo, degree;
     int point_insertion, speed_max, min_circ_points, constrained_bgmesh;
-    int histogram;
+    int histogram, initial_only;
     double normals, tangents, explode;
     int color_scheme, color_carousel ;
     int use_cut_plane;
diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp
index fb8f33ff0d..a341e2a802 100644
--- a/Common/GetOptions.cpp
+++ b/Common/GetOptions.cpp
@@ -1,4 +1,4 @@
-// $Id: GetOptions.cpp,v 1.36 2001-08-20 07:38:29 geuzaine Exp $
+// $Id: GetOptions.cpp,v 1.37 2001-08-24 06:58:19 geuzaine Exp $
 
 #include <unistd.h>
 #include "Gmsh.h"
@@ -190,6 +190,14 @@ void Get_Options (int argc, char *argv[], int *nbfiles) {
       else if(!strcmp(argv[i]+1, "old")){ 
         CTX.geom.old_circle = 1; i++;
       }
+      else if(!strcmp(argv[i]+1, "initial")){
+        i++;
+        if(argv[i]!=NULL) CTX.mesh.initial_only = atoi(argv[i++]);
+        else {    
+          fprintf(stderr, ERROR_STR "Missing number\n");
+          exit(1);
+        }
+      }
       else if(!strcmp(argv[i]+1, "quality")){
         i++;
         if(argv[i]!=NULL) CTX.mesh.quality = atof(argv[i++]);
diff --git a/Common/Options.cpp b/Common/Options.cpp
index aa38b13ffa..35f60d020c 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.42 2001-08-23 18:03:45 geuzaine Exp $
+// $Id: Options.cpp,v 1.43 2001-08-24 06:58:19 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -73,6 +73,7 @@ void Init_Options(int num){
 
   // The following defaults cannot be set by the user 
   CTX.batch = 0 ;
+  CTX.mesh.initial_only = 0 ;
   CTX.output_filename = NULL ;
   CTX.expose = 0 ;
   CTX.stream = TO_SCREEN ;
diff --git a/Mesh/2D_Mesh.cpp b/Mesh/2D_Mesh.cpp
index fee1ba49e6..06dd5866a2 100644
--- a/Mesh/2D_Mesh.cpp
+++ b/Mesh/2D_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 2D_Mesh.cpp,v 1.33 2001-08-20 07:38:30 geuzaine Exp $
+// $Id: 2D_Mesh.cpp,v 1.34 2001-08-24 06:58:19 geuzaine Exp $
 
 /*
    Maillage Delaunay d'une surface (Point insertion Technique)
@@ -705,7 +705,7 @@ void Maillage_Automatique_VieuxCode (Surface * pS, Mesh * m, int ori){
   }
 
   if (pS->Method)
-    mesh_domain (liste, List_Nbr (pS->Contours), &M, &N, 0);
+    mesh_domain (liste, List_Nbr (pS->Contours), &M, &N, (CTX.mesh.initial_only==2));
 
   for (i = 0; i < M.numpoints; i++){
     if (gPointArray[i].initial < 0){
diff --git a/Mesh/2D_Mesh_Shewchuk.cpp b/Mesh/2D_Mesh_Shewchuk.cpp
index a9aeebea9a..f7b7cf9541 100644
--- a/Mesh/2D_Mesh_Shewchuk.cpp
+++ b/Mesh/2D_Mesh_Shewchuk.cpp
@@ -1,4 +1,4 @@
-// $Id: 2D_Mesh_Shewchuk.cpp,v 1.4 2001-08-21 10:43:25 geuzaine Exp $
+// $Id: 2D_Mesh_Shewchuk.cpp,v 1.5 2001-08-24 06:58:19 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Mesh.h"
@@ -156,6 +156,11 @@ int Mesh_Shewchuk(Surface *s){
   Free(in.segmentmarkerlist);
   Free(in.holelist);
 
+  if(CTX.mesh.initial_only==2){
+    AddInMesh(s, NbPts, vtable, &mid);
+    return 0;
+  }
+
 #ifndef BGMESH
 
   mid.trianglearealist = (REAL *) Malloc(mid.numberoftriangles * sizeof(REAL));
diff --git a/Mesh/3D_Coherence.cpp b/Mesh/3D_Coherence.cpp
index c493d0eeee..53f0701511 100644
--- a/Mesh/3D_Coherence.cpp
+++ b/Mesh/3D_Coherence.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_Coherence.cpp,v 1.16 2001-08-11 23:28:32 geuzaine Exp $
+// $Id: 3D_Coherence.cpp,v 1.17 2001-08-24 06:58:19 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Numeric.h"
@@ -487,7 +487,6 @@ int Edge_Node (Edge * e, Vertex * v){
     return 1;
   if (!compareVertex (&e->V[1], &v))
     return 1;
-
   lc = myhypot (myhypot (e->V[0]->Pos.X - e->V[1]->Pos.X, e->V[0]->Pos.Y - e->V[1]->Pos.Y),
                 e->V[0]->Pos.Z - e->V[1]->Pos.Z);
   
@@ -1304,6 +1303,14 @@ int Coherence (Volume * v, Mesh * m){
       for (j = 0; j < List_Nbr (v->Surfaces); j++){
         List_Read (v->Surfaces, j, &s);
         if (Tree_Search (s->Simplexes, &simp)){
+	  /*
+	  if(List_Nbr(ListFaces)>2){
+	    printf("suppressed tri %d\n", simp->Num);
+	    printf(" (%g %g %g)\n", simp->V[0]->Pos.X, simp->V[0]->Pos.Y,simp->V[0]->Pos.Z);
+	    printf(" (%g %g %g)\n", simp->V[1]->Pos.X, simp->V[1]->Pos.Y,simp->V[1]->Pos.Z);
+	    printf(" (%g %g %g)\n", simp->V[2]->Pos.X, simp->V[2]->Pos.Y,simp->V[2]->Pos.Z);
+	  }
+	  */
           for (k = 0; k < List_Nbr (ListFaces); k++){
             List_Read (ListFaces, k, &Face);
             simp1 = Create_Simplex_MemeSens (simp, Face.V[0], Face.V[1], Face.V[2]);
@@ -1314,9 +1321,18 @@ int Coherence (Volume * v, Mesh * m){
             Tree_Replace (v->Vertices, &Face.V[0]);
             Tree_Replace (v->Vertices, &Face.V[1]);
             Tree_Replace (v->Vertices, &Face.V[2]);
+	    /*
+	    if(List_Nbr(ListFaces)>2){
+	      printf("replaced by tri %d\n", simp1->Num);
+	      printf(" (%g %g %g)\n", simp1->V[0]->Pos.X, simp1->V[0]->Pos.Y,simp1->V[0]->Pos.Z);
+	      printf(" (%g %g %g)\n", simp1->V[1]->Pos.X, simp1->V[1]->Pos.Y,simp1->V[1]->Pos.Z);
+	      printf(" (%g %g %g)\n", simp1->V[2]->Pos.X, simp1->V[2]->Pos.Y,simp1->V[2]->Pos.Z);
+	    }
+	    */
           }
           Tree_Suppress (s->Simplexes, &simp);
         }
+
       }
     }
     else{
diff --git a/Mesh/3D_Mesh.cpp b/Mesh/3D_Mesh.cpp
index 5d91a4a660..98d88808b5 100644
--- a/Mesh/3D_Mesh.cpp
+++ b/Mesh/3D_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_Mesh.cpp,v 1.27 2001-08-13 18:38:55 geuzaine Exp $
+// $Id: 3D_Mesh.cpp,v 1.28 2001-08-24 06:58:19 geuzaine Exp $
 
 /*
  
@@ -761,6 +761,14 @@ void Maillage_Volume (void *data, void *dum){
 
     Link_Simplexes (NULL, LOCAL->Simplexes);
     
+    if(CTX.mesh.initial_only==3){
+      POINTS_TREE = THEM->Vertices;
+      Tree_Action (v->Vertices, add_points);
+      POINTS_TREE = THEM->Simplexes;
+      Tree_Action (v->Simplexes, add_points);
+      return;  
+    }
+  
     /* Suppression des noeuds de num < 0 */
     
     Suppress = List_Create (10, 10, sizeof (Vertex *));
diff --git a/benchmarks/3d/Sphere.geo b/benchmarks/3d/Sphere.geo
index 2efe1e02c3..a507718634 100644
--- a/benchmarks/3d/Sphere.geo
+++ b/benchmarks/3d/Sphere.geo
@@ -38,5 +38,5 @@ Ruled Surface(28) = {27};
 Surface Loop(29) = {28,26,16,14,20,24,22,18};
 Complex Volume(30) = {29};
 
-Physical Volume(1) = 30;
+Physical Volume(1) = {0,30};
 Physical Surface(2) = {14:28:2};
-- 
GitLab