diff --git a/Common/Context.h b/Common/Context.h
index 114223458ebee3638e1625b00102a42b191e418b..4bb8e00afd01bc22516fefacb67625ab8b06e7f9 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -216,7 +216,7 @@ public :
       unsigned int tangents, normals;
     } geom;
     struct{
-      unsigned int vertex, line, triangle, quadrangle;
+      unsigned int vertex, vertex_deg2, line, triangle, quadrangle;
       unsigned int tetrahedron, hexahedron, prism, pyramid;
       unsigned int carousel[10];
       unsigned int tangents, normals;
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 52fe606a89e386f8f3ee848be6536241df205bdb..cf548d9eedeca1cb3370833314c9d8002edd0cb9 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -1205,6 +1205,11 @@ StringXColor MeshOptions_Color[] = {
     PACK_COLOR(0  , 123, 59 , 255),
     PACK_COLOR(0,   0,   0,   255),
     "Mesh vertex color" },
+  { F|O, "PointsSup" , opt_mesh_color_points_deg2 , 
+    PACK_COLOR(255, 0,  255 , 255),
+    PACK_COLOR(255, 0,  255 , 255),
+    PACK_COLOR(0,   0,  0,   255),
+    "Second order mesh vertex color" },
   { F|O, "Lines" , opt_mesh_color_lines , 
     PACK_COLOR(0,   255, 0,   255),
     PACK_COLOR(0,   255, 0,   255),
diff --git a/Common/Makefile b/Common/Makefile
index 7148e5555dcfb8a82b2ce212b0b3744769c95c7a..4f2bbbb7c1775190a9265da669ee6d0315c16cec 100644
--- a/Common/Makefile
+++ b/Common/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.52 2004-04-13 20:56:40 geuzaine Exp $
+# $Id: Makefile,v 1.53 2004-04-18 03:36:06 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -62,9 +62,10 @@ depend:
 Context.o: Context.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h ../Graphics/Draw.h ../Common/Views.h \
-  ../Common/ColorTable.h Context.h Options.h DefaultOptions.h Trackball.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h Context.h \
+  Options.h DefaultOptions.h Trackball.h
 Views.o: Views.cpp Gmsh.h Message.h ../DataStr/Malloc.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Views.h ColorTable.h Context.h Options.h
@@ -72,17 +73,18 @@ Options.o: Options.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
   ../Common/ColorTable.h ../DataStr/List.h Gmsh.h ../DataStr/Malloc.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h GmshUI.h \
-  ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Graphics/Draw.h Context.h ../Fltk/Solvers.h \
-  ../Fltk/GUI.h ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h
+  ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Graphics/Draw.h Context.h \
+  ../Fltk/Solvers.h ../Fltk/GUI.h ../Fltk/Opengl_Window.h \
+  ../Fltk/Colorbar_Window.h
 CommandLine.o: CommandLine.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   GmshUI.h GmshVersion.h CommandLine.h ../Numeric/Numeric.h Context.h \
   Options.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h Views.h ColorTable.h \
-  ../Parser/OpenFile.h ../Parser/Parser.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Views.h ColorTable.h ../Parser/OpenFile.h ../Parser/Parser.h
 Timer.o: Timer.cpp
 ColorTable.o: ColorTable.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
@@ -90,8 +92,9 @@ ColorTable.o: ColorTable.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
 Visibility.o: Visibility.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Geo/Geo.h ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h ../Parser/Parser.h Visibility.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Parser/Parser.h Visibility.h
 Trackball.o: Trackball.cpp Trackball.h
 License.o: License.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 48443f60d237b8f90316b62a9111be422d200a7f..6de928459501bccca8055057f4977bcc9a560ce1 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.142 2004-04-13 18:46:53 geuzaine Exp $
+// $Id: Options.cpp,v 1.143 2004-04-18 03:36:06 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -5055,6 +5055,17 @@ unsigned int opt_mesh_color_points(OPT_ARGS_COL)
 #endif
   return CTX.color.mesh.vertex;
 }
+unsigned int opt_mesh_color_points_deg2(OPT_ARGS_COL)
+{
+  if(action & GMSH_SET) {
+    CTX.color.mesh.vertex_deg2 = val;
+    CTX.mesh.changed = 1;
+  }
+#if defined(HAVE_FLTK)
+  CCC(CTX.color.mesh.vertex, WID->mesh_col[1]);
+#endif
+  return CTX.color.mesh.vertex_deg2;
+}
 unsigned int opt_mesh_color_lines(OPT_ARGS_COL)
 {
   if(action & GMSH_SET) {
@@ -5062,7 +5073,7 @@ unsigned int opt_mesh_color_lines(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.line, WID->mesh_col[1]);
+  CCC(CTX.color.mesh.line, WID->mesh_col[2]);
 #endif
   return CTX.color.mesh.line;
 }
@@ -5073,7 +5084,7 @@ unsigned int opt_mesh_color_triangles(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.triangle, WID->mesh_col[2]);
+  CCC(CTX.color.mesh.triangle, WID->mesh_col[3]);
 #endif
   return CTX.color.mesh.triangle;
 }
@@ -5084,7 +5095,7 @@ unsigned int opt_mesh_color_quadrangles(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.quadrangle, WID->mesh_col[3]);
+  CCC(CTX.color.mesh.quadrangle, WID->mesh_col[4]);
 #endif
   return CTX.color.mesh.quadrangle;
 }
@@ -5095,7 +5106,7 @@ unsigned int opt_mesh_color_tetrahedra(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.tetrahedron, WID->mesh_col[4]);
+  CCC(CTX.color.mesh.tetrahedron, WID->mesh_col[5]);
 #endif
   return CTX.color.mesh.tetrahedron;
 }
@@ -5106,7 +5117,7 @@ unsigned int opt_mesh_color_hexahedra(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.hexahedron, WID->mesh_col[5]);
+  CCC(CTX.color.mesh.hexahedron, WID->mesh_col[6]);
 #endif
   return CTX.color.mesh.hexahedron;
 }
@@ -5117,7 +5128,7 @@ unsigned int opt_mesh_color_prisms(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.prism, WID->mesh_col[6]);
+  CCC(CTX.color.mesh.prism, WID->mesh_col[7]);
 #endif
   return CTX.color.mesh.prism;
 }
@@ -5128,7 +5139,7 @@ unsigned int opt_mesh_color_pyramid(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.pyramid, WID->mesh_col[7]);
+  CCC(CTX.color.mesh.pyramid, WID->mesh_col[8]);
 #endif
   return CTX.color.mesh.pyramid;
 }
@@ -5139,7 +5150,7 @@ unsigned int opt_mesh_color_tangents(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.tangents, WID->mesh_col[8]);
+  CCC(CTX.color.mesh.tangents, WID->mesh_col[9]);
 #endif
   return CTX.color.mesh.tangents;
 }
@@ -5150,7 +5161,7 @@ unsigned int opt_mesh_color_normals(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.normals, WID->mesh_col[9]);
+  CCC(CTX.color.mesh.normals, WID->mesh_col[10]);
 #endif
   return CTX.color.mesh.normals;
 }
@@ -5161,7 +5172,7 @@ unsigned int opt_mesh_color_1(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[0], WID->mesh_col[10]);
+  CCC(CTX.color.mesh.carousel[0], WID->mesh_col[11]);
 #endif
   return CTX.color.mesh.carousel[0];
 }
@@ -5172,7 +5183,7 @@ unsigned int opt_mesh_color_2(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[1], WID->mesh_col[11]);
+  CCC(CTX.color.mesh.carousel[1], WID->mesh_col[12]);
 #endif
   return CTX.color.mesh.carousel[1];
 }
@@ -5183,7 +5194,7 @@ unsigned int opt_mesh_color_3(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[2], WID->mesh_col[12]);
+  CCC(CTX.color.mesh.carousel[2], WID->mesh_col[13]);
 #endif
   return CTX.color.mesh.carousel[2];
 }
@@ -5194,7 +5205,7 @@ unsigned int opt_mesh_color_4(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[3], WID->mesh_col[13]);
+  CCC(CTX.color.mesh.carousel[3], WID->mesh_col[14]);
 #endif
   return CTX.color.mesh.carousel[3];
 }
@@ -5205,7 +5216,7 @@ unsigned int opt_mesh_color_5(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[4], WID->mesh_col[14]);
+  CCC(CTX.color.mesh.carousel[4], WID->mesh_col[15]);
 #endif
   return CTX.color.mesh.carousel[4];
 }
@@ -5216,7 +5227,7 @@ unsigned int opt_mesh_color_6(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[5], WID->mesh_col[15]);
+  CCC(CTX.color.mesh.carousel[5], WID->mesh_col[16]);
 #endif
   return CTX.color.mesh.carousel[5];
 }
@@ -5227,7 +5238,7 @@ unsigned int opt_mesh_color_7(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[6], WID->mesh_col[16]);
+  CCC(CTX.color.mesh.carousel[6], WID->mesh_col[17]);
 #endif
   return CTX.color.mesh.carousel[6];
 }
@@ -5238,7 +5249,7 @@ unsigned int opt_mesh_color_8(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[7], WID->mesh_col[17]);
+  CCC(CTX.color.mesh.carousel[7], WID->mesh_col[18]);
 #endif
   return CTX.color.mesh.carousel[7];
 }
@@ -5249,7 +5260,7 @@ unsigned int opt_mesh_color_9(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[8], WID->mesh_col[18]);
+  CCC(CTX.color.mesh.carousel[8], WID->mesh_col[19]);
 #endif
   return CTX.color.mesh.carousel[8];
 }
@@ -5260,7 +5271,7 @@ unsigned int opt_mesh_color_10(OPT_ARGS_COL)
     CTX.mesh.changed = 1;
   }
 #if defined(HAVE_FLTK)
-  CCC(CTX.color.mesh.carousel[9], WID->mesh_col[19]);
+  CCC(CTX.color.mesh.carousel[9], WID->mesh_col[20]);
 #endif
   return CTX.color.mesh.carousel[9];
 }
diff --git a/Common/Options.h b/Common/Options.h
index 0726d3d6f55f6de1350948778eeb6ec5294774c6..bdc358a44918d0af949c3fba2151d2290d2d8991 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -516,6 +516,7 @@ unsigned int opt_geometry_color_volumes_highlight(OPT_ARGS_COL);
 unsigned int opt_geometry_color_tangents(OPT_ARGS_COL);
 unsigned int opt_geometry_color_normals(OPT_ARGS_COL);
 unsigned int opt_mesh_color_points(OPT_ARGS_COL); 
+unsigned int opt_mesh_color_points_deg2(OPT_ARGS_COL); 
 unsigned int opt_mesh_color_lines(OPT_ARGS_COL); 
 unsigned int opt_mesh_color_triangles(OPT_ARGS_COL);
 unsigned int opt_mesh_color_quadrangles(OPT_ARGS_COL);
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 4f004ce60c2d5812e33fe4be4bc040b3120c2d72..62defe26b270477072a04c74994b49906287f0c9 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.280 2004-04-15 02:13:23 geuzaine Exp $
+// $Id: GUI.cpp,v 1.281 2004-04-18 03:36:06 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -1758,7 +1758,7 @@ void GUI::create_option_window()
         mesh_value[i]->align(FL_ALIGN_RIGHT);
       }
 
-      mesh_butt[3] = new Fl_Check_Button(2 * WB, 2 * WB + 5 * BH, BW, BH, "Second order elements (1D and 2D mesh only)");
+      mesh_butt[3] = new Fl_Check_Button(2 * WB, 2 * WB + 5 * BH, BW, BH, "Second order elements (simplices only)");
       mesh_butt[3]->type(FL_TOGGLE_BUTTON);
       mesh_butt[3]->down_box(TOGGLE_BOX);
       mesh_butt[3]->selection_color(TOGGLE_COLOR);
diff --git a/Fltk/Makefile b/Fltk/Makefile
index c5254adfab03d9b0be97a1d9fff82a95aa40095e..5b6164c4381ad0199576ae89b4150736ce63a922 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.51 2004-03-30 18:17:06 geuzaine Exp $
+# $Id: Makefile,v 1.52 2004-04-18 03:36:06 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -68,11 +68,12 @@ Main.o: Main.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Common/ColorTable.h ../DataStr/List.h ../Common/Gmsh.h \
   ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \
   ../DataStr/Tools.h ../Common/GmshUI.h ../Common/GmshVersion.h \
-  ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Graphics/Draw.h ../Common/Context.h \
-  ../Parser/Parser.h GUI.h Opengl_Window.h Colorbar_Window.h \
-  ../Parser/OpenFile.h ../Common/CommandLine.h ../Numeric/Numeric.h
+  ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Graphics/Draw.h \
+  ../Common/Context.h ../Parser/Parser.h GUI.h Opengl_Window.h \
+  Colorbar_Window.h ../Parser/OpenFile.h ../Common/CommandLine.h \
+  ../Numeric/Numeric.h
 Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
@@ -84,7 +85,7 @@ GUI.o: GUI.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \
   ../DataStr/Tools.h ../Common/GmshUI.h ../Numeric/Numeric.h \
   ../Common/GmshVersion.h ../Common/Context.h ../Geo/Geo.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   ../Graphics/Draw.h GUI.h Opengl_Window.h Colorbar_Window.h Callbacks.h \
   Bitmaps.h Win32Icon.h ../Parser/OpenFile.h ../Common/CommandLine.h \
@@ -92,19 +93,19 @@ GUI.o: GUI.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
 Callbacks.o: Callbacks.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Geo/ExtractContour.h ../Graphics/Draw.h \
-  ../Common/Views.h ../Common/ColorTable.h ../Common/Timer.h \
-  ../Graphics/CreateFile.h ../Parser/OpenFile.h ../Common/CommandLine.h \
-  ../Common/Context.h ../Common/Options.h GUI.h Opengl_Window.h \
-  Colorbar_Window.h Callbacks.h ../Plugin/Plugin.h ../Common/Visibility.h \
-  ../Geo/MinMax.h Solvers.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Geo/ExtractContour.h \
+  ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h \
+  ../Common/Timer.h ../Graphics/CreateFile.h ../Parser/OpenFile.h \
+  ../Common/CommandLine.h ../Common/Context.h ../Common/Options.h GUI.h \
+  Opengl_Window.h Colorbar_Window.h Callbacks.h ../Plugin/Plugin.h \
+  ../Common/Visibility.h ../Geo/MinMax.h Solvers.h
 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 ../Common/GmshUI.h \
   ../Numeric/Numeric.h ../Common/Context.h ../Geo/Geo.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h GUI.h \
   Opengl_Window.h Colorbar_Window.h ../Graphics/gl2ps.h
@@ -112,7 +113,7 @@ 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 ../Numeric/Numeric.h \
   ../Common/GmshUI.h ../Common/Context.h ../Geo/Geo.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h GUI.h \
   Opengl_Window.h Colorbar_Window.h
@@ -127,6 +128,6 @@ Solvers.o: Solvers.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../utils/solvers/GmshClient.h \
   GmshServer.h ../Parser/OpenFile.h Solvers.h ../Common/GmshUI.h GUI.h \
   Opengl_Window.h Colorbar_Window.h ../Common/ColorTable.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   ../Graphics/Draw.h ../Common/Views.h ../Common/Context.h
diff --git a/Geo/Makefile b/Geo/Makefile
index 2186e5c04a3b360ecf2369c0b22d33f4dd3781a0..38d1834b826eed87aa283f10d44b512a374ce68a 100644
--- a/Geo/Makefile
+++ b/Geo/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.45 2004-04-13 20:56:40 geuzaine Exp $
+# $Id: Makefile,v 1.46 2004-04-18 03:36:06 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -61,9 +61,10 @@ depend:
 CAD.o: CAD.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h ../Mesh/Interpolation.h \
-  ../Mesh/Create.h CAD.h ../Common/Visibility.h ../Common/Context.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Mesh/Interpolation.h ../Mesh/Create.h CAD.h ../Common/Visibility.h \
+  ../Common/Context.h
 MinMax.o: MinMax.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h \
@@ -71,34 +72,35 @@ MinMax.o: MinMax.cpp ../Common/Gmsh.h ../Common/Message.h \
 ExtrudeParams.o: ExtrudeParams.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Geo.h CAD.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h
 Geo.o: Geo.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Geo.h CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h ../Parser/Parser.h \
-  ../Common/Context.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Parser/Parser.h ../Common/Context.h
 GeoUtils.o: GeoUtils.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Geo.h CAD.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h
 StepGeomDatabase.o: StepGeomDatabase.cpp ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Geo.h GeoUtils.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h ../Mesh/Nurbs.h CAD.h \
-  StepGeomDatabase.h ../Mesh/Create.h ../Common/Context.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Mesh/Nurbs.h CAD.h StepGeomDatabase.h ../Mesh/Create.h \
+  ../Common/Context.h
 ExtractContour.o: ExtractContour.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Geo.h CAD.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h
 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 Geo.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   CAD.h ../Common/Context.h
diff --git a/Graphics/Makefile b/Graphics/Makefile
index daf96f727063cd5a608f132cc34acf6419f16ace..1bbac6870f593078e5e89e07d9a8014885c4e4f1 100644
--- a/Graphics/Makefile
+++ b/Graphics/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.55 2004-02-28 00:48:49 geuzaine Exp $
+# $Id: Makefile,v 1.56 2004-04-18 03:36:07 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -72,51 +72,52 @@ depend:
 Draw.o: Draw.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h ../Common/Views.h \
-  ../Common/ColorTable.h ../Common/Context.h ../Geo/MinMax.h \
-  ../Numeric/Numeric.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
+  ../Geo/MinMax.h ../Numeric/Numeric.h
 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 \
   ../Common/GmshUI.h ../Geo/Geo.h ../Geo/CAD.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
   ../Geo/MinMax.h gl2ps.h ../Numeric/Numeric.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 \
   ../Common/GmshUI.h ../Numeric/Numeric.h ../Geo/Geo.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   ../Mesh/Utils.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
   ../Common/Context.h ../Mesh/Interpolation.h gl2ps.h
 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 \
   ../Common/GmshUI.h ../Numeric/Numeric.h ../Geo/Geo.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
   gl2ps.h
 PostElement.o: PostElement.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Geo/Geo.h \
-  ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  Draw.h ../Common/Views.h ../Common/ColorTable.h Iso.h \
+  ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h \
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
+  ../Mesh/Matrix.h Draw.h ../Common/Views.h ../Common/ColorTable.h Iso.h \
   ../Common/Context.h ../Numeric/Numeric.h
 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 \
   ../Common/GmshUI.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h ../Common/Views.h \
-  ../Common/ColorTable.h ../Common/Context.h ../Numeric/Numeric.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
+  ../Numeric/Numeric.h
 Entity.o: Entity.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
-  ../Numeric/Numeric.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Common/Context.h
+  ../Numeric/Numeric.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Common/Context.h
 ReadImg.o: ReadImg.cpp ReadImg.h ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
@@ -124,27 +125,28 @@ ReadImg.o: ReadImg.cpp ReadImg.h ../Common/Gmsh.h ../Common/Message.h \
 Scale.o: Scale.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
-  ../Numeric/Numeric.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Common/Context.h gl2ps.h
+  ../Numeric/Numeric.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Common/Context.h gl2ps.h
 Graph2D.o: Graph2D.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
   ../Common/Context.h ../Numeric/Numeric.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   Draw.h ../Common/Views.h ../Common/ColorTable.h gl2ps.h
 Axes.o: Axes.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Numeric/Numeric.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h ../Common/Views.h \
-  ../Common/ColorTable.h ../Common/Context.h gl2ps.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
+  gl2ps.h
 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 ../Common/GmshUI.h ../Mesh/Mesh.h \
-  ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
   ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
   ../Parser/OpenFile.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
   ../Common/Context.h ../Common/Options.h gl2ps.h gl2gif.h gl2jpeg.h \
diff --git a/Mesh/1D_Mesh.cpp b/Mesh/1D_Mesh.cpp
index 68515ad227abe55fe254295c666a83fcb3691c13..3b18b4bfc902c598dcd9d0fb9e9d61eb9dc84423 100644
--- a/Mesh/1D_Mesh.cpp
+++ b/Mesh/1D_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 1D_Mesh.cpp,v 1.36 2004-02-07 01:40:20 geuzaine Exp $
+// $Id: 1D_Mesh.cpp,v 1.37 2004-04-18 03:36:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -158,9 +158,6 @@ void Maillage_Curve(void *data, void *dummy)
   }
 
   if(Extrude_Mesh(c)){
-    if(CTX.mesh.order == 2){
-      Degre2(c->Simplexes, c, NULL);
-    }
     THEM->Statistics[4] += List_Nbr(c->Vertices);
     return;
   }
@@ -255,9 +252,5 @@ void Maillage_Curve(void *data, void *dummy)
     List_Add(c->TrsfSimplexes, &s);
   }
 
-  if(CTX.mesh.order == 2){
-    Degre2(c->Simplexes, c, NULL);
-  }
-
   THEM->Statistics[4] += List_Nbr(c->Vertices);
 }
diff --git a/Mesh/2D_Mesh.cpp b/Mesh/2D_Mesh.cpp
index e3c91cd5564fc2d91315288712878f299ef0d0e1..997c9aad2b728669b20ff62f0d7683a7e8d20689 100644
--- a/Mesh/2D_Mesh.cpp
+++ b/Mesh/2D_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 2D_Mesh.cpp,v 1.53 2004-03-03 22:26:33 geuzaine Exp $
+// $Id: 2D_Mesh.cpp,v 1.54 2004-04-18 03:36:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -813,9 +813,6 @@ void Maillage_Surface(void *data, void *dum)
     Tree_Action(THEM->Points, PutVertex_OnSurf);
     Tree_Action(s->Vertices, PutVertex_OnSurf);
     Tree_Action(s->Vertices, Add_In_Mesh);
-    if(CTX.mesh.order == 2){
-      Degre2(s->Simplexes, NULL, s);
-    }
     THEM->Statistics[5] += Tree_Nbr(THESURFACE->Vertices);
     THEM->Statistics[7] += Tree_Nbr(THESURFACE->Simplexes);
 
@@ -886,12 +883,7 @@ void Maillage_Surface(void *data, void *dum)
   End_Surface(s->Support);
   End_Surface(s);
 
-  if(CTX.mesh.order == 2){
-    Degre2(s->Simplexes, NULL, THESUPPORT);
-  }
-
   THEM->Statistics[5] += Tree_Nbr(THESURFACE->Vertices);
   THEM->Statistics[7] += Tree_Nbr(THESURFACE->Simplexes);       // tri+qua
   THEM->Statistics[8] += nbqua;
-
 }
diff --git a/Mesh/3D_Mesh.cpp b/Mesh/3D_Mesh.cpp
index 1c2a4b8a36f2c9dbbc1788e4ebeb5958bca0ab72..d7e7bcd9d99ec4128bdc15a0959d85014d81bac9 100644
--- a/Mesh/3D_Mesh.cpp
+++ b/Mesh/3D_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_Mesh.cpp,v 1.57 2004-02-07 01:40:21 geuzaine Exp $
+// $Id: 3D_Mesh.cpp,v 1.58 2004-04-18 03:36:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -1049,17 +1049,9 @@ void Maillage_Volume(void *data, void *dum)
     List_Delete(Simplexes_Destroyed);
   }
 
-  if(CTX.mesh.order == 2){
-    Msg(GERROR, "3D second order mesh not implemented yet");
-    // - hexa/prism/pyram: not done
-    // - tetra: wrong if edge swaps 
-    //Degre2(v->Simplexes, NULL, NULL);
-  }
-
   THEM->Statistics[6] += Tree_Nbr(v->Vertices);
   THEM->Statistics[9] += Tree_Nbr(v->Simplexes);
   THEM->Statistics[10] += Tree_Nbr(v->Hexahedra);
   THEM->Statistics[11] += Tree_Nbr(v->Prisms);
   THEM->Statistics[12] += Tree_Nbr(v->Pyramids);
-
 }
diff --git a/Mesh/3D_Mesh_Old.cpp b/Mesh/3D_Mesh_Old.cpp
index e41eca74b992971b89d572e33f16667617a0efd8..1121664954acdc5fb132d8f79abb347272841cf9 100644
--- a/Mesh/3D_Mesh_Old.cpp
+++ b/Mesh/3D_Mesh_Old.cpp
@@ -1,4 +1,4 @@
-// $Id: 3D_Mesh_Old.cpp,v 1.10 2004-02-07 01:40:21 geuzaine Exp $
+// $Id: 3D_Mesh_Old.cpp,v 1.11 2004-04-18 03:36:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -906,10 +906,6 @@ void Maillage_Volume(void *data, void *dum)
        */
     }
 
-    if(CTX.mesh.order == 2){
-      Degre2(v->Simplexes, NULL, NULL);
-    }
-
     List_Delete(Simplexes_New);
     List_Delete(Simplexes_Destroyed);
   }
diff --git a/Mesh/Element.h b/Mesh/Element.h
new file mode 100644
index 0000000000000000000000000000000000000000..8ceb1e951986e46cdb3de8eb28901fafba1c79fb
--- /dev/null
+++ b/Mesh/Element.h
@@ -0,0 +1,35 @@
+#ifndef _ELEMENT_H_
+#define _ELEMENT_H_
+
+// Copyright (C) 1997-2004 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 "List.h"
+
+class Element {
+ public:
+  int     Num;           // Number
+  int     iEnt;          // Elementary geometrical entity
+  int     iPart;         // Mesh partition index
+  char    Visible;       // Visualization flag
+  Vertex  **VSUP;        // suppl. nodes for higher order elts
+  virtual ~Element(){;}
+};
+
+#endif
diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp
index 170ccba75a45f5fbe02b7c9280161e8a86726e32..7d4444ab6804978a2469f208d0143f3226562d05 100644
--- a/Mesh/Generator.cpp
+++ b/Mesh/Generator.cpp
@@ -1,4 +1,4 @@
-// $Id: Generator.cpp,v 1.49 2004-02-28 00:48:50 geuzaine Exp $
+// $Id: Generator.cpp,v 1.50 2004-04-18 03:36:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -184,7 +184,7 @@ void Init_Mesh(Mesh * M)
   M->MaxSimplexNum = 0;
 
   ExitExtrude();
-  Reset_Degre2();
+  Degre1();
 
   Tree_Action(M->Vertices, Free_Vertex);  
   Tree_Delete(M->Vertices);
@@ -313,6 +313,16 @@ void mai3d(Mesh * M, int Asked)
     M->status = 3;
   }
 
+  // Second order elements
+
+  if(M->status && CTX.mesh.order == 2){
+    Msg(STATUS2, "Mesh second order...");
+    t1 = Cpu();
+    Degre2(M->status);
+    t2 = Cpu();
+    Msg(STATUS2, "Mesh second order complete (%g s)", t2 - t1);
+  }
+
   CTX.threads_lock = 0;
   CTX.mesh.changed = 1;
 }
diff --git a/Mesh/Makefile b/Mesh/Makefile
index 6b512ce9c76b478722a171c0232bb2d1df111ae6..ce3d60d9a7a54ec3b0e30c6ac09f4fa5ccd5e205 100644
--- a/Mesh/Makefile
+++ b/Mesh/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.58 2004-04-13 20:56:40 geuzaine Exp $
+# $Id: Makefile,v 1.59 2004-04-18 03:36:07 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -100,223 +100,228 @@ depend:
 1D_Mesh.o: 1D_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  Mesh.h Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h Utils.h ../Common/Context.h Interpolation.h
+  Mesh.h Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h Utils.h ../Common/Context.h Interpolation.h
 2D_Mesh.o: 2D_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Utils.h Create.h 2D_Mesh.h ../Common/Context.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Utils.h Create.h 2D_Mesh.h \
+  ../Common/Context.h
 2D_SMesh.o: 2D_SMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Geo/Geo.h Mesh.h Vertex.h \
-  Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h \
-  ../Numeric/Numeric.h Interpolation.h
+  Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
+  Matrix.h ../Numeric/Numeric.h Interpolation.h
 2D_Elliptic.o: 2D_Elliptic.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h
 2D_BGMesh.o: 2D_BGMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h 2D_Mesh.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h 2D_Mesh.h
 2D_Recombine.o: 2D_Recombine.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h Utils.h 2D_Mesh.h Create.h ../Common/Context.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h Utils.h 2D_Mesh.h Create.h ../Common/Context.h
 2D_InitMesh.o: 2D_InitMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h 2D_Mesh.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h 2D_Mesh.h
 2D_Bowyer.o: 2D_Bowyer.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h 2D_Mesh.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h 2D_Mesh.h
 2D_Bricks.o: 2D_Bricks.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h 2D_Mesh.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h 2D_Mesh.h
 2D_DivAndConq.o: 2D_DivAndConq.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h 2D_Mesh.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h 2D_Mesh.h
 2D_Util.o: 2D_Util.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h 2D_Mesh.h ../Common/Context.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h 2D_Mesh.h ../Common/Context.h
 2D_Links.o: 2D_Links.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h 2D_Mesh.h ../Common/Context.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h 2D_Mesh.h ../Common/Context.h
 2D_Tree.o: 2D_Tree.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Simplex.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h 2D_Mesh.h
+  ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Element.h Simplex.h \
+  Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h 2D_Mesh.h
 2D_Cylindrical.o: 2D_Cylindrical.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h ../Common/Context.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h ../Common/Context.h
 2D_Parametric.o: 2D_Parametric.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Interpolation.h 2D_Mesh.h Create.h ../Common/Context.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Interpolation.h 2D_Mesh.h Create.h \
+  ../Common/Context.h
 2D_Mesh_Aniso.o: 2D_Mesh_Aniso.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Interpolation.h Create.h ../Common/Context.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Interpolation.h Create.h \
+  ../Common/Context.h
 2D_Mesh_Triangle.o: 2D_Mesh_Triangle.cpp ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h \
-  Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h \
-  ../Numeric/Numeric.h ../Common/Context.h
+  Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
+  Matrix.h ../Numeric/Numeric.h ../Common/Context.h
 3D_Mesh.o: 3D_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h 3D_Mesh.h Create.h ../Common/Context.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h 3D_Mesh.h Create.h ../Common/Context.h
 3D_SMesh.o: 3D_SMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Simplex.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h Interpolation.h Create.h
+  ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Element.h Simplex.h \
+  Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h Interpolation.h \
+  Create.h
 3D_BGMesh.o: 3D_BGMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Simplex.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h 2D_Mesh.h 3D_Mesh.h \
-  ../Common/Views.h ../Common/ColorTable.h ../Numeric/Numeric.h \
+  ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Element.h Simplex.h \
+  Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h 2D_Mesh.h \
+  3D_Mesh.h ../Common/Views.h ../Common/ColorTable.h ../Numeric/Numeric.h \
   ../Common/Context.h
 3D_Extrude.o: 3D_Extrude.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Common/Context.h Create.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Common/Context.h Create.h
 3D_Extrude_Old.o: 3D_Extrude_Old.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Common/Context.h Create.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Common/Context.h Create.h
 3D_Coherence.o: 3D_Coherence.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  Mesh.h Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h 3D_Mesh.h Create.h
+  Mesh.h Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h 3D_Mesh.h Create.h
 3D_Divide.o: 3D_Divide.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h
 3D_Bricks.o: 3D_Bricks.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h
 MeshQuality.o: MeshQuality.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h
 Create.o: Create.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Utils.h ../Common/Context.h Create.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Utils.h ../Common/Context.h Create.h
 Generator.o: Generator.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h Create.h ../Common/Context.h ../Parser/OpenFile.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h Create.h ../Common/Context.h ../Parser/OpenFile.h
 Print_Mesh.o: Print_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Create.h ../Common/Context.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Create.h ../Common/Context.h
 Read_Mesh.o: Read_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Geo/Geo.h ../Geo/CAD.h \
-  ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  3D_Mesh.h Create.h ../Geo/MinMax.h ../Common/Context.h
+  ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h \
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
+  ../Mesh/Matrix.h 3D_Mesh.h Create.h ../Geo/MinMax.h ../Common/Context.h
 STL.o: STL.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
-  ../Numeric/Numeric.h Mesh.h Vertex.h Simplex.h Edge.h \
+  ../Numeric/Numeric.h Mesh.h Vertex.h Element.h Simplex.h Edge.h \
   ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h ../Geo/CAD.h \
   ../Geo/Geo.h Create.h Interpolation.h ../Common/Context.h
 SMS.o: SMS.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
-  ../Geo/Geo.h Mesh.h Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h \
-  STL.h Metric.h Matrix.h Create.h ../Geo/MinMax.h ../Geo/CAD.h \
-  ../Common/Context.h
+  ../Geo/Geo.h Mesh.h Vertex.h Element.h Simplex.h Edge.h \
+  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h Create.h ../Geo/MinMax.h \
+  ../Geo/CAD.h ../Common/Context.h
 SwapEdge.o: SwapEdge.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h SwapPatterns.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h SwapPatterns.h
 Utils.o: Utils.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Interpolation.h ../Common/Context.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Interpolation.h ../Common/Context.h
 Metric.o: Metric.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Interpolation.h
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Interpolation.h
 Nurbs.o: Nurbs.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../DataStr/Tools.h Nurbs.h Vertex.h Mesh.h Simplex.h \
-  Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h ../Geo/Geo.h \
-  ../Geo/GeoUtils.h Create.h ../Geo/CAD.h
+  ../DataStr/avl.h ../DataStr/Tools.h Nurbs.h Vertex.h Mesh.h Element.h \
+  Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h \
+  ../Geo/Geo.h ../Geo/GeoUtils.h Create.h ../Geo/CAD.h
 Interpolation.o: Interpolation.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  Nurbs.h Vertex.h Mesh.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h ../Geo/CAD.h Utils.h Interpolation.h
+  Nurbs.h Vertex.h Mesh.h Element.h Simplex.h Edge.h \
+  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h ../Geo/CAD.h Utils.h \
+  Interpolation.h
 SecondOrder.o: SecondOrder.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Geo/Geo.h Mesh.h Vertex.h \
-  Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h Utils.h \
-  Interpolation.h ../Numeric/Numeric.h
+  Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
+  Matrix.h Utils.h Interpolation.h ../Numeric/Numeric.h
 Smoothing.o: Smoothing.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
-  Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h
+  Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h
 CrossData.o: CrossData.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Simplex.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h
+  ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Element.h Simplex.h \
+  Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h
 Vertex.o: Vertex.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Vertex.h \
-  Mesh.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h \
-  ../Common/Context.h
+  Mesh.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
+  Matrix.h ../Common/Context.h
 Edge.o: Edge.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
-  ../Numeric/Numeric.h Mesh.h Vertex.h Simplex.h Edge.h \
+  ../Numeric/Numeric.h Mesh.h Vertex.h Element.h Simplex.h Edge.h \
   ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h
 Simplex.o: Simplex.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  Mesh.h Vertex.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h ../Common/Context.h
+  Mesh.h Vertex.h Element.h Simplex.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  Metric.h Matrix.h ../Common/Context.h
diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h
index 6b323635b46082f0e24e481c760320ac2e0d39b2..2ef267e7179335b564c8a6479c1fabbd80e579b2 100644
--- a/Mesh/Mesh.h
+++ b/Mesh/Mesh.h
@@ -23,6 +23,7 @@
 #include "List.h"
 #include "Tree.h"
 #include "Vertex.h"
+#include "Element.h"
 #include "Simplex.h"
 #include "Edge.h"
 #include "ExtrudeParams.h"
@@ -185,39 +186,27 @@ struct _MAILLAGE{
 };
 
 class NXE{
-  public :
+ public :
   Vertex *v;
   List_T *Liste;
   ~NXE();
   NXE();
 };
 
-typedef struct{
-  int Num; 
-  int iEnt; // parent geometrical entity
-  int iPart; // mesh partition index
-  char Visible;
+class Hexahedron : public Element{
+ public:
   Vertex *V[8];
-  Vertex **VSUP;
-}Hexahedron;
+};
 
-typedef struct{
-  int Num;
-  int iEnt; // parent geometrical entity
-  int iPart; // mesh partition index
-  char Visible;
+class Prism : public Element{
+ public:
   Vertex *V[6];
-  Vertex **VSUP;
-}Prism;
+};
 
-typedef struct{
-  int Num;
-  int iEnt; // parent geometrical entity
-  int iPart; // mesh partition index
-  char Visible;
+class Pyramid : public Element{
+ public:
   Vertex *V[5];
-  Vertex **VSUP;
-}Pyramid;
+};
 
 typedef struct{
   int N;
@@ -509,8 +498,10 @@ void deFreeze_Vertex (void *a, void *b);
 void crEdges (Tree_T * TreeElem, Tree_T * treeedges);
 
 double Lc_XYZ (double X, double Y, double Z, Mesh * m);
-void Degre2 (Tree_T * TreeElm, Curve * c, Surface * s);
-void Reset_Degre2 ();
+void Degre1();
+void Degre2(int dim);
+void Degre2_Curve(void *a, void *b);
+void Degre2_Surface(void *a, void *b);
 void ActionLiss (void *data, void *dummy);
 void ActionLissSurf (void *data, void *dummy);
 int  Recombine (Tree_T *TreeAllVert, Tree_T *TreeAllElg, double a);
diff --git a/Mesh/Print_Mesh.cpp b/Mesh/Print_Mesh.cpp
index 5c0cba48a5bd35c0c7c0a12e2fb8928d24372801..700c57dab8f6f544d028fe7c6ce7a0a7e0ef65b7 100644
--- a/Mesh/Print_Mesh.cpp
+++ b/Mesh/Print_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Print_Mesh.cpp,v 1.47 2004-02-07 01:40:22 geuzaine Exp $
+// $Id: Print_Mesh.cpp,v 1.48 2004-04-18 03:36:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -997,21 +997,15 @@ int process_Gref_nodes(FILE * fGref, Mesh * M,
   int i, nbtri;
   Vertex *v;
   Surface *s;
-  Curve *c;
-  List_T *ListSurfaces, *ListCurves, *Nodes;
+  List_T *Nodes;
 
-  ListCurves = Tree2List(M->Curves);
-  for(i = 0; i < List_Nbr(ListCurves); i++) {
-    List_Read(ListCurves, i, &c);
-    Degre2(c->Simplexes, c, NULL);
-  }
-  List_Delete(ListCurves);
-
-  ListSurfaces = Tree2List(M->Surfaces);
+  Tree_Action(M->Curves, Degre2_Curve);
+  Tree_Action(M->Surfaces, Degre2_Surface);
+ 
+  List_T *ListSurfaces = Tree2List(M->Surfaces);
   nbtri = 0;
   for(i = 0; i < List_Nbr(ListSurfaces); i++) {
     List_Read(ListSurfaces, i, &s);
-    Degre2(s->Simplexes, NULL, s);
     nbtri += Tree_Nbr(s->Simplexes);
   }
   List_Delete(ListSurfaces);
diff --git a/Mesh/Read_Mesh.cpp b/Mesh/Read_Mesh.cpp
index 4362c5c0f8a03b0beed27e207b883da0326b6328..92c014c01f788d7d219ae09b281cb8d226d7f3bd 100644
--- a/Mesh/Read_Mesh.cpp
+++ b/Mesh/Read_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Read_Mesh.cpp,v 1.70 2004-02-28 00:48:50 geuzaine Exp $
+// $Id: Read_Mesh.cpp,v 1.71 2004-04-18 03:36:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -293,6 +293,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp)
 	  if(Type == LGN2){
 	    simp->VSUP = (Vertex **) Malloc(1 * sizeof(Vertex *));
 	    simp->VSUP[0] = vertsp[2];
+	    simp->VSUP[0]->Degree = 2;
 	  }
           if(!Tree_Insert(c->Simplexes, &simp)){
 	    Msg(GERROR, "Line element %d already exists", simp->Num);
@@ -312,6 +313,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp)
 	    simp->VSUP = (Vertex **) Malloc(3 * sizeof(Vertex *));
 	    for(i = 0; i < 3; i++){
 	      simp->VSUP[i] = vertsp[i+3];
+	      simp->VSUP[i]->Degree = 2;
 	    }
 	  }
           if(Tree_Insert(s->Simplexes, &simp) && Tree_Insert(M->Simplexes, &simp)){
@@ -334,6 +336,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp)
 	    simp->VSUP = (Vertex **) Malloc(4 * sizeof(Vertex *));
 	    for(i = 0; i < 4; i++){
 	      simp->VSUP[i] = vertsp[i+4];
+	      simp->VSUP[i]->Degree = 2;
 	    }
 	  }
           if(Tree_Insert(s->Simplexes, &simp) && Tree_Insert(M->Simplexes, &simp)){
@@ -357,6 +360,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp)
 	    simp->VSUP = (Vertex **) Malloc(6 * sizeof(Vertex *));
 	    for(i = 0; i < 6; i++){
 	      simp->VSUP[i] = vertsp[i+4];
+	      simp->VSUP[i]->Degree = 2;
 	    }
 	  }
           if(Tree_Insert(v->Simplexes, &simp) && Tree_Insert(M->Simplexes, &simp)){
@@ -380,6 +384,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp)
 	    hex->VSUP = (Vertex **) Malloc(12 * sizeof(Vertex *));
 	    for(i = 0; i < 12; i++){
 	      hex->VSUP[i] = vertsp[i+8];
+	      hex->VSUP[i]->Degree = 2;
 	    }
 	  }
           if(Tree_Insert(v->Hexahedra, &hex)){
@@ -403,6 +408,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp)
 	    pri->VSUP = (Vertex **) Malloc(9 * sizeof(Vertex *));
 	    for(i = 0; i < 9; i++){
 	      pri->VSUP[i] = vertsp[i+6];
+	      pri->VSUP[i]->Degree = 2;
 	    }
 	  }
           if(Tree_Insert(v->Prisms, &pri)){
@@ -426,6 +432,7 @@ void Read_Mesh_MSH(Mesh * M, FILE * fp)
 	    pyr->VSUP = (Vertex **) Malloc(8 * sizeof(Vertex *));
 	    for(i = 0; i < 8; i++){
 	      pyr->VSUP[i] = vertsp[i+5];
+	      pyr->VSUP[i]->Degree = 2;
 	    }
 	  }
           if(Tree_Insert(v->Pyramids, &pyr)){
diff --git a/Mesh/SecondOrder.cpp b/Mesh/SecondOrder.cpp
index f6a5f5eed48176ea822b2ae60ccce3248b496f4b..1d5180294d533b00ecdc83386933f0eb95d91203 100644
--- a/Mesh/SecondOrder.cpp
+++ b/Mesh/SecondOrder.cpp
@@ -1,4 +1,4 @@
-// $Id: SecondOrder.cpp,v 1.18 2004-02-07 01:40:22 geuzaine Exp $
+// $Id: SecondOrder.cpp,v 1.19 2004-04-18 03:36:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -26,6 +26,18 @@
 #include "Interpolation.h"
 #include "Numeric.h"
 
+// FIXME: still todo
+// - middle edge nodes for hexas, prisms and pyramids
+// - middle face nodes for quads, hexas, prisms and pyramids
+
+// we really need to remove the quads from the simplex tree: it's a
+// real mess right now (EdgesInVolume makes sense only if we don't try
+// to do a 3D mesh with quads on surfaces)
+
+// -> add a Quad tree in Surface (like the Hax/Prism/Pyramid tree in
+// Volume); generalize Edge in terms of Element, and dynamic cast to
+// Simplex, Quandrangle, Hexahdra, etc.
+
 extern Mesh *THEM;
 
 static Surface *THES;
@@ -78,6 +90,7 @@ Vertex *oncurve(Vertex * v1, Vertex * v2)
   }
 
   pv = Create_Vertex(++THEM->MaxPointNum, v.Pos.X, v.Pos.Y, v.Pos.Z, v.lc, v.u);
+  pv->Degree = 2;
 
   if(!pv->ListCurves) {
     pv->ListCurves = List_Create(1, 1, sizeof(Curve *));
@@ -103,6 +116,8 @@ Vertex *onsurface(Vertex * v1, Vertex * v2)
   V = 0.5 * (V1 + V2);
   v = InterpolateSurface(THES, U, V, 0, 0);
   pv = Create_Vertex(++THEM->MaxPointNum, v.Pos.X, v.Pos.Y, v.Pos.Z, v.lc, v.u);
+  pv->Degree = 2;
+
   return pv;
 }
 
@@ -110,11 +125,6 @@ extern int edges_tetra[6][2];
 extern int edges_quad[4][2];
 extern int EdgesInVolume;
 
-// The following only works for additional nodes are associated with
-// the edges of the mesh. If you need a complete second order
-// representation, this is thus only valid for simplices (lines,
-// triangles, tetrahedra)...
-
 void PutMiddlePoint(void *a, void *b)
 {
   Edge *ed;
@@ -139,6 +149,7 @@ void PutMiddlePoint(void *a, void *b)
                       0.5 * (ed->V[0]->Pos.Z + ed->V[1]->Pos.Z),
                       0.5 * (ed->V[0]->lc + ed->V[1]->lc),
                       0.5 * (ed->V[0]->u + ed->V[1]->u));
+    v->Degree = 2;
   }
 
   ed->newv = v;
@@ -191,31 +202,137 @@ void PutMiddlePoint(void *a, void *b)
 }
 
 static Tree_T *TreeEdges = NULL;
+static List_T *VerticesToDelete = NULL;
+
+void ResetDegre2_Vertex(void *a, void *b)
+{
+  Vertex *v = *(Vertex**)a;
+  if(v->Degree == 2)
+    List_Add(VerticesToDelete, &v);
+}
+
+void ResetDegre2_Simplex(void *a, void *b)
+{
+  Simplex *s = *(Simplex**)a;
+  Free(s->VSUP);  
+  s->VSUP = NULL;
+}
 
-void Reset_Degre2(){
-  if(TreeEdges){
+void ResetDegre2_Curve(void *a, void *b)
+{
+  Curve *c = *(Curve**)a;
+  if(c->Dirty) return;
+  Tree_Action(c->Simplexes, ResetDegre2_Simplex);
+}
+
+void ResetDegre2_Surface(void *a, void *b)
+{
+  Surface *s = *(Surface**)a;
+  if(s->Dirty) return;
+  Tree_Action(s->Simplexes, ResetDegre2_Simplex);
+}
+
+void ResetDegre2_Volume(void *a, void *b)
+{
+  Volume *v = *(Volume**)a;
+  if(v->Dirty) return;
+  Tree_Action(v->Simplexes, ResetDegre2_Simplex);
+}
+
+void Degre1()
+{
+  // (re-)initialize the global tree of edges
+  if(TreeEdges)
     Tree_Delete(TreeEdges);
-  }
   TreeEdges = Tree_Create(sizeof(Edge), compareedge);
+
+  // reset VSUP in each element
+  Tree_Action(THEM->Curves, ResetDegre2_Curve);
+  Tree_Action(THEM->Surfaces, ResetDegre2_Surface);
+  Tree_Action(THEM->Volumes, ResetDegre2_Volume);
+
+  // remove any supp vertex from the database
+  if(VerticesToDelete)
+    List_Delete(VerticesToDelete);
+  VerticesToDelete = List_Create(100, 100, sizeof(Vertex*));
+  Tree_Action(THEM->Vertices, ResetDegre2_Vertex);
+  for(int i = 0; i < List_Nbr(VerticesToDelete); i++){
+    Vertex **v = (Vertex**)List_Pointer(VerticesToDelete, i);
+    Tree_Suppress(THEM->Vertices, v);
+    Free_Vertex(v, NULL);
+  }
 }
 
-void Degre2(Tree_T * TreeElm, Curve * c, Surface * s)
+void Degre2_Curve(void *a, void *b)
 {
-  THES = s;
+  Curve *c = *(Curve**)a;
+  if(c->Dirty) return;
   THEC = c;
+  THES = NULL;
+  EdgesInVolume = 0;
+  crEdges(c->Simplexes, TreeEdges);
+  Tree_Action(TreeEdges, PutMiddlePoint);
+}
+
+void Degre2_Surface(void *a, void *b)
+{
+  Surface *s = *(Surface**)a;
+  if(s->Dirty) return;
+  THEC = NULL;
+  THES = s;
+  EdgesInVolume = 0;
+  crEdges(s->Simplexes, TreeEdges);
+  Tree_Action(TreeEdges, PutMiddlePoint);
+}
 
-  if(THES || THEC){ // 1D or 2D mesh
-    EdgesInVolume = 0;
+void Degre2_Volume(void *a, void *b)
+{
+  Volume *v = *(Volume**)a;
+  if(v->Dirty) return;
+
+  // FIXME: warn if we have unhandled elements
+  if(Tree_Nbr(v->Hexahedra) || Tree_Nbr(v->Prisms) || Tree_Nbr(v->Pyramids) ||
+     THEM->Statistics[8]){
+    Msg(GERROR, "Second order hexahedra, prisms and pyramids not supported yet");
+    return;
   }
 
-  // create middle edge vertices for lines, triangles, quadrangles and
-  // tetrahedra
-  crEdges(TreeElm, TreeEdges);
+  THEC = NULL;
+  THES = NULL;
+  EdgesInVolume = 1;
+  crEdges(v->Simplexes, TreeEdges);
   Tree_Action(TreeEdges, PutMiddlePoint);
+}
 
-  EdgesInVolume = 1;
+void Degre2(int dim)
+{
+  int old = EdgesInVolume;
+
+  Degre1();
+  if(dim >= 1)
+    Tree_Action(THEM->Curves, Degre2_Curve);
+  if(dim >= 2)
+    Tree_Action(THEM->Surfaces, Degre2_Surface);
+  if(dim >= 3)
+    Tree_Action(THEM->Volumes, Degre2_Volume);
 
-  // FIXME: do the rest: middle face/volume vertices + hexahedra,
-  // prisms, pyramids
+  EdgesInVolume = old;
+}
 
+/* new interface
+EdgesContainer *edges = NULL;
+
+void Degre2(int dim)
+{
+  if(edges)
+    delete edges;
+  edges = new EdgesContainer();
+  Degre1();
+  if(dim >= 1)
+    Tree_Action(THEM->Curves, Degre2_Curve);
+  if(dim >= 2)
+    Tree_Action(THEM->Surfaces, Degre2_Surface);
+  if(dim >= 3)
+    Tree_Action(THEM->Volumes, Degre2_Volume);
 }
+*/
diff --git a/Mesh/Simplex.h b/Mesh/Simplex.h
index 92e8ef1296e54ca12773ddf3c09907f3f5ae4024..2eb71a5b6191697a6fef8c80856577731647dfda 100644
--- a/Mesh/Simplex.h
+++ b/Mesh/Simplex.h
@@ -22,20 +22,15 @@
 
 #include "List.h"
 #include "Vertex.h"
+#include "Element.h"
 
 typedef struct {
   Vertex *V[3];
 }Face;
 
-class Simplex{
-
-public:
-  int     Num;           // Number
-  int     iEnt;          // Elementary geometrical entity
-  int     iPart;         // Mesh partition index
-  char    Visible;       // Visualization flag
+class Simplex : public Element {
+ public:
   Face    F[4];          // 4 faces
-  Vertex  **VSUP;        // suppl. nodes for higher order elts
   Vertex  *V[4];         // 4 nodes
   double  Quality;       // simplex quality
   Coord   Center;        // CC center
diff --git a/Mesh/Vertex.cpp b/Mesh/Vertex.cpp
index 839fbfcd39f123cd4e3b5a4399def7cd5f8ba0af..08563b6f66a148ef0b4598ddb08669da64502e58 100644
--- a/Mesh/Vertex.cpp
+++ b/Mesh/Vertex.cpp
@@ -1,4 +1,4 @@
-// $Id: Vertex.cpp,v 1.24 2004-02-28 00:48:50 geuzaine Exp $
+// $Id: Vertex.cpp,v 1.25 2004-04-18 03:36:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -32,6 +32,7 @@ Vertex::Vertex()
 {
   Frozen = 0;
   Visible = VIS_GEOM | VIS_MESH;
+  Degree = 1;
   Pos.X = 0.0;
   Pos.Y = 0.0;
   Pos.Z = 0.0;
@@ -47,6 +48,7 @@ Vertex::Vertex(double X, double Y, double Z, double l, double W)
 {
   Frozen = 0;
   Visible = VIS_GEOM | VIS_MESH;
+  Degree = 1;
   Pos.X = X;
   Pos.Y = Y;
   Pos.Z = Z;
diff --git a/Mesh/Vertex.h b/Mesh/Vertex.h
index 82d0af92d77ca88394c2053231b4524bb7651d99..5c053c1277b3f034d69e9a390150207889f8dc44 100644
--- a/Mesh/Vertex.h
+++ b/Mesh/Vertex.h
@@ -29,7 +29,7 @@ typedef struct {
 class Vertex {
   public :
   int     Num;
-  char    Visible;
+  char    Visible, Degree;
   int     Frozen;
   double  lc,u,us[3],w;
   Coord   Pos;
diff --git a/Parser/Makefile b/Parser/Makefile
index 15ace3f2790415abd5601d049401817aa3d7f6f4..5666f5dc2d5f9cf3a7b90f20053f5efa05ec0f3e 100644
--- a/Parser/Makefile
+++ b/Parser/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.55 2004-02-28 00:48:55 geuzaine Exp $
+# $Id: Makefile,v 1.56 2004-04-18 03:36:07 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -65,29 +65,29 @@ depend:
 Gmsh.yy.o: Gmsh.yy.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
-  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Gmsh.tab.hpp
+  ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Gmsh.tab.hpp
 Gmsh.tab.o: Gmsh.tab.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
   ../Common/ColorTable.h ../DataStr/List.h ../Parallel/ParUtil.h \
   ../Common/Gmsh.h ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \
   ../DataStr/Tools.h ../Numeric/Numeric.h ../Common/Context.h \
   ../Geo/Geo.h ../Geo/GeoUtils.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h ../Mesh/Nurbs.h ../Geo/CAD.h \
-  ../Graphics/Draw.h ../Mesh/Create.h ../Geo/StepGeomDatabase.h \
-  ../Common/Colors.h Parser.h OpenFile.h ../Common/CommandLine.h \
-  FunctionManager.h ../Common/Timer.h ../Graphics/CreateFile.h \
-  ../Common/Visibility.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Mesh/Nurbs.h ../Geo/CAD.h ../Graphics/Draw.h ../Mesh/Create.h \
+  ../Geo/StepGeomDatabase.h ../Common/Colors.h Parser.h OpenFile.h \
+  ../Common/CommandLine.h FunctionManager.h ../Common/Timer.h \
+  ../Graphics/CreateFile.h ../Common/Visibility.h
 OpenFile.o: OpenFile.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h \
   ../Common/Context.h Parser.h OpenFile.h ../Common/CommandLine.h \
-  ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Simplex.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Geo/MinMax.h ../Common/Visibility.h ../Graphics/ReadImg.h \
-  ../Common/GmshUI.h ../Graphics/Draw.h ../Fltk/GUI.h \
-  ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h
+  ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
+  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Geo/MinMax.h ../Common/Visibility.h \
+  ../Graphics/ReadImg.h ../Common/GmshUI.h ../Graphics/Draw.h \
+  ../Fltk/GUI.h ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h
 FunctionManager.o: FunctionManager.cpp FunctionManager.h
diff --git a/Plugin/Makefile b/Plugin/Makefile
index 1203998dcf2c1156a2f66b1e6de25b498d674101..2effb48212c12793a059c1df851b3053dae01aa0 100644
--- a/Plugin/Makefile
+++ b/Plugin/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.43 2004-03-08 06:02:16 geuzaine Exp $
+# $Id: Makefile,v 1.44 2004-04-18 03:36:07 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -93,8 +93,9 @@ Triangulate.o: Triangulate.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/avl.h ../DataStr/Tools.h Plugin.h ../Common/Options.h \
   ../Common/Views.h ../Common/ColorTable.h Triangulate.h \
   ../Common/Context.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Simplex.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h ../Mesh/Utils.h ../Mesh/Create.h
+  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Edge.h \
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Mesh/Utils.h ../Mesh/Create.h
 SphericalRaise.o: SphericalRaise.cpp Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
   ../DataStr/List.h SphericalRaise.h ../Common/Context.h \
diff --git a/doc/VERSIONS b/doc/VERSIONS
index fe37b1d37a3f3d1965ccdab7b8db1bf9cc4fb535..1954249365566a138a8e79418c7bdc650fd36cc1 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,12 +1,14 @@
-$Id: VERSIONS,v 1.192 2004-04-14 00:28:59 geuzaine Exp $
-
-New since 1.51: new raster ("bitmap") PostScript/EPS/PDF output
-formats; new Plugin(Extract) to extract a given component from a
-post-processing view; various bug fixes (default postscript printing
-mode, drawing of 3D arrows/cylinders on Linux, default home directory
-on Windows, default initial file browser directory, extrusion of
-points with non-normalized axes of rotation, computation of the scene
-bounding box in scripts, + the usual documentation updates);
+$Id: VERSIONS,v 1.193 2004-04-18 03:36:07 geuzaine Exp $
+
+New in 1.52: new raster ("bitmap") PostScript/EPS/PDF output formats;
+new Plugin(Extract) to extract a given component from a
+post-processing view; improved handling of 2nd order elements;
+improved mesh projection on non-planar surfaces; various bug fixes
+(default postscript printing mode, drawing of 3D arrows/cylinders on
+Linux, default home directory on Windows, default initial file browser
+directory, extrusion of points with non-normalized axes of rotation,
+computation of the scene bounding box in scripts, + the usual
+documentation updates);
 
 New in 1.51: initial support for visualizing mesh partitions;
 integrated version 2.0 of the MSH mesh file format; new option to
diff --git a/doc/texinfo/gmsh.texi b/doc/texinfo/gmsh.texi
index f99cd88a4879359109f72f05dfc4ebfe44d13887..15b030208a8d79b863ad7a949d7c450e0096e491 100644
--- a/doc/texinfo/gmsh.texi
+++ b/doc/texinfo/gmsh.texi
@@ -1,5 +1,5 @@
 \input texinfo.tex @c -*-texinfo-*-
-@c $Id: gmsh.texi,v 1.103 2004-04-13 18:50:07 geuzaine Exp $
+@c $Id: gmsh.texi,v 1.104 2004-04-18 03:36:07 geuzaine Exp $
 @c
 @c Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 @c
@@ -3143,7 +3143,9 @@ post-processing file formats.
 @cindex Faces, ordering
 
 For all mesh and post-processing file formats, the reference elements are
-defined as follows.
+defined as follows@footnote{Beware that the ordering of the edges and the
+faces, that determine the ordering of the nodes for the second order
+elements, is different from the ordering in GetDP.}.
 
 @example
 @group
@@ -3174,15 +3176,14 @@ Line:
 @group
 Triangle:
                   edge 1: nodes 1 -> 2         
-   v                   2:       1 -> 3                  
-   |                   3:       2 -> 3                  
+   v                   2:       2 -> 3                  
+   |                   3:       3 -> 1                  
    |                           
-   3              face 1: edges 1 -2 3   nodes 1 2 3
+   3              
    |\        
    | \       
    |__\___u                    
    1   2                       
-
 @end group
 @end example
 
@@ -3190,15 +3191,14 @@ Triangle:
 @group
 Quadrangle:
                   edge 1: nodes 1 -> 2 
-        v              2:       1 -> 4                    
-        |              3:       2 -> 3                    
-     4--|--3           4:       3 -> 4 
+        v              2:       2 -> 3                    
+        |              3:       3 -> 4                    
+     4--|--3           4:       4 -> 1 
      |  |  |     
-   -----------u   face 1: edges 1 -2 3 4   nodes 1 2 3 4
+   -----------u   
      |  |  |     
      1--|--2      
         |         
-
 @end group
 @end example
 
@@ -3206,16 +3206,16 @@ Quadrangle:
 @group
 Tetrahedron:
                   edge 1: nodes 1 -> 2                
-   v                   2:       1 -> 3                                            
-   |                   3:       1 -> 4                
-   |                   4:       2 -> 3                
-   |                   5:       2 -> 4                
-   3                   6:       3 -> 4                
+   v                   2:       2 -> 3                                            
+   |                   3:       3 -> 1                
+   |                   4:       4 -> 1                
+   |                   5:       4 -> 3                
+   3                   6:       4 -> 2                
    |\                                                 
-   | \            face 1: edges  1 -3  5  nodes 1 2 4
-   |__\2_____u         2:       -1  2 -4        1 3 2
-   1\ /                3:       -2  3 -6        1 4 3
-     \4                4:        4 -5  6        2 3 4
+   | \            
+   |__\2_____u    
+   1\ /           
+     \4           
       \          
        w         
 @end group
@@ -3224,67 +3224,56 @@ Tetrahedron:
 @example
 @group
 Hexahedron:
-                  edge 1: nodes 1 -> 2
-        v              2:       1 -> 4
-        |              3:       1 -> 5
-        |              4:       2 -> 3
-   4----|--3           5:       2 -> 6
-   |\   |  |\          6:       3 -> 4
-   | 8-------7         7:       3 -> 7
-   | |   ----|---u     8:       4 -> 8
-   1-|---\-2 |         9:       5 -> 6
-    \|    \ \|        10:       5 -> 8
-     5-----\-6        11:       6 -> 7
-            \         12:       7 -> 8
+                  
+        v          
+        |          
+        |          
+   4----|--3       
+   |\   |  |\      
+   | 8-------7     
+   | |   ----|---u 
+   1-|---\-2 |     
+    \|    \ \|     
+     5-----\-6     
+            \      
              w         
-                  face 1: edges  1 -3  5 -9    nodes 1 2 6 5
-                       2:       -1  2 -4 -6          1 4 3 2  
-                       3:       -2  3 -8  10         1 5 8 4
-                       4:        4 -5  7 -11         2 3 7 6
-                       5:        6 -7  8 -12         3 4 8 7
-                       6:        9 -10 11 12         5 6 7 8
-
 @end group
 @end example
 
 @example
 @group
 Prism:
-                  edge 1: nodes 1 -> 2
-      v                2:       1 -> 3
-    3 |                3:       1 -> 4
-    |\|                4:       2 -> 3
-    | |                5:       2 -> 5
-    1_|2               6:       3 -> 6
-     \| 6              7:       4 -> 5
-      |_|_\___u        8:       4 -> 6 
-       \|  \           9:       5 -> 6 
+                  
+      v           
+    3 |           
+    |\|           
+    | |           
+    1_|2          
+     \| 6         
+      |_|_\___u   
+       \|  \      
         4 __5
-         \        face 1: edges  1 -3  5 -7     nodes 1 2 5 4 
-          \            2:       -1  2 -4              1 3 2   
-           w           3:       -2  3 -6  8           1 4 6 3 
-                       4:        4 -5  6 -9           2 3 6 5 
-                       5:        7 -8  9              4 5 6   
+         \       
+          \      
+           w     
 @end group
 @end example
 
 @example
 @group
 Pyramid:
-                  edge 1: nodes 1 -> 2
-        v              2:       1 -> 4 
-        |              3:       1 -> 5
-        |              4:       2 -> 3
-    4---|---3          5:       2 -> 5
-    | \ |  /|          6:       3 -> 4
-    |  \ -/-|---u      7:       3 -> 5
-    |  / 5\ |          8:       4 -> 5
+                  
+        v         
+        |         
+        |         
+    4---|---3     
+    | \ |  /|     
+    |  \ -/-|---u 
+    |  / 5\ |     
     1/----\-2              
-           \      face 1: edges  1  5 -3       nodes 1 2 5  
-            \          2:        2 -6 -4 -1          1 4 3 2
-             w         3:        3 -8 -2             1 5 4  
-                       4:        4  7 -5             2 3 5  
-                       5:        6  8 -7             3 4 5  
+           \      
+            \     
+             w    
 @end group
 @end example