From 11a22b981b191fb97fe82d4f6db2843158c4e83d Mon Sep 17 00:00:00 2001
From: Jean-Francois Remacle <jean-francois.remacle@uclouvain.be>
Date: Wed, 17 Jan 2001 21:26:25 +0000
Subject: [PATCH] Addition of a cutplane in the mesh Better visualization if
 isosurfaces, with the same light model on both faces. I'm gonna do something
 better in the near future.

---
 Common/Context.h    |   9 +++
 Common/Options.h    |   5 ++
 Geo/CAD.cpp         |   3 +-
 Geo/Geo.h           |   4 +-
 Graphics/Draw.cpp   |   5 +-
 Graphics/Mesh.cpp   |  94 ++++++++++++++--------
 Makefile            |   5 +-
 Mesh/Edge.h         |  33 +++++---
 Mesh/Makefile       |   3 +-
 Mesh/Read_Mesh.cpp  | 185 ++++++++++++++++++++++----------------------
 Parser/Gmsh.tab.cpp |   2 +-
 Parser/Gmsh.yy.cpp  |   4 +-
 12 files changed, 207 insertions(+), 145 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index 9a76253c96..0620f42c25 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -145,6 +145,15 @@ public :
     int format, nb_smoothing, algo, degree;
     int point_insertion, speed_max, min_circ_points;
     double normals, tangents, explode;
+    int use_cut_plane;
+    double cut_planea,cut_planeb,cut_planec,cut_planed;
+    double evalCutPlane (double x, double y, double z)
+    {
+      double val = cut_planea * x + 
+	cut_planeb * y + 
+	cut_planec * z + cut_planed; 
+      return val;
+    }
   } mesh;
 
   // post processing options 
diff --git a/Common/Options.h b/Common/Options.h
index 62d4d35e0d..21ac679c48 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -186,6 +186,11 @@ StringXNumber MeshOptions_Number[] = {
   { "Degree"          , GMSH_INT,    (void*)&CTX.mesh.degree         , 1. }, 
   { "Dual"            , GMSH_INT,    (void*)&CTX.mesh.dual           , 0. }, 
   { "Interactive"     , GMSH_INT,    (void*)&CTX.mesh.interactive    , 0. }, 
+  { "use_cut_plane"   , GMSH_INT,    (void*)&CTX.mesh.use_cut_plane  , 0  }, 
+  { "cut_planea"      , GMSH_DOUBLE, (void*)&CTX.mesh.cut_planea      , 1. }, 
+  { "cut_planeb"      , GMSH_DOUBLE, (void*)&CTX.mesh.cut_planeb      , 0. }, 
+  { "cut_planec"      , GMSH_DOUBLE, (void*)&CTX.mesh.cut_planec      , 0. }, 
+  { "cut_planed"      , GMSH_DOUBLE, (void*)&CTX.mesh.cut_planed      , 0. }, 
   { NULL              , GMSH_DOUBLE, NULL , 0. }
 } ;
 
diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp
index 48ab7bf07e..bb7b2a76fc 100644
--- a/Geo/CAD.cpp
+++ b/Geo/CAD.cpp
@@ -1,4 +1,4 @@
-// $Id: CAD.cpp,v 1.15 2001-01-12 13:28:57 geuzaine Exp $
+// $Id: CAD.cpp,v 1.16 2001-01-17 21:26:24 remacle Exp $
 
 #include "Gmsh.h"
 #include "Geo.h"
@@ -9,6 +9,7 @@
 #include "Const.h"
 #include "Create.h"
 #include "CAD.h"
+#include "Edge.h"
 #include "Context.h"
                                     
 extern Mesh      *THEM;
diff --git a/Geo/Geo.h b/Geo/Geo.h
index 4603ad981d..cb421bc249 100644
--- a/Geo/Geo.h
+++ b/Geo/Geo.h
@@ -44,13 +44,15 @@
 #define MSH_SURF_TORUS       1399
 #define MSH_SURF_CONE        1499
 #define MSH_SURF_TRIMMED     1599
-#define MSH_SURF_STL         1599
+#define MSH_SURF_STL         1699
+#define MSH_SURF_DISCRETE    1799
 
 #define MSH_VOLUME                   14
 #define MSH_SEGM_BSPLN       15
 #define MSH_SEGM_URBS        16
 #define MSH_SEGM_NURBS       17
 #define MSH_SEGM_BEZIER      18
+#define MSH_SEGM_DISCRETE    19
 
 #define MSH_PHYSICAL_POINT   300
 #define MSH_PHYSICAL_LINE    310
diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index 3af9710a56..ab3f96159c 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-// $Id: Draw.cpp,v 1.16 2001-01-10 10:06:17 geuzaine Exp $
+// $Id: Draw.cpp,v 1.17 2001-01-17 21:26:24 remacle Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -145,11 +145,12 @@ void InitShading(void){
   }
 
   /* simple color commands will automatically create appropriate materials */
-  glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
+  glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
   glEnable(GL_COLOR_MATERIAL);
 
   /* let's add some shininess to all these automatically created materials */
   glMaterialf(GL_FRONT, GL_SHININESS, 40.);
+  glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
   specular[0] = CTX.shine;
   specular[1] = CTX.shine;
   specular[2] = CTX.shine;
diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp
index dd72adef74..2e2830bf0c 100644
--- a/Graphics/Mesh.cpp
+++ b/Graphics/Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Mesh.cpp,v 1.16 2001-01-10 20:14:35 geuzaine Exp $
+// $Id: Mesh.cpp,v 1.17 2001-01-17 21:26:24 remacle Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -150,6 +150,12 @@ void Draw_Mesh_Points (void *a, void *b){
 
   v = (Vertex**)a;
 
+
+  if(CTX.mesh.use_cut_plane)
+    {
+      if(CTX.mesh.evalCutPlane((*v)->Pos.X, (*v)->Pos.Y, (*v)->Pos.Z) < 0)return;
+    }
+  
   if(CTX.render_mode == GMSH_SELECT){
     glLoadName(0);
     glPushName((*v)->Num);
@@ -193,6 +199,18 @@ void Draw_Simplex_Volume (void *a, void *b){
 
   if(!EntiteEstElleVisible((*s)->iEnt)) return;
 
+  double Xc = .25 * ((*s)->V[0]->Pos.X + (*s)->V[1]->Pos.X + 
+                     (*s)->V[2]->Pos.X + (*s)->V[3]->Pos.X);
+  double Yc = .25 * ((*s)->V[0]->Pos.Y + (*s)->V[1]->Pos.Y + 
+                     (*s)->V[2]->Pos.Y + (*s)->V[3]->Pos.Y);
+  double Zc = .25 * ((*s)->V[0]->Pos.Z + (*s)->V[1]->Pos.Z + 
+                     (*s)->V[2]->Pos.Z + (*s)->V[3]->Pos.Z);
+
+  if(CTX.mesh.use_cut_plane)
+    {
+      if(CTX.mesh.evalCutPlane(Xc,Yc,Zc) < 0)return;
+    }
+  
   if(!(*s)->V[3]) return;
 
   if(CTX.mesh.limit_gamma){
@@ -207,13 +225,6 @@ void Draw_Simplex_Volume (void *a, void *b){
 
   ColorSwitch((*s)->iEnt+1);
 
-  double Xc = .25 * ((*s)->V[0]->Pos.X + (*s)->V[1]->Pos.X + 
-                     (*s)->V[2]->Pos.X + (*s)->V[3]->Pos.X);
-  double Yc = .25 * ((*s)->V[0]->Pos.Y + (*s)->V[1]->Pos.Y + 
-                     (*s)->V[2]->Pos.Y + (*s)->V[3]->Pos.Y);
-  double Zc = .25 * ((*s)->V[0]->Pos.Z + (*s)->V[1]->Pos.Z + 
-                     (*s)->V[2]->Pos.Z + (*s)->V[3]->Pos.Z);
-
   for (int i=0 ; i<4 ; i++) {
      X[i] = Xc + CTX.mesh.explode * ((*s)->V[i]->Pos.X - Xc);
      Y[i] = Yc + CTX.mesh.explode * ((*s)->V[i]->Pos.Y - Yc);
@@ -376,6 +387,11 @@ void Draw_Simplex_Surfaces (void *a, void *b){
     Zc = ((*s)->V[0]->Pos.Z + (*s)->V[1]->Pos.Z + (*s)->V[2]->Pos.Z) / 3. ;
   }
 
+  if(CTX.mesh.use_cut_plane)
+    {
+      if(CTX.mesh.evalCutPlane(Xc,Yc,Zc) < 0)return;
+    }
+
   k=0;
   for (i=0 ; i<K ; i++) {
     pX[k] = Xc + CTX.mesh.explode * ((*s)->V[i]->Pos.X - Xc);
@@ -519,49 +535,61 @@ void Draw_Simplex_Points(void *a,void *b){
 void Draw_Hexahedron_Volume (void *a, void *b){
   Hexahedron **h;
   int i ;
-  double Xc = 0.0 , Yc = 0.0, Zc = 0.0 ;
+  double Xc = 0.0 , Yc = 0.0, Zc = 0.0 , X[8],Y[8],Z[8];
 
   h = (Hexahedron**)a;
 
   if(!EntiteEstElleVisible((*h)->iEnt)) return;
+
+  for(i=0 ; i<8 ; i++){
+    Xc += (*h)->V[i]->Pos.X;
+    Yc += (*h)->V[i]->Pos.Y;
+    Zc += (*h)->V[i]->Pos.Z;
+  }
+  Xc *= .125 ; 
+  Zc *= .125 ; 
+  Yc *= .125 ; 
+
+  if(CTX.mesh.use_cut_plane)
+    {
+      if(CTX.mesh.evalCutPlane(Xc,Yc,Zc) < 0)return;
+    }
   
   //glColor4ubv((GLubyte*)&CTX.color.mesh.hexahedron);
   ColorSwitch((*h)->iEnt+1);
 
+  for (int i=0 ; i<8 ; i++) {
+     X[i] = Xc + CTX.mesh.explode * 0.99 * ((*h)->V[i]->Pos.X - Xc);
+     Y[i] = Yc + CTX.mesh.explode * 0.99 * ((*h)->V[i]->Pos.Y - Yc);
+     Z[i] = Zc + CTX.mesh.explode * 0.99 * ((*h)->V[i]->Pos.Z - Zc);
+  }
+
   glBegin(GL_LINE_LOOP);
-  glVertex3d((*h)->V[0]->Pos.X, (*h)->V[0]->Pos.Y, (*h)->V[0]->Pos.Z);
-  glVertex3d((*h)->V[1]->Pos.X, (*h)->V[1]->Pos.Y, (*h)->V[1]->Pos.Z);
-  glVertex3d((*h)->V[2]->Pos.X, (*h)->V[2]->Pos.Y, (*h)->V[2]->Pos.Z);
-  glVertex3d((*h)->V[3]->Pos.X, (*h)->V[3]->Pos.Y, (*h)->V[3]->Pos.Z);
+  glVertex3d(X[0], Y[0], Z[0]);
+  glVertex3d(X[1], Y[1], Z[1]);
+  glVertex3d(X[2], Y[2], Z[2]);
+  glVertex3d(X[3], Y[3], Z[3]);
   glEnd();    
 
   glBegin(GL_LINE_LOOP);
-  glVertex3d((*h)->V[4]->Pos.X, (*h)->V[4]->Pos.Y, (*h)->V[4]->Pos.Z);
-  glVertex3d((*h)->V[5]->Pos.X, (*h)->V[5]->Pos.Y, (*h)->V[5]->Pos.Z);
-  glVertex3d((*h)->V[6]->Pos.X, (*h)->V[6]->Pos.Y, (*h)->V[6]->Pos.Z);
-  glVertex3d((*h)->V[7]->Pos.X, (*h)->V[7]->Pos.Y, (*h)->V[7]->Pos.Z);
+  glVertex3d(X[4], Y[4], Z[4]);
+  glVertex3d(X[5], Y[5], Z[5]);
+  glVertex3d(X[6], Y[6], Z[6]);
+  glVertex3d(X[7], Y[7], Z[7]);
   glEnd();    
 
   glBegin(GL_LINES);
-  glVertex3d((*h)->V[0]->Pos.X, (*h)->V[0]->Pos.Y, (*h)->V[0]->Pos.Z);
-  glVertex3d((*h)->V[4]->Pos.X, (*h)->V[4]->Pos.Y, (*h)->V[4]->Pos.Z);
-  glVertex3d((*h)->V[1]->Pos.X, (*h)->V[1]->Pos.Y, (*h)->V[1]->Pos.Z);
-  glVertex3d((*h)->V[5]->Pos.X, (*h)->V[5]->Pos.Y, (*h)->V[5]->Pos.Z);
-  glVertex3d((*h)->V[2]->Pos.X, (*h)->V[2]->Pos.Y, (*h)->V[2]->Pos.Z);
-  glVertex3d((*h)->V[6]->Pos.X, (*h)->V[6]->Pos.Y, (*h)->V[6]->Pos.Z);
-  glVertex3d((*h)->V[3]->Pos.X, (*h)->V[3]->Pos.Y, (*h)->V[3]->Pos.Z);
-  glVertex3d((*h)->V[7]->Pos.X, (*h)->V[7]->Pos.Y, (*h)->V[7]->Pos.Z);
+  glVertex3d(X[0], Y[0], Z[0]);
+  glVertex3d(X[4], Y[4], Z[4]);
+  glVertex3d(X[1], Y[1], Z[1]);
+  glVertex3d(X[5], Y[5], Z[5]);
+  glVertex3d(X[2], Y[2], Z[2]);
+  glVertex3d(X[6], Y[6], Z[6]);
+  glVertex3d(X[3], Y[3], Z[3]);
+  glVertex3d(X[7], Y[7], Z[7]);
   glEnd();    
 
   if (CTX.mesh.dual){
-    for(i=0 ; i<8 ; i++){
-      Xc += (*h)->V[i]->Pos.X;
-      Yc += (*h)->V[i]->Pos.Y;
-      Zc += (*h)->V[i]->Pos.Z;
-    }
-    Xc /= 8. ; 
-    Zc /= 8. ; 
-    Yc /= 8. ; 
 
     glColor4ubv((GLubyte*)&CTX.color.fg);
     glEnable(GL_LINE_STIPPLE);
diff --git a/Makefile b/Makefile
index cc86b81e71..9caf08ca01 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.39 2001-01-13 15:41:35 geuzaine Exp $
+# $Id: Makefile,v 1.40 2001-01-17 21:26:24 remacle Exp $
 # ----------------------------------------------------------------------
 #  Makefile for Gmsh  
 # ----------------------------------------------------------------------
@@ -29,6 +29,7 @@ MESA_MOTIF_STATIC_LIB = $(HOME)/SOURCES/Mesa-static/lib/libGLw.a
                    -L/usr/X11R6/lib -lXt -lX11 -lXext 
         FLTK_LIB = -L$(HOME)/SOURCES/fltk/lib -lfltk\
                    -L/usr/X11R6/lib -lXext -lX11
+
       THREAD_LIB = -L/usr/lib -lpthread
         JPEG_LIB = jpeg/libjpeg.a
 
@@ -256,7 +257,7 @@ linux-rpm: tag compile_little_endian_2952 link_mesa_2952 strip_bin compress_bin
 
 ibm: tag compile_big_endian link_mesa strip_bin compress_bin
 
-sun: tag compile_big_endian link_mesa strip_bin compress_bin
+sun: tag compile_big_endian link_opengl strip_bin compress_bin
 
 hp: tag compile_big_endian link_hp strip_bin compress_bin
 
diff --git a/Mesh/Edge.h b/Mesh/Edge.h
index d856e4ae87..6794c4b660 100644
--- a/Mesh/Edge.h
+++ b/Mesh/Edge.h
@@ -8,25 +8,36 @@
 
 class Edge {
 public :
+  int Num;
   Vertex *V[2];
   List_T *Simplexes;
   Vertex *newv;
   Vertex *O[2];
   double a;
   List_T *Liste;
+  List_T *Points;
+  Edge()
+    {
+      Num = 0;
+      Liste = NULL;
+      Simplexes = NULL;
+      Points = NULL;
+    }
 };
 
-class EdgesContainer{
-public :
-  Tree_T * AllEdges;
-  EdgesContainer (Tree_T *Simplexes, bool i = false);
-  EdgesContainer (List_T *Surfaces);
-  ~EdgesContainer();
-  void AddTree (Tree_T *Simplexes, bool EdgesInVolume);
-  void AddEdges(Simplex *s, bool i);
-  void RemoveEdge(Edge *e);
-  void SwapEdge (Vertex *v[2]);
-  bool Search(Vertex *v1, Vertex *v2);
+class EdgesContainer
+{
+  public :
+    Tree_T * AllEdges;
+    EdgesContainer (Tree_T *Simplexes, bool i = false);
+    EdgesContainer (List_T *Surfaces);
+    ~EdgesContainer();
+    void AddTree (Tree_T *Simplexes, bool EdgesInVolume);
+    void AddEdges(Simplex *s, bool i);
+    void GetEdges(Simplex *s, bool i, Edge *ed[4],int *ori);
+    void RemoveEdge(Edge *e);
+    void SwapEdge (Vertex *v[2]);
+    bool Search(Vertex *v1, Vertex *v2);
 };
 
 int compareedge (const void *a, const void *b);
diff --git a/Mesh/Makefile b/Mesh/Makefile
index 99d15cb0d2..b057b13c7f 100644
--- a/Mesh/Makefile
+++ b/Mesh/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.10 2001-01-13 17:08:41 geuzaine Exp $
+# $Id: Makefile,v 1.11 2001-01-17 21:26:24 remacle Exp $
 #
 # Makefile for "libMesh.a"
 #
@@ -48,6 +48,7 @@ SRC = 1D_Mesh.cpp \
       Generator.cpp \
       Print_Mesh.cpp \
       Read_Mesh.cpp \
+      SMS.cpp \
       STL.cpp \
       SwapEdge.cpp \
       Numeric.cpp \
diff --git a/Mesh/Read_Mesh.cpp b/Mesh/Read_Mesh.cpp
index 88e7acf046..dc04bd458c 100644
--- a/Mesh/Read_Mesh.cpp
+++ b/Mesh/Read_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Read_Mesh.cpp,v 1.7 2001-01-12 13:29:00 geuzaine Exp $
+// $Id: Read_Mesh.cpp,v 1.8 2001-01-17 21:26:24 remacle Exp $
 
 #include "Gmsh.h"
 #include "Geo.h"
@@ -95,96 +95,99 @@ void Read_Mesh_MSH (Mesh *M, FILE *File_GEO){
         for (j = 0 ; j < Nbr_Nodes ; j++)
           fscanf(File_GEO, "%d", &verts[j].Num) ;
         
-        switch(Type){
-        case LGN1: case LGN2:
-          c = &C; c->Num = Elementary;
-          if(!(cc = (Curve**)Tree_PQuery(M->Curves, &c))){
-            c = Create_Curve(Elementary, MSH_SEGM_LINE, 0, NULL,
-                             NULL, 0, 1, 0., 1.);
-            Tree_Add(M->Curves, &c);
-          }
-          else
-            c = *cc;
-          break;
-        case TRI1: case QUA1: case TRI2: case QUA2:
-          s = &S; s->Num = Elementary;
-          if(!(ss = (Surface**)Tree_PQuery(M->Surfaces, &s))){
-            s = Create_Surface(Elementary, MSH_SURF_PLAN, Elementary);
-            Tree_Add(M->Surfaces, &s);
-          }
-          else
-            s = *ss;
-          break;
-        case TET1: case HEX1: case PRI1: case TET2: case HEX2: case PRI2: 
-          v = &V; v->Num = Elementary;
-          if(!(vv = (Volume**)Tree_PQuery(M->Volumes, &v))){
-            v = Create_Volume(Elementary, MSH_VOLUME, Elementary);
-            Tree_Add(M->Volumes, &v);
-          }
-          else
-            v = *vv;
-          break;
-        default :
-          break;
-        }
-
-        for(i=0 ; i<Nbr_Nodes ; i++) {
-          vertsp[i] = &verts[i];
-          if(!(vertspp = (Vertex**)Tree_PQuery(M->Vertices, &vertsp[i])))
-            Msg(GERROR, "Unknown Vertex %d in Element %d", verts[i].Num, Num);
-          else
-            vertsp[i] = *vertspp;
-        }
-
-        switch(Type){
-        case LGN1:
-          simp = Create_Simplex(vertsp[0], vertsp[1], NULL , NULL);
-          simp->Num = Num ;
-          simp->iEnt = Elementary ;
-          Tree_Insert(c->Simplexes, &simp) ;
-          Tree_Insert(M->Simplexes, &simp) ; 
-          break;
-        case TRI1:
-          simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], NULL);
-          simp->Num = Num ;
-          simp->iEnt = Elementary ;
-          Tree_Insert(s->Simplexes, &simp) ;
-          Tree_Insert(M->Simplexes, &simp) ;
-          break;
-        case QUA1:
-          simp = Create_Quadrangle(vertsp[0], vertsp[1], vertsp[2], vertsp[3]);
-          simp->Num = Num ;
-          simp->iEnt = Elementary ;
-          Tree_Insert(s->Simplexes, &simp) ;
-          Tree_Insert(M->Simplexes, &simp) ;
-          break;
-        case TET1:
-          simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], vertsp[3]);
-          simp->Num = Num ;
-          simp->iEnt = Elementary ;
-          Tree_Insert(v->Simplexes, &simp) ;
-          Tree_Insert(M->Simplexes, &simp) ;
-          break;
-        case HEX1:
-          hex = Create_Hexahedron(vertsp[0], vertsp[1], vertsp[2], vertsp[3],
-                                  vertsp[4], vertsp[5], vertsp[6], vertsp[7]);
-          hex->Num = Num ;
-          hex->iEnt = Elementary ;
-          Tree_Insert(v->Hexahedra, &hex) ;
-          break;
-        case PRI1:
-          pri = Create_Prism(vertsp[0], vertsp[1], vertsp[2], 
-                             vertsp[3], vertsp[4], vertsp[5]);
-          pri->Num = Num ;
-          pri->iEnt = Elementary ;
-          Tree_Insert(v->Prisms, &pri) ;
-          break;
-        case PNT:
-          break;
-        default :
-          Msg(WARNING, "Unknown Type of Element in Read_Mesh");
-          break;
-        }
+	if(Elementary >= 0)
+	  {
+	    switch(Type){
+	    case LGN1: case LGN2:
+	      c = &C; c->Num = Elementary;
+	      if(!(cc = (Curve**)Tree_PQuery(M->Curves, &c))){
+		c = Create_Curve(Elementary, MSH_SEGM_LINE, 0, NULL,
+				 NULL, 0, 1, 0., 1.);
+		Tree_Add(M->Curves, &c);
+	      }
+	      else
+		c = *cc;
+	      break;
+	    case TRI1: case QUA1: case TRI2: case QUA2:
+	      s = &S; s->Num = Elementary;
+	      if(!(ss = (Surface**)Tree_PQuery(M->Surfaces, &s))){
+		s = Create_Surface(Elementary, MSH_SURF_PLAN, Elementary);
+		Tree_Add(M->Surfaces, &s);
+	      }
+	      else
+		s = *ss;
+	      break;
+	    case TET1: case HEX1: case PRI1: case TET2: case HEX2: case PRI2: 
+	      v = &V; v->Num = Elementary;
+	      if(!(vv = (Volume**)Tree_PQuery(M->Volumes, &v))){
+		v = Create_Volume(Elementary, MSH_VOLUME, Elementary);
+		Tree_Add(M->Volumes, &v);
+	      }
+	      else
+		v = *vv;
+	      break;
+	    default :
+	      break;
+	    }
+
+	    for(i=0 ; i<Nbr_Nodes ; i++) {
+	      vertsp[i] = &verts[i];
+	      if(!(vertspp = (Vertex**)Tree_PQuery(M->Vertices, &vertsp[i])))
+		Msg(GERROR, "Unknown Vertex %d in Element %d", verts[i].Num, Num);
+	      else
+		vertsp[i] = *vertspp;
+	    }
+	    
+	    switch(Type){
+	    case LGN1:
+	      simp = Create_Simplex(vertsp[0], vertsp[1], NULL , NULL);
+	      simp->Num = Num ;
+	      simp->iEnt = Elementary ;
+	      Tree_Insert(c->Simplexes, &simp) ;
+	      Tree_Insert(M->Simplexes, &simp) ; 
+	      break;
+	    case TRI1:
+	      simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], NULL);
+	      simp->Num = Num ;
+	      simp->iEnt = Elementary ;
+	      Tree_Insert(s->Simplexes, &simp) ;
+	      Tree_Insert(M->Simplexes, &simp) ;
+	      break;
+	    case QUA1:
+	      simp = Create_Quadrangle(vertsp[0], vertsp[1], vertsp[2], vertsp[3]);
+	      simp->Num = Num ;
+	      simp->iEnt = Elementary ;
+	      Tree_Insert(s->Simplexes, &simp) ;
+	      Tree_Insert(M->Simplexes, &simp) ;
+	      break;
+	    case TET1:
+	      simp = Create_Simplex(vertsp[0], vertsp[1], vertsp[2], vertsp[3]);
+	      simp->Num = Num ;
+	      simp->iEnt = Elementary ;
+	      Tree_Insert(v->Simplexes, &simp) ;
+	      Tree_Insert(M->Simplexes, &simp) ;
+	      break;
+	    case HEX1:
+	      hex = Create_Hexahedron(vertsp[0], vertsp[1], vertsp[2], vertsp[3],
+				      vertsp[4], vertsp[5], vertsp[6], vertsp[7]);
+	      hex->Num = Num ;
+	      hex->iEnt = Elementary ;
+	      Tree_Insert(v->Hexahedra, &hex) ;
+	      break;
+	    case PRI1:
+	      pri = Create_Prism(vertsp[0], vertsp[1], vertsp[2], 
+				 vertsp[3], vertsp[4], vertsp[5]);
+	      pri->Num = Num ;
+	      pri->iEnt = Elementary ;
+	      Tree_Insert(v->Prisms, &pri) ;
+	      break;
+	    case PNT:
+	      break;
+	    default :
+	      Msg(WARNING, "Unknown Type of Element in Read_Mesh");
+	      break;
+	    }
+	  }
       }
 
     }
diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index 2bf1056bc0..5a49f613b2 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -169,7 +169,7 @@
 #line 1 "Gmsh.y"
  
 
-// $Id: Gmsh.tab.cpp,v 1.63 2001-01-11 22:27:55 geuzaine Exp $
+// $Id: Gmsh.tab.cpp,v 1.64 2001-01-17 21:26:24 remacle Exp $
 
 #include <stdarg.h>
 
diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp
index 6dcbe2a855..3742be1300 100644
--- a/Parser/Gmsh.yy.cpp
+++ b/Parser/Gmsh.yy.cpp
@@ -2,7 +2,7 @@
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.63 2001-01-11 22:27:56 geuzaine Exp $
+ * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.64 2001-01-17 21:26:25 remacle Exp $
  */
 
 #define FLEX_SCANNER
@@ -977,7 +977,7 @@ char *yytext;
 #define INITIAL 0
 #line 2 "Gmsh.l"
 
-// $Id: Gmsh.yy.cpp,v 1.63 2001-01-11 22:27:56 geuzaine Exp $
+// $Id: Gmsh.yy.cpp,v 1.64 2001-01-17 21:26:25 remacle Exp $
 
 #include <stdio.h>
 #include <stdlib.h>
-- 
GitLab