diff --git a/Common/Makefile b/Common/Makefile
index a2f309e549f866bfbf507762f364df1d9ac7288f..9b102cc1bfb1e387a2c08087506d11b8ef6b98cd 100644
--- a/Common/Makefile
+++ b/Common/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.92 2006-07-12 07:24:12 geuzaine Exp $
+# $Id: Makefile,v 1.93 2006-07-14 12:17:05 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -118,7 +118,13 @@ Options.o: Options.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Geo/ExtrudeParams.h \
   ../Common/GmshDefines.h ../Mesh/Metric.h ../Mesh/Vertex.h \
   ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h ../Graphics/Draw.h \
-  Context.h Options.h ../Fltk/Solvers.h ../Fltk/GUI.h \
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h Context.h Options.h ../Fltk/Solvers.h ../Fltk/GUI.h \
   ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h ../Common/GmshUI.h \
   ../Fltk/Popup_Button.h
 # 1 "/Users/geuzaine/.gmsh/Common//"
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 2c86b4054be98c6928aa7dd2b90c393a74c2eee7..330198107e6c214b4c897dd02920c57473a28cd9 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.418 2006-07-12 07:24:12 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.419 2006-07-14 12:17:05 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -46,12 +46,13 @@
 #include "Numeric.h"
 #include "Solvers.h"
 #include "OS.h"
+#include "GModel.h"
 
 using namespace std;
 
+extern Context_T CTX;
 extern GUI *WID;
 extern Mesh *THEM;
-extern Context_T CTX;
 
 // Helper routines
 
@@ -938,9 +939,9 @@ void general_options_color_scheme_cb(CALLBACK_ARGS)
 
 void general_options_rotation_center_select_cb(CALLBACK_ARGS)
 {
-  Vertex *v[SELECTION_MAX_HITS];
-  Curve *c[SELECTION_MAX_HITS];
-  Surface *s[SELECTION_MAX_HITS];
+  GVertex *v[SELECTION_MAX_HITS];
+  GEdge *c[SELECTION_MAX_HITS];
+  GFace *s[SELECTION_MAX_HITS];
   int ne;
 
   opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1);
@@ -952,14 +953,14 @@ void general_options_rotation_center_select_cb(CALLBACK_ARGS)
   if(ib == 'l') {
     // This would bypass the "Apply" button... Not necessarily bad,
     // but it's not consistent with the rest of the GUI.
-    //opt_general_rotation_center0(0, GMSH_SET|GMSH_GUI, v->Pos.X);
-    //opt_general_rotation_center1(0, GMSH_SET|GMSH_GUI, v->Pos.Y);
-    //opt_general_rotation_center2(0, GMSH_SET|GMSH_GUI, v->Pos.Z);
+    //opt_general_rotation_center0(0, GMSH_SET|GMSH_GUI, v->x());
+    //opt_general_rotation_center1(0, GMSH_SET|GMSH_GUI, v->y());
+    //opt_general_rotation_center2(0, GMSH_SET|GMSH_GUI, v->z());
 
     // This is more conform to the way we do things elsewhere:
-    WID->gen_value[8]->value(v[0]->Pos.X);
-    WID->gen_value[9]->value(v[0]->Pos.Y);
-    WID->gen_value[10]->value(v[0]->Pos.Z);
+    WID->gen_value[8]->value(v[0]->x());
+    WID->gen_value[9]->value(v[0]->y());
+    WID->gen_value[10]->value(v[0]->z());
   }
   ZeroHighlight();
   Draw();
@@ -1886,9 +1887,9 @@ void geometry_elementary_add_new_point_cb(CALLBACK_ARGS)
     WID->g_opengl_window->AddPointMode = true;
     Msg(ONSCREEN, "Move mouse and/or enter coordinates\n"
 	"[Press 'Shift' to hold position, 'e' to add point or 'q' to abort]");
-    Vertex *v[SELECTION_MAX_HITS];
-    Curve *c[SELECTION_MAX_HITS];
-    Surface *s[SELECTION_MAX_HITS];
+    GVertex *v[SELECTION_MAX_HITS];
+    GEdge *c[SELECTION_MAX_HITS];
+    GFace *s[SELECTION_MAX_HITS];
     int ne;
     char ib = SelectEntity(ENT_NONE, &ne, v, c, s);
     if(ib == 'e'){
@@ -1912,9 +1913,9 @@ void geometry_elementary_add_new_point_cb(CALLBACK_ARGS)
 
 static void _new_multiline(int type)
 {
-  Vertex *v[SELECTION_MAX_HITS];
-  Curve *c[SELECTION_MAX_HITS];
-  Surface *s[SELECTION_MAX_HITS];
+  GVertex *v[SELECTION_MAX_HITS];
+  GEdge *c[SELECTION_MAX_HITS];
+  GFace *s[SELECTION_MAX_HITS];
   int n, p[100], ne;
 
   opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1);
@@ -1933,7 +1934,7 @@ static void _new_multiline(int type)
     char ib = SelectEntity(ENT_POINT, &ne, v, c, s);
     if(ib == 'l') {
       for(int i = 0; i < ne; i++)
-	p[n++] = v[i]->Num;
+	p[n++] = v[i]->tag();
     }
     if(ib == 'r') {
       Msg(WARNING, "Entity de-selection not supported yet during multi-line creation");
@@ -1985,9 +1986,9 @@ void geometry_elementary_add_new_line_cb(CALLBACK_ARGS)
   //
   //_new_multiline(0);
   //
-  Vertex *v[SELECTION_MAX_HITS];
-  Curve *c[SELECTION_MAX_HITS];
-  Surface *s[SELECTION_MAX_HITS];
+  GVertex *v[SELECTION_MAX_HITS];
+  GEdge *c[SELECTION_MAX_HITS];
+  GFace *s[SELECTION_MAX_HITS];
   int n, p[100], ne;
 
   opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1);
@@ -2005,7 +2006,7 @@ void geometry_elementary_add_new_line_cb(CALLBACK_ARGS)
 	  "[Press 'u' to undo last selection or 'q' to abort]");
     char ib = SelectEntity(ENT_POINT, &ne, v, c, s);
     if(ib == 'l') {
-      p[n++] = v[0]->Num;
+      p[n++] = v[0]->tag();
     }
     if(ib == 'r') {
       Msg(WARNING, "Entity de-selection not supported yet during line creation");
@@ -2047,9 +2048,9 @@ void geometry_elementary_add_new_bspline_cb(CALLBACK_ARGS)
 
 void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS)
 {
-  Vertex *v[SELECTION_MAX_HITS];
-  Curve *c[SELECTION_MAX_HITS];
-  Surface *s[SELECTION_MAX_HITS];
+  GVertex *v[SELECTION_MAX_HITS];
+  GEdge *c[SELECTION_MAX_HITS];
+  GFace *s[SELECTION_MAX_HITS];
   int n, p[100], ne;
 
   opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1);
@@ -2070,7 +2071,7 @@ void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS)
 	  "[Press 'u' to undo last selection or 'q' to abort]");
     char ib = SelectEntity(ENT_POINT, &ne, v, c, s);
     if(ib == 'l') {
-      p[n++] = v[0]->Num;
+      p[n++] = v[0]->tag();
     }
     if(ib == 'r') {
       Msg(WARNING, "Entity de-selection not supported yet during circle creation");
@@ -2102,9 +2103,9 @@ void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS)
 
 void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS)
 {
-  Vertex *v[SELECTION_MAX_HITS];
-  Curve *c[SELECTION_MAX_HITS];
-  Surface *s[SELECTION_MAX_HITS];
+  GVertex *v[SELECTION_MAX_HITS];
+  GEdge *c[SELECTION_MAX_HITS];
+  GFace *s[SELECTION_MAX_HITS];
   int n, p[100], ne;
 
   opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1);
@@ -2128,7 +2129,7 @@ void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS)
 	  "[Press 'u' to undo last selection or 'q' to abort]");
     char ib = SelectEntity(ENT_POINT, &ne, v, c, s);
     if(ib == 'l') {
-      p[n++] = v[0]->Num;
+      p[n++] = v[0]->tag();
     }
     if(ib == 'r') {
       Msg(WARNING, "Entity de-selection not supported yet during ellipse creation");
@@ -2160,9 +2161,9 @@ void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS)
 
 static void _new_surface_volume(int mode)
 {
-  Vertex *v[SELECTION_MAX_HITS];
-  Curve *c[SELECTION_MAX_HITS];
-  Surface *s[SELECTION_MAX_HITS];
+  GVertex *v[SELECTION_MAX_HITS];
+  GEdge *c[SELECTION_MAX_HITS];
+  GFace *s[SELECTION_MAX_HITS];
   int type, num, ne;
 
   List_T *List1 = List_Create(10, 10, sizeof(int));
@@ -2224,7 +2225,7 @@ static void _new_surface_volume(int mode)
 	Msg(WARNING, "Entity de-selection not supported yet during surface/volume creation");
       }
       if(ib == 'l') {
-	int num = (type == ENT_LINE) ? c[0]->Num : s[0]->Num;
+	int num = (type == ENT_LINE) ? c[0]->tag() : s[0]->tag();
 	if(SelectContour(type, num, List1)) {
 	  if(type == ENT_LINE)
 	    add_lineloop(List1, CTX.filename, &num);
@@ -2262,7 +2263,7 @@ static void _new_surface_volume(int mode)
 	      }
 	    }
 	    if(ib == 'l') {
-	      num = (type == ENT_LINE) ? c[0]->Num : s[0]->Num;
+	      num = (type == ENT_LINE) ? c[0]->tag() : s[0]->tag();
 	      if(SelectContour(type, num, List1)) {
 		if(type == ENT_LINE)
 		  add_lineloop(List1, CTX.filename, &num);
@@ -2319,9 +2320,9 @@ static void _action_point_line_surface_volume(int action, int mode, char *what)
 {
   extern void BDS_To_Mesh(Mesh *m);
 
-  Vertex *v[SELECTION_MAX_HITS];
-  Curve *c[SELECTION_MAX_HITS];
-  Surface *s[SELECTION_MAX_HITS];
+  GVertex *v[SELECTION_MAX_HITS];
+  GEdge *c[SELECTION_MAX_HITS];
+  GFace *s[SELECTION_MAX_HITS];
   int type, ne;
   char *str;
 
@@ -2392,18 +2393,22 @@ static void _action_point_line_surface_volume(int action, int mode, char *what)
       // ordering (this is slower, but this way undo works as
       // expected)
       for(int i = 0; i < ne; i++){
+	int tag;
 	switch (type) {
 	case ENT_POINT: 
-	  if(List_ISearchSeq(List1, &v[i]->Num, fcmp_int) < 0)
-	    List_Add(List1, &v[i]->Num);
+	  tag = v[i]->tag();
+	  if(List_ISearchSeq(List1, &tag, fcmp_int) < 0)
+	    List_Add(List1, &tag);
 	  break;
 	case ENT_LINE:
-	  if(List_ISearchSeq(List1, &c[i]->Num, fcmp_int) < 0)
-	    List_Add(List1, &c[i]->Num);
+	  tag = c[i]->tag();
+	  if(List_ISearchSeq(List1, &tag, fcmp_int) < 0)
+	    List_Add(List1, &tag);
 	  break;
-	case ENT_SURFACE: 
-	  if(List_ISearchSeq(List1, &s[i]->Num, fcmp_int) < 0)
-	    List_Add(List1, &s[i]->Num);
+	case ENT_SURFACE:
+	  tag = s[i]->tag();
+	  if(List_ISearchSeq(List1, &tag, fcmp_int) < 0)
+	    List_Add(List1, &tag);
 	  break;
 	}
       }
@@ -2413,22 +2418,25 @@ static void _action_point_line_surface_volume(int action, int mode, char *what)
       // ordering (this is slower, but this way undo works as
       // expected)
       for(int i = 0; i < ne; i++){
-	int index;
+	int index, tag;
 	switch (type) {
 	case ENT_POINT:
-	  index = List_ISearchSeq(List1, &v[i]->Num, fcmp_int); 
+	  tag = v[i]->tag();
+	  index = List_ISearchSeq(List1, &tag, fcmp_int); 
 	  if(index >= 0) List_PSuppress(List1, index);
-	  ZeroHighlightEntity(v[i], NULL, NULL);
+	  ZeroHighlightEntityNum(tag, 0, 0);
 	  break;
 	case ENT_LINE:
-	  index = List_ISearchSeq(List1, &c[i]->Num, fcmp_int); 
+	  tag = c[i]->tag();
+	  index = List_ISearchSeq(List1, &tag, fcmp_int); 
 	  if(index >= 0) List_PSuppress(List1, index);
-	  ZeroHighlightEntity(NULL, c[i], NULL);
+	  ZeroHighlightEntityNum(0, tag, 0);
 	  break;
 	case ENT_SURFACE:
-	  index = List_ISearchSeq(List1, &s[i]->Num, fcmp_int); 
+	  tag = s[i]->tag();
+	  index = List_ISearchSeq(List1, &tag, fcmp_int); 
 	  if(index >= 0) List_PSuppress(List1, index);
-	  ZeroHighlightEntity(NULL, NULL, s[i]);
+	  ZeroHighlightEntityNum(0, 0, tag);
 	  break;
 	}
       }
@@ -2967,9 +2975,9 @@ void mesh_define_transfinite_cb(CALLBACK_ARGS)
 
 static void _add_transfinite_elliptic(int type, int dim)
 {
-  Vertex *v[SELECTION_MAX_HITS];
-  Curve *c[SELECTION_MAX_HITS];
-  Surface *s[SELECTION_MAX_HITS];
+  GVertex *v[SELECTION_MAX_HITS];
+  GEdge *c[SELECTION_MAX_HITS];
+  GFace *s[SELECTION_MAX_HITS];
   char ib;
   int n, p[100], ne;
 
@@ -3035,10 +3043,11 @@ static void _add_transfinite_elliptic(int type, int dim)
     if(ib == 'l') {
       switch (dim) {
       case 1:
-        p[n++] = c[0]->Num;
+        p[n++] = c[0]->tag();
         break;
       case 2:
-        p[n++] = s[0]->Num; // fall-through
+        p[n++] = s[0]->tag(); 
+	// fall-through
       case 3:
         while(1) {
 	  if(n == ((dim == 2) ? 1 : 0))
@@ -3049,7 +3058,7 @@ static void _add_transfinite_elliptic(int type, int dim)
 		"[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]");
           ib = SelectEntity(ENT_POINT, &ne, v, c, s);
           if(ib == 'l') {
-            p[n++] = v[0]->Num;
+            p[n++] = v[0]->tag();
           }
 	  if(ib == 'u') {
 	    if(n > ((dim == 2) ? 1 : 0)){
diff --git a/Fltk/Makefile b/Fltk/Makefile
index dafb49567c8fe9b82712dd4d27eb0171165c10c6..a8e0023e3951df0e480b2a309657b57a7f71f8d4 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.89 2006-07-12 07:24:13 geuzaine Exp $
+# $Id: Makefile,v 1.90 2006-07-14 12:17:05 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -80,14 +80,15 @@ Main.o: Main.cpp GUI.h Opengl_Window.h ../Mesh/Mesh.h ../DataStr/List.h \
   ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \
   ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h ../Geo/Geo.h \
-  ../Graphics/Draw.h ../Common/Context.h ../Parser/Parser.h \
-  ../Parser/OpenFile.h ../Common/CommandLine.h Solvers.h ../Geo/GModel.h \
-  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
-  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
-  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h
+  ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h \
+  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h \
+  ../Geo/GEntity.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
+  ../Geo/GRegion.h ../Geo/GEntity.h ../Common/Context.h \
+  ../Parser/Parser.h ../Parser/OpenFile.h ../Common/CommandLine.h \
+  Solvers.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
@@ -115,10 +116,16 @@ GUI.o: GUI.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h \
   ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/GmshDefines.h \
   ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
-  ../Mesh/Matrix.h ../Geo/ExtrudeParams.h ../Graphics/Draw.h GUI.h \
-  Opengl_Window.h Colorbar_Window.h Popup_Button.h Callbacks.h Bitmaps.h \
-  Win32Icon.h ../Parser/OpenFile.h ../Common/CommandLine.h Solvers.h \
-  Shortcut_Window.h
+  ../Mesh/Matrix.h ../Geo/ExtrudeParams.h ../Graphics/Draw.h \
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h GUI.h Opengl_Window.h Colorbar_Window.h Popup_Button.h \
+  Callbacks.h Bitmaps.h Win32Icon.h ../Parser/OpenFile.h \
+  ../Common/CommandLine.h Solvers.h Shortcut_Window.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 GUI_Extras.o: GUI_Extras.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
@@ -134,7 +141,13 @@ GUI_Extras.o: GUI_Extras.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Common/Context.h ../Graphics/Draw.h ../Common/Views.h \
   ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Callbacks.o: Callbacks.cpp ../Mesh/BDS.h ../contrib/ANN/include/ANN/ANN.h \
   ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
@@ -149,45 +162,63 @@ Callbacks.o: Callbacks.cpp ../Mesh/BDS.h ../contrib/ANN/include/ANN/ANN.h \
   ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/GmshDefines.h \
   ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
   ../Mesh/Matrix.h ../Geo/ExtrudeParams.h ../Geo/ExtractContour.h \
-  ../Graphics/Draw.h ../Graphics/CreateFile.h ../Parser/OpenFile.h \
-  ../Common/CommandLine.h ../Common/Context.h ../Common/Options.h GUI.h \
-  Opengl_Window.h Colorbar_Window.h Popup_Button.h GUI_Extras.h \
-  Callbacks.h ../Plugin/Plugin.h ../Plugin/PluginManager.h \
-  ../Plugin/Plugin.h ../Common/Visibility.h Solvers.h ../Common/OS.h
+  ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h \
+  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h \
+  ../Geo/GEntity.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
+  ../Geo/GRegion.h ../Geo/GEntity.h ../Graphics/CreateFile.h \
+  ../Parser/OpenFile.h ../Common/CommandLine.h ../Common/Context.h \
+  ../Common/Options.h GUI.h Opengl_Window.h Colorbar_Window.h \
+  Popup_Button.h GUI_Extras.h Callbacks.h ../Plugin/Plugin.h \
+  ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Common/Visibility.h \
+  Solvers.h ../Common/OS.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
   ../Common/GmshUI.h ../Numeric/Numeric.h ../Common/Context.h \
-  ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Vertex.h ../Mesh/Element.h \
-  ../Mesh/Face.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Geo/ExtrudeParams.h \
-  ../Common/VertexArray.h ../Common/SmoothNormals.h \
-  ../Common/GmshDefines.h ../Mesh/Metric.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h ../Graphics/Draw.h \
-  ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
+  ../Geo/Geo.h ../Graphics/Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h GUI.h Opengl_Window.h \
-  Colorbar_Window.h Popup_Button.h ../Graphics/gl2ps.h \
-  /usr/local/include/FL/images/zlib.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h GUI.h Opengl_Window.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
+  ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Vertex.h \
+  ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Mesh/Vertex.h \
+  ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h Colorbar_Window.h \
+  Popup_Button.h ../Graphics/gl2ps.h /usr/local/include/FL/images/zlib.h \
   /usr/local/include/FL/images/zconf.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Opengl_Window.o: Opengl_Window.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
   ../Numeric/Numeric.h ../Common/GmshUI.h ../Common/Context.h \
-  ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Vertex.h ../Mesh/Element.h \
-  ../Mesh/Face.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Geo/ExtrudeParams.h \
-  ../Common/VertexArray.h ../Common/SmoothNormals.h \
-  ../Common/GmshDefines.h ../Mesh/Metric.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h ../Graphics/Draw.h \
-  ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
+  ../Geo/Geo.h ../Graphics/Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h GUI.h Opengl_Window.h \
-  Colorbar_Window.h Popup_Button.h
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h GUI.h Opengl_Window.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
+  ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Vertex.h \
+  ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
+  ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Mesh/Vertex.h \
+  ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h Colorbar_Window.h \
+  Popup_Button.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Colorbar_Window.o: Colorbar_Window.cpp ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
@@ -221,4 +252,11 @@ Solvers.o: Solvers.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Common/ColorTable.h Popup_Button.h ../Graphics/Draw.h \
   ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Context.h
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Common/Context.h
diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp
index 100559335a59e66cd93b311a4ca51247393f3aba..152bdfac610331d9a96d1cb1b90066910e76594a 100644
--- a/Fltk/Opengl.cpp
+++ b/Fltk/Opengl.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl.cpp,v 1.59 2006-07-12 07:24:13 geuzaine Exp $
+// $Id: Opengl.cpp,v 1.60 2006-07-14 12:17:05 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -24,10 +24,10 @@
 #include "Numeric.h"
 #include "Context.h"
 #include "Geo.h"
-#include "Mesh.h"
 #include "Draw.h"
 #include "GUI.h"
 #include "gl2ps.h"
+#include "GModel.h"
 
 extern GUI *WID;
 extern Context_T CTX;
@@ -185,9 +185,9 @@ void Draw_OnScreenMessages()
 // Select entity routine
 
 char SelectEntity(int type, int *n,
-		  Vertex *v[SELECTION_MAX_HITS], 
-		  Curve *c[SELECTION_MAX_HITS], 
-		  Surface *s[SELECTION_MAX_HITS])
+		  GVertex *v[SELECTION_MAX_HITS], 
+		  GEdge *c[SELECTION_MAX_HITS], 
+		  GFace *s[SELECTION_MAX_HITS])
 {
   if(!WID) return 'q';
 
@@ -203,9 +203,9 @@ char SelectEntity(int type, int *n,
   while(1) {
     *n = 0;
     for(int i = 0; i < SELECTION_MAX_HITS; i++){
-      v[i] = NULL;
-      c[i] = NULL;
-      s[i] = NULL;
+      v[i] = 0;
+      c[i] = 0;
+      s[i] = 0;
     }
 
     WID->wait();
diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp
index c487a01287200a41d7d1fcaa36576c91caa254da..080d68773aa8a04498ce04decca3530c8029590c 100644
--- a/Fltk/Opengl_Window.cpp
+++ b/Fltk/Opengl_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl_Window.cpp,v 1.61 2006-07-12 07:24:13 geuzaine Exp $
+// $Id: Opengl_Window.cpp,v 1.62 2006-07-14 12:17:05 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -24,10 +24,10 @@
 #include "GmshUI.h"
 #include "Context.h"
 #include "Geo.h"
-#include "Mesh.h"
 #include "Draw.h"
 #include "GUI.h"
 #include "Opengl_Window.h"
+#include "GModel.h"
 
 extern GUI *WID;
 extern Context_T CTX;
@@ -178,9 +178,9 @@ void Opengl_Window::draw()
 
 int Opengl_Window::handle(int event)
 {
-  Vertex *v[SELECTION_MAX_HITS];
-  Curve *c[SELECTION_MAX_HITS];
-  Surface *s[SELECTION_MAX_HITS];
+  GVertex *v[SELECTION_MAX_HITS];
+  GEdge *c[SELECTION_MAX_HITS];
+  GFace *s[SELECTION_MAX_HITS];
   double dx, dy;
 
   switch (event) {
diff --git a/Geo/GEdge.h b/Geo/GEdge.h
index 438f6dfe3102f405bed08d21f1eb23ad6ed74948..51db94655f63b5f813e9ec09378a9138f0c9fe9c 100644
--- a/Geo/GEdge.h
+++ b/Geo/GEdge.h
@@ -63,6 +63,13 @@ public:
   virtual int minimumMeshSegments () const {return 1;}
   virtual int minimumDrawSegments () const {return 1;}
 
+  virtual std::string getInfoString()
+  {
+    char tmp[256];
+    sprintf(tmp, "%s %d {%d,%d}", getTypeString().c_str(), tag(), v0->tag(), v1->tag());
+    return std::string(tmp);
+  }
+
 protected:
 
   GVertex *v0,*v1;
diff --git a/Geo/GEntity.h b/Geo/GEntity.h
index 3cdaeb21982da3cde1d496d24de8c80bd3e8a4bd..649aaba86314f9b0b5d81b3dfd4dc576ae57e840 100644
--- a/Geo/GEntity.h
+++ b/Geo/GEntity.h
@@ -25,12 +25,12 @@ public:
 
   enum GeomType{
     Unknown,
-    Discrete,
     Point,
     Line,
     Circle,
     Ellipse,
     ParametricCurve,
+    DiscreteCurve,
     Plane,
     Nurb,
     Cylinder,
@@ -38,8 +38,41 @@ public:
     Cone,
     Torus,
     ParametricSurface,
-    ThreeDimVolume
+    DiscreteSurface,
+    Volume
+  };
+
+  virtual std::string getTypeString(){
+    char *name[] = {
+      "Unknown",
+      "Point",
+      "Line",
+      "Circle",
+      "Ellipse",
+      "ParametricCurve",
+      "DiscreteCurve",
+      "Plane",
+      "Nurb",
+      "Cylinder",
+      "Sphere",
+      "Cone",
+      "Torus",
+      "ParametricSurface",
+      "DiscreteSurface",
+      "Volume"
     };
+    int type = (int)geomType();
+    if(type < 0 || type > sizeof(name))
+      return "Unknown";
+    else
+      return name[type];
+  }
+
+  virtual std::string getInfoString() {
+    char tmp[256];
+    sprintf(tmp, "%s %d", getTypeString().c_str(), tag());
+    return std::string(tmp);
+  }
 
   GEntity(GModel *m, int t) : _model(m),_tag(t){
     drawAttributes.Visible = VIS_GEOM | VIS_MESH; 
@@ -111,7 +144,21 @@ public:
 
 };
 
+class EntityLessThan {
+ public:
+  bool operator()(const GEntity *ent1, const GEntity *ent2) const
+  {
+    return ent1->tag() < ent2->tag();
+  }
+};
 
-#endif
-
+// A dummy non-abstract entity used for sorting
+class dummyEntity : public GEntity {
+public:
+  dummyEntity(GModel *model, int tag) : GEntity(model, tag){}
+  virtual int dim() const {return -1;}
+  virtual GeomType geomType() const {return Unknown;}
+  virtual void * getNativePtr() const {return 0;}
+};
 
+#endif
diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index 7791e61595c2af22f42278f9f2ab2d4345514f47..8edfab243bc75c40e4fe16df8fc2c186b6391356 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -17,54 +17,44 @@ int GModel::numVertex() const
   return vertices.size();
 }
 
+// JF: how can we do the following in a cleaner way???
+
 GRegion * GModel::regionByTag(int n) const
 {
-  std::list<GRegion*>:: const_iterator it = regions.begin();
-  std::list<GRegion*>:: const_iterator end = regions.end();
-  while (it != end)
-    {
-      GRegion *rr = (GRegion*) (*it);
-      if ( rr->tag() == n)return *it;
-      ++it;
-    }
-  return 0;
+  dummyEntity tmp((GModel*)this, n);
+  riter it = regions.find((GRegion*)&tmp);
+  if(it != regions.end())
+    return (GRegion *) (*it);
+  else
+    return 0;
 }
 
 GFace * GModel::faceByTag(int n) const
 {
-  std::list<GFace*>:: const_iterator it = faces.begin();
-  std::list<GFace*>:: const_iterator end = faces.end();
-  while (it != end)
-    {
-      GFace *ff = (GFace*) (*it);
-      if ( ff->tag() == n)return *it;
-      ++it;
-    }
-  return 0;
+  dummyEntity tmp((GModel*)this, n);
+  fiter it = faces.find((GFace*)&tmp);
+  if(it != faces.end())
+    return (GFace *) (*it);
+  else
+    return 0;
 }
 
 GEdge * GModel::edgeByTag(int n) const
 {
-  std::list<GEdge*>:: const_iterator it = edges.begin();
-  std::list<GEdge*>:: const_iterator end = edges.end();
-  while (it != end)
-    {
-      GEdge *ee = (GEdge*) (*it);
-      if ( ee->tag() == n)return *it;
-      ++it;
-    }
-  return 0;
+  dummyEntity tmp((GModel*)this, n);
+  eiter it = edges.find((GEdge*)&tmp);
+  if(it != edges.end())
+    return (GEdge *) (*it);
+  else
+    return 0;
 }
+
 GVertex * GModel::vertexByTag(int n) const
 {
-  std::list<GVertex*>:: const_iterator it = vertices.begin();
-  std::list<GVertex*>:: const_iterator end = vertices.end();
-  while (it != end)
-    {
-      GVertex *vv = (GVertex*) (*it);
-      if ( vv->tag() == n)return *it;
-      ++it;
-    }
-  return 0;
+  dummyEntity tmp((GModel*)this, n);
+  viter it = vertices.find((GVertex*)&tmp);
+  if(it != vertices.end())
+    return (GVertex *) (*it);
+  else
+    return 0;
 }
-
diff --git a/Geo/GModel.h b/Geo/GModel.h
index 7907daaa9d1e7a431a9b88a9e31bf62b119f4e24..d407620a757024472921194055c6508c1a1c30ec 100644
--- a/Geo/GModel.h
+++ b/Geo/GModel.h
@@ -2,6 +2,7 @@
 #define H_GModel
 
 #include <algorithm>
+#include <set>
 #include "GVertex.h"
 #include "GEdge.h"
 #include "GFace.h"
@@ -14,10 +15,10 @@ class GModel
 public:
   virtual ~GModel() {}
 
-  typedef std::list<GRegion*>::iterator riter;
-  typedef std::list<GFace*>  ::iterator   fiter;
-  typedef std::list<GEdge*>  ::iterator   eiter;
-  typedef std::list<GVertex*>::iterator viter;
+  typedef std::set<GRegion*, EntityLessThan>::iterator riter;
+  typedef std::set<GFace*,   EntityLessThan>::iterator fiter;
+  typedef std::set<GEdge*,   EntityLessThan>::iterator eiter;
+  typedef std::set<GVertex*, EntityLessThan>::iterator viter;
 
   /** Returns the geometric tolerance for the entire model. */
   virtual double tolerance() const {return 1.e-14;}
@@ -44,10 +45,10 @@ public:
   virtual GEdge   * edgeByTag  (int n) const;
   virtual GVertex * vertexByTag(int n) const;
 
-  void add(GRegion *r){regions.push_back(r);}
-  void add(GFace *f)  {faces.push_back(f);}
-  void add(GEdge *e)  {edges.push_back(e);}
-  void add(GVertex *v){vertices.push_back(v);}
+  void add(GRegion *r){regions.insert(r);}
+  void add(GFace *f)  {faces.insert(f);}
+  void add(GEdge *e)  {edges.insert(e);}
+  void add(GVertex *v){vertices.insert(v);}
 
   void remove(GRegion *r){regions.erase(std::find(firstRegion(),lastRegion(),r));}
   void remove(GFace *f){faces.erase(std::find(firstFace(),lastFace(),f));}
@@ -57,10 +58,10 @@ public:
 protected:
   std::string modelName;
   GModel(const std::string &name):modelName(name){}
-  std::list<GRegion*> regions;
-  std::list<GFace*> faces;
-  std::list<GEdge*> edges;
-  std::list<GVertex*> vertices;
+  std::set<GRegion*, EntityLessThan> regions;
+  std::set<GFace*, EntityLessThan> faces;
+  std::set<GEdge*, EntityLessThan> edges;
+  std::set<GVertex*, EntityLessThan> vertices;
 };
 
 
diff --git a/Geo/GRegion.h b/Geo/GRegion.h
index 89de9cf2af4cdc22f92709659060cfc54e847b53..6e59dcc02ac87352d51b56145e54cc7475645a4d 100644
--- a/Geo/GRegion.h
+++ b/Geo/GRegion.h
@@ -8,11 +8,11 @@ class GRegion : public GEntity {
  protected:
   std::list<GFace *> l_faces;
   std::list<int>     l_dirs;
-public:
+ public:
   GRegion(GModel *model, int tag) : GEntity (model,tag) {}
   virtual ~GRegion();
   virtual int dim() const {return 3;}
-  virtual GeomType geomType() const {return ThreeDimVolume;}
+  virtual GeomType geomType() const {return Volume;}
 };
 
 #endif
diff --git a/Geo/GVertex.h b/Geo/GVertex.h
index dd837d93e7bdea3f6b332cfa88bdaae1f0801c62..d8e772def7eaa783e620ebc44f0786e0a20f71c7 100644
--- a/Geo/GVertex.h
+++ b/Geo/GVertex.h
@@ -19,6 +19,12 @@ public:
   virtual int dim() const {return 0;}
   virtual GeomType geomType() const {return Point;}
   virtual double prescribedMeshSizeAtVertex() const {return 0;}
+  virtual std::string getInfoString()
+  {
+    char tmp[256];
+    sprintf(tmp, "%s %d {%g,%g,%g}", getTypeString().c_str(), tag(), x(), y(), z());
+    return std::string(tmp);
+  }
 
 protected:
   std::list<GEdge*> l_edges;
diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index f82020d6ed8d00b12e237360ec486746c4037b2c..177262972cfe2dd3dfbbb09bc23f1b173b002ec2 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -1,4 +1,4 @@
-// $Id: Geo.cpp,v 1.50 2006-01-14 22:32:58 geuzaine Exp $
+// $Id: Geo.cpp,v 1.51 2006-07-14 12:17:06 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -25,8 +25,10 @@
 #include "CAD.h"
 #include "Parser.h"
 #include "Context.h"
+#include "gmshModel.h"
 
 extern Context_T CTX;
+extern GModel *GMODEL;
 
 #define BUFFSIZE 128000
 
@@ -97,6 +99,9 @@ void add_infile(char *text, char *fich)
   fclose(yyin);
   fprintf(file, "%s\n", text);
   fclose(file);
+
+  if(GMODEL) delete GMODEL;
+  GMODEL = new gmshModel;
 }
 
 void coherence(char *fich)
diff --git a/Geo/Makefile b/Geo/Makefile
index 560782d6a4df1d597ab35535657d2fb0a74f7b0c..132accadcef68e5254538ba77436cda54e4b9301 100644
--- a/Geo/Makefile
+++ b/Geo/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.78 2006-07-12 07:24:13 geuzaine Exp $
+# $Id: Makefile,v 1.79 2006-07-14 12:17:06 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -114,7 +114,10 @@ Geo.o: Geo.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshDefines.h ../Mesh/Metric.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
-  ExtrudeParams.h ../Parser/Parser.h ../Common/Context.h
+  ExtrudeParams.h ../Parser/Parser.h ../Common/Context.h gmshModel.h \
+  GModel.h GVertex.h GEntity.h Range.h SPoint3.h SBoundingBox3d.h \
+  MVertex.h GPoint.h GEdge.h SVector3.h SPoint2.h GFace.h Pair.h \
+  GRegion.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 GeoUtils.o: GeoUtils.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
diff --git a/Geo/gmshEdge.cpp b/Geo/gmshEdge.cpp
index 8327e818e0a1ec58169b91e39423c6fa08c210da..e443e271a07a30698a4430e933bf2ff2860d4514 100644
--- a/Geo/gmshEdge.cpp
+++ b/Geo/gmshEdge.cpp
@@ -118,7 +118,7 @@ GEntity::GeomType gmshEdge::geomType() const
   case MSH_SEGM_BEZIER: 
   case MSH_SEGM_NURBS:
   case MSH_SEGM_SPLN: return Nurb; 
-  case MSH_SEGM_DISCRETE: return Discrete; 
+  case MSH_SEGM_DISCRETE: return DiscreteCurve; 
   default : return Unknown;
   }
 }
@@ -145,11 +145,5 @@ int gmshEdge::minimumMeshSegments () const
 
 int gmshEdge::minimumDrawSegments () const
 {
-  if(geomType() == Circle || geomType() == Ellipse)
-    return (int)(fabs(c->Circle.t1 - c->Circle.t2) *
-		 (double)CTX.geom.circle_points / Pi) - 1;
-  else if(geomType() == ParametricCurve || geomType() == Nurb)
-    return CTX.geom.circle_points;
-  else
-    return GEdge::minimumDrawSegments () ;
+  return CTX.geom.circle_points;
 }
diff --git a/Geo/gmshFace.cpp b/Geo/gmshFace.cpp
index b248dc5927fa822de01e53e51f1f869acb4f1156..5228377822fbc6913867d228296c1c6ac3f89f48 100644
--- a/Geo/gmshFace.cpp
+++ b/Geo/gmshFace.cpp
@@ -142,7 +142,7 @@ GEntity::GeomType gmshFace::geomType() const
   switch(s->Typ){
   case MSH_SURF_NURBS: return Nurb;
   case MSH_SURF_PLAN: return Plane;
-  case MSH_SURF_DISCRETE: return Discrete;
+  case MSH_SURF_DISCRETE: return DiscreteSurface;
   default: return Unknown;
   }
 }
@@ -161,10 +161,7 @@ void * gmshFace::getNativePtr() const
 { return s; }
 
 
-// added 200306
 int gmshFace::containsPoint(const SPoint3 &pt) const
 { 
   throw;
 }
-
-// added 200306
diff --git a/Geo/gmshRegion.cpp b/Geo/gmshRegion.cpp
index 5c741b5971e9932af72953330f5eee50aa588bfc..40623214a6e56811348baf8a0be3b00bea7034b3 100644
--- a/Geo/gmshRegion.cpp
+++ b/Geo/gmshRegion.cpp
@@ -6,7 +6,7 @@
 #include "CAD.h"
 #include "Geo.h"
 
-gmshRegion::gmshRegion(GModel *m,Volume * volume):GRegion (m,volume->Num), v(volume)
+gmshRegion::gmshRegion(GModel *m,::Volume * volume):GRegion (m,volume->Num), v(volume)
 {
   Surface *s;
   int ori;
diff --git a/Geo/gmshRegion.h b/Geo/gmshRegion.h
index 2e90ed092bb0f16b72ed449c28d9442aef6c3792..ba99ab714795472f92331252dda4ac1ab541e282 100644
--- a/Geo/gmshRegion.h
+++ b/Geo/gmshRegion.h
@@ -7,7 +7,7 @@
 
 class gmshRegion : public GRegion {
 public:
-  gmshRegion(GModel *m, Volume *_v);
+  gmshRegion(GModel *m, ::Volume *_v);
   virtual ~gmshRegion() {}
 
   //  virtual GeoRep * geometry(){return 0;}
@@ -15,7 +15,7 @@ public:
   virtual double tolerance() const {return 1.e-14;}
 
   void * getNativePtr() const {return v;}
-  Volume *v;
+  ::Volume *v;
 protected:
 
 };
diff --git a/Graphics/CreateFile.cpp b/Graphics/CreateFile.cpp
index 5967367f0f0817aa8f826909ac57cb3e2c58ccaa..e023b841559c7318ec9e17025d277ffd0ee29853 100644
--- a/Graphics/CreateFile.cpp
+++ b/Graphics/CreateFile.cpp
@@ -1,4 +1,4 @@
-// $Id: CreateFile.cpp,v 1.81 2006-07-12 07:24:13 geuzaine Exp $
+// $Id: CreateFile.cpp,v 1.82 2006-07-14 12:17:06 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -24,6 +24,7 @@
 #include "OpenFile.h"
 #include "Context.h"
 #include "Options.h"
+#include "Mesh.h"
 
 #include "gl2ps.h"
 #include "gl2gif.h"
diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index 7d5f25a2ffdb6ffe801205df79fa0d620bc51a2b..4ea06d3c83f1d68ca0eb0fe62935426c644add7c 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-// $Id: Draw.cpp,v 1.96 2006-07-12 07:24:13 geuzaine Exp $
+// $Id: Draw.cpp,v 1.97 2006-07-14 12:17:06 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -27,9 +27,11 @@
 #include "Draw.h"
 #include "Context.h"
 #include "Numeric.h"
+#include "GModel.h"
 
 extern Mesh *THEM;
 extern Context_T CTX;
+extern GModel *GMODEL;
 
 // Global Draw functions
 
@@ -359,9 +361,9 @@ int fcmp_hit_depth(const void *a, const void *b)
 
 int Process_SelectionBuffer(int type, bool multi,
 			    int x, int y, int w, int h,
-			    Vertex *v[SELECTION_MAX_HITS],
-			    Curve *c[SELECTION_MAX_HITS],
-			    Surface *s[SELECTION_MAX_HITS])
+			    GVertex *v[SELECTION_MAX_HITS],
+			    GEdge *c[SELECTION_MAX_HITS],
+			    GFace *s[SELECTION_MAX_HITS])
 {
   hit hits[SELECTION_BUFFER_SIZE];
   GLuint selectBuf[SELECTION_BUFFER_SIZE];
@@ -432,7 +434,7 @@ int Process_SelectionBuffer(int type, bool multi,
        (type == ENT_SURFACE && hits[i].type == 2)){
       switch (hits[i].type) {
       case 0:
-	if(!(v[j] = FindPoint(hits[i].ient, THEM))){
+	if(!(v[j] = GMODEL->vertexByTag(hits[i].ient))){
 	  Msg(GERROR, "Problem in point selection processing");
 	  return j;
 	}
@@ -440,7 +442,7 @@ int Process_SelectionBuffer(int type, bool multi,
 	if(!multi) return 1;
 	break;
       case 1:
-	if(!(c[j] = FindCurve(hits[i].ient, THEM))){
+	if(!(c[j] = GMODEL->edgeByTag(hits[i].ient))){
 	  Msg(GERROR, "Problem in line selection processing");
 	  return j;
 	}
@@ -448,7 +450,7 @@ int Process_SelectionBuffer(int type, bool multi,
 	if(!multi) return 1;
 	break;
       case 2:
-	if(!(s[j] = FindSurface(hits[i].ient, THEM))){
+	if(!(s[j] = GMODEL->faceByTag(hits[i].ient))){
 	  Msg(GERROR, "Problem in surface selection processing");
 	  return j;
 	}
diff --git a/Graphics/Draw.h b/Graphics/Draw.h
index 1590fa71ddfb1131e010e89373baca6afd41a52d..7f906ccaab9ea826ef28ea66a84a2d24e0aa9d8c 100644
--- a/Graphics/Draw.h
+++ b/Graphics/Draw.h
@@ -22,7 +22,7 @@
 
 #include "List.h"
 #include "Views.h"
-#include "Mesh.h"
+#include "GModel.h"
 
 #define GMSH_RENDER    1
 #define GMSH_SELECT    2
@@ -41,13 +41,13 @@ void InitRenderModel(void);
 
 int Process_SelectionBuffer(int type, bool multi, 
 			    int x, int y, int w, int h, 
-			    Vertex *v[SELECTION_MAX_HITS], 
-			    Curve *c[SELECTION_MAX_HITS], 
-			    Surface *s[SELECTION_MAX_HITS]);
+			    GVertex *v[SELECTION_MAX_HITS], 
+			    GEdge *c[SELECTION_MAX_HITS], 
+			    GFace *s[SELECTION_MAX_HITS]);
 char SelectEntity(int type, int *n,
-		  Vertex *v[SELECTION_MAX_HITS], 
-		  Curve *c[SELECTION_MAX_HITS], 
-		  Surface *s[SELECTION_MAX_HITS]);
+		  GVertex *v[SELECTION_MAX_HITS], 
+		  GEdge *c[SELECTION_MAX_HITS], 
+		  GFace *s[SELECTION_MAX_HITS]);
 
 void unproject(double x, double y, double p[3], double d[3]);
 void Viewport2World(double win[3], double xyz[3]);
@@ -57,9 +57,9 @@ unsigned int PaletteContinuous(Post_View * View, double min, double max, double
 unsigned int PaletteContinuousLinear(Post_View * v, double min, double max, double val);
 unsigned int PaletteDiscrete(Post_View * View, int nbi, int i);
 
-void HighlightEntity(Vertex *v,Curve *c, Surface *s, int permanent);
+void HighlightEntity(GVertex *v, GEdge *c, GFace *s, int permanent);
 void HighlightEntityNum(int v, int c, int s, int permanant);
-void ZeroHighlightEntity(Vertex *v,Curve *c, Surface *s);
+void ZeroHighlightEntity(GVertex *v, GEdge *c, GFace *s);
 void ZeroHighlightEntityNum(int v, int c, int s);
 void ZeroHighlight();
 
diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp
index 55e34ba5cd52ba9e44e8b026a8878f16a0fd214a..6eff60b973fd438bc78738d3661b51bcb3434776 100644
--- a/Graphics/Geom.cpp
+++ b/Graphics/Geom.cpp
@@ -1,4 +1,4 @@
-// $Id: Geom.cpp,v 1.99 2006-07-12 09:07:36 geuzaine Exp $
+// $Id: Geom.cpp,v 1.100 2006-07-14 12:17:06 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -33,12 +33,8 @@
 #include "PluginManager.h"
 #include "gl2ps.h"
 #include "GModel.h"
-#include "GVertex.h"
-#include "GEdge.h"
-#include "GFace.h"
 
 extern Context_T CTX;
-extern Mesh *THEM;
 extern GModel *GMODEL;
 
 // Points
@@ -53,7 +49,7 @@ void Draw_Geo_Vertex(GVertex *v)
     glPushName(v->tag());
   }
   
-  if(v->drawAttributes.Frozen) {
+  if(v->drawAttributes.Frozen > 0) {
     glPointSize(CTX.geom.point_sel_size);
     gl2psPointSize(CTX.geom.point_sel_size * CTX.print.eps_point_size_factor);
     glColor4ubv((GLubyte *) & CTX.color.geom.point_sel);
@@ -66,7 +62,7 @@ void Draw_Geo_Vertex(GVertex *v)
 
   if(CTX.geom.points) {
     if(CTX.geom.point_type == 1) {
-      if(v->drawAttributes.Frozen)
+      if(v->drawAttributes.Frozen > 0)
 	Draw_Sphere(CTX.geom.point_sel_size, v->x(), v->y(), v->z(), 
 		    CTX.geom.light);
       else
@@ -119,7 +115,7 @@ void Draw_Geo_Edge(GEdge *c)
     glPushName(c->tag());
   }
 
-  if(c->drawAttributes.Frozen) {
+  if(c->drawAttributes.Frozen > 0) {
     glLineWidth(CTX.geom.line_sel_width);
     gl2psLineWidth(CTX.geom.line_sel_width * CTX.print.eps_line_width_factor);
     glColor4ubv((GLubyte *) & CTX.color.geom.line_sel);
@@ -135,36 +131,28 @@ void Draw_Geo_Edge(GEdge *c)
   double t_max = t_bounds.high();
 
   if(CTX.geom.lines) {
-    if(c->geomType() == GEntity::Discrete){
+    if(c->geomType() == GEntity::DiscreteCurve){
       // do nothing: we draw the elements in the mesh drawing routines
     }
     else {
       int N = c->minimumDrawSegments() + 1;
       if(CTX.geom.line_type >= 1) {
+	GMSH_Solve_Plugin *sp = 0;
+	if(CTX.geom.line_type == 2)
+	  sp = GMSH_PluginManager::instance()->findSolverPlugin();
 	for(int i = 0; i < N - 1; i++) {
 	  double t1 = t_min + (double)i / (double)(N - 1) * (t_max - t_min);
 	  GPoint p1 = c->point(t1);
 	  double t2 = t_min + (double)(i + 1) / (double)(N - 1) * (t_max - t_min);
 	  GPoint p2 = c->point(t2);
-	  double x[2], y[2], z[2];
-	  x[0] = p1.x();
-	  y[0] = p1.y();
-	  z[0] = p1.z();
-	  x[1] = p2.x();
-	  y[1] = p2.y();
-	  z[1] = p2.z();
-	  Draw_Cylinder(c->drawAttributes.Frozen ? CTX.geom.line_sel_width : CTX.geom.line_width,
-			x, y, z, CTX.geom.light);
-	}
-	if(CTX.geom.line_type == 2) {
-	  GMSH_Solve_Plugin *sp = GMSH_PluginManager::instance()->findSolverPlugin();
+	  double x[2] = {p1.x(), p2.x()};
+	  double y[2] = {p1.y(), p2.y()};
+	  double z[2] = {p1.z(), p2.z()};
+	  Draw_Cylinder(c->drawAttributes.Frozen > 0 ? CTX.geom.line_sel_width : 
+			CTX.geom.line_width, x, y, z, CTX.geom.light);
 	  if(sp) {
 	    Msg(FATAL, "GL_enhanceLine not done");
-	    for(int i = 0; i < N - 1; i++) {
-	      //v = InterpolateCurve(c, (double)i / (double)(NN - 1), 0);
-	      //dv = InterpolateCurve(c, (double)(i + 1) / (double)(NN - 1), 0);
-	      //sp-> GL_enhanceLine (c->Num,&v,&dv);
-	    }
+	    //sp->GL_enhanceLine (c->tag(), &p1, &p2);
 	  }
 	}
       }
@@ -544,19 +532,17 @@ void Draw_NonPlane_Surface(Surface * s)
   }
 }
 
-void Draw_Surface(void *a, void *b)
+void Draw_Geo_Face(GFace *s)
 {
-  Surface *s = *(Surface **) a;
-
-  if(!s || !s->Support || !(s->Visible & VIS_GEOM))
+  if(!(s->drawAttributes.Visible & VIS_GEOM))
     return;
 
   if(CTX.render_mode == GMSH_SELECT) {
     glPushName(2);
-    glPushName(s->Num);
+    glPushName(s->tag());
   }
 
-  if(s->ipar[4] > 0) {
+  if(s->drawAttributes.Frozen > 0) {
     glLineWidth(CTX.geom.line_sel_width / 2.);
     gl2psLineWidth(CTX.geom.line_sel_width / 2. *
 		   CTX.print.eps_line_width_factor);
@@ -568,14 +554,15 @@ void Draw_Surface(void *a, void *b)
     glColor4ubv((GLubyte *) & CTX.color.geom.surface);
   }
 
-  if(s->Typ == MSH_SURF_DISCRETE){
+  if(s->geomType() == GEntity::DiscreteSurface){
     // do nothing: we draw the elements in the mesh drawing routines
   }
-  else if(s->Typ == MSH_SURF_PLAN){
-    Draw_Plane_Surface(s);
+  else if(s->geomType() == GEntity::Plane){
+    Msg(GERROR, "draw plane surface not done yet");
+    //Draw_Plane_Surface(s);
   }
   else{
-    Draw_NonPlane_Surface(s);
+    //Draw_NonPlane_Surface(s);
   }
 
   if(CTX.render_mode == GMSH_SELECT) {
@@ -586,7 +573,7 @@ void Draw_Surface(void *a, void *b)
 
 // Volumes
 
-void Draw_Volumes()
+void Draw_Geo_Region(GRegion *v)
 {
 }
 
@@ -597,161 +584,98 @@ void Draw_Geom()
   if(!GMODEL) return;
   
   if(CTX.geom.points || CTX.geom.points_num)
-    for(GModel::viter v = GMODEL->firstVertex(); v != GMODEL->lastVertex(); v++)
-      Draw_Geo_Vertex(*v);
+    for(GModel::viter it = GMODEL->firstVertex(); it != GMODEL->lastVertex(); it++)
+      Draw_Geo_Vertex(*it);
 
   if(CTX.geom.lines || CTX.geom.lines_num || CTX.geom.tangents)
-    for(GModel::eiter e = GMODEL->firstEdge(); e != GMODEL->lastEdge(); e++)
-      Draw_Geo_Edge(*e);
+    for(GModel::eiter it = GMODEL->firstEdge(); it != GMODEL->lastEdge(); it++)
+      Draw_Geo_Edge(*it);
 
-  /*
   if(CTX.geom.surfaces || CTX.geom.surfaces_num || CTX.geom.normals)
-    Tree_Action(THEM->Surfaces, Draw_Surface);
+    for(GModel::fiter it = GMODEL->firstFace(); it != GMODEL->lastFace(); it++)
+      Draw_Geo_Face(*it);
+
   if(CTX.geom.volumes || CTX.geom.volumes_num)
-    Draw_Volumes();
-  */
+    for(GModel::riter it = GMODEL->firstRegion(); it != GMODEL->lastRegion(); it++)
+      Draw_Geo_Region(*it);
 }
 
-// Highlight routines
-
-void HighlightEntity(Vertex * v, Curve * c, Surface * s, int permanent)
+// Highlight routines (Note: in Gmsh < 1.61, we used to draw permanent
+// highlights (the "red" selected lines, etc.) using incremental
+// drawing, i.e., by drawing "over" the current picture in-between
+// Draw() calls. This was fine for simple overlays on points and lines
+// (that we could draw with a slightly larger width so that they would
+// cover the old ones), but it does not work well when drawing
+// surfaces, post-pro views, etc. And since real cross-platform
+// overlays are unmanageable, the best solution is actually to redraw
+// the whole scene. This is the approach we follow now.
+
+void HighlightEntity(GEntity *e, int permanent)
 {
-  Curve *cc;
-  char Message[256], temp[256];
-
-  // Note: in Gmsh < 1.61, we used to draw permanent highlights (the
-  // "red" selected lines, etc.) using incremental drawing, i.e., by
-  // drawing "over" the current picture in-between Draw() calls. This
-  // was fine for simple overlays on points and lines (that we could
-  // draw with a slightly larger width so that they would cover the
-  // old ones), but it does not work well when drawing surfaces,
-  // post-pro views, etc. And since real cross-platform overlays are
-  // unmanageable, the best solution is actually to redraw the whole
-  // scene. This is the approach we follow now.
-
-  if(v) {
-    if(permanent){
-      v->Frozen = 1;
-    }
-    else{
-      Msg(STATUS1N, "Point %d {%.5g,%.5g,%.5g} (%.5g)", v->Num, v->Pos.X,
-	  v->Pos.Y, v->Pos.Z, v->lc);
-    }
-  }
-  else if(c) {
-    if(permanent){
-      c->ipar[3] = 2;
-    }
-    else{
-      if(c->beg && c->end)
-	Msg(STATUS1N, "Curve %d {%d->%d}", c->Num, c->beg->Num, c->end->Num);
-      else
-	Msg(STATUS1N, "Curve %d", c->Num);
-    }
-  }
-  else if(s) {
-    if(permanent){
-      s->ipar[4] = 2;
-    }
-    else{
-      int nbg = List_Nbr(s->Generatrices);
-      if(nbg){
-	sprintf(Message, "Surface %d {", s->Num);
-	if(nbg < 10) {
-	  for(int i = 0; i < nbg; i++) {
-	    List_Read(s->Generatrices, i, &cc);
-	    if(!i)
-	      sprintf(temp, "%d", cc->Num);
-	    else
-	      sprintf(temp, ",%d", cc->Num);
-	    strcat(Message, temp);
-	  }
-	}
-	else {
-	  strcat(Message, "...");
-	}
-	strcat(Message, "}");
-	Msg(STATUS1N, Message);
-      }
-      else{
-	Msg(STATUS1N, "Surface %d", s->Num);
-	//Msg(STATUS1N, "Surface %d (%d)", s->Num, s->geomTyp());
-      }
-    }
-  }
-  else{
-    if(!permanent)
-      Msg(STATUS1N, " ");
-  }
+  if(permanent)
+    e->drawAttributes.Frozen = 2;
+  else
+    Msg(STATUS1N, "%s", e->getInfoString().c_str());
+}
 
+void HighlightEntity(GVertex *v, GEdge *c, GFace *s, int permanent)
+{
+  if(v) HighlightEntity(v, permanent);
+  else if(c) HighlightEntity(c, permanent);
+  else if(s) HighlightEntity(s, permanent);
+  else if(!permanent) Msg(STATUS1N, " ");
 }
 
 void HighlightEntityNum(int v, int c, int s, int permanent)
 {
   if(v) {
-    Vertex *pv = FindPoint(v, THEM);
-    if(pv)
-      HighlightEntity(pv, NULL, NULL, permanent);
+    GVertex *pv = GMODEL->vertexByTag(v);
+    if(pv) HighlightEntity(pv, permanent);
   }
   if(c) {
-    Curve *pc = FindCurve(c, THEM);
-    if(pc)
-      HighlightEntity(NULL, pc, NULL, permanent);
+    GEdge *pc = GMODEL->edgeByTag(c);
+    if(pc) HighlightEntity(pc, permanent);
   }
   if(s) {
-    Surface *ps = FindSurface(s, THEM);
-    if(ps)
-      HighlightEntity(NULL, NULL, ps, permanent);
+    GFace *ps = GMODEL->faceByTag(s);
+    if(ps) HighlightEntity(ps, permanent);
   }
 }
 
-void ZeroHighlightPoint(void *a, void *b)
+void ZeroHighlightEntity(GEntity *e)
 {
-  Vertex *v = *(Vertex **) a;
-  v->Frozen = 0;
+  e->drawAttributes.Frozen = -2;
 }
 
-void ZeroHighlightCurve(void *a, void *b)
+void ZeroHighlightEntity(GVertex *v, GEdge *c, GFace *s)
 {
-  Curve *c = *(Curve **) a;
-  c->ipar[3] = -2;
-}
-
-void ZeroHighlightSurface(void *a, void *b)
-{
-  Surface *s = *(Surface **) a;
-  s->ipar[4] = -2;
+  if(v) ZeroHighlightEntity(v);
+  if(c) ZeroHighlightEntity(c);
+  if(s) ZeroHighlightEntity(s);
 }
 
 void ZeroHighlight()
 {
-  Tree_Action(THEM->Points, ZeroHighlightPoint);
-  Tree_Action(THEM->Curves, ZeroHighlightCurve);
-  Tree_Action(THEM->Surfaces, ZeroHighlightSurface);
-}
-
-void ZeroHighlightEntity(Vertex * v, Curve * c, Surface * s)
-{
-  if(v) ZeroHighlightPoint(&v, NULL);
-  if(c) ZeroHighlightCurve(&c, NULL);
-  if(s) ZeroHighlightSurface(&s, NULL);
+  for(GModel::viter it = GMODEL->firstVertex(); it != GMODEL->lastVertex(); it++)
+    ZeroHighlightEntity(*it);
+  for(GModel::eiter it = GMODEL->firstEdge(); it != GMODEL->lastEdge(); it++)
+    ZeroHighlightEntity(*it);
+  for(GModel::fiter it = GMODEL->firstFace(); it != GMODEL->lastFace(); it++)
+    ZeroHighlightEntity(*it);
 }
 
 void ZeroHighlightEntityNum(int v, int c, int s)
 {
   if(v) {
-    Vertex *pv = FindPoint(v, THEM);
-    if(pv)
-      ZeroHighlightPoint(&pv, NULL);
+    GVertex *pv = GMODEL->vertexByTag(v);
+    if(pv) ZeroHighlightEntity(pv);
   }
   if(c) {
-    Curve *pc = FindCurve(c, THEM);
-    if(pc)
-      ZeroHighlightCurve(&pc, NULL);
+    GEdge *pc = GMODEL->edgeByTag(c);
+    if(pc) ZeroHighlightEntity(pc);
   }
   if(s) {
-    Surface *ps = FindSurface(s, THEM);
-    if(ps)
-      ZeroHighlightSurface(&ps, NULL);
+    GFace *ps = GMODEL->faceByTag(s);
+    if(ps) ZeroHighlightEntity(ps);
   }
 }
diff --git a/Graphics/Makefile b/Graphics/Makefile
index e9dee0bd3f98f710c5230cd48c4fb9cc5d519b00..f3621a3c5da688ddb0e713eb2e0d535a80b28709 100644
--- a/Graphics/Makefile
+++ b/Graphics/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.82 2006-07-12 07:24:13 geuzaine Exp $
+# $Id: Makefile,v 1.83 2006-07-14 12:17:06 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -83,7 +83,13 @@ Draw.o: Draw.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Geo/ExtrudeParams.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
   ../Common/VertexArray.h ../Common/SmoothNormals.h \
   ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ../Common/Context.h
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h ../Common/Context.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 Mesh.o: Mesh.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
@@ -98,34 +104,41 @@ Mesh.o: Mesh.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Geo/ExtrudeParams.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
   ../Common/VertexArray.h ../Common/SmoothNormals.h \
   ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ../Common/Context.h ../Geo/MinMax.h gl2ps.h \
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h ../Common/Context.h ../Geo/MinMax.h gl2ps.h \
   /usr/local/include/FL/images/zlib.h \
   /usr/local/include/FL/images/zconf.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
-Geom.o: Geom.cpp ../Mesh/BDS.h ../contrib/ANN/include/ANN/ANN.h \
-  ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
-  ../Common/VertexArray.h ../Common/SmoothNormals.h ../Numeric/Numeric.h \
-  ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
-  ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h \
-  ../DataStr/Tree.h ../Common/GmshUI.h ../Geo/Geo.h ../Geo/CAD.h \
-  ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/GmshDefines.h \
-  ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
-  ../Mesh/Matrix.h ../Geo/ExtrudeParams.h ../Mesh/Utils.h \
-  ../Mesh/Vertex.h ../Mesh/Mesh.h Draw.h ../Common/Context.h \
-  ../Mesh/Interpolation.h ../Mesh/Vertex.h ../Mesh/Mesh.h \
-  ../Plugin/Plugin.h ../Common/Options.h ../Plugin/PluginManager.h \
-  ../Plugin/Plugin.h gl2ps.h /usr/local/include/FL/images/zlib.h \
-  /usr/local/include/FL/images/zconf.h ../Geo/GModel.h ../Geo/GVertex.h \
-  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+Geom.o: Geom.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
+  ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
+  ../DataStr/List.h ../DataStr/Tree.h ../Common/GmshUI.h \
+  ../Numeric/Numeric.h ../Geo/Geo.h ../Geo/CAD.h ../Mesh/Mesh.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
+  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
+  ../Geo/ExtrudeParams.h ../Common/VertexArray.h \
+  ../Common/SmoothNormals.h ../Common/GmshDefines.h ../Mesh/Metric.h \
+  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
+  ../Geo/ExtrudeParams.h ../Mesh/Utils.h ../Mesh/Vertex.h ../Mesh/Mesh.h \
+  Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
+  ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
   ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
   ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
   ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Common/Context.h ../Mesh/Interpolation.h ../Mesh/Vertex.h \
+  ../Mesh/Mesh.h ../Plugin/Plugin.h ../Common/Options.h \
+  ../Plugin/PluginManager.h ../Plugin/Plugin.h gl2ps.h \
+  /usr/local/include/FL/images/zlib.h \
+  /usr/local/include/FL/images/zconf.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 Post.o: Post.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
@@ -139,8 +152,14 @@ Post.o: Post.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
   Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Context.h \
-  gl2ps.h /usr/local/include/FL/images/zlib.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Common/Context.h gl2ps.h /usr/local/include/FL/images/zlib.h \
   /usr/local/include/FL/images/zconf.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 PostElement.o: PostElement.cpp ../Common/Gmsh.h ../Common/Message.h \
@@ -156,7 +175,13 @@ PostElement.o: PostElement.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Mesh/Matrix.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
   ../Common/VertexArray.h ../Common/SmoothNormals.h \
   ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \
-  Iso.h ../Common/Context.h
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h Iso.h ../Common/Context.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 Iso.o: Iso.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
@@ -170,7 +195,13 @@ Iso.o: Iso.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Mesh/Matrix.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
   ../Common/VertexArray.h ../Common/SmoothNormals.h \
   ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ../Common/Context.h
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h ../Common/Context.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 Entity.o: Entity.cpp ../Mesh/Mesh.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h \
@@ -184,8 +215,14 @@ Entity.o: Entity.cpp ../Mesh/Mesh.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/Tree.h ../Common/GmshUI.h Draw.h ../Common/Views.h \
   ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Context.h \
-  gl2ps.h /usr/local/include/FL/images/zlib.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Common/Context.h gl2ps.h /usr/local/include/FL/images/zlib.h \
   /usr/local/include/FL/images/zconf.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 ReadImg.o: ReadImg.cpp ReadImg.h ../Common/Gmsh.h ../Common/Message.h \
@@ -207,8 +244,14 @@ Scale.o: Scale.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
   Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Context.h \
-  gl2ps.h /usr/local/include/FL/images/zlib.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Common/Context.h gl2ps.h /usr/local/include/FL/images/zlib.h \
   /usr/local/include/FL/images/zconf.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 Graph2D.o: Graph2D.cpp ../Common/Gmsh.h ../Common/Message.h \
@@ -223,24 +266,38 @@ Graph2D.o: Graph2D.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
   Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h gl2ps.h \
-  /usr/local/include/FL/images/zlib.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  gl2ps.h /usr/local/include/FL/images/zlib.h \
   /usr/local/include/FL/images/zconf.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 CreateFile.o: CreateFile.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
   ../Common/GmshUI.h ../Parser/OpenFile.h ../Common/Context.h \
-  ../Common/Options.h gl2ps.h /usr/local/include/FL/images/zlib.h \
+  ../Common/Options.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Face.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Geo/ExtrudeParams.h \
+  ../Common/VertexArray.h ../Common/SmoothNormals.h ../Numeric/Numeric.h \
+  ../Common/GmshDefines.h ../Mesh/Metric.h ../Mesh/Vertex.h \
+  ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h gl2ps.h \
+  /usr/local/include/FL/images/zlib.h \
   /usr/local/include/FL/images/zconf.h gl2gif.h PixelBuffer.h Draw.h \
   ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
-  ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
+  ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
   gl2jpeg.h gl2png.h gl2ppm.h gl2yuv.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 gl2ps.o: gl2ps.cpp gl2ps.h /usr/local/include/FL/images/zlib.h \
@@ -252,12 +309,14 @@ gl2gif.o: gl2gif.cpp gl2gif.h PixelBuffer.h ../Common/Gmsh.h \
   ../DataStr/Tree.h ../Common/GmshUI.h Draw.h ../Common/Views.h \
   ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 gl2jpeg.o: gl2jpeg.cpp gl2jpeg.h PixelBuffer.h ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
@@ -265,13 +324,14 @@ gl2jpeg.o: gl2jpeg.cpp gl2jpeg.h PixelBuffer.h ../Common/Gmsh.h \
   ../DataStr/Tree.h ../Common/GmshUI.h Draw.h ../Common/Views.h \
   ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
-  /usr/local/include/FL/images/jpeglib.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h /usr/local/include/FL/images/jpeglib.h \
   /usr/local/include/FL/images/jconfig.h \
   /usr/local/include/FL/images/jmorecfg.h \
   /usr/local/include/FL/images/jerror.h
@@ -282,13 +342,15 @@ gl2png.o: gl2png.cpp gl2png.h PixelBuffer.h ../Common/Gmsh.h \
   ../DataStr/Tree.h ../Common/GmshUI.h Draw.h ../Common/Views.h \
   ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
-  /usr/local/include/FL/images/png.h /usr/local/include/FL/images/zlib.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h /usr/local/include/FL/images/png.h \
+  /usr/local/include/FL/images/zlib.h \
   /usr/local/include/FL/images/zconf.h \
   /usr/local/include/FL/images/pngconf.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
@@ -298,12 +360,14 @@ gl2ppm.o: gl2ppm.cpp gl2ppm.h PixelBuffer.h ../Common/Gmsh.h \
   ../DataStr/Tree.h ../Common/GmshUI.h Draw.h ../Common/Views.h \
   ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 gl2yuv.o: gl2yuv.cpp gl2yuv.h PixelBuffer.h ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
@@ -311,9 +375,11 @@ gl2yuv.o: gl2yuv.cpp gl2yuv.h PixelBuffer.h ../Common/Gmsh.h \
   ../DataStr/Tree.h ../Common/GmshUI.h Draw.h ../Common/Views.h \
   ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \
-  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h
diff --git a/Parser/Makefile b/Parser/Makefile
index 16bdd0a5eb53f1ab2edb01bc7b90a52592b33367..aa3f577e90cd2aa6e975b406bb58c3404462f7ee 100644
--- a/Parser/Makefile
+++ b/Parser/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.87 2006-07-12 07:24:23 geuzaine Exp $
+# $Id: Makefile,v 1.88 2006-07-14 12:17:06 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -90,10 +90,17 @@ Gmsh.tab.o: Gmsh.tab.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/GmshDefines.h \
   ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
   ../Mesh/Matrix.h ../Mesh/Nurbs.h ../Mesh/Vertex.h ../Mesh/Mesh.h \
-  ../Geo/CAD.h ../Geo/ExtrudeParams.h ../Graphics/Draw.h ../Mesh/Create.h \
-  ../Mesh/Vertex.h ../Mesh/Mesh.h ../Common/Colors.h ../Common/Options.h \
-  Parser.h OpenFile.h ../Common/CommandLine.h FunctionManager.h \
-  ../Common/OS.h ../Graphics/CreateFile.h ../Common/Visibility.h
+  ../Geo/CAD.h ../Geo/ExtrudeParams.h ../Graphics/Draw.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Mesh/Create.h ../Mesh/Vertex.h ../Mesh/Mesh.h ../Common/Colors.h \
+  ../Common/Options.h Parser.h OpenFile.h ../Common/CommandLine.h \
+  FunctionManager.h ../Common/OS.h ../Graphics/CreateFile.h \
+  ../Common/Visibility.h
 # 1 "/Users/geuzaine/.gmsh/Parser//"
 Gmsh.yy.o: Gmsh.yy.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp
index f212e3563f6c9b50a744a5971897d48b53fe2a83..2a18509a7ba91fb3753d8d6f1c6c4d9efbe1d4db 100644
--- a/Parser/OpenFile.cpp
+++ b/Parser/OpenFile.cpp
@@ -1,4 +1,4 @@
-// $Id: OpenFile.cpp,v 1.97 2006-07-12 07:24:23 geuzaine Exp $
+// $Id: OpenFile.cpp,v 1.98 2006-07-14 12:17:06 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -192,6 +192,9 @@ int ParseFile(char *f, int silent, int close, int warn_if_missing)
     Msg(STATUS2N, "Read '%s'", yyname);
   }
 
+  if(GMODEL) delete GMODEL;
+  GMODEL = new gmshModel;
+
   SetBoundingBox();
 
   strncpy(yyname, yyname_old, 255);
@@ -352,7 +355,6 @@ int MergeProblem(char *name, int warn_if_missing)
     }
     else {
       status = ParseFile(name, 0, 1);
-      GMODEL = new gmshModel ;
     }
   }
 
diff --git a/Plugin/Makefile b/Plugin/Makefile
index f30d1857f6ddc003599cfd0d1cfcc46ef86d604a..21ea95828d97f2dd79b104414a1f543a612e1875 100644
--- a/Plugin/Makefile
+++ b/Plugin/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.99 2006-07-12 07:24:23 geuzaine Exp $
+# $Id: Makefile,v 1.100 2006-07-14 12:17:06 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -103,26 +103,28 @@ CutPlane.o: CutPlane.cpp CutPlane.h Levelset.h Plugin.h \
   ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \
   ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Context.h \
-  ../Common/GmshUI.h ../Graphics/Draw.h ../Mesh/Mesh.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/GmshDefines.h \
-  ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
-  ../Mesh/Matrix.h
+  ../Common/GmshUI.h ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h \
+  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 CutSphere.o: CutSphere.cpp CutSphere.h Levelset.h Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
   ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \
   ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Context.h \
-  ../Common/GmshUI.h ../Graphics/Draw.h ../Mesh/Mesh.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/GmshDefines.h \
-  ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
-  ../Mesh/Matrix.h
+  ../Common/GmshUI.h ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h \
+  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 CutMap.o: CutMap.cpp CutMap.h Levelset.h Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
@@ -142,13 +144,14 @@ CutParametric.o: CutParametric.cpp ../Common/OctreePost.h \
   ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \
   ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Context.h \
-  ../Common/GmshUI.h ../Graphics/Draw.h ../Mesh/Mesh.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/GmshDefines.h \
-  ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
-  ../Mesh/Matrix.h ../contrib/MathEval/matheval.h
+  ../Common/GmshUI.h ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h \
+  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Common/GmshDefines.h ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h ../contrib/MathEval/matheval.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 Lambda2.o: Lambda2.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
   ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
@@ -176,12 +179,13 @@ StreamLines.o: StreamLines.cpp ../Common/OctreePost.h ../Common/Octree.h \
   ../DataStr/List.h ../Common/VertexArray.h ../Common/SmoothNormals.h \
   ../Numeric/Numeric.h ../Common/GmshMatrix.h ../Common/AdaptiveViews.h \
   ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
-  ../Graphics/Draw.h ../Mesh/Mesh.h ../DataStr/Tree.h ../DataStr/avl.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h
+  ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Geo/MVertex.h ../Common/GmshDefines.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 CutGrid.o: CutGrid.cpp ../Common/OctreePost.h ../Common/Octree.h \
   ../Common/OctreeInternals.h CutGrid.h Plugin.h ../Common/Options.h \
@@ -189,12 +193,13 @@ CutGrid.o: CutGrid.cpp ../Common/OctreePost.h ../Common/Octree.h \
   ../DataStr/List.h ../Common/VertexArray.h ../Common/SmoothNormals.h \
   ../Numeric/Numeric.h ../Common/GmshMatrix.h ../Common/AdaptiveViews.h \
   ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
-  ../Graphics/Draw.h ../Mesh/Mesh.h ../DataStr/Tree.h ../DataStr/avl.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h
+  ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Geo/MVertex.h ../Common/GmshDefines.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 Transform.o: Transform.cpp Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
@@ -236,8 +241,15 @@ StructuralSolver.o: StructuralSolver.cpp StructuralSolver.h ../Geo/Geo.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
   ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/GmshUI.h \
   ../Common/Context.h ../DataStr/Tools.h ../DataStr/List.h \
-  ../DataStr/Tree.h ../Graphics/Draw.h ../Mesh/Utils.h ../Mesh/Vertex.h \
-  ../Mesh/Mesh.h ../Fltk/Shortcut_Window.h
+  ../DataStr/Tree.h ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h \
+  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MVertex.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Mesh/Utils.h ../Mesh/Vertex.h ../Mesh/Mesh.h \
+  ../Fltk/Shortcut_Window.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 Skin.o: Skin.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
   ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
@@ -321,7 +333,13 @@ Annotate.o: Annotate.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
   ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/GmshDefines.h \
   ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
   ../Mesh/Matrix.h ../Fltk/Colorbar_Window.h ../Fltk/Popup_Button.h \
-  ../Graphics/Draw.h
+  ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/GEdge.h \
+  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/GFace.h ../Geo/GPoint.h \
+  ../Geo/GEntity.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
+  ../Geo/GRegion.h ../Geo/GEntity.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 Remove.o: Remove.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
   ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
@@ -334,12 +352,13 @@ Probe.o: Probe.cpp Probe.h Plugin.h ../Common/Options.h \
   ../DataStr/List.h ../Common/VertexArray.h ../Common/SmoothNormals.h \
   ../Numeric/Numeric.h ../Common/GmshMatrix.h ../Common/AdaptiveViews.h \
   ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
-  ../Graphics/Draw.h ../Mesh/Mesh.h ../DataStr/Tree.h ../DataStr/avl.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Face.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Geo/ExtrudeParams.h ../Common/GmshDefines.h ../Mesh/Metric.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
+  ../Graphics/Draw.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Geo/MVertex.h ../Common/GmshDefines.h \
+  ../Geo/GPoint.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
   ../Common/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 HarmonicToTime.o: HarmonicToTime.cpp Plugin.h ../Common/Options.h \