From d3b32db34682744a521f7f94220e3fa7b651d3a2 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 18 Sep 2007 16:26:04 +0000
Subject: [PATCH] - don't use vertex arrays for quads anymore (they are wrong
 for non-plane quad faces): just use triangles everywhere

- removed _links in PView

- various small cleanups
---
 Common/VertexArray.cpp                    |  12 +-
 Common/VertexArray.h                      |   2 +-
 Geo/GEntity.cpp                           |   5 +-
 Geo/GEntity.h                             |   2 +-
 Geo/MElement.cpp                          |  22 ++--
 Geo/MElement.h                            | 149 ++++++++++++++--------
 Graphics/Entity.cpp                       |   3 +-
 Graphics/Mesh.cpp                         |  57 ++-------
 Graphics/Post.cpp                         | 123 +++++++++---------
 Graphics/SelectBuffer.cpp                 |   6 +-
 Graphics/gl2ps.cpp                        |  24 +++-
 Graphics/gl2ps.h                          |   9 +-
 Plugin/MakeSimplex.cpp                    |   8 +-
 Plugin/Remove.cpp                         |   7 +-
 Post/AdaptiveViews.cpp                    |  43 +++----
 Post/PView.cpp                            |  46 +++----
 Post/PView.h                              |   5 -
 benchmarks/misc/animation.geo             |   3 +-
 benchmarks/misc/bgmesh/Makefile           |   8 --
 benchmarks/misc/bgmesh/proj.geo           |  12 --
 benchmarks/misc/bgmesh/proj.pro           |  77 -----------
 benchmarks/misc/bgmesh/solver.par         | 140 --------------------
 benchmarks/misc/levelset/Makefile         |  11 --
 benchmarks/misc/levelset/displacement.scp |  16 ---
 benchmarks/misc/levelset/levelsetTest.geo |  39 ------
 benchmarks/misc/levelset/levelsetTest.opt |  18 ---
 benchmarks/misc/levelset/levelsetTest.pro |  79 ------------
 benchmarks/misc/levelset/solver.par       | 140 --------------------
 doc/TODO                                  |  67 +++-------
 29 files changed, 273 insertions(+), 860 deletions(-)
 delete mode 100644 benchmarks/misc/bgmesh/Makefile
 delete mode 100644 benchmarks/misc/bgmesh/proj.geo
 delete mode 100644 benchmarks/misc/bgmesh/proj.pro
 delete mode 100644 benchmarks/misc/bgmesh/solver.par
 delete mode 100644 benchmarks/misc/levelset/Makefile
 delete mode 100644 benchmarks/misc/levelset/displacement.scp
 delete mode 100644 benchmarks/misc/levelset/levelsetTest.geo
 delete mode 100644 benchmarks/misc/levelset/levelsetTest.opt
 delete mode 100644 benchmarks/misc/levelset/levelsetTest.pro
 delete mode 100644 benchmarks/misc/levelset/solver.par

diff --git a/Common/VertexArray.cpp b/Common/VertexArray.cpp
index 46b17c71f2..4319cd3f0e 100644
--- a/Common/VertexArray.cpp
+++ b/Common/VertexArray.cpp
@@ -1,4 +1,4 @@
-// $Id: VertexArray.cpp,v 1.23 2007-09-14 18:51:37 geuzaine Exp $
+// $Id: VertexArray.cpp,v 1.24 2007-09-18 16:26:01 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -145,14 +145,14 @@ void VertexArray::sort(double x, double y, double z)
   // twice. We should think about a more efficient way to sort the
   // three arrays in place.
 
-  AlphaElementLessThan::numVertices = getNumVerticesPerElement();
+  int npe = getNumVerticesPerElement();
+  int n = getNumVertices() / npe;
+
+  AlphaElementLessThan::numVertices = npe;
   AlphaElementLessThan::eye[0] = x;
   AlphaElementLessThan::eye[1] = y;
   AlphaElementLessThan::eye[2] = z;
 
-  int npe = getNumVerticesPerElement();
-  int n = getNumVertices() / npe;
-
   std::vector<AlphaElement> elements;
   elements.reserve(n);
   if(_normals.size())
@@ -176,7 +176,7 @@ void VertexArray::sort(double x, double y, double z)
   sortedColors.reserve(_colors.size());
 
   for(int i = 0; i < n; i++){
-    for(int j = 0; j < getNumVerticesPerElement(); j++){
+    for(int j = 0; j < npe; j++){
       for(int k = 0; k < 3; k++){
 	sortedVertices.push_back(elements[i].v[3 * j + k]);
 	if(elements[i].v)
diff --git a/Common/VertexArray.h b/Common/VertexArray.h
index 8d1e6772e9..018222deb9 100644
--- a/Common/VertexArray.h
+++ b/Common/VertexArray.h
@@ -53,7 +53,7 @@ class BarycenterLessThan{
 
 class VertexArray{
  private:
-  int _numVerticesPerElement;
+  const int _numVerticesPerElement;
   std::vector<float> _vertices;
   std::vector<char> _normals;
   std::vector<unsigned char> _colors;
diff --git a/Geo/GEntity.cpp b/Geo/GEntity.cpp
index 44d4ad9d8c..948968cb06 100644
--- a/Geo/GEntity.cpp
+++ b/Geo/GEntity.cpp
@@ -1,4 +1,4 @@
-// $Id: GEntity.cpp,v 1.13 2007-09-12 20:14:34 geuzaine Exp $
+// $Id: GEntity.cpp,v 1.14 2007-09-18 16:26:02 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -26,7 +26,7 @@ extern Context_T CTX;
 
 GEntity::GEntity(GModel *m, int t)
   : _model(m), _tag(t), _visible(true), _selection(0),
-    _allElementsVisible(1), va_lines(0), va_triangles(0), va_quads(0)
+    _allElementsVisible(1), va_lines(0), va_triangles(0)
 {
   _color = CTX.PACK_COLOR(0, 0, 255, 0);
 }
@@ -40,7 +40,6 @@ void GEntity::deleteVertexArrays()
 {
   if(va_lines) delete va_lines; va_lines = 0;
   if(va_triangles) delete va_triangles; va_triangles = 0;
-  if(va_quads) delete va_quads; va_quads = 0;
 }
 
 char GEntity::getVisibility()
diff --git a/Geo/GEntity.h b/Geo/GEntity.h
index 19dca36fd8..f6b1b73d7d 100644
--- a/Geo/GEntity.h
+++ b/Geo/GEntity.h
@@ -229,7 +229,7 @@ class GEntity {
   std::vector<int> physicals;
 
   // Vertex arrays to draw the mesh efficiently
-  VertexArray *va_lines, *va_triangles, *va_quads;
+  VertexArray *va_lines, *va_triangles;
 };
 
 class GEntityLessThan {
diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp
index a57ed2566b..01a2170636 100644
--- a/Geo/MElement.cpp
+++ b/Geo/MElement.cpp
@@ -1,4 +1,4 @@
-// $Id: MElement.cpp,v 1.41 2007-09-14 01:54:20 geuzaine Exp $
+// $Id: MElement.cpp,v 1.42 2007-09-18 16:26:02 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -73,7 +73,7 @@ int MElement::getNumEdgesRep()
   return getNumEdges();
 }
 
-int MElement::getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+void MElement::getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
 {
   MEdge e = getEdge(num);
   SVector3 normal = (getDim() == 2) ? getFace(0).normal() : e.normal();
@@ -84,11 +84,10 @@ int MElement::getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
     z[i] = v->z();
     n[i] = normal;
   }
-  return 2;
 }
 
-int MElement::_getEdgeRep(const int edge[2], double *x, double *y, double *z,
-			  SVector3 *n, int faceIndex)
+void MElement::_getEdgeRep(const int edge[2], double *x, double *y, double *z,
+			   SVector3 *n, int faceIndex)
 {
   MEdge e(getVertex(edge[0]), getVertex(edge[1]));
   SVector3 normal = (faceIndex >= 0) ? getFace(faceIndex).normal() : e.normal();
@@ -99,7 +98,6 @@ int MElement::_getEdgeRep(const int edge[2], double *x, double *y, double *z,
     z[i] = v->z();
     n[i] = normal;
   }
-  return 2;
 }
 
 int MElement::getNumFacesRep()
@@ -107,22 +105,21 @@ int MElement::getNumFacesRep()
   return getNumFaces();
 }
 
-int MElement::getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+void MElement::getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
 {
   MFace f = getFace(num);
   SVector3 normal = f.normal();
-  for(int i = 0; i < f.getNumVertices(); i++){
+  for(int i = 0; i < 3; i++){
     MVertex *v = f.getVertex(i);
     x[i] = v->x();
     y[i] = v->y();
     z[i] = v->z();
     n[i] = normal;
   }
-  return f.getNumVertices();
 }
 
-int MElement::_getFaceRep(const int face[3], double *x, double *y, double *z,
-			  SVector3 *n)
+void MElement::_getFaceRep(const int face[3], double *x, double *y, double *z,
+			   SVector3 *n)
 {
   for(int i = 0; i < 3; i++){
     MVertex *v = getVertex(face[i]);
@@ -135,7 +132,6 @@ int MElement::_getFaceRep(const int face[3], double *x, double *y, double *z,
   SVector3 normal = crossprod(t1, t2);
   normal.normalize();
   for(int i = 0; i < 3; i++) n[i] = normal;
-  return 3;
 }
 
 double MTetrahedron::gammaShapeMeasure()
@@ -514,7 +510,7 @@ void MTriangle::circumcenterXY(double *p1, double *p2, double *p3, double *res)
 
   d = 2. * (double)(y1 * (x2 - x3) + y2 * (x3 - x1) + y3 * (x1 - x2));
   if(d == 0.0) {
-    Msg(GERROR, "Colinear points in circum circle computation");
+    Msg(WARNING, "Colinear points in circum circle computation");
     res[0] = res[1] = -99999.;
     return ;
   }
diff --git a/Geo/MElement.h b/Geo/MElement.h
index a481aa9cc6..a7c590f6c2 100644
--- a/Geo/MElement.h
+++ b/Geo/MElement.h
@@ -40,10 +40,10 @@ class MElement
   short _partition;
   char _visible;
  protected:
-  int _getEdgeRep(const int edge[2], double *x, double *y, double *z, 
-		  SVector3 *n, int faceIndex=-1);
-  int _getFaceRep(const int face[3], double *x, double *y, double *z, 
-		  SVector3 *n);
+  void _getEdgeRep(const int edge[2], double *x, double *y, double *z, 
+		   SVector3 *n, int faceIndex=-1);
+  void _getFaceRep(const int face[3], double *x, double *y, double *z, 
+		   SVector3 *n);
  public :
   MElement(int num=0, int part=0) 
     : _visible(true) 
@@ -108,7 +108,7 @@ class MElement
 
   // get an edge representation for drawing
   virtual int getNumEdgesRep();
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n);
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n);
 
   // get the faces
   virtual int getNumFaces() = 0;
@@ -116,7 +116,7 @@ class MElement
 
   // get a face representation for drawing
   virtual int getNumFacesRep();
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n);
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n);
 
   // get the max/min edge length
   virtual double maxEdge();
@@ -234,12 +234,12 @@ class MLine3 : public MLine {
   }
   virtual int getNumEdgeVertices(){ return 1; }
   virtual int getNumEdgesRep(){ return 2; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_lin3[2][2] = {
       {0, 2}, {2, 1}
     };
-    return _getEdgeRep(edges_lin3[num], x, y, z, n);
+    _getEdgeRep(edges_lin3[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_LIN_3; }
   virtual int getTypeForUNV(){ return 24; } // parabolic beam
@@ -271,11 +271,11 @@ class MLineN : public MLine {
   virtual MVertex *getVertex(int num){ return num < 2 ? _v[num] : _vs[num - 2]; }
   virtual int getNumEdgeVertices(){ return _vs.size(); }
   virtual int getNumEdgesRep(){ return _vs.size() + 1; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     const int edge[2] = {(num == 0) ? 0 : num + 1, 
 			 (num == getNumEdgesRep() - 1) ? 1 : num + 2};
-    return _getEdgeRep(edge, x, y, z, n);
+    _getEdgeRep(edge, x, y, z, n);
   }
   virtual int getTypeForMSH(){ 
     if(_vs.size() == 2) return MSH_LIN_4; 
@@ -383,22 +383,22 @@ class MTriangle6 : public MTriangle {
   }
   virtual int getNumEdgeVertices(){ return 3; }
   virtual int getNumEdgesRep(){ return 6; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_tri6[6][2] = {
       {0, 3}, {3, 1},
       {1, 4}, {4, 2},
       {2, 5}, {5, 0}
     };
-    return _getEdgeRep(edges_tri6[num], x, y, z, n, 0);
+    _getEdgeRep(edges_tri6[num], x, y, z, n, 0);
   }
   virtual int getNumFacesRep(){ return 4; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_tri2[4][3] = {
       {0, 3, 5}, {1, 4, 3}, {2, 5, 4}, {3, 4, 5}
     };
-    return _getFaceRep(faces_tri2[num], x, y, z, n);
+    _getFaceRep(faces_tri2[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_TRI_6; }
   virtual int getTypeForUNV(){ return 92; } // thin shell parabolic triangle
@@ -455,10 +455,10 @@ class MTriangleN : public MTriangle {
   }
   virtual int getNumEdgeVertices(){ return _order - 1; }
   virtual int getNumEdgesRep(){ return 3 * _order; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     const int edge[2] = {_orderedIndex(num), _orderedIndex((num + 1) % (3 * _order))};
-    return _getEdgeRep(edge, x, y, z, n, 0);
+    _getEdgeRep(edge, x, y, z, n, 0);
   }
   virtual int getTypeForMSH()
   {
@@ -515,6 +515,14 @@ class MQuadrangle : public MElement {
   }
   virtual int getNumFaces(){ return 1; }
   virtual MFace getFace(int num){ return MFace(_v[0], _v[1], _v[2], _v[3]); }
+  virtual int getNumFacesRep(){ return 2; }
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  { 
+    static const int faces_qua[2][3] = {
+      {0, 1, 2}, {0, 2, 3}
+    };
+    _getFaceRep(faces_qua[num], x, y, z, n);
+  }
   virtual int getTypeForMSH(){ return MSH_QUA_4; }
   virtual int getTypeForUNV(){ return 94; } // thin shell linear quadrilateral
   virtual const char *getStringForPOS(){ return "SQ"; }
@@ -553,7 +561,7 @@ class MQuadrangle8 : public MQuadrangle {
   }
   virtual int getNumEdgeVertices(){ return 4; }
   virtual int getNumEdgesRep(){ return 8; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_qua8[8][2] = {
       {0, 4}, {4, 1},
@@ -561,15 +569,15 @@ class MQuadrangle8 : public MQuadrangle {
       {2, 6}, {6, 3},
       {3, 7}, {7, 0}
     };
-    return _getEdgeRep(edges_qua8[num], x, y, z, n, 0);
+    _getEdgeRep(edges_qua8[num], x, y, z, n, 0);
   }
   virtual int getNumFacesRep(){ return 6; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_qua8[6][3] = {
       {0, 4, 7}, {1, 5, 4}, {2, 6, 5}, {3, 7, 6}, {4, 5, 6}, {4, 6, 7}
     };
-    return _getFaceRep(faces_qua8[num], x, y, z, n);
+    _getFaceRep(faces_qua8[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_QUA_8; }
   virtual int getTypeForUNV(){ return 95; } // shell parabolic quadrilateral
@@ -608,7 +616,7 @@ class MQuadrangle9 : public MQuadrangle {
   virtual int getNumEdgeVertices(){ return 4; }
   virtual int getNumFaceVertices(){ return 1; }
   virtual int getNumEdgesRep(){ return 8; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_qua9[8][2] = {
       {0, 4}, {4, 1},
@@ -616,16 +624,16 @@ class MQuadrangle9 : public MQuadrangle {
       {2, 6}, {6, 3},
       {3, 7}, {7, 0}
     };
-    return _getEdgeRep(edges_qua9[num], x, y, z, n, 0);
+    _getEdgeRep(edges_qua9[num], x, y, z, n, 0);
   }
   virtual int getNumFacesRep(){ return 8; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_qua9[8][4] = {
       {0, 4, 8}, {0, 8, 7}, {1, 5, 8}, {1, 8, 4}, 
       {2, 6, 8}, {2, 8, 5}, {3, 7, 8}, {3, 8, 6}
     };
-    return _getFaceRep(faces_qua9[num], x, y, z, n);
+    _getFaceRep(faces_qua9[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_QUA_9; }
   virtual int getTypeForUNV(){ return 0; } // not available
@@ -797,7 +805,7 @@ class MTetrahedron10 : public MTetrahedron {
   }
   virtual int getNumEdgeVertices(){ return 6; }
   virtual int getNumEdgesRep(){ return 12; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_tetra10[12][2] = {
       {0, 4}, {4, 1},
@@ -807,10 +815,10 @@ class MTetrahedron10 : public MTetrahedron {
       {3, 8}, {8, 2},
       {3, 9}, {9, 1}
     };
-    return _getEdgeRep(edges_tetra10[num], x, y, z, n);
+    _getEdgeRep(edges_tetra10[num], x, y, z, n);
   }
   virtual int getNumFacesRep(){ return 16; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_tetra10[16][3] = {
       {0, 6, 4}, {2, 5, 6}, {1, 4, 5}, {6, 5, 4},
@@ -818,7 +826,7 @@ class MTetrahedron10 : public MTetrahedron {
       {0, 7, 6}, {3, 8, 7}, {2, 6, 8}, {7, 8, 6},
       {3, 9, 8}, {1, 5, 9}, {2, 8, 5}, {9, 5, 8}
     };
-    return _getFaceRep(faces_tetra10[num], x, y, z, n);
+    _getFaceRep(faces_tetra10[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_TET_10; }
   virtual int getTypeForUNV(){ return 118; } // solid parabolic tetrahedron
@@ -888,6 +896,19 @@ class MHexahedron : public MElement {
 		 _v[faces_hexa[num][2]],
 		 _v[faces_hexa[num][3]]);
   }
+  virtual int getNumFacesRep(){ return 12; }
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  { 
+    static const int faces_hexa[12][3] = {
+      {0, 3, 2}, {0, 2, 1},
+      {0, 1, 5}, {0, 5, 4},
+      {0, 4, 7}, {0, 7, 3},
+      {1, 2, 6}, {1, 6, 5},
+      {2, 3, 7}, {2, 7, 6},
+      {4, 5, 6}, {4, 6, 7}
+    };
+    _getFaceRep(faces_hexa[num], x, y, z, n);
+  }
   virtual int getTypeForMSH(){ return MSH_HEX_8; }
   virtual int getTypeForUNV(){ return 115; } // solid linear brick
   virtual const char *getStringForPOS(){ return "SH"; }
@@ -954,7 +975,7 @@ class MHexahedron20 : public MHexahedron {
   }
   virtual int getNumEdgeVertices(){ return 12; }
   virtual int getNumEdgesRep(){ return 24; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_hexa20[24][2] = {
       {0, 8}, {8, 1},
@@ -970,10 +991,10 @@ class MHexahedron20 : public MHexahedron {
       {5, 18}, {18, 6},
       {6, 19}, {19, 7}
     };
-    return _getEdgeRep(edges_hexa20[num], x, y, z, n);
+    _getEdgeRep(edges_hexa20[num], x, y, z, n);
   }
   virtual int getNumFacesRep(){ return 36; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_hexa20[36][3] = {
       {0, 9, 8}, {3, 13, 9}, {2, 11, 13}, {1, 8, 11}, {8, 9, 13}, {8, 13, 11},
@@ -983,7 +1004,7 @@ class MHexahedron20 : public MHexahedron {
       {2, 13, 14}, {3, 15, 13}, {7, 19, 15}, {6, 14, 19}, {13, 15, 19}, {13, 19, 14},
       {4, 16, 17}, {5, 18, 16}, {6, 19, 18}, {7, 17, 19}, {16, 18, 19}, {16, 19, 17}
     };
-    return _getFaceRep(faces_hexa20[num], x, y, z, n);
+    _getFaceRep(faces_hexa20[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_HEX_20; }
   virtual int getTypeForUNV(){ return 116; } // solid parabolic brick
@@ -1035,7 +1056,7 @@ class MHexahedron27 : public MHexahedron {
   virtual int getNumFaceVertices(){ return 6; }
   virtual int getNumVolumeVertices(){ return 1; }
   virtual int getNumEdgesRep(){ return 24; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_hexa27[24][2] = {
       {0, 8}, {8, 1},
@@ -1051,10 +1072,10 @@ class MHexahedron27 : public MHexahedron {
       {5, 18}, {18, 6},
       {6, 19}, {19, 7}
     };
-    return _getEdgeRep(edges_hexa27[num], x, y, z, n);
+    _getEdgeRep(edges_hexa27[num], x, y, z, n);
   }
   virtual int getNumFacesRep(){ return 48; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_hexa27[48][3] = {
       {0, 9, 20}, {0, 20, 8}, {3, 13, 20}, {3, 20, 9}, 
@@ -1070,7 +1091,7 @@ class MHexahedron27 : public MHexahedron {
       {4, 16, 25}, {4, 25, 17}, {5, 18, 25}, {5, 25, 16}, 
       {6, 19, 25}, {6, 25, 18}, {7, 17, 25}, {7, 25, 19}  
     };
-    return _getFaceRep(faces_hexa27[num], x, y, z, n);
+    _getFaceRep(faces_hexa27[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_HEX_27; }
   virtual int getTypeForUNV(){ return 0; } // not available
@@ -1148,6 +1169,18 @@ class MPrism : public MElement {
 		   _v[quadfaces_prism[num - 2][2]],
 		   _v[quadfaces_prism[num - 2][3]]);
   }
+  virtual int getNumFacesRep(){ return 8; }
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  { 
+    static const int faces_prism[8][3] = {
+      {0, 2, 1},
+      {3, 4, 5},
+      {0, 1, 4}, {0, 4, 3},
+      {0, 3, 5}, {0, 5, 2},
+      {1, 2, 5}, {1, 5, 4}
+    };
+    _getFaceRep(faces_prism[num], x, y, z, n);
+  }
   virtual int getTypeForMSH(){ return MSH_PRI_6; }
   virtual int getTypeForUNV(){ return 112; } // solid linear wedge
   virtual const char *getStringForPOS(){ return "SI"; }
@@ -1210,7 +1243,7 @@ class MPrism15 : public MPrism {
   }
   virtual int getNumEdgeVertices(){ return 9; }
   virtual int getNumEdgesRep(){ return 18; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_prism15[18][2] = {
       {0, 6}, {6, 1},
@@ -1223,10 +1256,10 @@ class MPrism15 : public MPrism {
       {3, 13}, {13, 5},
       {4, 14}, {14, 5}
     };
-    return _getEdgeRep(edges_prism15[num], x, y, z, n);
+    _getEdgeRep(edges_prism15[num], x, y, z, n);
   }
   virtual int getNumFacesRep(){ return 26; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_prism15[26][3] = {
       {0, 7, 6}, {2, 9, 7}, {1, 6, 9}, {6, 7, 9},
@@ -1235,7 +1268,7 @@ class MPrism15 : public MPrism {
       {0, 8, 7}, {3, 13, 8}, {5, 11, 13}, {2, 7, 11}, {7, 8, 13}, {7, 13, 11},
       {1, 9, 10}, {2, 11, 9}, {5, 14, 11}, {4, 10, 14}, {9, 11, 14}, {9, 14, 10}
     };
-    return _getFaceRep(faces_prism15[num], x, y, z, n);
+    _getFaceRep(faces_prism15[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_PRI_15; }
   virtual int getTypeForUNV(){ return 113; } // solid parabolic wedge
@@ -1280,7 +1313,7 @@ class MPrism18 : public MPrism {
   virtual int getNumEdgeVertices(){ return 9; }
   virtual int getNumFaceVertices(){ return 3; }
   virtual int getNumEdgesRep(){ return 18; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_prism18[18][2] = {
       {0, 6}, {6, 1},
@@ -1293,10 +1326,10 @@ class MPrism18 : public MPrism {
       {3, 13}, {13, 5},
       {4, 14}, {14, 5}
     };
-    return _getEdgeRep(edges_prism18[num], x, y, z, n);
+    _getEdgeRep(edges_prism18[num], x, y, z, n);
   }
   virtual int getNumFacesRep(){ return 32; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_prism18[32][3] = {
       {0, 7, 6}, {2, 9, 7}, {1, 6, 9}, {6, 7, 9},
@@ -1308,7 +1341,7 @@ class MPrism18 : public MPrism {
       {1, 9, 17}, {1, 17, 10}, {2, 11, 17}, {2, 17, 9},  
       {5, 14, 17}, {5, 17, 11}, {4, 10, 17}, {4, 17, 14}
     };
-    return _getFaceRep(faces_prism18[num], x, y, z, n);
+    _getFaceRep(faces_prism18[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_PRI_18; }
   virtual int getTypeForUNV(){ return 0; } // not available
@@ -1375,6 +1408,18 @@ class MPyramid : public MElement {
     else
       return MFace(_v[0], _v[3], _v[2], _v[1]);
   }
+  virtual int getNumFacesRep(){ return 6; }
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  { 
+    static const int faces_pyramid[6][3] = {
+      {0, 1, 4},
+      {3, 0, 4},
+      {1, 2, 4},
+      {2, 3, 4},
+      {0, 3, 2}, {0, 2, 1}
+    };
+    _getFaceRep(faces_pyramid[num], x, y, z, n);
+  }
   virtual int getTypeForMSH(){ return MSH_PYR_5; }
   virtual int getTypeForUNV(){ return 0; } // not available
   virtual const char *getStringForPOS(){ return "SY"; }
@@ -1424,7 +1469,7 @@ class MPyramid13 : public MPyramid {
   virtual MVertex *getVertex(int num){ return num < 5 ? _v[num] : _vs[num - 5]; }
   virtual int getNumEdgeVertices(){ return 8; }
   virtual int getNumEdgesRep(){ return 16; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_pyramid13[16][2] = {
       {0, 5}, {5, 1},
@@ -1436,10 +1481,10 @@ class MPyramid13 : public MPyramid {
       {2, 11}, {11, 4},
       {3, 12}, {12, 4}
     };
-    return _getEdgeRep(edges_pyramid13[num], x, y, z, n);
+    _getEdgeRep(edges_pyramid13[num], x, y, z, n);
   }
   virtual int getNumFacesRep(){ return 22; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_pyramid13[22][3] = {
       {0, 5, 7}, {1, 9, 5}, {4, 7, 9}, {5, 9, 7},
@@ -1448,7 +1493,7 @@ class MPyramid13 : public MPyramid {
       {2, 10, 11}, {3, 12, 10}, {4, 11, 12}, {10, 12, 11},
       {0, 6, 5}, {3, 10, 6}, {2, 8, 10}, {1, 5, 8}, {5, 6, 10}, {5, 10, 8}
     };
-    return _getFaceRep(faces_pyramid13[num], x, y, z, n);
+    _getFaceRep(faces_pyramid13[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_PYR_13; }
   virtual int getTypeForUNV(){ return 0; } // not available
@@ -1491,7 +1536,7 @@ class MPyramid14 : public MPyramid {
   virtual int getNumEdgeVertices(){ return 8; }
   virtual int getNumFaceVertices(){ return 1; }
   virtual int getNumEdgesRep(){ return 16; }
-  virtual int getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getEdgeRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int edges_pyramid14[16][2] = {
       {0, 5}, {5, 1},
@@ -1503,10 +1548,10 @@ class MPyramid14 : public MPyramid {
       {2, 11}, {11, 4},
       {3, 12}, {12, 4}
     };
-    return _getEdgeRep(edges_pyramid14[num], x, y, z, n);
+    _getEdgeRep(edges_pyramid14[num], x, y, z, n);
   }
   virtual int getNumFacesRep(){ return 24; }
-  virtual int getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
+  virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)
   { 
     static const int faces_pyramid14[24][3] = {
       {0, 5, 7}, {1, 9, 5}, {4, 7, 9}, {5, 9, 7},
@@ -1516,7 +1561,7 @@ class MPyramid14 : public MPyramid {
       {0, 6, 13}, {0, 13, 5}, {3, 10, 13}, {3, 13, 6}, 
       {2, 8, 13}, {2, 13, 10}, {1, 5, 13}, {1, 13, 8}
     };
-    return _getFaceRep(faces_pyramid14[num], x, y, z, n);
+    _getFaceRep(faces_pyramid14[num], x, y, z, n);
   }
   virtual int getTypeForMSH(){ return MSH_PYR_14; }
   virtual int getTypeForUNV(){ return 0; } // not available
diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp
index 8e14ff24c4..3dac1cfa82 100644
--- a/Graphics/Entity.cpp
+++ b/Graphics/Entity.cpp
@@ -1,4 +1,4 @@
-// $Id: Entity.cpp,v 1.77 2007-09-10 04:47:03 geuzaine Exp $
+// $Id: Entity.cpp,v 1.78 2007-09-18 16:26:02 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -326,7 +326,6 @@ void Draw_SimpleVector(int arrow, int fill,
 
 }
 
-
 void Draw_3DArrow(double relHeadRadius, double relStemLength, double relStemRadius,
 		  double x, double y, double z, double dx, double dy, double dz,
 		  double length, int light)
diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp
index 78e1c968e0..ec49aefcbb 100644
--- a/Graphics/Mesh.cpp
+++ b/Graphics/Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Mesh.cpp,v 1.205 2007-09-14 04:04:34 geuzaine Exp $
+// $Id: Mesh.cpp,v 1.206 2007-09-18 16:26:02 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -359,10 +359,10 @@ static void addSmoothNormals(GEntity *e, std::vector<T*> &elements)
     SPoint3 pc;
     if(CTX.mesh.explode != 1.) pc = ele->barycenter();
     for(int j = 0; j < ele->getNumFacesRep(); j++){
-      double x[4], y[4], z[4];
-      SVector3 n[4];
-      int numverts = ele->getFaceRep(j, x, y, z, n);
-      for(int k = 0; k < numverts; k++){
+      double x[3], y[3], z[3];
+      SVector3 n[3];
+      ele->getFaceRep(j, x, y, z, n);
+      for(int k = 0; k < 3; k++){
 	if(CTX.mesh.explode != 1.){
 	  x[k] = pc[0] + CTX.mesh.explode * (x[k] - pc[0]);
 	  y[k] = pc[1] + CTX.mesh.explode * (y[k] - pc[1]);
@@ -415,23 +415,20 @@ static void addElementsInArrays(GEntity *e, std::vector<T*> &elements,
 
     if(faces){
       for(int j = 0; j < ele->getNumFacesRep(); j++){
-	double x[4], y[4], z[4];
-	SVector3 n[4];
-	int numverts = ele->getFaceRep(j, x, y, z, n);
+	double x[3], y[3], z[3];
+	SVector3 n[3];
+	ele->getFaceRep(j, x, y, z, n);
 	if(CTX.mesh.explode != 1.){
-	  for(int k = 0; k < numverts; k++){
+	  for(int k = 0; k < 3; k++){
 	    x[k] = pc[0] + CTX.mesh.explode * (x[k] - pc[0]);
 	    y[k] = pc[1] + CTX.mesh.explode * (y[k] - pc[1]);
 	    z[k] = pc[2] + CTX.mesh.explode * (z[k] - pc[2]);
 	  }
 	}
 	if(e->dim() == 2 && CTX.mesh.smooth_normals)
-	  for(int k = 0; k < numverts; k++)
+	  for(int k = 0; k < 3; k++)
 	    e->model()->normals->get(x[k], y[k], z[k], n[k][0], n[k][1], n[k][2]);
-	if(numverts == 3)
-	  e->va_triangles->add(x, y, z, n, col, ele, !CTX.pick_elements);
-	else if(numverts == 4)
-	  e->va_quads->add(x, y, z, n, col, ele, !CTX.pick_elements);
+	e->va_triangles->add(x, y, z, n, col, ele, !CTX.pick_elements);
       }
     }
   }
@@ -615,16 +612,7 @@ class initMeshGFace {
   {
     int num = 0;
     if(CTX.mesh.surfaces_faces){
-      num += f->triangles.size();
-      if(_curved) num *= 4;
-    }
-    return num + 100;
-  }
-  int _estimateNumQuads(GFace *f)
-  {
-    int num = 0;
-    if(CTX.mesh.surfaces_faces){
-      num += f->quadrangles.size();
+      num += (f->triangles.size() + 2 * f->quadrangles.size());
       if(_curved) num *= 4;
     }
     return num + 100;
@@ -646,12 +634,10 @@ class initMeshGFace {
 		 areSomeElementsCurved(f->quadrangles));
       f->va_lines = new VertexArray(2, _estimateNumLines(f));
       f->va_triangles = new VertexArray(3, _estimateNumTriangles(f));
-      f->va_quads = new VertexArray(4, _estimateNumQuads(f));
       if(CTX.mesh.triangles) addElementsInArrays(f, f->triangles, edg, fac);
       if(CTX.mesh.quadrangles) addElementsInArrays(f, f->quadrangles, edg, fac);
       f->va_lines->finalize();
       f->va_triangles->finalize();
-      f->va_quads->finalize();
     }
   }
 };
@@ -670,7 +656,6 @@ class drawMeshGFace {
     drawArrays(f, f->va_lines, GL_LINES, CTX.mesh.light && CTX.mesh.light_lines, 
 	       CTX.mesh.surfaces_faces, CTX.color.mesh.line);
     drawArrays(f, f->va_triangles, GL_TRIANGLES, CTX.mesh.light);
-    drawArrays(f, f->va_quads, GL_QUADS, CTX.mesh.light);
 
     if(CTX.mesh.surfaces_num) {
       if(CTX.mesh.triangles)
@@ -726,19 +711,8 @@ class initMeshGRegion {
   {
     int num = 0;
     if(CTX.mesh.volumes_faces){
-      num += (4 * r->tetrahedra.size() + 2 * r->prisms.size() + 
-	      4 * r->pyramids.size()) / 2;
-      if(CTX.mesh.explode != 1.) num *= 2;
-      if(_curved) num *= 4;
-    }
-    return num + 100;
-  }
-  int _estimateNumQuads(GRegion *r)
-  {
-    int num = 0;
-    if(CTX.mesh.volumes_faces){
-      num += (6 * r->hexahedra.size() + 3 * r->prisms.size() +
-	      r->pyramids.size()) / 2;
+      num += (4 * r->tetrahedra.size() + 12 * r->hexahedra.size() +
+	      8 * r->prisms.size() + 6 * r->pyramids.size()) / 2;
       if(CTX.mesh.explode != 1.) num *= 2;
       if(_curved) num *= 4;
     }
@@ -765,14 +739,12 @@ class initMeshGRegion {
 		 areSomeElementsCurved(r->pyramids));
       r->va_lines = new VertexArray(2, _estimateNumLines(r));
       r->va_triangles = new VertexArray(3, _estimateNumTriangles(r));
-      r->va_quads = new VertexArray(4, _estimateNumQuads(r));
       if(CTX.mesh.tetrahedra) addElementsInArrays(r, r->tetrahedra, edg, fac);
       if(CTX.mesh.hexahedra) addElementsInArrays(r, r->hexahedra, edg, fac);
       if(CTX.mesh.prisms) addElementsInArrays(r, r->prisms, edg, fac);
       if(CTX.mesh.pyramids) addElementsInArrays(r, r->pyramids, edg, fac);
       r->va_lines->finalize();
       r->va_triangles->finalize();
-      r->va_quads->finalize();
     }
   }
 };
@@ -791,7 +763,6 @@ class drawMeshGRegion {
     drawArrays(r, r->va_lines, GL_LINES, CTX.mesh.light && CTX.mesh.light_lines, 
 	       CTX.mesh.volumes_faces, CTX.color.mesh.line);
     drawArrays(r, r->va_triangles, GL_TRIANGLES, CTX.mesh.light);
-    drawArrays(r, r->va_quads, GL_QUADS, CTX.mesh.light);
     
     if(CTX.mesh.volumes_num) {
       if(CTX.mesh.tetrahedra) 
diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp
index 5162a40ce2..113de5f768 100644
--- a/Graphics/Post.cpp
+++ b/Graphics/Post.cpp
@@ -1,4 +1,4 @@
-// $Id: Post.cpp,v 1.133 2007-09-15 16:57:28 geuzaine Exp $
+// $Id: Post.cpp,v 1.134 2007-09-18 16:26:02 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -94,18 +94,27 @@ void getLineNormal(PView *p, double x[2], double y[2], double z[2],
     }
   }
   else if(computeNormal){
-    // if we don't have a normal, we compute one
-    SVector3 t(x[1] - x[0], y[1] - y[0], z[1] - z[0]);
-    SVector3 ex(0., 0., 0.);
-    if(t[0] == 0.)
-      ex[0] = 1.;
-    else if(t[1] == 0.)
-      ex[1] = 1.;
-    else
-      ex[2] = 1.;
-    n[0] = crossprod(t, ex);
-    n[0].normalize();
-    n[1] = n[0];
+    SBoundingBox3d bb = p->getData()->getBoundingBox();
+    if(bb.min().z() == bb.max().z())
+      n[0] = n[1] = SVector3(0., 0., 1.);
+    else if(bb.min().y() == bb.max().y())
+      n[0] = n[1] = SVector3(0., 1., 0.);
+    else if(bb.min().x() == bb.max().x())
+      n[0] = n[1] = SVector3(1., 0., 0.);
+    else{
+      // we don't have any info about the normal, just pick one
+      SVector3 t(x[1] - x[0], y[1] - y[0], z[1] - z[0]);
+      SVector3 ex(0., 0., 0.);
+      if(t[0] == 0.)
+	ex[0] = 1.;
+      else if(t[1] == 0.)
+	ex[1] = 1.;
+      else
+	ex[2] = 1.;
+      n[0] = crossprod(t, ex);
+      n[0].normalize();
+      n[1] = n[0];
+    }
   }
 }
 
@@ -242,16 +251,16 @@ void changeCoordinates(PView *p, int iele, int numNodes, int numComp,
   }
 }
 
-void addOutlinePoint(PView *p, double xyz[NMAX][3], unsigned int color,
-		     bool pre=false, int i0=0)
+void addOutlinePoint(PView *p, double xyz[NMAX][3], unsigned int color, bool pre,
+		     int i0=0)
 {
   if(pre) return;
   SVector3 n = getPointNormal(p, 1.);
   p->va_points->add(&xyz[i0][0], &xyz[i0][1], &xyz[i0][2], &n, &color, 0, true);
 }
 
-void addScalarPoint(PView *p, double xyz[NMAX][3], double val[NMAX][9],
-		    bool pre=false, int i0=0, bool unique=false)
+void addScalarPoint(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool pre,
+		    int i0=0, bool unique=false)
 {
   if(pre) return;
 
@@ -267,8 +276,8 @@ void addScalarPoint(PView *p, double xyz[NMAX][3], double val[NMAX][9],
   }
 }
 
-void addOutlineLine(PView *p, double xyz[NMAX][3], unsigned int color,
-		    bool pre=false, int i0=0, int i1=1)
+void addOutlineLine(PView *p, double xyz[NMAX][3], unsigned int color, bool pre,
+		    int i0=0, int i1=1)
 {
   if(pre) return;
 
@@ -284,8 +293,8 @@ void addOutlineLine(PView *p, double xyz[NMAX][3], unsigned int color,
   p->va_lines->add(x, y, z, n, col, 0, true);
 }
 
-void addScalarLine(PView *p, double xyz[NMAX][3], double val[NMAX][9], 
-		   bool pre=false, int i0=0, int i1=1, bool unique=false)
+void addScalarLine(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool pre,
+		   int i0=0, int i1=1, bool unique=false)
 {
   if(pre) return;
 
@@ -362,8 +371,8 @@ void addScalarLine(PView *p, double xyz[NMAX][3], double val[NMAX][9],
   }
 }
 
-void addOutlineTriangle(PView *p, double xyz[NMAX][3], unsigned int color,
-			bool pre=false, int i0=0, int i1=1, int i2=2)
+void addOutlineTriangle(PView *p, double xyz[NMAX][3], unsigned int color, bool pre,
+			int i0=0, int i1=1, int i2=2)
 {
   PViewOptions *opt = p->getOptions();
 
@@ -388,9 +397,8 @@ void addOutlineTriangle(PView *p, double xyz[NMAX][3], unsigned int color,
   }
 }
 
-void addScalarTriangle(PView *p, double xyz[NMAX][3], double val[NMAX][9],
-		       bool pre=false, int i0=0, int i1=1, int i2=2,
-		       bool unique=false)
+void addScalarTriangle(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool pre,
+		       int i0=0, int i1=1, int i2=2, bool unique=false)
 {
   PViewOptions *opt = p->getOptions();
 
@@ -506,8 +514,8 @@ void addScalarTriangle(PView *p, double xyz[NMAX][3], double val[NMAX][9],
   }
 }
 
-void addOutlineQuadrangle(PView *p, double xyz[NMAX][3], unsigned int color,
-			  bool pre=false, int i0=0, int i1=1, int i2=2, int i3=3)
+void addOutlineQuadrangle(PView *p, double xyz[NMAX][3], unsigned int color, bool pre,
+			  int i0=0, int i1=1, int i2=2, int i3=3)
 {
   PViewOptions *opt = p->getOptions();
 
@@ -532,9 +540,8 @@ void addOutlineQuadrangle(PView *p, double xyz[NMAX][3], unsigned int color,
   }
 }
 
-void addScalarQuadrangle(PView *p, double xyz[NMAX][3], double val[NMAX][9],
-			 bool pre=false, int i0=0, int i1=1, int i2=2, int i3=3,
-			 bool unique=false)
+void addScalarQuadrangle(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool pre,
+			 int i0=0, int i1=1, int i2=2, int i3=3, bool unique=false)
 {
   PViewOptions *opt = p->getOptions();
 
@@ -553,16 +560,15 @@ void addScalarQuadrangle(PView *p, double xyz[NMAX][3], double val[NMAX][9],
     addScalarTriangle(p, xyz, val, pre, it[i][0], it[i][1], it[i][2], unique);
 }
 
-void addOutlineTetrahedron(PView *p, double xyz[NMAX][3], unsigned int color,
-			   bool pre=false)
+void addOutlineTetrahedron(PView *p, double xyz[NMAX][3], unsigned int color, bool pre)
 {
   const int it[4][3] = {{0, 2, 1}, {0, 1, 3}, {0, 3, 2}, {3, 1, 2}};
   for(int i = 0; i < 4; i++)
     addOutlineTriangle(p, xyz, color, pre, it[i][0], it[i][1], it[i][2]);
 }
 
-void addScalarTetrahedron(PView *p, double xyz[NMAX][3], double val[NMAX][9],
-			  bool pre=false, int i0=0, int i1=1, int i2=2, int i3=3)
+void addScalarTetrahedron(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool pre,
+			  int i0=0, int i1=1, int i2=2, int i3=3)
 {
   PViewOptions *opt = p->getOptions();
 
@@ -615,8 +621,7 @@ void addScalarTetrahedron(PView *p, double xyz[NMAX][3], double val[NMAX][9],
   }
 }
 
-void addOutlineHexahedron(PView *p, double xyz[NMAX][3], unsigned int color,
-			  bool pre=false)
+void addOutlineHexahedron(PView *p, double xyz[NMAX][3], unsigned int color, bool pre)
 {
   const int iq[6][4] = {{0, 3, 2, 1}, {0, 1, 5, 4}, {0, 4, 7, 3},
 			{1, 2, 6, 5}, {2, 3, 7, 6}, {4, 5, 6, 7}};
@@ -626,8 +631,7 @@ void addOutlineHexahedron(PView *p, double xyz[NMAX][3], unsigned int color,
 			 iq[i][2], iq[i][3]);
 }
 
-void addScalarHexahedron(PView *p, double xyz[NMAX][3], double val[NMAX][9],
-			 bool pre=false)
+void addScalarHexahedron(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool pre)
 {
   PViewOptions *opt = p->getOptions();
 
@@ -648,8 +652,7 @@ void addScalarHexahedron(PView *p, double xyz[NMAX][3], double val[NMAX][9],
     addScalarTetrahedron(p, xyz, val, pre, is[i][0], is[i][1], is[i][2], is[i][3]);
 }
 
-void addOutlinePrism(PView *p, double xyz[NMAX][3], unsigned int color,
-		     bool pre=false)
+void addOutlinePrism(PView *p, double xyz[NMAX][3], unsigned int color, bool pre)
 {
   const int iq[3][4] = {{0, 1, 4, 3}, {0, 3, 5, 2}, {1, 2, 5, 4}};
   const int it[2][3] = {{0, 2, 1}, {3, 4, 5}};
@@ -660,8 +663,7 @@ void addOutlinePrism(PView *p, double xyz[NMAX][3], unsigned int color,
     addOutlineTriangle(p, xyz, color, pre, it[i][0], it[i][1], it[i][2]);
 }
 
-void addScalarPrism(PView *p, double xyz[NMAX][3], double val[NMAX][9],
-		    bool pre=false)
+void addScalarPrism(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool pre)
 {
   PViewOptions *opt = p->getOptions();
 
@@ -683,8 +685,7 @@ void addScalarPrism(PView *p, double xyz[NMAX][3], double val[NMAX][9],
     addScalarTetrahedron(p, xyz, val, pre, is[i][0], is[i][1], is[i][2], is[i][3]);
 }
 
-void addOutlinePyramid(PView *p, double xyz[NMAX][3], unsigned int color,
-		       bool pre=false)
+void addOutlinePyramid(PView *p, double xyz[NMAX][3], unsigned int color, bool pre)
 {
   const int it[4][3] = {{0, 1, 4}, {3, 0, 4}, {1, 2, 4}, {2, 3, 4}};
 
@@ -693,8 +694,7 @@ void addOutlinePyramid(PView *p, double xyz[NMAX][3], unsigned int color,
     addOutlineTriangle(p, xyz, color, pre, it[i][0], it[i][1], it[i][2]);
 }
 
-void addScalarPyramid(PView *p, double xyz[NMAX][3], double val[NMAX][9],
-		      bool pre=false)
+void addScalarPyramid(PView *p, double xyz[NMAX][3], double val[NMAX][9], bool pre)
 {
   PViewOptions *opt = p->getOptions();
 
@@ -873,7 +873,7 @@ bool skipElement(PView *p, int numEdges)
   }
 }
 
-void addElementsInArrays(PView *p, bool preprocessNormalsOnly=false)
+void addElementsInArrays(PView *p, bool preprocessNormalsOnly)
 {
   PViewData *data = p->getData();
   PViewOptions *opt = p->getOptions();
@@ -985,17 +985,22 @@ void drawVectorArray(PView *p, VertexArray *va)
     else
       max = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
     if(max){
-      double f = CTX.pixel_equiv_x / CTX.s[0] * opt->ArrowSize / max;
-      double dx = v[0] * f, dy = v[1] * f, dz = v[2] * f;
-      double x = s[0], y = s[1], z = s[2];
-      if(opt->CenterGlyphs){
-	x -= 0.5 * dx;
-	y -= 0.5 * dy;
-	z -= 0.5 * dz;
+      double scale = opt->ArrowSize / max;
+      double px = v[0] * scale, py = v[1] * scale, pz = v[2] * scale;
+      // only draw vectors larger than 1 pixel on screen
+      if(fabs(px) > 1. || fabs(py) > 1. || fabs(pz) > 1.){
+	double d = CTX.pixel_equiv_x / CTX.s[0];
+	double dx = px * d, dy = py * d, dz = pz * d;
+	double x = s[0], y = s[1], z = s[2];
+	if(opt->CenterGlyphs){
+	  x -= 0.5 * dx;
+	  y -= 0.5 * dy;
+	  z -= 0.5 * dz;
+	}
+	Draw_Vector(opt->VectorType, opt->IntervalsType != PViewOptions::Iso,
+		    opt->ArrowRelHeadRadius, opt->ArrowRelStemLength,
+		    opt->ArrowRelStemRadius, x, y, z, dx, dy, dz, opt->Light);
       }
-      Draw_Vector(opt->VectorType, opt->IntervalsType != PViewOptions::Iso,
-		  opt->ArrowRelHeadRadius, opt->ArrowRelStemLength,
-		  opt->ArrowRelStemRadius, x, y, z, dx, dy, dz, opt->Light);
     }
   }
 }
@@ -1218,7 +1223,7 @@ class initPView {
     }
 
     if(opt->SmoothNormals) addElementsInArrays(p, true);
-    addElementsInArrays(p);
+    addElementsInArrays(p, false);
 
     Msg(INFO, "Rendering %d vertices", p->va_points->getNumVertices() + 
 	p->va_lines->getNumVertices() + p->va_triangles->getNumVertices() + 
diff --git a/Graphics/SelectBuffer.cpp b/Graphics/SelectBuffer.cpp
index d9ceff99b0..11b79de24a 100644
--- a/Graphics/SelectBuffer.cpp
+++ b/Graphics/SelectBuffer.cpp
@@ -1,4 +1,4 @@
-// $Id: SelectBuffer.cpp,v 1.14 2007-09-12 20:14:34 geuzaine Exp $
+// $Id: SelectBuffer.cpp,v 1.15 2007-09-18 16:26:02 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -57,10 +57,6 @@ MElement *getElement(GEntity *e, int va_type, int index)
     if(e->va_triangles && index < e->va_triangles->getNumElementPointers())
       return *e->va_triangles->getElementPointerArray(index);
     break;
-  case 4:
-    if(e->va_quads && index < e->va_quads->getNumElementPointers())
-      return *e->va_quads->getElementPointerArray(index);
-    break;
   }
   return 0;
 }
diff --git a/Graphics/gl2ps.cpp b/Graphics/gl2ps.cpp
index 77bbf9001a..3bca05582f 100644
--- a/Graphics/gl2ps.cpp
+++ b/Graphics/gl2ps.cpp
@@ -1,7 +1,7 @@
-/* $Id: gl2ps.cpp,v 1.112 2007-09-04 13:47:01 remacle Exp $ */
+/* $Id: gl2ps.cpp,v 1.113 2007-09-18 16:26:02 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to PostScript Printing Library
- * Copyright (C) 1999-2006 Christophe Geuzaine <geuz@geuz.org>
+ * Copyright (C) 1999-2007 Christophe Geuzaine <geuz@geuz.org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of either:
@@ -1375,7 +1375,7 @@ static void gl2psDivideQuad(GL2PSprimitive *quad,
   (*t2)->verts[0] = quad->verts[0];
   (*t2)->verts[1] = quad->verts[2];
   (*t2)->verts[2] = quad->verts[3];
-  (*t1)->boundary = ((quad->boundary & 4) ? 2 : 0) | ((quad->boundary & 4) ? 2 : 0);
+  (*t2)->boundary = ((quad->boundary & 4) ? 2 : 0) | ((quad->boundary & 4) ? 2 : 0);
 }
 
 static int gl2psCompareDepth(const void *a, const void *b)
@@ -4893,7 +4893,8 @@ static void gl2psPrintSVGHeader(void)
                 (int)gl2ps->viewport[0], (int)gl2ps->viewport[3]);
   }
 
-  gl2psPrintf("<g>\n");
+  /* group all the primitives and disable antialiasing */
+  gl2psPrintf("<g shape-rendering=\"crispEdges\">\n");
 }
 
 static void gl2psPrintSVGSmoothTriangle(GL2PSxyz xyz[3], GL2PSrgba rgba[3])
@@ -5743,6 +5744,9 @@ GL2PSDLL_API GLint gl2psEndViewport(void)
 
   res = (gl2psbackends[gl2ps->format]->endViewport)();
 
+  /* reset last used colors, line widths */
+  gl2ps->lastlinewidth = -1.0F;
+
   return res;
 }
 
@@ -5970,6 +5974,18 @@ GL2PSDLL_API GLint gl2psSetOptions(GLint options)
   return GL2PS_SUCCESS;
 }
 
+GL2PSDLL_API GLint gl2psGetOptions(GLint *options)
+{
+  if(!gl2ps) {
+    *options = 0;
+    return GL2PS_UNINITIALIZED;
+  }
+
+  *options = gl2ps->options;
+
+  return GL2PS_SUCCESS;
+}
+
 GL2PSDLL_API const char *gl2psGetFileExtension(GLint format)
 {
   if(format >= 0 && format < (GLint)(sizeof(gl2psbackends)/sizeof(gl2psbackends[0])))
diff --git a/Graphics/gl2ps.h b/Graphics/gl2ps.h
index 351692580a..9057f7c1dc 100644
--- a/Graphics/gl2ps.h
+++ b/Graphics/gl2ps.h
@@ -1,7 +1,7 @@
-/* $Id: gl2ps.h,v 1.70 2007-09-04 13:47:02 remacle Exp $ */
+/* $Id: gl2ps.h,v 1.71 2007-09-18 16:26:02 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to PostScript Printing Library
- * Copyright (C) 1999-2006 Christophe Geuzaine <geuz@geuz.org>
+ * Copyright (C) 1999-2007 Christophe Geuzaine <geuz@geuz.org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of either:
@@ -78,14 +78,14 @@
 
 #define GL2PS_MAJOR_VERSION 1
 #define GL2PS_MINOR_VERSION 3
-#define GL2PS_PATCH_VERSION 2
+#define GL2PS_PATCH_VERSION 3
 #define GL2PS_EXTRA_VERSION "-cvs"
 
 #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
                        0.01 * GL2PS_MINOR_VERSION + \
                        0.0001 * GL2PS_PATCH_VERSION)
 
-#define GL2PS_COPYRIGHT "(C) 1999-2006 Christophe Geuzaine (geuz@geuz.org)"
+#define GL2PS_COPYRIGHT "(C) 1999-2007 Christophe Geuzaine (geuz@geuz.org)"
 
 /* Output file formats (the values and the ordering are important!) */
 
@@ -166,6 +166,7 @@ GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
                                   FILE *stream, const char *filename);
 GL2PSDLL_API GLint gl2psEndPage(void);
 GL2PSDLL_API GLint gl2psSetOptions(GLint options);
+GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
 GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
 GL2PSDLL_API GLint gl2psEndViewport(void);
 GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, 
diff --git a/Plugin/MakeSimplex.cpp b/Plugin/MakeSimplex.cpp
index 398a76d0d3..91a79bcbfe 100644
--- a/Plugin/MakeSimplex.cpp
+++ b/Plugin/MakeSimplex.cpp
@@ -1,4 +1,4 @@
-// $Id: MakeSimplex.cpp,v 1.4 2007-09-15 15:01:03 geuzaine Exp $
+// $Id: MakeSimplex.cpp,v 1.5 2007-09-18 16:26:02 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -120,12 +120,6 @@ PView *GMSH_MakeSimplexPlugin::execute(PView *v)
   PViewDataList *data1 = getDataList(v1);
   if(!data1) return v;
 
-  // Bail out if the view is an alias or if other views duplicate it
-  if(v1->getAliasOf() || v1->getLinks()) {
-    Msg(GERROR, "MakeSimplex cannot be applied to an aliased view");
-    return 0;
-  }
-
   // quads
   decomposeList(data1, 4, 1, &data1->SQ, &data1->NbSQ, data1->ST, &data1->NbST);
   decomposeList(data1, 4, 3, &data1->VQ, &data1->NbVQ, data1->VT, &data1->NbVT);
diff --git a/Plugin/Remove.cpp b/Plugin/Remove.cpp
index 5c9ebd326b..af842d2b2c 100644
--- a/Plugin/Remove.cpp
+++ b/Plugin/Remove.cpp
@@ -1,4 +1,4 @@
-// $Id: Remove.cpp,v 1.11 2007-09-11 14:01:55 geuzaine Exp $
+// $Id: Remove.cpp,v 1.12 2007-09-18 16:26:02 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -94,11 +94,6 @@ PView *GMSH_RemovePlugin::execute(PView *v)
   PViewDataList *data1 = getDataList(v1);
   if(!data1) return v;
   
-  if(v1->getAliasOf() || v1->getLinks()){
-    Msg(GERROR, "Cannot remove data from aliased view");
-    return v1;
-  }
-
   int scalar = (int)RemoveOptions_Number[10].def;
   int vector = (int)RemoveOptions_Number[11].def;
   int tensor = (int)RemoveOptions_Number[12].def;
diff --git a/Post/AdaptiveViews.cpp b/Post/AdaptiveViews.cpp
index 86cb1e2566..1ecc325f6f 100644
--- a/Post/AdaptiveViews.cpp
+++ b/Post/AdaptiveViews.cpp
@@ -24,11 +24,6 @@
 #include "AdaptiveViews.h"
 #include "Plugin.h"
 
-// A recursive effective implementation
-
-void computeShapeFunctions(Double_Matrix *coeffs, Double_Matrix *eexps,
-                           double u, double v, double w, double *sf);
-
 std::set<adapt_point> adapt_point::all_points;
 std::list<adapt_edge*> adapt_edge::all_elems;
 std::list<adapt_triangle*> adapt_triangle::all_elems;
@@ -42,6 +37,25 @@ int adapt_tet::nbNod = 4;
 int adapt_quad::nbNod = 4;
 int adapt_hex::nbNod = 8;
 
+void computeShapeFunctions(Double_Matrix *coeffs, Double_Matrix *eexps,
+                           double u, double v, double w, double *sf)
+{
+  static double powsuvw[256];
+  for(int j = 0; j < coeffs->size2(); ++j) {
+    double powu = (*eexps)(j, 0);
+    double powv = (*eexps)(j, 1);
+    double poww = (*eexps)(j, 2);
+    powsuvw[j] = pow(u, powu) * pow(v, powv) * pow(w, poww);
+  }
+
+  for(int i = 0; i < coeffs->size1(); ++i) {
+    sf[i] = 0.0;
+    for(int j = 0; j < coeffs->size2(); ++j) {
+      sf[i] += (*coeffs)(i, j) * powsuvw[j];
+    }
+  }
+}
+
 adapt_point *adapt_point::New(double x, double y, double z,
                               Double_Matrix *coeffs, Double_Matrix *eexps)
 {
@@ -922,25 +936,6 @@ void Adaptive_Post_View::setAdaptiveResolutionLevel_TEMPL(int level, int levelma
   }
 }
 
-void computeShapeFunctions(Double_Matrix *coeffs, Double_Matrix *eexps,
-                           double u, double v, double w, double *sf)
-{
-  static double powsuvw[256];
-  for(int j = 0; j < coeffs->size2(); ++j) {
-    double powu = (*eexps)(j, 0);
-    double powv = (*eexps)(j, 1);
-    double poww = (*eexps)(j, 2);
-    powsuvw[j] = pow(u, powu) * pow(v, powv) * pow(w, poww);
-  }
-
-  for(int i = 0; i < coeffs->size1(); ++i) {
-    sf[i] = 0.0;
-    for(int j = 0; j < coeffs->size2(); ++j) {
-      sf[i] += (*coeffs)(i, j) * powsuvw[j];
-    }
-  }
-}
-
 void Adaptive_Post_View::initWithLowResolution(PViewDataList *data)
 {
   List_T *myList;
diff --git a/Post/PView.cpp b/Post/PView.cpp
index f02ef9bfb8..2c3e3aa76e 100644
--- a/Post/PView.cpp
+++ b/Post/PView.cpp
@@ -1,4 +1,4 @@
-// $Id: PView.cpp,v 1.9 2007-09-14 18:51:37 geuzaine Exp $
+// $Id: PView.cpp,v 1.10 2007-09-18 16:26:02 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -34,7 +34,6 @@ void PView::_init()
   _num = ++_globalNum;
   _changed = true;
   _aliasOf = 0;
-  _links = 0;
   _eye = SPoint3(0., 0., 0.);
   va_points = va_lines = va_triangles = va_vectors = 0;
   normals = 0;
@@ -60,7 +59,6 @@ PView::PView(PView *ref, bool copyOptions)
 {
   _init();
   _aliasOf = ref->getNum();
-  ref->getLinks()++;
   _data = ref->getData();
   if(copyOptions)
     _options = new PViewOptions(*ref->getOptions());
@@ -113,25 +111,21 @@ PView::~PView()
   if(it != list.end()) list.erase(it);
   for(unsigned int i = 0; i < list.size(); i++) list[i]->setIndex(i);
 
-  if(!_data || _links > 0) return;
-
-  if(_aliasOf){
-    for(unsigned int i = 0; i < list.size(); i++){
-      if(list[i]->getNum() == _aliasOf){
-	// original data still exists, decrement ref counter
-	list[i]->getLinks()--;
-	return;
-      }
-    }
-    for(unsigned int i = 0; i < list.size(); i++){
-      if(list[i]->getAliasOf() == _aliasOf){
-	// original is gone, but other aliases exist
+  if(!_data) return;
+
+  // do not delete if another view is an alias of this one
+  for(unsigned int i = 0; i < list.size(); i++)
+    if(list[i]->getAliasOf() == _num)
+      return;
+  
+  // do not delete if this view is an alias and 1) if the original
+  // still exists, or 2) if there are other aliases to the same view
+  if(_aliasOf)
+    for(unsigned int i = 0; i < list.size(); i++)
+      if(list[i]->getNum() == _aliasOf || list[i]->getAliasOf() == _aliasOf)
 	return;
-      }
-    }
-  }
-
-  Msg(DEBUG, "Deleting data in ex-View[%d] (unique num = %d)", _index, _num);
+  
+  Msg(DEBUG, "Deleting data in View[%d] (unique num = %d)", _index, _num);
   delete _data;
 }
 
@@ -151,16 +145,6 @@ void PView::setChanged(bool val)
   if(_changed) _eye = SPoint3(0., 0., 0.); 
 }
 
-PView *PView::current()
-{ 
-  if(list.empty()){
-    Msg(GERROR, "No view available");
-    return 0;
-  }
-  // return the last one for now
-  return list.back();
-}
-
 bool PView::read(std::string filename, int fileIndex)
 {
   FILE *fp = fopen(filename.c_str(), "rb");
diff --git a/Post/PView.h b/Post/PView.h
index 163bc3cd37..f02d8b5dd3 100644
--- a/Post/PView.h
+++ b/Post/PView.h
@@ -39,8 +39,6 @@ class PView{
   bool _changed;
   // tag of the source view if this view is an alias, zero otherwise
   int _aliasOf;
-  // reference counter (how many views link to this one)
-  int _links;
   // eye position (for transparency sorting)
   SPoint3 _eye;
   // the options
@@ -70,15 +68,12 @@ class PView{
   void setIndex(int val){ _index = val; }
   bool &getChanged(){ return _changed; }
   void setChanged(bool val);
-  int &getLinks(){ return _links; }
   int getAliasOf(){ return _aliasOf; }
   SPoint3 &getEye(){ return _eye; }
   void setEye(SPoint3 &p){ _eye = p; }
 
   // the static list of all loaded views
   static std::vector<PView*> list;
-  // the current view
-  static PView *current();
   // read view(s) in list format from a file
   static bool read(std::string filename, int fileIndex=-1);
   // combine view
diff --git a/benchmarks/misc/animation.geo b/benchmarks/misc/animation.geo
index 9afba2aecb..4959e8d55e 100644
--- a/benchmarks/misc/animation.geo
+++ b/benchmarks/misc/animation.geo
@@ -11,8 +11,7 @@ For(1:300)
   General.RotationX += 10 ;
   General.RotationY =  General.RotationX / 3 ;
 
-  View[0].TimeStep += 
-    (View[0].TimeStep < View[0].NbTimeStep-1) ? 1 : 0 ;
+  View[0].TimeStep++;
 
   Sleep 0.1;
   Draw;
diff --git a/benchmarks/misc/bgmesh/Makefile b/benchmarks/misc/bgmesh/Makefile
deleted file mode 100644
index b9679d725d..0000000000
--- a/benchmarks/misc/bgmesh/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-
-doit:
-	gmsh proj.geo -3
-	getdp proj -solve Proj -pos v -bin
-	gmsh proj.geo -bgm proj.pos
-
-clean:
-	rm -f *.msh *.pre *.res *.pos
diff --git a/benchmarks/misc/bgmesh/proj.geo b/benchmarks/misc/bgmesh/proj.geo
deleted file mode 100644
index a73b221626..0000000000
--- a/benchmarks/misc/bgmesh/proj.geo
+++ /dev/null
@@ -1,12 +0,0 @@
-Point(1) = {0.0,0.0,0.0,.25};
-Point(2) = {1,0.0,0.0,.25};         
-Point(3) = {1,1,0.0,.25};         
-Point(4) = {0,1,0.0,.25};         
-Line(1) = {4,3};         
-Line(2) = {3,2};         
-Line(3) = {2,1};         
-Line(4) = {1,4};         
-Line Loop(5) = {2,3,4,1};         
-Plane Surface(6) = {5};         
-Extrude Surface { 6, {0,0.0,1} };         
-Physical Volume(1) = {1};
diff --git a/benchmarks/misc/bgmesh/proj.pro b/benchmarks/misc/bgmesh/proj.pro
deleted file mode 100644
index b48db486fb..0000000000
--- a/benchmarks/misc/bgmesh/proj.pro
+++ /dev/null
@@ -1,77 +0,0 @@
-// Moronic getdp input file to create some test post-proessing maps
-
-Group {
-  Omega = Region[ {1} ];
-}
-
-Function {
-  Fct[] = (Sin[Pi*(X[]+1)]+1) * 0.4 + 0.05 ;
-}
-
-Jacobian {
-  { Name JVol ; Case { { Region All ; Jacobian Vol ; } } }
-  { Name JSur ; Case { { Region All ; Jacobian Sur ; } } }
-}
-
-Integration {
-  { Name I1 ;
-    Case { {Type Gauss ;
-            Case { { GeoElement Line        ; NumberOfPoints  4 ; }
-                   { GeoElement Triangle    ; NumberOfPoints  12 ; }
-                   { GeoElement Quadrangle  ; NumberOfPoints  4 ; }
-                   { GeoElement Tetrahedron ; NumberOfPoints  15 ; }
-                   { GeoElement Hexahedron  ; NumberOfPoints  34 ; }
-                   { GeoElement Prism       ; NumberOfPoints  9 ; } 
-                   { GeoElement Pyramid     ; NumberOfPoints  8 ; } }
-           }
-         }
-  }
-}
-
-FunctionSpace {
-  { Name Proj ; Type Form0 ; 
-    BasisFunction {
-      { Name sn ; NameOfCoef phin ; Function BF_Node ;
-        Support Omega ; Entity NodesOf[ All ] ; }
-    }
-  }
-}
-
-Formulation {
-  { Name Proj ; Type FemEquation ;
-    Quantity { 
-      { Name v ; Type Local ; NameOfSpace Proj ; }
-    }
-    Equation {
-      Galerkin { [ Dof{v} , {v} ] ;  In Omega ; Jacobian JVol ; Integration I1 ; }
-      Galerkin { [ -Fct[] , {v} ] ;  In Omega ; Jacobian JVol ; Integration I1 ; }
-    }
-  }
-
-}
-
-Resolution {
-  { Name Proj ;
-    System {
-      { Name Proj ; NameOfFormulation Proj ; Type Complex; Frequency 1; }
-    }
-    Operation { 
-      Generate Proj ; Solve Proj ; SaveSolution Proj ;
-    }
-  }
-
-}
-
-PostProcessing {
-  { Name Proj ; NameOfFormulation Proj  ;
-    Quantity {
-      { Name v ; Value { Term { [ {v} ] ; In Omega ; } } }
-      { Name v3 ; Value { Term { [ Vector[0,{v},0] ] ; In Omega ; } } }
-    }
-  }
-
-}
-
-PostOperation v UsingPost Proj {
-  Print[ v , OnElementsOf Omega , File "proj.pos" ] ;
-}
diff --git a/benchmarks/misc/bgmesh/solver.par b/benchmarks/misc/bgmesh/solver.par
deleted file mode 100644
index 0c560e0ad1..0000000000
--- a/benchmarks/misc/bgmesh/solver.par
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-
-Matrix_Format (Integer): 
-    - 1  Sparse 
-    - 2  Full 
-    - default : 1
-
-Matrix_Printing (Integer): Disk write ('fort.*') 
-    - 1  matrix (csr) 
-    - 2  preconditioner (msr) 
-    - 3  both 
-    - default : 0
-
-Matrix_Storage (Integer): Disk Write or Read in internal format 
-    - 0  none 
-    - 1  write matrix (sparse) 
-    - 2  read matrix (sparse) 
-    - default : 0
-
-Scaling (Integer): Scale system 
-    - 0  no 
-    - 1  on basis of diagonal elements  (no loss of possible symmetry) 
-    - 2  on basis of inf. norm  of first rows and then columns  (asymmetric) 
-    - 3  on basis of norm 1     of first rows and then columns  (asymmetric) 
-    - 4  on basis of norm 2     of first rows and then columns  (asymmetric) 
-    - default : 0
-
-Renumbering_Technique (Integer): 
-    - 0  No renumbering 
-    - 1  Reverse Cuthill-Mc Kee 
-    - default : 1 
-
-Preconditioner (Integer): 
-    - 0  NONE     No Factorization
-    - 1  ILUT     Incomplete LU factorization with dual truncation strategy 
-    - 2  ILUTP    ILUT with column  pivoting                                
-    - 3  ILUD     ILU with single dropping + diagonal compensation (~MILUT) 
-    - 4  ILUDP    ILUD with column pivoting                                 
-    - 5  ILUK     level-k ILU                                               
-    - 6  ILU0     simple ILU(0) preconditioning                             
-    - 7  MILU0    MILU(0) preconditioning                                   
-    - 8  DIAGONAL                                                           
-    - default : 2 
-
-Preconditioner_Position (Integer): 
-    - 0  No Preconditioner 
-    - 1  Left Preconditioner 
-    - 2  Right Preconditioner 
-    - 3  Both Left and Right Preconditioner 
-    - default : 2 
-
-Nb_Fill (Integer): 
-    - ILUT/ILUTP : maximum number of elements per line 
-      of L and U (except diagonal element) 
-    - ILUK : each element whose fill-in level is greater than NB_FILL 
-      is dropped. 
-    - default : 20
-
-Permutation_Tolerance (Real): Tolerance for column permutation in ILUTP/ILUDP. 
-    At stage i, columns i and j are permuted if 
-    abs(a(i,j))*PERMUTATION_TOLERANCE > abs(a(i,i)). 
-    - 0  no permutations 
-    - 0.001 -> 0.1  classical 
-    - default : 0.05
-
-Dropping_Tolerance (Real): 
-    - ILUT/ILUTP/ILUK: a(i,j) is dropped if 
-      abs(a(i,j)) < DROPPING_TOLERANCE * abs(diagonal element in U). 
-    - ILUD/ILUDP : a(i,j) is dropped if 
-      abs(a(i,j)) < DROPPING_TOLERANCE * [weighted norm of line i]. 
-      Weighted norm = 1-norm / number of nonzero elements on the line. 
-    - default : 0
-
-Diagonal_Compensation (Real): ILUD/ILUDP: the term 'DIAGONAL_COMPENSATION * (sum 
-    of all dropped elements of the line)' is added to the diagonal element in U 
-    - 0  ~ ILU with threshold 
-      1  ~ MILU with threshold. 
-    - default : 0
-
-Re_Use_ILU (Integer): Reuse ILU decomposition (and renumbering if any)
-    - 0  no 
-    - 1  yes 
-    - default : 0
-
-Algorithm (Integer): 
-    - 1  CG       Conjugate Gradient                    
-    - 2  CGNR     CG (Normal Residual equation)         
-    - 3  BCG      Bi-Conjugate Gradient                 
-    - 4  DBCG     BCG with partial pivoting             
-    - 5  BCGSTAB  BCG stabilized                        
-    - 6  TFQMR    Transpose-Free Quasi-Minimum Residual 
-    - 7  FOM      Full Orthogonalization Method         
-    - 8  GMRES    Generalized Minimum RESidual          
-    - 9  FGMRES   Flexible version of GMRES             
-    - 10 DQGMRES  Direct versions of GMRES              
-    - 11 LU       LU Factorization                      
-    - 12 PGMRES   Alternative version of GMRES          
-    - default : 8
-
-Krylov_Size (Integer): Krylov subspace size 
-    - default : 40
-
-IC_Acceleration (Real): IC accelerator
-    - default : 1 
-
-Re_Use_LU (Integer): Reuse LU decomposition
-    - 0  no 
-    - 1  yes 
-    - default : 0
-
-Iterative_Improvement (Integer): Iterative improvement of the solution obtained by a LU 
-    - default : 0
-
-Nb_Iter_Max (Integer): Maximum number of iterations 
-    - default : 1000 
-
-Stopping_Test (Real): Target relative residual 
-    - default : 1e-10 
-
-*/
-
-            Matrix_Format            1
-          Matrix_Printing            0
-           Matrix_Storage            0
-                  Scaling            0
-    Renumbering_Technique            1
-           Preconditioner            2
-  Preconditioner_Position            2
-                  Nb_Fill           20
-    Permutation_Tolerance         0.05
-       Dropping_Tolerance            0
-    Diagonal_Compensation            0
-               Re_Use_ILU            0
-                Algorithm            8
-              Krylov_Size           40
-          IC_Acceleration            1
-                Re_Use_LU            0
-    Iterative_Improvement            0
-              Nb_Iter_Max         1000
-            Stopping_Test        1e-10
diff --git a/benchmarks/misc/levelset/Makefile b/benchmarks/misc/levelset/Makefile
deleted file mode 100644
index e247b81bb8..0000000000
--- a/benchmarks/misc/levelset/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-
-doit:
-	gmsh levelsetTest.geo -3
-	getdp levelsetTest -solve Proj -pos v -bin
-	gmsh levelsetTest.geo levelsetTest1.pos levelsetTest.opt
-
-#	gmsh levelsetTest.geo levelsetTest2.pos levelsetTest.opt
-#	gmsh levelsetTest.geo levelsetTest3.pos levelsetTest.opt
-
-clean:
-	rm -f *.msh *.pre *.res *.pos
diff --git a/benchmarks/misc/levelset/displacement.scp b/benchmarks/misc/levelset/displacement.scp
deleted file mode 100644
index c58336dbc8..0000000000
--- a/benchmarks/misc/levelset/displacement.scp
+++ /dev/null
@@ -1,16 +0,0 @@
-MergeWithBoundingBox "levelsetTest1.pos";
-Merge "levelsetTest3.pos";
-
-fact = View[1].Max * 0.001;
-
-For i In {0:View[0].NbTimeStep-1}
-  Plugin(DisplacementRaise).iView = 0;
-  Plugin(DisplacementRaise).dView = 1;
-  Plugin(DisplacementRaise).dTimeStep = i;
-  Plugin(DisplacementRaise).Factor = fact;
-  Plugin(DisplacementRaise).Run;
-  Draw;
-  Print Sprintf("pic-%02g.jpg", i);
-  Plugin(DisplacementRaise).Factor = -fact;
-  Plugin(DisplacementRaise).Run;
-EndFor
diff --git a/benchmarks/misc/levelset/levelsetTest.geo b/benchmarks/misc/levelset/levelsetTest.geo
deleted file mode 100644
index 3ee8155d7f..0000000000
--- a/benchmarks/misc/levelset/levelsetTest.geo
+++ /dev/null
@@ -1,39 +0,0 @@
-lc = 0.1;
-
-Point(1) = {0,0,0,lc};
-Point(2) = {0,1,0,lc};
-Point(3) = {1,1,0,lc};
-Point(4) = {1,0,0,lc};
-Line(1) = {1,4};
-Line(2) = {4,3};
-Line(3) = {3,2};
-Line(4) = {2,1};
-Line Loop(5) = {3,4,1,2};
-
-Plane Surface(6) = {5};
-
-Transfinite Surface{6} = {1,2,3,4};
-Recombine Surface{6};
-
-Translate {2,0,0} {
-  Duplicata{ Surface{6}; }
-}
-Translate {4,0,0} {
-  Duplicata{ Surface{6}; }
-}
-
-Extrude Surface {6, {-1,1,0}, {2.5,2.5,1}, Pi/4}{
-  Layers { {2/lc}, {100}, {1} }; Recombine;
-};
-
-Extrude Surface {7, {0,0,1}}{
-  Layers { {1/lc}, {200}, {1} }; Recombine;
-};
-
-Extrude Surface {12, {-1,-1,0}, {2.5,2.5,1}, Pi/4}{
-  Layers { {1/lc}, {300}, {1} };
-};
-
-Physical Volume(1) = {100,200,300};
-Physical Surface(2) = {1:100};
-Physical Line(3) = {1:100};
diff --git a/benchmarks/misc/levelset/levelsetTest.opt b/benchmarks/misc/levelset/levelsetTest.opt
deleted file mode 100644
index e9062d6db0..0000000000
--- a/benchmarks/misc/levelset/levelsetTest.opt
+++ /dev/null
@@ -1,18 +0,0 @@
-Plugin(CutPlane).A = 1;
-Plugin(CutPlane).B = 0;
-Plugin(CutPlane).C = 0;
-Plugin(CutPlane).D = 0;
-Plugin(CutPlane).Run;
-
-Plugin(CutPlane).D = -2.5;
-Plugin(CutPlane).Run;
-
-Plugin(CutPlane).D = -4.1;
-Plugin(CutPlane).Run;
-
-Plugin(CutMap).A = 1;
-Plugin(CutMap).Run;
-
-Plugin(CutMap).A = 22;
-Plugin(CutMap).Run;
-
diff --git a/benchmarks/misc/levelset/levelsetTest.pro b/benchmarks/misc/levelset/levelsetTest.pro
deleted file mode 100644
index f0ef74f62a..0000000000
--- a/benchmarks/misc/levelset/levelsetTest.pro
+++ /dev/null
@@ -1,79 +0,0 @@
-// Moronic getdp input file to create some test post-proessing maps
-
-Group {
-  Omega = Region[ {1,2,3,4} ];
-}
-
-Function {
-  Fct[] = Complex[ X[]^2-Sin[2*Y[]]+Sqrt[Z[]] ,  Sin[2*Z[]] + X[]^2 ];
-}
-
-Jacobian {
-  { Name JVol ; Case { { Region All ; Jacobian Vol ; } } }
-  { Name JSur ; Case { { Region All ; Jacobian Sur ; } } }
-}
-
-Integration {
-  { Name I1 ;
-    Case { {Type Gauss ;
-            Case { { GeoElement Line        ; NumberOfPoints  4 ; }
-                   { GeoElement Triangle    ; NumberOfPoints  12 ; }
-                   { GeoElement Quadrangle  ; NumberOfPoints  4 ; }
-                   { GeoElement Tetrahedron ; NumberOfPoints  15 ; }
-                   { GeoElement Hexahedron  ; NumberOfPoints  34 ; }
-                   { GeoElement Prism       ; NumberOfPoints  9 ; } 
-                   { GeoElement Pyramid     ; NumberOfPoints  8 ; } }
-           }
-         }
-  }
-}
-
-FunctionSpace {
-  { Name Proj ; Type Form0 ; 
-    BasisFunction {
-      { Name sn ; NameOfCoef phin ; Function BF_Node ;
-        Support Omega ; Entity NodesOf[ All ] ; }
-    }
-  }
-}
-
-Formulation {
-  { Name Proj ; Type FemEquation ;
-    Quantity { 
-      { Name v ; Type Local ; NameOfSpace Proj ; }
-    }
-    Equation {
-      Galerkin { [ Dof{v} , {v} ] ;  In Omega ; Jacobian JVol ; Integration I1 ; }
-      Galerkin { [ -Fct[] , {v} ] ;  In Omega ; Jacobian JVol ; Integration I1 ; }
-    }
-  }
-
-}
-
-Resolution {
-  { Name Proj ;
-    System {
-      { Name Proj ; NameOfFormulation Proj ; Type Complex; Frequency 1; }
-    }
-    Operation { 
-      Generate Proj ; Solve Proj ; SaveSolution Proj ;
-    }
-  }
-
-}
-
-PostProcessing {
-  { Name Proj ; NameOfFormulation Proj  ;
-    Quantity {
-      { Name v ; Value { Term { [ {v} ] ; In Omega ; } } }
-      { Name v3 ; Value { Term { [ Vector[0,{v},0] ] ; In Omega ; } } }
-    }
-  }
-
-}
-
-PostOperation v UsingPost Proj {
-  Print[ v , OnElementsOf Omega , File "levelsetTest1.pos" ] ;
-  Print[ v , OnElementsOf Omega , File "levelsetTest2.pos" , DecomposeInSimplex  ] ;
-  Print[ v3 , OnElementsOf Omega , File "levelsetTest3.pos"  ] ;
-}
diff --git a/benchmarks/misc/levelset/solver.par b/benchmarks/misc/levelset/solver.par
deleted file mode 100644
index 0c560e0ad1..0000000000
--- a/benchmarks/misc/levelset/solver.par
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-
-Matrix_Format (Integer): 
-    - 1  Sparse 
-    - 2  Full 
-    - default : 1
-
-Matrix_Printing (Integer): Disk write ('fort.*') 
-    - 1  matrix (csr) 
-    - 2  preconditioner (msr) 
-    - 3  both 
-    - default : 0
-
-Matrix_Storage (Integer): Disk Write or Read in internal format 
-    - 0  none 
-    - 1  write matrix (sparse) 
-    - 2  read matrix (sparse) 
-    - default : 0
-
-Scaling (Integer): Scale system 
-    - 0  no 
-    - 1  on basis of diagonal elements  (no loss of possible symmetry) 
-    - 2  on basis of inf. norm  of first rows and then columns  (asymmetric) 
-    - 3  on basis of norm 1     of first rows and then columns  (asymmetric) 
-    - 4  on basis of norm 2     of first rows and then columns  (asymmetric) 
-    - default : 0
-
-Renumbering_Technique (Integer): 
-    - 0  No renumbering 
-    - 1  Reverse Cuthill-Mc Kee 
-    - default : 1 
-
-Preconditioner (Integer): 
-    - 0  NONE     No Factorization
-    - 1  ILUT     Incomplete LU factorization with dual truncation strategy 
-    - 2  ILUTP    ILUT with column  pivoting                                
-    - 3  ILUD     ILU with single dropping + diagonal compensation (~MILUT) 
-    - 4  ILUDP    ILUD with column pivoting                                 
-    - 5  ILUK     level-k ILU                                               
-    - 6  ILU0     simple ILU(0) preconditioning                             
-    - 7  MILU0    MILU(0) preconditioning                                   
-    - 8  DIAGONAL                                                           
-    - default : 2 
-
-Preconditioner_Position (Integer): 
-    - 0  No Preconditioner 
-    - 1  Left Preconditioner 
-    - 2  Right Preconditioner 
-    - 3  Both Left and Right Preconditioner 
-    - default : 2 
-
-Nb_Fill (Integer): 
-    - ILUT/ILUTP : maximum number of elements per line 
-      of L and U (except diagonal element) 
-    - ILUK : each element whose fill-in level is greater than NB_FILL 
-      is dropped. 
-    - default : 20
-
-Permutation_Tolerance (Real): Tolerance for column permutation in ILUTP/ILUDP. 
-    At stage i, columns i and j are permuted if 
-    abs(a(i,j))*PERMUTATION_TOLERANCE > abs(a(i,i)). 
-    - 0  no permutations 
-    - 0.001 -> 0.1  classical 
-    - default : 0.05
-
-Dropping_Tolerance (Real): 
-    - ILUT/ILUTP/ILUK: a(i,j) is dropped if 
-      abs(a(i,j)) < DROPPING_TOLERANCE * abs(diagonal element in U). 
-    - ILUD/ILUDP : a(i,j) is dropped if 
-      abs(a(i,j)) < DROPPING_TOLERANCE * [weighted norm of line i]. 
-      Weighted norm = 1-norm / number of nonzero elements on the line. 
-    - default : 0
-
-Diagonal_Compensation (Real): ILUD/ILUDP: the term 'DIAGONAL_COMPENSATION * (sum 
-    of all dropped elements of the line)' is added to the diagonal element in U 
-    - 0  ~ ILU with threshold 
-      1  ~ MILU with threshold. 
-    - default : 0
-
-Re_Use_ILU (Integer): Reuse ILU decomposition (and renumbering if any)
-    - 0  no 
-    - 1  yes 
-    - default : 0
-
-Algorithm (Integer): 
-    - 1  CG       Conjugate Gradient                    
-    - 2  CGNR     CG (Normal Residual equation)         
-    - 3  BCG      Bi-Conjugate Gradient                 
-    - 4  DBCG     BCG with partial pivoting             
-    - 5  BCGSTAB  BCG stabilized                        
-    - 6  TFQMR    Transpose-Free Quasi-Minimum Residual 
-    - 7  FOM      Full Orthogonalization Method         
-    - 8  GMRES    Generalized Minimum RESidual          
-    - 9  FGMRES   Flexible version of GMRES             
-    - 10 DQGMRES  Direct versions of GMRES              
-    - 11 LU       LU Factorization                      
-    - 12 PGMRES   Alternative version of GMRES          
-    - default : 8
-
-Krylov_Size (Integer): Krylov subspace size 
-    - default : 40
-
-IC_Acceleration (Real): IC accelerator
-    - default : 1 
-
-Re_Use_LU (Integer): Reuse LU decomposition
-    - 0  no 
-    - 1  yes 
-    - default : 0
-
-Iterative_Improvement (Integer): Iterative improvement of the solution obtained by a LU 
-    - default : 0
-
-Nb_Iter_Max (Integer): Maximum number of iterations 
-    - default : 1000 
-
-Stopping_Test (Real): Target relative residual 
-    - default : 1e-10 
-
-*/
-
-            Matrix_Format            1
-          Matrix_Printing            0
-           Matrix_Storage            0
-                  Scaling            0
-    Renumbering_Technique            1
-           Preconditioner            2
-  Preconditioner_Position            2
-                  Nb_Fill           20
-    Permutation_Tolerance         0.05
-       Dropping_Tolerance            0
-    Diagonal_Compensation            0
-               Re_Use_ILU            0
-                Algorithm            8
-              Krylov_Size           40
-          IC_Acceleration            1
-                Re_Use_LU            0
-    Iterative_Improvement            0
-              Nb_Iter_Max         1000
-            Stopping_Test        1e-10
diff --git a/doc/TODO b/doc/TODO
index 739b8a611f..59322e0761 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,4 +1,11 @@
-$Id: TODO,v 1.60 2007-08-23 06:59:53 geuzaine Exp $
+$Id: TODO,v 1.61 2007-09-18 16:26:04 geuzaine Exp $
+
+********************************************************************
+
+add set<BarycenterData> in VertexArray so that we can do automatic
+boundary constructions (should probably be ON by default for 3D scalar
+rendering when explode==1). Transfer data to actual arrays in
+VertexArray::finalize()
 
 ********************************************************************
 
@@ -14,7 +21,7 @@ GModel->checkMeshCoherence
 
 ********************************************************************
 
-add function to deform MESH with displacement post-pro view
+add function to deform the MESH with a displacement post-pro view
 
 ********************************************************************
 
@@ -41,9 +48,9 @@ reinterface Triangle for plane surfaces
 
 ********************************************************************
 
-Bug: need to better understand how Netgen deals with charact. lengths:
-a larger geometry (with appropriately scaled lcs) leads to a larger
-mesh!
+Bug: need to better understand how Netgen deals with characteristic
+lengths: a larger geometry (with appropriately scaled lcs) leads to a
+larger mesh
 
 ********************************************************************
 
@@ -64,11 +71,6 @@ add transformations on volumes
 
 ********************************************************************
 
-when we mesh->edit->delete elements (or maybe when we save meshes)
-we should delete any unused vertices [for akash]
-
-********************************************************************
-
 introduce Right/Left/Alternate for extruded meshes
 
 ********************************************************************
@@ -83,11 +85,7 @@ cases
 
 ********************************************************************
 
-recode BDS::extract edges
-
-********************************************************************
-
-recode BDS::remesh (for STL remeshing)
+implement STL remeshing
 
 ********************************************************************
 
@@ -143,7 +141,7 @@ surface.)
 
 ********************************************************************
 
-add a min_recursion option for adaptve views (to force at least a 
+add a min_recursion option for adaptive views (to force at least a 
 certain number of subdivisions)
 
 ********************************************************************
@@ -189,13 +187,6 @@ strategy
 
 ********************************************************************
 
-template the view handling/drawing routines so that we can actually
-use post-pro files with float values (50% file savings can be nice
-for very large maps; would bring the format up to par with an 
-index-based format)
-
-********************************************************************
-
 add/restore Parametric curve type (use MathEval!)
 
 ********************************************************************
@@ -215,15 +206,7 @@ be solved if we had dynamic labels?)
 
 ********************************************************************
 
-rewrite the View and ColorTable interface in C++
-
-********************************************************************
-
-post-processing file format:
-- add an integer per simplex (region num)?
-- add a format similar to the msh format (node list + simplex list)?
-- add a structured format?
-...or implement one of the "industry-standard" formats?
+rewrite ColorTable as a C++ class
 
 ********************************************************************
 
@@ -250,23 +233,3 @@ Yves Krahenbuhl wrote:
 > restreindre (automatiquement ou non) a une interpolation lineaire
 > entre les points en question.
 
-********************************************************************
-
-Pb avec View->Reload si plusieurs vues dans le meme fichier
-
-> > Hmm, je viens de tester sous Linux et je n'arrive pas a reproduire le
-> > bug. A moins que... Aurais-tu toutes tes vues stockees dans le meme
-> > fichier ? Car 'reload' relit simplement le fichier duquel provient la
-> > vue (et il le relit entierement).
-> 
-> Tout a fait, toutes les vues sont dans un fichier unique.
-
-C'est de la que vient le probleme. Le 'reload' recharge en fait le
-fichier duquel provient la vue, en *forcant* sa position dans la liste
-des vues chargees. Si le fichier contient plusieurs vues, il va
-recharger la premiere, lui affecter la position de celle que tu veux
-recharger, puis la deuxieme, en lui affectant le meme position, et
-ainsi de suite. Ca fait donc un supeeer memory leak : tu recharges
-bien toutes les vues, mais tu ne sais acceder qu'a la derniere... Pour
-corriger ca, il faudrait que l'on garde comme info supplementaire dans
-chaque vue quelle etait sa position dans le fichier.
-- 
GitLab