From b6141e0d22029aa2542ba69443d28453150d6874 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 10 Oct 2006 00:44:42 +0000
Subject: [PATCH] new GModel::writeGEO (only implemented for gmshModel for now;
 goal is to be able to implement this for other derived model types (like OCC)
 later, too)

---
 Common/Makefile       |  18 +--
 Fltk/Makefile         |  76 ++++++------
 Geo/GModel.h          |   3 +
 Geo/Geo.h             |   2 -
 Geo/Makefile          | 146 +++++++++++------------
 Geo/Print_Geo.cpp     | 267 ------------------------------------------
 Geo/gmshModel.cpp     | 247 +++++++++++++++++++++++++++++++++++++-
 Geo/gmshModel.h       |   1 +
 Graphics/Makefile     |  40 +++----
 Mesh/Makefile         |  55 ++++-----
 Parser/CreateFile.cpp |  10 +-
 Parser/Makefile       |  26 ++--
 Plugin/Makefile       |   8 +-
 13 files changed, 435 insertions(+), 464 deletions(-)
 delete mode 100644 Geo/Print_Geo.cpp

diff --git a/Common/Makefile b/Common/Makefile
index 48e40c3fb2..8734bbd992 100644
--- a/Common/Makefile
+++ b/Common/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.110 2006-09-14 15:48:35 geuzaine Exp $
+# $Id: Makefile,v 1.111 2006-10-10 00:44:41 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -127,12 +127,12 @@ CommandLine.o: CommandLine.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Context.h ../Geo/GFace.h \
-  ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
-  ../Geo/MElement.h ../Geo/SBoundingBox3d.h ../Common/SmoothNormals.h \
-  OS.h
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Context.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
+  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SBoundingBox3d.h \
+  ../Common/SmoothNormals.h OS.h
 # 1 "/Users/geuzaine/.gmsh/Common//"
 OS.o: OS.cpp Message.h
 # 1 "/Users/geuzaine/.gmsh/Common//"
@@ -147,8 +147,8 @@ Visibility.o: Visibility.cpp Visibility.h GmshDefines.h ../Geo/GVertex.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
   ../Common/Context.h ../DataStr/List.h ../Geo/GFace.h ../Geo/GPoint.h \
   ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
   ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
diff --git a/Fltk/Makefile b/Fltk/Makefile
index a91dd7c801..4a633fae58 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.107 2006-09-14 15:48:35 geuzaine Exp $
+# $Id: Makefile,v 1.108 2006-10-10 00:44:41 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -86,10 +86,10 @@ Main.o: Main.cpp GUI.h Opengl_Window.h ../Mesh/Mesh.h \
   ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
-  ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
-  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h ../Geo/GPoint.h \
+  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
+  ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
   ../Geo/SBoundingBox3d.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \
@@ -156,17 +156,17 @@ Callbacks.o: Callbacks.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h \
   ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/MElement.h \
   ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \
-  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Context.h \
-  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h \
-  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
-  ../Geo/GEntity.h ../Geo/MElement.h ../Parser/CreateFile.h \
-  ../Parser/OpenFile.h ../Common/CommandLine.h ../Common/Options.h GUI.h \
-  Opengl_Window.h Colorbar_Window.h Popup_Button.h \
-  SpherePosition_Widget.h GUI_Extras.h Callbacks.h ../Plugin/Plugin.h \
-  ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Common/Visibility.h \
-  ../Common/GmshDefines.h Solvers.h ../Common/OS.h ../Geo/GModel.h \
-  ../Geo/GVertex.h ../Geo/GEdge.h ../Geo/GFace.h ../Geo/GRegion.h \
-  ../Geo/SBoundingBox3d.h
+  ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
+  ../Common/Context.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
+  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
+  ../Parser/CreateFile.h ../Parser/OpenFile.h ../Common/CommandLine.h \
+  ../Common/Options.h GUI.h Opengl_Window.h Colorbar_Window.h \
+  Popup_Button.h SpherePosition_Widget.h GUI_Extras.h Callbacks.h \
+  ../Plugin/Plugin.h ../Plugin/PluginManager.h ../Plugin/Plugin.h \
+  ../Common/Visibility.h ../Common/GmshDefines.h Solvers.h ../Common/OS.h \
+  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEdge.h ../Geo/GFace.h \
+  ../Geo/GRegion.h ../Geo/SBoundingBox3d.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 \
@@ -181,17 +181,17 @@ Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h ../Geo/GPoint.h \
-  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
-  ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.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 \
-  SpherePosition_Widget.h ../Graphics/gl2ps.h
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h \
+  ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Geo/MElement.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 SpherePosition_Widget.h ../Graphics/gl2ps.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 \
@@ -206,17 +206,17 @@ Opengl_Window.o: Opengl_Window.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h ../Geo/GPoint.h \
-  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
-  ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.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 \
-  SpherePosition_Widget.h
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h \
+  ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Geo/MElement.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 SpherePosition_Widget.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Colorbar_Window.o: Colorbar_Window.cpp ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
diff --git a/Geo/GModel.h b/Geo/GModel.h
index 9b577e92cf..c6794a90da 100644
--- a/Geo/GModel.h
+++ b/Geo/GModel.h
@@ -145,6 +145,9 @@ class GModel
   int writeBDF(const std::string &name, int format=0, bool saveAll=false, 
 	       double scalingFactor=1.0);
 
+  // Export flat Gmsh geo model (only implemented for gmshModel at the moment)
+  virtual int writeGEO(const std::string &name){ return 0; }
+
   // FIXME: this will be removed (and rewritten)
   smooth_normals *normals;
 };
diff --git a/Geo/Geo.h b/Geo/Geo.h
index dab94a4e8c..c355cf0140 100644
--- a/Geo/Geo.h
+++ b/Geo/Geo.h
@@ -120,6 +120,4 @@ void extrude(List_T *list, char *fich, char *what, char *tx, char *ty, char *tz)
 void protude(List_T *list, char *fich, char *what, char *ax, char *ay, char *az,
 	     char *px, char *py, char *pz, char *angle);
 
-void Print_Geo(char *c);
-
 #endif
diff --git a/Geo/Makefile b/Geo/Makefile
index 3449e24c21..9f278a5aca 100644
--- a/Geo/Makefile
+++ b/Geo/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.100 2006-09-07 04:54:55 geuzaine Exp $
+# $Id: Makefile,v 1.101 2006-10-10 00:44:41 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -47,8 +47,7 @@ SRC = CAD.cpp \
       fourierModel.cpp\
       SVector3.cpp\
       SBoundingBox3d.cpp\
-      ExtractContour.cpp \
-      Print_Geo.cpp
+      ExtractContour.cpp
 
 OBJ = ${SRC:.cpp=.o}
 
@@ -108,8 +107,8 @@ Geo.o: Geo.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.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 MElement.h MEdge.h MFace.h GFace.h Pair.h \
-  GRegion.h ../Common/SmoothNormals.h
+  SVector3.h SPoint2.h MElement.h MEdge.h ../Common/Hash.h MFace.h \
+  GFace.h Pair.h GRegion.h ../Common/SmoothNormals.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 \
@@ -124,36 +123,37 @@ GeoUtils.o: GeoUtils.cpp ../Common/Gmsh.h ../Common/Message.h \
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 GEntity.o: GEntity.cpp GEntity.h Range.h SPoint3.h SBoundingBox3d.h \
   ../Common/GmshDefines.h MRep.h GEdge.h GVertex.h MVertex.h GPoint.h \
-  SVector3.h SPoint2.h MElement.h MEdge.h MFace.h ../Numeric/Numeric.h \
-  ../Common/Context.h ../DataStr/List.h GFace.h Pair.h GRegion.h \
-  ../Common/VertexArray.h ../Common/Message.h ../Common/OS.h
+  SVector3.h SPoint2.h MElement.h MEdge.h ../Common/Hash.h MFace.h \
+  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GFace.h \
+  Pair.h GRegion.h ../Common/VertexArray.h ../Common/Message.h \
+  ../Common/OS.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 GVertex.o: GVertex.cpp GVertex.h GEntity.h Range.h SPoint3.h \
   SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h GPoint.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 GEdge.o: GEdge.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \
   SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h GPoint.h GEdge.h \
-  SVector3.h SPoint2.h MElement.h MEdge.h MFace.h ../Numeric/Numeric.h \
-  ../Common/Context.h ../DataStr/List.h GFace.h Pair.h GRegion.h \
-  ../Common/SmoothNormals.h
+  SVector3.h SPoint2.h MElement.h MEdge.h ../Common/Hash.h MFace.h \
+  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GFace.h \
+  Pair.h GRegion.h ../Common/SmoothNormals.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 GFace.o: GFace.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \
   SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h GPoint.h GEdge.h \
-  SVector3.h SPoint2.h MElement.h MEdge.h MFace.h ../Numeric/Numeric.h \
-  ../Common/Context.h ../DataStr/List.h GFace.h Pair.h GRegion.h \
-  ../Common/SmoothNormals.h ../Common/Message.h
+  SVector3.h SPoint2.h MElement.h MEdge.h ../Common/Hash.h MFace.h \
+  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GFace.h \
+  Pair.h GRegion.h ../Common/SmoothNormals.h ../Common/Message.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 GRegion.o: GRegion.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \
   SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h GPoint.h GEdge.h \
-  SVector3.h SPoint2.h MElement.h MEdge.h MFace.h ../Numeric/Numeric.h \
-  ../Common/Context.h ../DataStr/List.h GFace.h Pair.h GRegion.h \
-  ../Common/SmoothNormals.h
+  SVector3.h SPoint2.h MElement.h MEdge.h ../Common/Hash.h MFace.h \
+  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GFace.h \
+  Pair.h GRegion.h ../Common/SmoothNormals.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 GModel.o: GModel.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \
   SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h GPoint.h GEdge.h \
-  SVector3.h SPoint2.h MElement.h MEdge.h MFace.h ../Numeric/Numeric.h \
-  ../Common/Context.h ../DataStr/List.h GFace.h Pair.h GRegion.h \
-  ../Common/SmoothNormals.h
+  SVector3.h SPoint2.h MElement.h MEdge.h ../Common/Hash.h MFace.h \
+  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GFace.h \
+  Pair.h GRegion.h ../Common/SmoothNormals.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 GModelIO.o: GModelIO.cpp ../Common/Message.h ../Common/GmshDefines.h \
   gmshRegion.h ../Mesh/Mesh.h ../DataStr/List.h ../DataStr/Tree.h \
@@ -164,81 +164,81 @@ GModelIO.o: GModelIO.cpp ../Common/Message.h ../Common/GmshDefines.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.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 \
-  MElement.h MEdge.h MFace.h ../Numeric/Numeric.h ../Common/Context.h \
-  GFace.h Pair.h GRegion.h ../Common/SmoothNormals.h gmshFace.h \
-  gmshVertex.h gmshEdge.h
+  MElement.h MEdge.h ../Common/Hash.h MFace.h ../Numeric/Numeric.h \
+  ../Common/Context.h GFace.h Pair.h GRegion.h ../Common/SmoothNormals.h \
+  gmshFace.h gmshVertex.h gmshEdge.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 MVertex.o: MVertex.cpp MVertex.h SPoint3.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 MElement.o: MElement.cpp MElement.h ../Common/GmshDefines.h MVertex.h \
-  SPoint3.h MEdge.h SVector3.h MFace.h ../Numeric/Numeric.h \
-  ../Common/Context.h ../DataStr/List.h GEntity.h Range.h \
-  SBoundingBox3d.h
+  SPoint3.h MEdge.h SVector3.h ../Common/Hash.h MFace.h \
+  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GEntity.h \
+  Range.h SBoundingBox3d.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 gmshModel.o: gmshModel.cpp gmshModel.h GModel.h GVertex.h GEntity.h \
   Range.h SPoint3.h SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h \
-  GPoint.h GEdge.h SVector3.h SPoint2.h MElement.h MEdge.h MFace.h \
-  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GFace.h \
-  Pair.h GRegion.h ../Common/SmoothNormals.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 \
-  ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
-  ../Mesh/Matrix.h Geo.h ../DataStr/Tools.h ../DataStr/List.h \
-  ../DataStr/Tree.h ../Common/Message.h gmshVertex.h gmshFace.h \
-  gmshEdge.h gmshRegion.h
-# 1 "/Users/geuzaine/.gmsh/Geo//"
-gmshEdge.o: gmshEdge.cpp gmshModel.h GModel.h GVertex.h GEntity.h Range.h \
-  SPoint3.h SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h GPoint.h \
-  GEdge.h SVector3.h SPoint2.h MElement.h MEdge.h MFace.h \
-  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GFace.h \
-  Pair.h GRegion.h ../Common/SmoothNormals.h gmshEdge.h gmshVertex.h \
+  GPoint.h GEdge.h SVector3.h SPoint2.h MElement.h MEdge.h \
+  ../Common/Hash.h MFace.h ../Numeric/Numeric.h ../Common/Context.h \
+  ../DataStr/List.h GFace.h Pair.h GRegion.h ../Common/SmoothNormals.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 ../Mesh/Metric.h ../Mesh/Vertex.h \
+  ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h Geo.h \
+  ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
+  ../Common/Message.h gmshVertex.h gmshFace.h gmshEdge.h gmshRegion.h
+# 1 "/Users/geuzaine/.gmsh/Geo//"
+gmshEdge.o: gmshEdge.cpp gmshModel.h GModel.h GVertex.h GEntity.h Range.h \
+  SPoint3.h SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h GPoint.h \
+  GEdge.h SVector3.h SPoint2.h MElement.h MEdge.h ../Common/Hash.h \
+  MFace.h ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h \
+  GFace.h Pair.h GRegion.h ../Common/SmoothNormals.h gmshEdge.h \
+  gmshVertex.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 ../Mesh/Metric.h ../Mesh/Vertex.h \
   ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
   ../Mesh/Interpolation.h ../Mesh/Vertex.h ../Mesh/Mesh.h CAD.h \
   ExtrudeParams.h Geo.h ../Mesh/Create.h ../Mesh/Vertex.h ../Mesh/Mesh.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 gmshFace.o: gmshFace.cpp gmshModel.h GModel.h GVertex.h GEntity.h Range.h \
   SPoint3.h SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h GPoint.h \
-  GEdge.h SVector3.h SPoint2.h MElement.h MEdge.h MFace.h \
-  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GFace.h \
-  Pair.h GRegion.h ../Common/SmoothNormals.h gmshVertex.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 \
-  ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
-  ../Mesh/Matrix.h gmshEdge.h gmshFace.h ../Mesh/Interpolation.h \
-  ../Mesh/Vertex.h ../Mesh/Mesh.h CAD.h ExtrudeParams.h Geo.h \
-  ../Mesh/Create.h ../Mesh/Vertex.h ../Mesh/Mesh.h ../Mesh/Utils.h \
-  ../Mesh/Vertex.h ../Mesh/Mesh.h ../Common/Message.h
-# 1 "/Users/geuzaine/.gmsh/Geo//"
-gmshRegion.o: gmshRegion.cpp gmshModel.h GModel.h GVertex.h GEntity.h \
-  Range.h SPoint3.h SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h \
-  GPoint.h GEdge.h SVector3.h SPoint2.h MElement.h MEdge.h MFace.h \
-  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h GFace.h \
-  Pair.h GRegion.h ../Common/SmoothNormals.h gmshFace.h gmshVertex.h \
+  GEdge.h SVector3.h SPoint2.h MElement.h MEdge.h ../Common/Hash.h \
+  MFace.h ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h \
+  GFace.h Pair.h GRegion.h ../Common/SmoothNormals.h gmshVertex.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 ../Mesh/Metric.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h gmshRegion.h Geo.h \
-  ../Mesh/Create.h ../Mesh/Vertex.h ../Mesh/Mesh.h
+  ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h gmshEdge.h gmshFace.h \
+  ../Mesh/Interpolation.h ../Mesh/Vertex.h ../Mesh/Mesh.h CAD.h \
+  ExtrudeParams.h Geo.h ../Mesh/Create.h ../Mesh/Vertex.h ../Mesh/Mesh.h \
+  ../Mesh/Utils.h ../Mesh/Vertex.h ../Mesh/Mesh.h ../Common/Message.h
+# 1 "/Users/geuzaine/.gmsh/Geo//"
+gmshRegion.o: gmshRegion.cpp gmshModel.h GModel.h GVertex.h GEntity.h \
+  Range.h SPoint3.h SBoundingBox3d.h ../Common/GmshDefines.h MVertex.h \
+  GPoint.h GEdge.h SVector3.h SPoint2.h MElement.h MEdge.h \
+  ../Common/Hash.h MFace.h ../Numeric/Numeric.h ../Common/Context.h \
+  ../DataStr/List.h GFace.h Pair.h GRegion.h ../Common/SmoothNormals.h \
+  gmshFace.h gmshVertex.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 ../Mesh/Metric.h \
+  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
+  gmshRegion.h Geo.h ../Mesh/Create.h ../Mesh/Vertex.h ../Mesh/Mesh.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 fourierModel.o: fourierModel.cpp fourierModel.h GModel.h GVertex.h \
   GEntity.h Range.h SPoint3.h SBoundingBox3d.h ../Common/GmshDefines.h \
   MVertex.h GPoint.h GEdge.h SVector3.h SPoint2.h MElement.h MEdge.h \
-  MFace.h ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h \
-  GFace.h Pair.h GRegion.h ../Common/SmoothNormals.h ../Common/Message.h \
-  ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
-  ../Common/SmoothNormals.h ../Common/AdaptiveViews.h \
-  ../Common/GmshMatrix.h
+  ../Common/Hash.h MFace.h ../Numeric/Numeric.h ../Common/Context.h \
+  ../DataStr/List.h GFace.h Pair.h GRegion.h ../Common/SmoothNormals.h \
+  ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
+  ../Common/VertexArray.h ../Common/SmoothNormals.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
 SVector3.o: SVector3.cpp SVector3.h SPoint3.h
 # 1 "/Users/geuzaine/.gmsh/Geo//"
@@ -254,13 +254,3 @@ ExtractContour.o: ExtractContour.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Geo/ExtrudeParams.h ../Mesh/Metric.h ../Mesh/Vertex.h \
   ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h CAD.h ExtrudeParams.h \
   ../Numeric/Numeric.h
-# 1 "/Users/geuzaine/.gmsh/Geo//"
-Print_Geo.o: Print_Geo.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 \
-  Geo.h ../Mesh/Mesh.h ../Common/GmshDefines.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 CAD.h ExtrudeParams.h
diff --git a/Geo/Print_Geo.cpp b/Geo/Print_Geo.cpp
deleted file mode 100644
index 78bd280fee..0000000000
--- a/Geo/Print_Geo.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-// $Id: Print_Geo.cpp,v 1.45 2006-08-05 10:05:45 geuzaine Exp $
-//
-// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-// USA.
-// 
-// Please report all bugs and problems to <gmsh@geuz.org>.
-
-#include "Gmsh.h"
-#include "Geo.h"
-#include "Mesh.h"
-#include "CAD.h"
-
-extern Mesh *THEM;
-
-FILE *FOUT;
-
-void Print_Point(void *a, void *b)
-{
-  Vertex *v = *(Vertex **) a;
-  fprintf(FOUT, "Point(%d) = {%.16g, %.16g, %.16g, %.16g};\n",
-          v->Num, v->Pos.X, v->Pos.Y, v->Pos.Z, v->lc);
-}
-
-void Print_Nurbs(Curve *c, FILE *f)
-{
-  fprintf(f, "Nurbs (%d) = {", c->Num);
-  for(int i = 0; i < List_Nbr(c->Control_Points); i++) {
-    Vertex *v;
-    List_Read(c->Control_Points, i, &v);
-    if(!i)
-      fprintf(FOUT, "%d", v->Num);
-    else
-      fprintf(FOUT, ", %d", v->Num);
-    if(i % 8 == 7 && i != List_Nbr(c->Control_Points) - 1)
-      fprintf(FOUT, "\n");
-  }
-  fprintf(f, "}\n");
-  fprintf(f, "  Knots {");
-  for(int j = 0; j < List_Nbr(c->Control_Points) + c->degre + 1; j++) {
-    if(!j)
-      fprintf(f, "%.16g", c->k[j]);
-    else
-      fprintf(f, ", %.16g", c->k[j]);
-    if(j % 5 == 4 && j != List_Nbr(c->Control_Points) + c->degre)
-      fprintf(FOUT, "\n        ");
-  }
-  fprintf(f, "}\n");
-  fprintf(f, "  Order %d;\n", c->degre);
-}
-
-void Print_Curve(void *a, void *b)
-{
-  Curve *c = *(Curve **) a;
-
-  if(c->Num < 0 || c->Typ == MSH_SEGM_DISCRETE)
-    return;
-
-  switch (c->Typ) {
-  case MSH_SEGM_LINE:
-    fprintf(FOUT, "Line (%d) = ", c->Num);
-    break;
-  case MSH_SEGM_CIRC:
-  case MSH_SEGM_CIRC_INV:
-    fprintf(FOUT, "Circle (%d) = ", c->Num);
-    break;
-  case MSH_SEGM_ELLI:
-  case MSH_SEGM_ELLI_INV:
-    fprintf(FOUT, "Ellipse (%d) = ", c->Num);
-    break;
-  case MSH_SEGM_NURBS:
-    Print_Nurbs(c, FOUT);
-    return;
-  case MSH_SEGM_SPLN:
-    fprintf(FOUT, "CatmullRom (%d) = ", c->Num);
-    break;
-  case MSH_SEGM_BSPLN:
-    fprintf(FOUT, "BSpline (%d) = ", c->Num);
-    break;
-  case MSH_SEGM_BEZIER:
-    fprintf(FOUT, "Bezier (%d) = ", c->Num);
-    break;
-  default:
-    Msg(GERROR, "Unknown curve type %d", c->Typ);
-    return;
-  }
-
-  for(int i = 0; i < List_Nbr(c->Control_Points); i++) {
-    Vertex *v;
-    List_Read(c->Control_Points, i, &v);
-    if(i)
-      fprintf(FOUT, ", %d", v->Num);
-    else
-      fprintf(FOUT, "{%d", v->Num);
-    if(i % 6 == 7)
-      fprintf(FOUT, "\n");
-  }
-
-  fprintf(FOUT, "};\n");
-}
-
-void Print_Surface(void *a, void *b)
-{
-  Surface *s = *(Surface **) a;
-
-  if(s->Typ == MSH_SURF_DISCRETE)
-    return;
-
-  int NUMLOOP = s->Num + 1000000;
-  if(s->Typ != MSH_SURF_NURBS) {
-    if(List_Nbr(s->Generatrices)){
-      fprintf(FOUT, "Line Loop (%d) = ", NUMLOOP);
-      for(int i = 0; i < List_Nbr(s->Generatrices); i++) {
-	Curve *c;
-	List_Read(s->Generatrices, i, &c);
-	if(i)
-	  fprintf(FOUT, ", %d", c->Num);
-	else
-	  fprintf(FOUT, "{%d", c->Num);
-      }
-      fprintf(FOUT, "};\n");
-    }
-  }
-
-  switch (s->Typ) {
-  case MSH_SURF_REGL:
-  case MSH_SURF_TRIC:
-    fprintf(FOUT, "Ruled Surface (%d) = {%d};\n", s->Num, NUMLOOP);
-    break;
-  case MSH_SURF_PLAN:
-    fprintf(FOUT, "Plane Surface (%d) = {%d};\n", s->Num, NUMLOOP);
-    break;
-  case MSH_SURF_TRIMMED:
-    fprintf(FOUT, "Trimmed Surface (%d) = %d {%d};\n", s->Num,
-            s->Support->Num, NUMLOOP);
-    break;
-  case MSH_SURF_NURBS:
-    fprintf(FOUT, "Nurbs Surface (%d) = {\n", s->Num);
-    for(int i = 0; i < s->Nv; i++) {
-      fprintf(FOUT, "  {");
-      for(int j = 0; j < s->Nu; j++) {
-	Vertex *v;
-        List_Read(s->Control_Points, j + s->Nu * i, &v);
-        if(!j)
-          fprintf(FOUT, "%d", v->Num);
-        else
-          fprintf(FOUT, ", %d", v->Num);
-      }
-      if(i != s->Nv - 1)
-        fprintf(FOUT, "},\n");
-      else
-        fprintf(FOUT, "}}\n");
-    }
-    fprintf(FOUT, "  Knots\n  {");
-    for(int j = 0; j < s->Nu + s->OrderU + 1; j++) {
-      if(!j)
-        fprintf(FOUT, "%.16g", s->ku[j]);
-      else
-        fprintf(FOUT, ", %.16g", s->ku[j]);
-      if(j % 5 == 4 && j != s->Nu + s->OrderU)
-        fprintf(FOUT, "\n  ");
-    }
-    fprintf(FOUT, "}\n  {");
-    for(int j = 0; j < s->Nv + s->OrderV + 1; j++) {
-      if(!j)
-        fprintf(FOUT, "%.16g", s->kv[j]);
-      else
-        fprintf(FOUT, ", %.16g", s->kv[j]);
-      if(j % 5 == 4 && j != s->Nv + s->OrderV)
-        fprintf(FOUT, "\n  ");
-    }
-    fprintf(FOUT, "}\n  Order %d %d;\n", s->OrderU, s->OrderV);
-    break;
-  }
-}
-
-void Print_Volume(void *a, void *b)
-{
-  Volume *vol = *(Volume **) a;
-
-  if(vol->Typ == MSH_VOLUME_DISCRETE)
-    return;
-
-  int NUMLOOP = vol->Num + 1000000;
-
-  fprintf(FOUT, "Surface Loop (%d) = ", NUMLOOP);
-
-  for(int i = 0; i < List_Nbr(vol->Surfaces); i++) {
-    Surface *s;
-    List_Read(vol->Surfaces, i, &s);
-    if(i)
-      fprintf(FOUT, ", %d", s->Num);
-    else
-      fprintf(FOUT, "{%d", s->Num);
-  }
-  fprintf(FOUT, "};\n");
-
-  switch (vol->Typ) {
-  case MSH_VOLUME:
-    fprintf(FOUT, "Volume (%d) = {%d};\n", vol->Num, NUMLOOP);
-    break;
-  }
-}
-
-void Print_PhysicalGroups(void *a, void *b)
-{
-  PhysicalGroup *pg = *(PhysicalGroup **) a;
-
-  switch (pg->Typ) {
-  case MSH_PHYSICAL_POINT:
-    fprintf(FOUT, "Physical Point (%d) = ", pg->Num);
-    break;
-  case MSH_PHYSICAL_LINE:
-    fprintf(FOUT, "Physical Line (%d) = ", pg->Num);
-    break;
-  case MSH_PHYSICAL_SURFACE:
-    fprintf(FOUT, "Physical Surface (%d) = ", pg->Num);
-    break;
-  case MSH_PHYSICAL_VOLUME:
-    fprintf(FOUT, "Physical Volume (%d) = ", pg->Num);
-    break;
-  }
-
-  for(int i = 0; i < List_Nbr(pg->Entities); i++) {
-    int j;
-    List_Read(pg->Entities, i, &j);
-    if(i)
-      fprintf(FOUT, ", %d", j);
-    else
-      fprintf(FOUT, "{%d", j);
-  }
-  fprintf(FOUT, "};\n");
-}
-
-void Print_Geo(char *filename)
-{
-  if(filename) {
-    FOUT = fopen(filename, "w");
-    if(!FOUT) {
-      Msg(GERROR, "Unable to open file '%s'", filename);
-      return;
-    }
-  }
-  else
-    FOUT = stdout;
-
-  Tree_Action(THEM->Points, Print_Point);
-  Tree_Action(THEM->Curves, Print_Curve);
-  Tree_Action(THEM->Surfaces, Print_Surface); 
-  Tree_Action(THEM->Volumes, Print_Volume);
-  List_Action(THEM->PhysicalGroups, Print_PhysicalGroups);
-
-  if(filename) fclose(FOUT);
-}
diff --git a/Geo/gmshModel.cpp b/Geo/gmshModel.cpp
index d3896fd1e7..597ed12c7c 100644
--- a/Geo/gmshModel.cpp
+++ b/Geo/gmshModel.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshModel.cpp,v 1.19 2006-09-10 16:10:34 geuzaine Exp $
+// $Id: gmshModel.cpp,v 1.20 2006-10-10 00:44:41 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -123,3 +123,248 @@ void gmshModel::import()
   Msg(DEBUG, "%d Faces", faces.size());
   Msg(DEBUG, "%d Regions", regions.size());
 }
+
+static FILE *geo = 0;
+
+class writeGVertexGEO {
+ public :
+  void operator () (GVertex *gv)
+  {
+    Vertex *v = (Vertex*)gv->getNativePtr();
+    fprintf(geo, "Point(%d) = {%.16g, %.16g, %.16g, %.16g};\n",
+	    v->Num, v->Pos.X, v->Pos.Y, v->Pos.Z, v->lc);
+  }
+};
+
+class writeGEdgeGEO {
+ public :
+  void operator () (GEdge *ge)
+  {
+    Curve *c = (Curve *)ge->getNativePtr();
+    
+    if(c->Num < 0 || c->Typ == MSH_SEGM_DISCRETE)
+      return;
+
+    switch (c->Typ) {
+    case MSH_SEGM_LINE:
+      fprintf(geo, "Line (%d) = ", c->Num);
+      break;
+    case MSH_SEGM_CIRC:
+    case MSH_SEGM_CIRC_INV:
+      fprintf(geo, "Circle (%d) = ", c->Num);
+      break;
+    case MSH_SEGM_ELLI:
+    case MSH_SEGM_ELLI_INV:
+      fprintf(geo, "Ellipse (%d) = ", c->Num);
+      break;
+    case MSH_SEGM_NURBS:
+      fprintf(geo, "Nurbs (%d) = {", c->Num);
+      for(int i = 0; i < List_Nbr(c->Control_Points); i++) {
+	Vertex *v;
+	List_Read(c->Control_Points, i, &v);
+	if(!i)
+	  fprintf(geo, "%d", v->Num);
+	else
+	  fprintf(geo, ", %d", v->Num);
+	if(i % 8 == 7 && i != List_Nbr(c->Control_Points) - 1)
+	  fprintf(geo, "\n");
+      }
+      fprintf(geo, "}\n");
+      fprintf(geo, "  Knots {");
+      for(int j = 0; j < List_Nbr(c->Control_Points) + c->degre + 1; j++) {
+	if(!j)
+	  fprintf(geo, "%.16g", c->k[j]);
+	else
+	  fprintf(geo, ", %.16g", c->k[j]);
+	if(j % 5 == 4 && j != List_Nbr(c->Control_Points) + c->degre)
+	  fprintf(geo, "\n        ");
+      }
+      fprintf(geo, "}\n");
+      fprintf(geo, "  Order %d;\n", c->degre);
+      return;
+    case MSH_SEGM_SPLN:
+      fprintf(geo, "CatmullRom (%d) = ", c->Num);
+      break;
+    case MSH_SEGM_BSPLN:
+      fprintf(geo, "BSpline (%d) = ", c->Num);
+      break;
+    case MSH_SEGM_BEZIER:
+      fprintf(geo, "Bezier (%d) = ", c->Num);
+      break;
+    default:
+      Msg(GERROR, "Unknown curve type %d", c->Typ);
+      return;
+    }
+
+    for(int i = 0; i < List_Nbr(c->Control_Points); i++) {
+      Vertex *v;
+      List_Read(c->Control_Points, i, &v);
+      if(i)
+	fprintf(geo, ", %d", v->Num);
+      else
+	fprintf(geo, "{%d", v->Num);
+      if(i % 6 == 7)
+	fprintf(geo, "\n");
+    }
+    
+    fprintf(geo, "};\n");
+  }
+};
+
+class writeGFaceGEO {
+ public :
+  void operator () (GFace *gf)
+  {
+    Surface *s = (Surface *)gf->getNativePtr();
+    
+    if(s->Typ == MSH_SURF_DISCRETE)
+      return;
+    
+    int NUMLOOP = s->Num + 1000000;
+    if(s->Typ != MSH_SURF_NURBS) {
+      if(List_Nbr(s->Generatrices)){
+	fprintf(geo, "Line Loop (%d) = ", NUMLOOP);
+	for(int i = 0; i < List_Nbr(s->Generatrices); i++) {
+	  Curve *c;
+	  List_Read(s->Generatrices, i, &c);
+	  if(i)
+	    fprintf(geo, ", %d", c->Num);
+	  else
+	    fprintf(geo, "{%d", c->Num);
+	}
+	fprintf(geo, "};\n");
+      }
+    }
+    
+    switch (s->Typ) {
+    case MSH_SURF_REGL:
+    case MSH_SURF_TRIC:
+      fprintf(geo, "Ruled Surface (%d) = {%d};\n", s->Num, NUMLOOP);
+      break;
+    case MSH_SURF_PLAN:
+      fprintf(geo, "Plane Surface (%d) = {%d};\n", s->Num, NUMLOOP);
+      break;
+    case MSH_SURF_TRIMMED:
+      fprintf(geo, "Trimmed Surface (%d) = %d {%d};\n", s->Num,
+	      s->Support->Num, NUMLOOP);
+      break;
+    case MSH_SURF_NURBS:
+      fprintf(geo, "Nurbs Surface (%d) = {\n", s->Num);
+      for(int i = 0; i < s->Nv; i++) {
+	fprintf(geo, "  {");
+	for(int j = 0; j < s->Nu; j++) {
+	  Vertex *v;
+	  List_Read(s->Control_Points, j + s->Nu * i, &v);
+	  if(!j)
+	    fprintf(geo, "%d", v->Num);
+	  else
+	    fprintf(geo, ", %d", v->Num);
+	}
+	if(i != s->Nv - 1)
+	  fprintf(geo, "},\n");
+	else
+	  fprintf(geo, "}}\n");
+      }
+      fprintf(geo, "  Knots\n  {");
+      for(int j = 0; j < s->Nu + s->OrderU + 1; j++) {
+	if(!j)
+	  fprintf(geo, "%.16g", s->ku[j]);
+	else
+	  fprintf(geo, ", %.16g", s->ku[j]);
+	if(j % 5 == 4 && j != s->Nu + s->OrderU)
+	  fprintf(geo, "\n  ");
+      }
+      fprintf(geo, "}\n  {");
+      for(int j = 0; j < s->Nv + s->OrderV + 1; j++) {
+	if(!j)
+	  fprintf(geo, "%.16g", s->kv[j]);
+	else
+	  fprintf(geo, ", %.16g", s->kv[j]);
+	if(j % 5 == 4 && j != s->Nv + s->OrderV)
+	  fprintf(geo, "\n  ");
+      }
+      fprintf(geo, "}\n  Order %d %d;\n", s->OrderU, s->OrderV);
+      break;
+    }
+  }
+};
+
+class writeGRegionGEO {
+ public :
+  void operator () (GRegion *gr)
+  {
+    Volume *vol = (Volume *)gr->getNativePtr();
+    
+    if(vol->Typ == MSH_VOLUME_DISCRETE)
+      return;
+    
+    int NUMLOOP = vol->Num + 1000000;
+    
+    fprintf(geo, "Surface Loop (%d) = ", NUMLOOP);
+    
+    for(int i = 0; i < List_Nbr(vol->Surfaces); i++) {
+      Surface *s;
+      List_Read(vol->Surfaces, i, &s);
+      if(i)
+	fprintf(geo, ", %d", s->Num);
+      else
+	fprintf(geo, "{%d", s->Num);
+    }
+    fprintf(geo, "};\n");
+    
+    switch (vol->Typ) {
+    case MSH_VOLUME:
+      fprintf(geo, "Volume (%d) = {%d};\n", vol->Num, NUMLOOP);
+      break;
+    }
+  }
+};
+
+void writePhysicalGroupGEO(void *a, void *b)
+{
+  PhysicalGroup *pg = *(PhysicalGroup **) a;
+
+  switch (pg->Typ) {
+  case MSH_PHYSICAL_POINT:
+    fprintf(geo, "Physical Point (%d) = ", pg->Num);
+    break;
+  case MSH_PHYSICAL_LINE:
+    fprintf(geo, "Physical Line (%d) = ", pg->Num);
+    break;
+  case MSH_PHYSICAL_SURFACE:
+    fprintf(geo, "Physical Surface (%d) = ", pg->Num);
+    break;
+  case MSH_PHYSICAL_VOLUME:
+    fprintf(geo, "Physical Volume (%d) = ", pg->Num);
+    break;
+  }
+
+  for(int i = 0; i < List_Nbr(pg->Entities); i++) {
+    int j;
+    List_Read(pg->Entities, i, &j);
+    if(i)
+      fprintf(geo, ", %d", j);
+    else
+      fprintf(geo, "{%d", j);
+  }
+  fprintf(geo, "};\n");
+}
+
+int gmshModel::writeGEO(const std::string &name)
+{
+  geo = fopen(name.c_str(), "w");
+  if(!geo){
+    Msg(GERROR, "Unable to open file '%s'", name.c_str());
+    return 0;
+  }
+
+  std::for_each(firstVertex(), lastVertex(), writeGVertexGEO());
+  std::for_each(firstEdge(), lastEdge(), writeGEdgeGEO());
+  std::for_each(firstFace(), lastFace(), writeGFaceGEO());
+  std::for_each(firstRegion(), lastRegion(), writeGRegionGEO());
+
+  List_Action(THEM->PhysicalGroups, writePhysicalGroupGEO);
+
+  fclose(geo);
+  return 1;
+}
diff --git a/Geo/gmshModel.h b/Geo/gmshModel.h
index bc1f964466..fab6d8992d 100644
--- a/Geo/gmshModel.h
+++ b/Geo/gmshModel.h
@@ -29,6 +29,7 @@ class gmshModel : public GModel {
 
   // import data from the old Gmsh database ("THEM")
   virtual void import();
+  virtual int writeGEO(const std::string &name);
 };
 
 #endif
diff --git a/Graphics/Makefile b/Graphics/Makefile
index 2fbb805863..63b9a8cfe1 100644
--- a/Graphics/Makefile
+++ b/Graphics/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.102 2006-08-24 15:24:16 geuzaine Exp $
+# $Id: Makefile,v 1.103 2006-10-10 00:44:42 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -87,11 +87,11 @@ Draw.o: Draw.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h ../Geo/GPoint.h \
-  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
-  ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
-  ../Geo/SBoundingBox3d.h
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h \
+  ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Geo/MElement.h ../Geo/SBoundingBox3d.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 \
@@ -101,8 +101,8 @@ Mesh.o: Mesh.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
   ../Common/Context.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
   ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
   ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
@@ -125,10 +125,10 @@ Geom.o: Geom.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
-  ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
-  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h ../Geo/GPoint.h \
+  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
+  ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
   ../Geo/SBoundingBox3d.h
 # 1 "/Users/geuzaine/.gmsh/Graphics//"
 Post.o: Post.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
@@ -159,14 +159,14 @@ SelectBuffer.o: SelectBuffer.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h ../Geo/GPoint.h \
-  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
-  ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
-  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEdge.h ../Geo/GFace.h \
-  ../Geo/GRegion.h ../Geo/SBoundingBox3d.h ../Geo/MRep.h ../Geo/GEdge.h \
-  ../Geo/GFace.h ../Geo/GRegion.h ../Geo/MVertex.h ../Geo/MEdge.h \
-  ../Geo/MElement.h ../Common/OS.h
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/GFace.h \
+  ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h \
+  ../Geo/MElement.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEdge.h \
+  ../Geo/GFace.h ../Geo/GRegion.h ../Geo/SBoundingBox3d.h ../Geo/MRep.h \
+  ../Geo/GEdge.h ../Geo/GFace.h ../Geo/GRegion.h ../Geo/MVertex.h \
+  ../Geo/MEdge.h ../Geo/MElement.h ../Common/OS.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 \
diff --git a/Mesh/Makefile b/Mesh/Makefile
index 389b01b621..9ef12e274c 100644
--- a/Mesh/Makefile
+++ b/Mesh/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.133 2006-09-14 15:48:35 geuzaine Exp $
+# $Id: Makefile,v 1.134 2006-10-10 00:44:42 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -329,9 +329,9 @@ BDS.o: BDS.cpp ../Numeric/Numeric.h ../Common/GmshMatrix.h BDS.h \
   ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
   ../Common/GmshDefines.h ../Geo/MElement.h ../Geo/MVertex.h \
   ../Geo/SPoint3.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
-  ../Common/Context.h ../DataStr/List.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Common/Views.h \
+  ../Geo/SPoint3.h ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h \
+  ../Geo/SVector3.h ../Common/Context.h ../DataStr/List.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Common/Views.h \
   ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/AdaptiveViews.h \
   ../Common/GmshMatrix.h ../Common/Message.h
@@ -356,9 +356,9 @@ Generator.o: Generator.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/Range.h \
   ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
   ../Geo/MElement.h ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/MEdge.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Context.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Common/Views.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Context.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Common/Views.h \
   ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/AdaptiveViews.h \
   ../Common/GmshMatrix.h Create.h ../Parser/OpenFile.h PartitionMesh.h \
@@ -410,14 +410,14 @@ meshGEdge.o: meshGEdge.cpp meshGEdge.h ../Geo/GEdge.h ../Geo/GEntity.h \
   ../Geo/GEntity.h ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/GPoint.h \
   ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
   ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
-  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h \
-  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h \
-  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.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 \
-  Utils.h Vertex.h Mesh.h Element.h Simplex.h Face.h Edge.h \
-  ../Geo/ExtrudeParams.h Metric.h Matrix.h
+  ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h \
+  ../Geo/SVector3.h ../Numeric/Numeric.h ../Common/Context.h \
+  ../DataStr/List.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.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 Utils.h Vertex.h Mesh.h Element.h Simplex.h Face.h \
+  Edge.h ../Geo/ExtrudeParams.h Metric.h Matrix.h
 # 1 "/Users/geuzaine/.gmsh/Mesh//"
 meshGFace.o: meshGFace.cpp meshGFace.h ../Geo/GVertex.h ../Geo/GEntity.h \
   ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
@@ -427,8 +427,8 @@ meshGFace.o: meshGFace.cpp meshGFace.h ../Geo/GVertex.h ../Geo/GEntity.h \
   Face.h Edge.h ../Geo/ExtrudeParams.h Metric.h Matrix.h ../Geo/GEdge.h \
   ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
   ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
   ../Common/Context.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
   ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
   Utils.h ../Common/Message.h BDS.h ../Common/Views.h \
@@ -442,8 +442,8 @@ meshGFaceTransfinite.o: meshGFaceTransfinite.cpp meshGFace.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
   ../Common/Context.h ../DataStr/List.h ../Geo/GFace.h ../Geo/GPoint.h \
   ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
   ../Geo/Pair.h ../Common/Message.h
@@ -452,10 +452,11 @@ meshGRegionDelaunayInsertion.o: meshGRegionDelaunayInsertion.cpp \
   meshGRegionDelaunayInsertion.h ../Geo/MElement.h \
   ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/SPoint3.h \
   ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
-  ../Common/Context.h ../DataStr/List.h ../Geo/GRegion.h ../Geo/GEntity.h \
-  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
-  ../Geo/SPoint3.h ../Geo/MElement.h ../Common/Message.h
+  ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
+  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h \
+  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/MElement.h \
+  ../Common/Message.h
 # 1 "/Users/geuzaine/.gmsh/Mesh//"
 meshGRegion.o: meshGRegion.cpp meshGRegion.h ../Geo/GModel.h \
   ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
@@ -463,8 +464,8 @@ meshGRegion.o: meshGRegion.cpp meshGRegion.h ../Geo/GModel.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
   ../Common/Context.h ../DataStr/List.h ../Geo/GFace.h ../Geo/GPoint.h \
   ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
   ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
@@ -495,8 +496,8 @@ SecondOrder.o: SecondOrder.cpp ../Geo/GModel.h ../Geo/GVertex.h \
   ../Geo/MVertex.h ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h \
-  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
+  ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
   ../Common/Context.h ../DataStr/List.h ../Geo/GFace.h ../Geo/GPoint.h \
   ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
   ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
diff --git a/Parser/CreateFile.cpp b/Parser/CreateFile.cpp
index 39996d26df..8f1bb301f6 100644
--- a/Parser/CreateFile.cpp
+++ b/Parser/CreateFile.cpp
@@ -1,4 +1,4 @@
-// $Id: CreateFile.cpp,v 1.8 2006-09-03 07:44:10 geuzaine Exp $
+// $Id: CreateFile.cpp,v 1.9 2006-10-10 00:44:42 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -137,10 +137,6 @@ void CreateOutputFile(char *filename, int format)
     printEndMessage = false;
     break;
     
-  case FORMAT_GEO:
-    Print_Geo(name);
-    break;
-
   case FORMAT_OPT:
     Print_Options(0, GMSH_FULLRC, 1, 1, name);
     break;
@@ -175,6 +171,10 @@ void CreateOutputFile(char *filename, int format)
     GMODEL->writePOS(name);
     break;
 
+  case FORMAT_GEO:
+    GMODEL->writeGEO(name);
+    break;
+
 #if defined(HAVE_FLTK)
   case FORMAT_PPM:
   case FORMAT_YUV:
diff --git a/Parser/Makefile b/Parser/Makefile
index 34568cf86f..db7009b1a5 100644
--- a/Parser/Makefile
+++ b/Parser/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.102 2006-08-26 13:34:46 geuzaine Exp $
+# $Id: Makefile,v 1.103 2006-10-10 00:44:42 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -116,14 +116,14 @@ OpenFile.o: OpenFile.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Geo/SPoint3.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/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Numeric/Numeric.h ../Common/Context.h \
-  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/MElement.h \
-  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/GRegion.h \
-  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SBoundingBox3d.h \
-  ../Common/SmoothNormals.h ../Geo/fourierModel.h ../Geo/GModel.h \
-  Parser.h OpenFile.h ../Common/CommandLine.h ../Common/Views.h \
-  ../Common/ColorTable.h ../Common/VertexArray.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
+  ../Common/Context.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
+  ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
+  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
+  ../Geo/SBoundingBox3d.h ../Common/SmoothNormals.h ../Geo/fourierModel.h \
+  ../Geo/GModel.h Parser.h OpenFile.h ../Common/CommandLine.h \
+  ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.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 \
@@ -146,10 +146,10 @@ CreateFile.o: CreateFile.cpp ../Common/Gmsh.h ../Common/Message.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/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
-  ../Numeric/Numeric.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
-  ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
-  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
+  ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h \
+  ../Geo/SVector3.h ../Numeric/Numeric.h ../Geo/GFace.h ../Geo/GPoint.h \
+  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
+  ../Geo/Pair.h ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
   ../Geo/SBoundingBox3d.h ../Common/SmoothNormals.h ../Common/GmshUI.h \
   ../Graphics/gl2ps.h ../Graphics/gl2gif.h ../Graphics/PixelBuffer.h \
   ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h \
diff --git a/Plugin/Makefile b/Plugin/Makefile
index 574c3b0a87..152c2fe1b4 100644
--- a/Plugin/Makefile
+++ b/Plugin/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.109 2006-08-26 13:34:46 geuzaine Exp $
+# $Id: Makefile,v 1.110 2006-10-10 00:44:42 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -213,9 +213,9 @@ ExtractEdges.o: ExtractEdges.cpp Plugin.h ../Common/Options.h \
   ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/GmshDefines.h \
   ../Geo/MElement.h ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/MEdge.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/SPoint2.h ../Geo/SVector3.h \
-  ../Geo/Pair.h
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/Hash.h \
+  ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h ../Geo/SPoint2.h \
+  ../Geo/SVector3.h ../Geo/Pair.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 DecomposeInSimplex.o: DecomposeInSimplex.cpp Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
-- 
GitLab