diff --git a/Graphics/Makefile b/Graphics/Makefile
index a576693622275c9e2fec2fe95c5678143f081f0a..5b65b8f410a6c07fc62a5a41a9370392830f623f 100644
--- a/Graphics/Makefile
+++ b/Graphics/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.125 2007-09-01 14:27:55 geuzaine Exp $
+# $Id: Makefile,v 1.126 2007-09-01 16:05:43 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -135,20 +135,8 @@ Post.o: Post.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   Iso.h ../Post/Views.h ../Post/ColorTable.h ../Common/VertexArray.h \
   ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
   ../Post/AdaptiveViews.h ../Common/GmshMatrix.h ../Post/PView.h \
-  ../Post/AdaptiveViews.h ../Post/PViewData.h ../Geo/GModel.h \
-  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Common/GmshDefines.h ../Geo/MVertex.h \
-  ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
-  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Context.h \
-  ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
-  ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/MElement.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h ../Geo/GRegion.h \
-  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/ExtrudeParams.h \
-  ../Geo/SBoundingBox3d.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  gl2ps.h
+  ../Post/AdaptiveViews.h ../Post/PViewData.h ../Post/PViewOptions.h \
+  ../Post/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 ../DataStr/List.h ../DataStr/Tree.h \
@@ -212,20 +200,8 @@ Scale.o: Scale.cpp ../Common/GmshUI.h Draw.h ../DataStr/List.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PView.h \
   ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
   ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/AdaptiveViews.h \
-  ../Common/GmshMatrix.h ../Post/PViewData.h ../Geo/GModel.h \
-  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Common/GmshDefines.h ../Geo/MVertex.h \
-  ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
-  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Context.h \
-  ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
-  ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/MElement.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h ../Geo/GRegion.h \
-  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/ExtrudeParams.h \
-  ../Geo/SBoundingBox3d.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  gl2ps.h
+  ../Common/GmshMatrix.h ../Post/PViewData.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Common/Context.h gl2ps.h
 Graph2D_Old.o: Graph2D_Old.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
@@ -234,37 +210,13 @@ Graph2D_Old.o: Graph2D_Old.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Post/ColorTable.h ../Common/VertexArray.h ../Geo/SVector3.h \
   ../Geo/SPoint3.h ../Common/SmoothData.h ../Post/AdaptiveViews.h \
   ../Common/GmshMatrix.h gl2ps.h ../Post/PView.h ../Post/AdaptiveViews.h \
-  ../Post/PViewData.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
-  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
-  ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/SPoint3.h \
-  ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h \
-  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
-  ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h \
-  ../Geo/GEntity.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/MElement.h \
-  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h \
-  ../Geo/GRegion.h ../Geo/GEntity.h ../Geo/MElement.h \
-  ../Geo/ExtrudeParams.h ../Geo/SBoundingBox3d.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h
+  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h
 Graph2D.o: Graph2D.cpp ../Common/GmshUI.h Draw.h ../DataStr/List.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PView.h \
   ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
   ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/AdaptiveViews.h \
-  ../Common/GmshMatrix.h ../Post/PViewData.h ../Geo/GModel.h \
-  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Common/GmshDefines.h ../Geo/MVertex.h \
-  ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h \
-  ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h \
-  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Context.h \
-  ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
-  ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/MElement.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h ../Geo/GRegion.h \
-  ../Geo/GEntity.h ../Geo/MElement.h ../Geo/ExtrudeParams.h \
-  ../Geo/SBoundingBox3d.h ../Post/PViewOptions.h ../Post/ColorTable.h \
-  gl2ps.h
+  ../Common/GmshMatrix.h ../Post/PViewData.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h gl2ps.h ../Common/Context.h
 gl2ps.o: gl2ps.cpp gl2ps.h
 gl2gif.o: gl2gif.cpp gl2gif.h PixelBuffer.h ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
diff --git a/Post/Makefile b/Post/Makefile
index afd24e8b5c07380f84daea95df178e97862025be..8d5ad98739d205d933fd53271a7cd1ef1de0963d 100644
--- a/Post/Makefile
+++ b/Post/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.7 2007-08-27 13:46:22 geuzaine Exp $
+# $Id: Makefile,v 1.8 2007-09-01 16:05:43 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -28,8 +28,10 @@ INCLUDE = -I../Common -I../DataStr -I../Geo -I../Mesh -I../Post\
 CFLAGS  =${OPTIM} ${FLAGS} ${INCLUDE}
 
 SRC = PView.cpp\
-        PViewData.cpp PViewOptions.cpp\
-        PViewIO.cpp\
+        PViewData.cpp\
+          PViewDataList.cpp PViewDataListIO.cpp\
+          PViewDataGModel.cpp\
+        PViewOptions.cpp\
       Views.cpp\
         ViewsIO.cpp\
       AdaptiveViews.cpp\
@@ -62,51 +64,33 @@ depend:
 PView.o: PView.cpp PView.h ../Common/VertexArray.h ../Geo/SVector3.h \
   ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
   AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h PViewData.h \
-  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
-  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h PViewOptions.h ColorTable.h \
+  PViewDataList.h ../Common/Message.h
+PViewData.o: PViewData.cpp PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h
+PViewDataList.o: PViewDataList.cpp PViewDataList.h PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Numeric/Numeric.h ../Common/SmoothData.h ../Common/Context.h
+PViewDataListIO.o: PViewDataListIO.cpp PViewDataList.h PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../DataStr/List.h \
+  ../Common/Message.h
+PViewDataGModel.o: PViewDataGModel.cpp PViewDataGModel.h PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h PViewDataList.h \
+  ../DataStr/List.h ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
   ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/SPoint3.h \
   ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h \
-  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
-  ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Common/Context.h ../Geo/ExtrudeParams.h \
+  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint3.h \
+  ../Geo/SPoint2.h ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h \
+  ../Geo/MVertex.h ../Geo/SVector3.h ../Numeric/Numeric.h \
+  ../Common/Context.h ../Geo/ExtrudeParams.h ../Common/SmoothData.h \
   ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/GEdgeLoop.h \
   ../Geo/GEdge.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
   ../Geo/Pair.h ../Geo/ExtrudeParams.h ../Geo/GRegion.h ../Geo/GEntity.h \
-  ../Geo/MElement.h ../Geo/ExtrudeParams.h ../Geo/SBoundingBox3d.h \
-  PViewOptions.h ColorTable.h ../Common/Message.h
-PViewData.o: PViewData.cpp PViewData.h ../Geo/GModel.h ../Geo/GVertex.h \
-  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/GmshDefines.h \
-  ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.h \
-  ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Geo/SPoint3.h ../Geo/SPoint2.h ../Geo/MElement.h \
-  ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h ../Geo/SVector3.h \
-  ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h ../Geo/SVector3.h \
-  ../Numeric/Numeric.h ../Common/Context.h ../DataStr/List.h \
-  ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Geo/GFace.h \
-  ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/GEdgeLoop.h ../Geo/GEdge.h \
-  ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h \
-  ../Geo/ExtrudeParams.h ../Geo/GRegion.h ../Geo/GEntity.h \
   ../Geo/MElement.h ../Geo/ExtrudeParams.h ../Geo/SBoundingBox3d.h
 PViewOptions.o: PViewOptions.cpp PViewOptions.h ColorTable.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/Message.h
-PViewIO.o: PViewIO.cpp PView.h ../Common/VertexArray.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
-  AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h PViewData.h \
-  ../Geo/GModel.h ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h \
-  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
-  ../Common/GmshDefines.h ../Geo/MVertex.h ../Geo/SPoint3.h \
-  ../Geo/GPoint.h ../Geo/SPoint2.h ../Geo/GEdge.h ../Geo/GEntity.h \
-  ../Geo/GVertex.h ../Geo/SVector3.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
-  ../Geo/MElement.h ../Geo/MVertex.h ../Geo/MEdge.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Common/Hash.h ../Geo/MFace.h ../Geo/MVertex.h \
-  ../Geo/SVector3.h ../Common/Context.h ../Geo/ExtrudeParams.h \
-  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/GEdgeLoop.h \
-  ../Geo/GEdge.h ../Geo/MElement.h ../Geo/SPoint2.h ../Geo/SVector3.h \
-  ../Geo/Pair.h ../Geo/ExtrudeParams.h ../Geo/GRegion.h ../Geo/GEntity.h \
-  ../Geo/MElement.h ../Geo/ExtrudeParams.h ../Geo/SBoundingBox3d.h \
-  PViewOptions.h ColorTable.h ../Common/Message.h
 Views.o: Views.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
diff --git a/Post/PView.cpp b/Post/PView.cpp
index 9dccc32a8ff5ca8c4595be78b01690d848181844..b8e7bb534647198d11958ecdd8fe76e9c188860c 100644
--- a/Post/PView.cpp
+++ b/Post/PView.cpp
@@ -1,4 +1,4 @@
-// $Id: PView.cpp,v 1.4 2007-09-01 14:27:55 geuzaine Exp $
+// $Id: PView.cpp,v 1.5 2007-09-01 16:05:43 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -23,6 +23,7 @@
 // 
 
 #include "PView.h"
+#include "PViewDataList.h"
 #include "Message.h"
 
 int PView::_globalNum = 0;
diff --git a/Post/PViewData.cpp b/Post/PViewData.cpp
index e227053f68fe7797f795acd8229641235bbef651..3e8044a1cb69742cfc9bd1b2f910fbd7dbd408ee 100644
--- a/Post/PViewData.cpp
+++ b/Post/PViewData.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewData.cpp,v 1.8 2007-09-01 14:27:55 geuzaine Exp $
+// $Id: PViewData.cpp,v 1.9 2007-09-01 16:05:43 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -23,464 +23,3 @@
 // 
 
 #include "PViewData.h"
-#include "Numeric.h"
-#include "SmoothData.h"
-#include "Context.h"
-
-extern Context_T CTX;
-
-PViewDataList::PViewDataList(bool allocate)
-  : PViewData(), DataSize(sizeof(double)), NbTimeStep(0), 
-    Min(VAL_INF), Max(-VAL_INF), Time(0),
-    NbSP(0), SP(0), NbVP(0), VP(0), NbTP(0), TP(0),
-    NbSL(0), SL(0), NbVL(0), VL(0), NbTL(0), TL(0),
-    NbSL2(0), SL2(0), NbVL2(0), VL2(0), NbTL2(0), TL2(0),
-    NbST(0), ST(0), NbVT(0), VT(0), NbTT(0), TT(0),
-    NbST2(0), ST2(0), NbVT2(0), VT2(0), NbTT2(0), TT2(0),
-    NbSQ(0), SQ(0), NbVQ(0), VQ(0), NbTQ(0), TQ(0),
-    NbSQ2(0), SQ2(0), NbVQ2(0), VQ2(0), NbTQ2(0), TQ2(0),
-    NbSS(0), SS(0), NbVS(0), VS(0), NbTS(0), TS(0),
-    NbSS2(0), SS2(0), NbVS2(0), VS2(0), NbTS2(0), TS2(0),
-    NbSH(0), SH(0), NbVH(0), VH(0), NbTH(0), TH(0),
-    NbSH2(0), SH2(0), NbVH2(0), VH2(0), NbTH2(0), TH2(0),
-    NbSI(0), SI(0), NbVI(0), VI(0), NbTI(0), TI(0),
-    NbSI2(0), SI2(0), NbVI2(0), VI2(0), NbTI2(0), TI2(0),
-    NbSY(0), SY(0), NbVY(0), VY(0), NbTY(0), TY(0),
-    NbSY2(0), SY2(0), NbVY2(0), VY2(0), NbTY2(0), TY2(0),
-    NbT2(0), T2D(0), T2C(0), NbT3(0), T3D(0), T3C(0),
-    _lastElement(-1), _lastDimension(-1), _lastNumNodes(-1), 
-    _lastNumComponents(-1), _lastNumEdges(-1), _lastXYZ(0), _lastVal(0)
-{
-  for(int i = 0; i < 24; i++) _index[i] = 0;
-
-  if(allocate){
-#define LCD List_Create(1, 1000, sizeof(double))
-    Time = LCD;
-    SP = LCD; VP = LCD; TP = LCD;
-    SL = LCD; VL = LCD; TL = LCD; SL2 = LCD; VL2 = LCD; TL2 = LCD; 
-    ST = LCD; VT = LCD; TT = LCD; ST2 = LCD; VT2 = LCD; TT2 = LCD; 
-    SQ = LCD; VQ = LCD; TQ = LCD; SQ2 = LCD; VQ2 = LCD; TQ2 = LCD; 
-    SS = LCD; VS = LCD; TS = LCD; SS2 = LCD; VS2 = LCD; TS2 = LCD; 
-    SH = LCD; VH = LCD; TH = LCD; SH2 = LCD; VH2 = LCD; TH2 = LCD; 
-    SI = LCD; VI = LCD; TI = LCD; SI2 = LCD; VI2 = LCD; TI2 = LCD; 
-    SY = LCD; VY = LCD; TY = LCD; SY2 = LCD; VY2 = LCD; TY2 = LCD; 
-#undef LCD
-    T2D = List_Create(1, 100, sizeof(double));
-    T2C = List_Create(1, 100, sizeof(char));
-    T3D = List_Create(1, 100, sizeof(double));
-    T3C = List_Create(1, 100, sizeof(char));
-    Grains = new std::map<int, List_T*>;
-    DisplayListsOfGrains= new std::map<int, int>;
-  }
-}
-
-PViewDataList::~PViewDataList()
-{
-  List_Delete(Time);
-  List_Delete(SP); List_Delete(VP); List_Delete(TP);
-  List_Delete(SL); List_Delete(VL); List_Delete(TL);
-  List_Delete(ST); List_Delete(VT); List_Delete(TT);
-  List_Delete(SQ); List_Delete(VQ); List_Delete(TQ);
-  List_Delete(SS); List_Delete(VS); List_Delete(TS);
-  List_Delete(SH); List_Delete(VH); List_Delete(TH);
-  List_Delete(SI); List_Delete(VI); List_Delete(TI);
-  List_Delete(SY); List_Delete(VY); List_Delete(TY);
-  List_Delete(T2D); List_Delete(T2C);
-  List_Delete(T3D); List_Delete(T3C);
-  if(Grains) delete Grains;
-  if(DisplayListsOfGrains) delete DisplayListsOfGrains;
-}
-
-void PViewDataList::finalize()
-{
-  // finalize text strings first, to get the max value of NbTimeStep
-  // for strings-only views (strings are designed to degrade
-  // gracefully when some have fewer time steps than others). If there
-  // are any elements in the view, this value will be replaced by the
-  // minimum number of time steps common to all elements.
-  _stat(T2D, T2C, 4); _stat(T3D, T3C, 5);
-
-  // convert all "old-style" (non adaptive) 2nd order elements into
-  // linear elements *and* free all the data associated with the
-  // 2nd order elements
-  //FIXME:   _splitCurvedElements();
-
-  // compute min/max and other statistics for all element lists
-  _stat(SP, 1, NbSP, 1); _stat(VP, 3, NbVP, 1); _stat(TP, 9, NbTP, 1);
-  _stat(SL, 1, NbSL, 2); _stat(VL, 3, NbVL, 2); _stat(TL, 9, NbTL, 2);
-  _stat(ST, 1, NbST, 3); _stat(VT, 3, NbVT, 3); _stat(TT, 9, NbTT, 3);
-  _stat(SQ, 1, NbSQ, 4); _stat(VQ, 3, NbVQ, 4); _stat(TQ, 9, NbTQ, 4);
-  _stat(SS, 1, NbSS, 4); _stat(VS, 3, NbVS, 4); _stat(TS, 9, NbTS, 4);
-  _stat(SH, 1, NbSH, 8); _stat(VH, 3, NbVH, 8); _stat(TH, 9, NbTH, 8);
-  _stat(SI, 1, NbSI, 6); _stat(VI, 3, NbVI, 6); _stat(TI, 9, NbTI, 6);
-  _stat(SY, 1, NbSY, 5); _stat(VY, 3, NbVY, 5); _stat(TY, 9, NbTY, 5);
-
-  // add dummy time values if none (or too few) time values are
-  // provided (e.g. using the old parsed format)
-  if(Time && List_Nbr(Time) < NbTimeStep) {
-    for(int i = List_Nbr(Time); i < NbTimeStep; i++) {
-      double d = (double)i;
-      List_Add(Time, &d);
-    }
-  }
-
-  // compute starting element indices
-  int nb[24] = {NbSP, NbVP, NbTP,  NbSL, NbVL, NbTL,  NbST, NbVT, NbTT, 
-		NbSQ, NbVQ, NbTQ,  NbSS, NbVS, NbTS,  NbSH, NbVH, NbTH, 
-		NbSI, NbVI, NbTI,  NbSY, NbVY, NbTY};
-  for(int i = 0; i < 24; i++){
-    _index[i] = 0;
-    for(int j = 0; j <= i; j++)
-      _index[i] += nb[j];
-  }
-
-  if(CTX.post.smooth) smooth();
-  
-  setDirty(false);
-}
-
-double PViewDataList::getTime(int step)
-{
-  if(step < 0 || step >= List_Nbr(Time)) return 0.;
-  double val;
-  List_Read(Time, step, &val);
-  return val;
-}
-
-double PViewDataList::getMin(int step)
-{
-  if(step < 0) return Min;
-  return TimeStepMin[step];
-}
-
-double PViewDataList::getMax(int step)
-{
-  if(step < 0) return Max;
-  return TimeStepMax[step];
-}
-
-void PViewDataList::_stat(List_T *D, List_T *C, int nb)
-{
-  // compute statistics for text lists
-  for(int i = 0; i < List_Nbr(D); i += nb){
-    double beg, end;
-    List_Read(D, i + nb - 1, &beg);
-    if(i > List_Nbr(D) - 2 * nb)
-      end = (double)List_Nbr(C);
-    else
-      List_Read(D, i + nb + nb - 1, &end);
-    char *c = (char*)List_Pointer(C, (int)beg);
-    int nbtime = 0;
-    for(int j = 0; j < (int)(end - beg); j++)
-      if(c[j] == '\0') nbtime++;
-    if(nbtime > NbTimeStep) 
-      NbTimeStep = nbtime;
-  }
-  if(nb == 5){
-    for(int i = 0; i < List_Nbr(D); i += nb){
-      double x, y, z;
-      List_Read(D, i, &x);
-      List_Read(D, i + 1, &y);
-      List_Read(D, i + 2, &z);
-      BBox += SPoint3(x, y, z);
-    }
-  }
-}
-
-void PViewDataList::_stat(List_T *list, int nbcomp, int nbelm, int nbnod)
-{
-  // compute statistics for element lists
-  if(!nbelm) return;
-
-  int nb = List_Nbr(list) / nbelm;
-  for(int i = 0; i < List_Nbr(list); i += nb){
-    int N = nb - 3 * nbnod;
-    double *X = (double *)List_Pointer_Fast(list, i);
-    double *Y = (double *)List_Pointer_Fast(list, i + 1 * nbnod);
-    double *Z = (double *)List_Pointer_Fast(list, i + 2 * nbnod);
-    double *V = (double *)List_Pointer_Fast(list, i + 3 * nbnod);
-
-    // update bounding box
-    for(int j = 0; j < nbnod; j++)
-      BBox += SPoint3(X[j], Y[j], Z[j]);
-
-    // update num time steps
-    if(Min == VAL_INF || Max == -VAL_INF){
-      NbTimeStep = N / (nbcomp * nbnod);
-      TimeStepMin.clear();
-      TimeStepMax.clear();
-      for(int j = 0; j < NbTimeStep; j++){
-	TimeStepMin.push_back(VAL_INF);
-	TimeStepMax.push_back(-VAL_INF);
-      }
-    }
-    else if(N / (nbcomp * nbnod) < NbTimeStep){
-      // if some elts have less steps, reduce the total number!
-      NbTimeStep = N / (nbcomp * nbnod);
-    }
-    
-    // update min/max
-    for(int j = 0; j < N; j += nbcomp) {
-      double l0;
-      if(nbcomp == 1)
-	l0 = V[j];
-      else if(nbcomp == 3)
-	l0 = sqrt(DSQR(V[j]) + DSQR(V[j + 1]) + DSQR(V[j + 2]));
-      else
-	l0 = ComputeVonMises(V + j); // FIXME: can do better?
-      Min = std::min(l0, Min);
-      Max = std::max(l0, Max);
-      int ts = j / (nbcomp * nbnod);
-      if(ts < NbTimeStep){ // security
-	TimeStepMin[ts] = std::min(l0, TimeStepMin[ts]);
-	TimeStepMax[ts] = std::max(l0, TimeStepMax[ts]);
-      }
-    }
-  }
-}
-
-void PViewDataList::_setLast(int ele, int dim, int nbnod, int nbcomp, int nbedg,
-			     List_T *list, int nblist)
-{
-  _lastDimension = dim;
-  _lastNumNodes = nbnod;
-  _lastNumComponents = nbcomp;
-  _lastNumEdges = nbedg;
-  int nb = List_Nbr(list) / nblist;
-  _lastXYZ = (double*)List_Pointer_Fast(list, ele * nb);
-  _lastVal = (double*)List_Pointer_Fast(list, ele * nb + 3 * _lastNumNodes);
-}
-
-void PViewDataList::_setLast(int ele)
-{
-  _lastElement = ele;
-  if(ele < _index[2]){ // points
-    if(ele < _index[0]) _setLast(ele, 0, 1, 1, 0, SP, NbSP);
-    else if(ele < _index[1]) _setLast(ele - _index[0], 0, 1, 3, 0, VP, NbVP);
-    else _setLast(ele - _index[1], 0, 1, 9, 0, TP, NbTP);
-  }
-  else if(ele < _index[5]){ // lines
-    if(ele < _index[3]) _setLast(ele - _index[2], 1, 2, 1, 1, SL, NbSL);
-    else if(ele < _index[4]) _setLast(ele - _index[3], 1, 2, 3, 1, VL, NbVL);
-    else _setLast(ele - _index[4], 1, 2, 9, 1, TL, NbTL);
-  }
-  else if(ele < _index[8]){ // triangles
-    if(ele < _index[6]) _setLast(ele - _index[5], 2, 3, 1, 3, ST, NbST);
-    else if(ele < _index[7]) _setLast(ele - _index[6], 2, 3, 3, 3, VT, NbVT);
-    else _setLast(ele - _index[7], 2, 3, 9, 3, TT, NbTT);
-  }
-  else if(ele < _index[11]){ // quadrangles
-    if(ele < _index[9]) _setLast(ele - _index[8], 2, 4, 1, 4, SQ, NbSQ);
-    else if(ele < _index[10]) _setLast(ele - _index[9], 2, 4, 3, 4, VQ, NbVQ);
-    else _setLast(ele - _index[10], 2, 4, 9, 4, TQ, NbTQ);
-  }
-  else if(ele < _index[14]){ // tetrahedra
-    if(ele < _index[12]) _setLast(ele - _index[11], 3, 4, 1, 6, SS, NbSS);
-    else if(ele < _index[13]) _setLast(ele - _index[12], 3, 4, 3, 6, VS, NbVS);
-    else _setLast(ele - _index[13], 3, 2, 9, 6, TS, NbTS);
-  }
-  else if(ele < _index[17]){ // hexahedra
-    if(ele < _index[15]) _setLast(ele - _index[14], 3, 8, 1, 12, SH, NbSH);
-    else if(ele < _index[16]) _setLast(ele - _index[15], 3, 8, 3, 12, VH, NbVH);
-    else _setLast(ele - _index[16], 3, 8, 9, 12, TH, NbTH);
-  }
-  else if(ele < _index[20]){ // prisms
-    if(ele < _index[18]) _setLast(ele - _index[17], 3, 6, 1, 9, SI, NbSI);
-    else if(ele < _index[19]) _setLast(ele - _index[18], 3, 6, 3, 9, VI, NbVI);
-    else _setLast(ele - _index[19], 3, 6, 9, 9, TI, NbTI);
-  }
-  else{ // pyramids
-    if(ele < _index[21]) _setLast(ele - _index[20], 3, 5, 1, 15, SY, NbSY);
-    else if(ele < _index[22]) _setLast(ele - _index[21], 3, 5, 3, 15, VY, NbVY);
-    else _setLast(ele - _index[22], 3, 5, 9, 15, TY, NbTY);
-  }
-}
-
-int PViewDataList::getDimension(int ele)
-{
-  if(ele != _lastElement) _setLast(ele);
-  return _lastDimension;
-}
-
-int PViewDataList::getNumNodes(int ele)
-{
-  if(ele != _lastElement) _setLast(ele);
-  return _lastNumNodes;
-}
-
-void PViewDataList::getNode(int ele, int nod, double &x, double &y, double &z)
-{
-  if(ele != _lastElement) _setLast(ele);
-  x = _lastXYZ[nod];
-  y = _lastXYZ[_lastNumNodes + nod];
-  z = _lastXYZ[2 * _lastNumNodes + nod];
-}
-
-int PViewDataList::getNumComponents(int ele)
-{
-  if(ele != _lastElement) _setLast(ele);
-  return _lastNumComponents;
-}
-
-void PViewDataList::getValue(int ele, int nod, int comp, int step, double &val)
-{
-  if(ele != _lastElement) _setLast(ele);
-  val = _lastVal[step * _lastNumNodes  * _lastNumComponents + 
-		 nod * _lastNumComponents +
-		 comp];
-}
-
-int PViewDataList::getNumEdges(int ele)
-{
-  if(ele != _lastElement) _setLast(ele);
-  return _lastNumEdges;
-}
-
-void PViewDataList::_getString(int dim, int i, int timestep, std::string &str, 
-			       double &x, double &y, double &z, double &style)
-{
-  // 3D: T3D is a list of double: x,y,z,style,index,x,y,z,style,index,...
-  //     T3C is a list of chars: string\0,string\0,string\0,string\0,...
-  //     Parser format is: T3(x,y,z,style){"str","str",...};
-  // 2D: T2D is a list of double: x,y,style,index,x,y,style,index,...
-  //     T2C is a list of chars: string\0,string\0,string\0,string\0,...
-  //     Parser format is: T2(x,y,style){"str","str",...};
-
-  int nb = (dim == 2) ? NbT2 : NbT3;
-  List_T *td = (dim == 2) ? T2D : T3D;
-  List_T *tc = (dim == 2) ? T2C : T3C;
-  int nbd = (dim == 2) ? 4 : 5;
-
-  int index, nbchar;
-  double *d1 = (double *)List_Pointer(td, i * nbd);
-  double *d2 = (double *)List_Pointer_Test(td, (i + 1) * nbd);
-  if(dim == 2) {
-    x = d1[0];
-    y = d1[1];
-    z = 0.;
-    style = d1[2];
-    index = (int)d1[3];
-    if(d2)
-      nbchar = (int)d2[3] - index;
-    else
-      nbchar = List_Nbr(tc) - index;
-  }
-  else {
-    x = d1[0];
-    y = d1[1];
-    z = d1[2];
-    style = d1[3];
-    index = (int)d1[4];
-    if(d2)
-      nbchar = (int)d2[4] - index;
-    else
-      nbchar = List_Nbr(tc) - index;
-  }
-  
-  char *c = (char *)List_Pointer(tc, index);
-  int k = 0, l = 0;
-  while(k < nbchar && l != timestep) {
-    if(c[k++] == '\0')
-      l++;
-  }
-  if(k < nbchar && l == timestep)
-    str = std::string(&c[k]);
-  else
-    str = std::string(c);
-}
-
-void PViewDataList::getString2D(int i, int step, std::string &str, 
-				double &x, double &y, double &style)
-{
-  double z;
-  _getString(2, i, step, str, x, y, z, style);
-}
-
-void PViewDataList::getString3D(int i, int step, std::string &str, 
-				double &x, double &y, double &z, double &style)
-{
-  _getString(3, i, step, str, x, y, z, style);
-}
-
-static void generateConnectivities(List_T *list, int nbList, 
-				   int nbTimeStep, int nbVert, 
-				   smooth_data &data)
-{
-  if(!nbList) return;
-  double *vals = new double[nbTimeStep];
-  int nb = List_Nbr(list) / nbList;
-  for(int i = 0; i < List_Nbr(list); i += nb) {
-    double *x = (double *)List_Pointer_Fast(list, i);
-    double *y = (double *)List_Pointer_Fast(list, i + nbVert);
-    double *z = (double *)List_Pointer_Fast(list, i + 2 * nbVert);
-    double *v = (double *)List_Pointer_Fast(list, i + 3 * nbVert);
-    for(int j = 0; j < nbVert; j++) {
-      for(int k = 0; k < nbTimeStep; k++)
-        vals[k] = v[j + k * nbVert];
-      data.add(x[j], y[j], z[j], nbTimeStep, vals);
-    }
-  }
-  delete [] vals;
-}
-
-static void smoothList(List_T *list, int nbList, double &min, double &max, 
-		       std::vector<double> &tsmin, std::vector<double> &tsmax, 
-		       int nbTimeStep, int nbVert, smooth_data &data)
-{
-  if(!nbList) return;
-  double *vals = new double[nbTimeStep];
-  int nb = List_Nbr(list)/nbList;
-  for(int i = 0; i < List_Nbr(list); i += nb) {
-    double *x = (double *)List_Pointer_Fast(list, i);
-    double *y = (double *)List_Pointer_Fast(list, i + nbVert);
-    double *z = (double *)List_Pointer_Fast(list, i + 2 * nbVert);
-    double *v = (double *)List_Pointer_Fast(list, i + 3 * nbVert);
-    for(int j = 0; j < nbVert; j++) {
-      if(data.get(x[j], y[j], z[j], nbTimeStep, vals)){
-	for(int k = 0; k < nbTimeStep; k++) {
-	  double dd = vals[k];
-          v[j + k * nbVert] = dd;
-	  min = std::min(min, dd);
-	  max = std::max(max, dd);
-          tsmin[k] = std::min(tsmin[k], dd);
-          tsmax[k] = std::max(tsmax[k], dd);
-        }
-      }
-    }
-  }
-  delete [] vals;
-}
-
-void PViewDataList::smooth()
-{
-  double old_eps = xyzv::eps;
-  xyzv::eps = CTX.lc * 1.e-8;
-  
-  if(NbSL || NbST || NbSQ || NbSS || NbSH || NbSI || NbSY) {
-    Min = VAL_INF;
-    Max = -VAL_INF;
-    TimeStepMin.clear();
-    TimeStepMax.clear();
-    for(int j = 0; j < NbTimeStep; j++){
-      TimeStepMin.push_back(VAL_INF);
-      TimeStepMax.push_back(-VAL_INF);
-    }
-    smooth_data data;
-    generateConnectivities(SL, NbSL, NbTimeStep, 2, data);
-    generateConnectivities(ST, NbST, NbTimeStep, 3, data);
-    generateConnectivities(SQ, NbSQ, NbTimeStep, 4, data);
-    generateConnectivities(SS, NbSS, NbTimeStep, 4, data);
-    generateConnectivities(SH, NbSH, NbTimeStep, 8, data);
-    generateConnectivities(SI, NbSI, NbTimeStep, 6, data);
-    generateConnectivities(SY, NbSY, NbTimeStep, 5, data);
-    smoothList(SL, NbSL, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 2, data);
-    smoothList(ST, NbST, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 3, data);
-    smoothList(SQ, NbSQ, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 4, data);
-    smoothList(SS, NbSS, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 4, data);
-    smoothList(SH, NbSH, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 8, data);
-    smoothList(SI, NbSI, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 6, data);
-    smoothList(SY, NbSY, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 5, data);
-  }
-
-  xyzv::eps = old_eps;  
-}
diff --git a/Post/PViewData.h b/Post/PViewData.h
index 3fc5d4bee21ae1f16100989aebb0c64ad1861617..ecb692b52ef7bdd0948930ec35d94a3fc37c2455 100644
--- a/Post/PViewData.h
+++ b/Post/PViewData.h
@@ -20,14 +20,8 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include <map>
-#include <vector>
 #include <string>
-#include "GModel.h"
 #include "SBoundingBox3d.h"
-#include "List.h"
-
-#define VAL_INF 1.e200
 
 // abstract interface to post-processing view data
 class PViewData {
@@ -75,110 +69,4 @@ class PViewData {
   virtual bool read(std::string filename){}
 };
 
-// data container using old-style lists of `discontinuous' element
-class PViewDataList : public PViewData {
- public: 
-  // FIXME: all these members will be made private once the plugins
-  // have been rewritten
-  int DataSize; // size(double) or sizeof(float)
-  int NbTimeStep;
-  double Min, Max;
-  std::vector<double> TimeStepMin, TimeStepMax;
-  SBoundingBox3d BBox;
-  List_T *Time;
-  int NbSP, NbVP, NbTP;
-  List_T *SP, *VP, *TP; // points
-  int NbSL, NbVL, NbTL, NbSL2, NbVL2, NbTL2;
-  List_T *SL, *VL, *TL, *SL2, *VL2, *TL2; // lines
-  int NbST, NbVT, NbTT, NbST2, NbVT2, NbTT2;
-  List_T *ST, *VT, *TT, *ST2, *VT2, *TT2; // triangles
-  int NbSQ, NbVQ, NbTQ, NbSQ2, NbVQ2, NbTQ2;
-  List_T *SQ, *VQ, *TQ, *SQ2, *VQ2, *TQ2; // quadrangles
-  int NbSS, NbVS, NbTS, NbSS2, NbVS2, NbTS2;
-  List_T *SS, *VS, *TS, *SS2, *VS2, *TS2; // tetrahedra
-  int NbSH, NbVH, NbTH, NbSH2, NbVH2, NbTH2;
-  List_T *SH, *VH, *TH, *SH2, *VH2, *TH2; // hexahedra
-  int NbSI, NbVI, NbTI, NbSI2, NbVI2, NbTI2;
-  List_T *SI, *VI, *TI, *SI2, *VI2, *TI2; // prisms
-  int NbSY, NbVY, NbTY, NbSY2, NbVY2, NbTY2;
-  List_T *SY, *VY, *TY, *SY2, *VY2, *TY2; // pyramids
-  int NbT2, NbT3;
-  List_T *T2D, *T2C, *T3D, *T3C; // 2D and 3D text strings
-  std::map<int, List_T*> *Grains; // For LMGC90, grains shapes
-  std::map<int, int> *DisplayListsOfGrains; // For LMGC90, grains shapes
- private:
-  int _index[24];
-  int _lastElement, _lastDimension;
-  int _lastNumNodes, _lastNumComponents, _lastNumEdges;
-  double *_lastXYZ, *_lastVal;
-  void _stat(List_T *D, List_T *C, int nb);
-  void _stat(List_T *list, int nbcomp, int nbelm, int nbnod);
-  void _setLast(int ele);
-  void _setLast(int ele, int dim, int nbnod, int nbcomp, int nbedg,
-		List_T *list, int nblist);
-  void _getString(int dim, int i, int timestep, std::string &str, 
-		  double &x, double &y, double &z, double &style);
- public:
-  PViewDataList(bool allocate=true);
-  ~PViewDataList();
-  void finalize();
-  int getNumTimeSteps(){ return NbTimeStep; }
-  double getTime(int step);
-  double getMin(int step=-1);
-  double getMax(int step=-1);
-  SBoundingBox3d getBoundingBox(){ return BBox; }
-  int getNumScalars(){ return NbSP + NbSL + NbST + NbSQ + NbSS + NbSH + NbSI + NbSY; }
-  int getNumVectors(){ return NbVP + NbVL + NbVT + NbVQ + NbVS + NbVH + NbVI + NbVY; }
-  int getNumTensors(){ return NbTP + NbTL + NbTT + NbTQ + NbTS + NbTH + NbTI + NbTY; }
-  int getNumPoints(){ return NbSP + NbVP + NbTP; }
-  int getNumLines(){ return NbSL + NbVL + NbTL; }
-  int getNumTriangles(){ return NbST + NbVT + NbTT; }
-  int getNumQuadrangles(){ return NbSQ + NbVQ + NbTQ; }
-  int getNumTetrahedra(){ return NbSS + NbVS + NbTS; }
-  int getNumHexahedra(){ return NbSH + NbVH + NbTH; }
-  int getNumPrisms(){ return NbSI + NbVI + NbTI; }
-  int getNumPyramids(){ return NbSY + NbVY + NbTY; }
-  int getNumElements()
-  {
-    return getNumPoints() + getNumLines() + getNumTriangles() + 
-      getNumQuadrangles() + getNumTetrahedra() + getNumHexahedra() + 
-      getNumPrisms() + getNumPyramids();
-  }
-  int getDimension(int ele);
-  int getNumNodes(int ele);
-  void getNode(int ele, int nod, double &x, double &y, double &z);
-  int getNumComponents(int ele);
-  void getValue(int ele, int node, int comp, int step, double &val);
-  int getNumEdges(int ele);
-  int getNumStrings2D(){ return NbT2; }
-  int getNumStrings3D(){ return NbT3; }
-  void getString2D(int i, int step, std::string &str, 
-		   double &x, double &y, double &style);
-  void getString3D(int i, int step, std::string &str, 
-		   double &x, double &y, double &z, double &style);
-  void smooth();
-  bool read(std::string filename);
-};
-
-// data container using elements from a GModel
-class PViewDataGModel : public PViewData {
- private:
-  GModel *_model;
-  PViewDataList *_cloneToList(); // create old-style data from this
- public:
-  PViewDataGModel(){}
-  ~PViewDataGModel(){}
-  int getNumTimeSteps(){ return 1; }
-  double getMin(int step=-1){ return 0.; }
-  double getMax(int step=-1){ return 1.; }
-  SBoundingBox3d getBoundingBox(){ return SBoundingBox3d(); }
-  int getNumElements(){ return _model->numElements(); }
-  int getDimension(int ele){ return 0; }
-  int getNumNodes(int ele){ return 0; }
-  void getNode(int ele, int nod, double &x, double &y, double &z){}
-  int getNumComponents(int ele){ return 1; }
-  void getValue(int ele, int node, int comp, int step, double &val){}
-  int getNumEdges(int ele){ return 0; }
-};
-
 #endif
diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4deea8560ddc080676d21a8d7078c412e3140ee8
--- /dev/null
+++ b/Post/PViewDataGModel.cpp
@@ -0,0 +1,25 @@
+// $Id: PViewDataGModel.cpp,v 1.1 2007-09-01 16:06:24 geuzaine Exp $
+//
+// Copyright (C) 1997-2007 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>.
+//
+// Contributor(s):
+// 
+
+#include "PViewDataGModel.h"
diff --git a/Post/PViewDataGModel.h b/Post/PViewDataGModel.h
new file mode 100644
index 0000000000000000000000000000000000000000..f37e1da570b0a133d96933fc8c321c8ca87e08e1
--- /dev/null
+++ b/Post/PViewDataGModel.h
@@ -0,0 +1,49 @@
+#ifndef _PVIEW_DATA_GMODEL_H_
+#define _PVIEW_DATA_GMODEL_H_
+
+// Copyright (C) 1997-2007 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 "PViewData.h"
+#include "PViewDataList.h"
+#include "GModel.h"
+#include "SBoundingBox3d.h"
+
+// data container using elements from a GModel
+class PViewDataGModel : public PViewData {
+ private:
+  GModel *_model;
+  PViewDataList *_cloneToList(); // create old-style data from this
+ public:
+  PViewDataGModel(){}
+  ~PViewDataGModel(){}
+  int getNumTimeSteps(){ return 1; }
+  double getMin(int step=-1){ return 0.; }
+  double getMax(int step=-1){ return 1.; }
+  SBoundingBox3d getBoundingBox(){ return SBoundingBox3d(); }
+  int getNumElements(){ return _model->numElements(); }
+  int getDimension(int ele){ return 0; }
+  int getNumNodes(int ele){ return 0; }
+  void getNode(int ele, int nod, double &x, double &y, double &z){}
+  int getNumComponents(int ele){ return 1; }
+  void getValue(int ele, int node, int comp, int step, double &val){}
+  int getNumEdges(int ele){ return 0; }
+};
+
+#endif
diff --git a/Post/PViewDataList.cpp b/Post/PViewDataList.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a9520a4bba0c1de348698154080bec6a169d8c50
--- /dev/null
+++ b/Post/PViewDataList.cpp
@@ -0,0 +1,486 @@
+// $Id: PViewDataList.cpp,v 1.1 2007-09-01 16:06:24 geuzaine Exp $
+//
+// Copyright (C) 1997-2007 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>.
+//
+// Contributor(s):
+// 
+
+#include "PViewDataList.h"
+#include "Numeric.h"
+#include "SmoothData.h"
+#include "Context.h"
+
+extern Context_T CTX;
+
+PViewDataList::PViewDataList(bool allocate)
+  : PViewData(), DataSize(sizeof(double)), NbTimeStep(0), 
+    Min(VAL_INF), Max(-VAL_INF), Time(0),
+    NbSP(0), SP(0), NbVP(0), VP(0), NbTP(0), TP(0),
+    NbSL(0), SL(0), NbVL(0), VL(0), NbTL(0), TL(0),
+    NbSL2(0), SL2(0), NbVL2(0), VL2(0), NbTL2(0), TL2(0),
+    NbST(0), ST(0), NbVT(0), VT(0), NbTT(0), TT(0),
+    NbST2(0), ST2(0), NbVT2(0), VT2(0), NbTT2(0), TT2(0),
+    NbSQ(0), SQ(0), NbVQ(0), VQ(0), NbTQ(0), TQ(0),
+    NbSQ2(0), SQ2(0), NbVQ2(0), VQ2(0), NbTQ2(0), TQ2(0),
+    NbSS(0), SS(0), NbVS(0), VS(0), NbTS(0), TS(0),
+    NbSS2(0), SS2(0), NbVS2(0), VS2(0), NbTS2(0), TS2(0),
+    NbSH(0), SH(0), NbVH(0), VH(0), NbTH(0), TH(0),
+    NbSH2(0), SH2(0), NbVH2(0), VH2(0), NbTH2(0), TH2(0),
+    NbSI(0), SI(0), NbVI(0), VI(0), NbTI(0), TI(0),
+    NbSI2(0), SI2(0), NbVI2(0), VI2(0), NbTI2(0), TI2(0),
+    NbSY(0), SY(0), NbVY(0), VY(0), NbTY(0), TY(0),
+    NbSY2(0), SY2(0), NbVY2(0), VY2(0), NbTY2(0), TY2(0),
+    NbT2(0), T2D(0), T2C(0), NbT3(0), T3D(0), T3C(0),
+    _lastElement(-1), _lastDimension(-1), _lastNumNodes(-1), 
+    _lastNumComponents(-1), _lastNumEdges(-1), _lastXYZ(0), _lastVal(0)
+{
+  for(int i = 0; i < 24; i++) _index[i] = 0;
+
+  if(allocate){
+#define LCD List_Create(1, 1000, sizeof(double))
+    Time = LCD;
+    SP = LCD; VP = LCD; TP = LCD;
+    SL = LCD; VL = LCD; TL = LCD; SL2 = LCD; VL2 = LCD; TL2 = LCD; 
+    ST = LCD; VT = LCD; TT = LCD; ST2 = LCD; VT2 = LCD; TT2 = LCD; 
+    SQ = LCD; VQ = LCD; TQ = LCD; SQ2 = LCD; VQ2 = LCD; TQ2 = LCD; 
+    SS = LCD; VS = LCD; TS = LCD; SS2 = LCD; VS2 = LCD; TS2 = LCD; 
+    SH = LCD; VH = LCD; TH = LCD; SH2 = LCD; VH2 = LCD; TH2 = LCD; 
+    SI = LCD; VI = LCD; TI = LCD; SI2 = LCD; VI2 = LCD; TI2 = LCD; 
+    SY = LCD; VY = LCD; TY = LCD; SY2 = LCD; VY2 = LCD; TY2 = LCD; 
+#undef LCD
+    T2D = List_Create(1, 100, sizeof(double));
+    T2C = List_Create(1, 100, sizeof(char));
+    T3D = List_Create(1, 100, sizeof(double));
+    T3C = List_Create(1, 100, sizeof(char));
+    Grains = new std::map<int, List_T*>;
+    DisplayListsOfGrains= new std::map<int, int>;
+  }
+}
+
+PViewDataList::~PViewDataList()
+{
+  List_Delete(Time);
+  List_Delete(SP); List_Delete(VP); List_Delete(TP);
+  List_Delete(SL); List_Delete(VL); List_Delete(TL);
+  List_Delete(ST); List_Delete(VT); List_Delete(TT);
+  List_Delete(SQ); List_Delete(VQ); List_Delete(TQ);
+  List_Delete(SS); List_Delete(VS); List_Delete(TS);
+  List_Delete(SH); List_Delete(VH); List_Delete(TH);
+  List_Delete(SI); List_Delete(VI); List_Delete(TI);
+  List_Delete(SY); List_Delete(VY); List_Delete(TY);
+  List_Delete(T2D); List_Delete(T2C);
+  List_Delete(T3D); List_Delete(T3C);
+  if(Grains) delete Grains;
+  if(DisplayListsOfGrains) delete DisplayListsOfGrains;
+}
+
+void PViewDataList::finalize()
+{
+  // finalize text strings first, to get the max value of NbTimeStep
+  // for strings-only views (strings are designed to degrade
+  // gracefully when some have fewer time steps than others). If there
+  // are any elements in the view, this value will be replaced by the
+  // minimum number of time steps common to all elements.
+  _stat(T2D, T2C, 4); _stat(T3D, T3C, 5);
+
+  // convert all "old-style" (non adaptive) 2nd order elements into
+  // linear elements *and* free all the data associated with the
+  // 2nd order elements
+  //FIXME:   _splitCurvedElements();
+
+  // compute min/max and other statistics for all element lists
+  _stat(SP, 1, NbSP, 1); _stat(VP, 3, NbVP, 1); _stat(TP, 9, NbTP, 1);
+  _stat(SL, 1, NbSL, 2); _stat(VL, 3, NbVL, 2); _stat(TL, 9, NbTL, 2);
+  _stat(ST, 1, NbST, 3); _stat(VT, 3, NbVT, 3); _stat(TT, 9, NbTT, 3);
+  _stat(SQ, 1, NbSQ, 4); _stat(VQ, 3, NbVQ, 4); _stat(TQ, 9, NbTQ, 4);
+  _stat(SS, 1, NbSS, 4); _stat(VS, 3, NbVS, 4); _stat(TS, 9, NbTS, 4);
+  _stat(SH, 1, NbSH, 8); _stat(VH, 3, NbVH, 8); _stat(TH, 9, NbTH, 8);
+  _stat(SI, 1, NbSI, 6); _stat(VI, 3, NbVI, 6); _stat(TI, 9, NbTI, 6);
+  _stat(SY, 1, NbSY, 5); _stat(VY, 3, NbVY, 5); _stat(TY, 9, NbTY, 5);
+
+  // add dummy time values if none (or too few) time values are
+  // provided (e.g. using the old parsed format)
+  if(Time && List_Nbr(Time) < NbTimeStep) {
+    for(int i = List_Nbr(Time); i < NbTimeStep; i++) {
+      double d = (double)i;
+      List_Add(Time, &d);
+    }
+  }
+
+  // compute starting element indices
+  int nb[24] = {NbSP, NbVP, NbTP,  NbSL, NbVL, NbTL,  NbST, NbVT, NbTT, 
+		NbSQ, NbVQ, NbTQ,  NbSS, NbVS, NbTS,  NbSH, NbVH, NbTH, 
+		NbSI, NbVI, NbTI,  NbSY, NbVY, NbTY};
+  for(int i = 0; i < 24; i++){
+    _index[i] = 0;
+    for(int j = 0; j <= i; j++)
+      _index[i] += nb[j];
+  }
+
+  if(CTX.post.smooth) smooth();
+  
+  setDirty(false);
+}
+
+double PViewDataList::getTime(int step)
+{
+  if(step < 0 || step >= List_Nbr(Time)) return 0.;
+  double val;
+  List_Read(Time, step, &val);
+  return val;
+}
+
+double PViewDataList::getMin(int step)
+{
+  if(step < 0) return Min;
+  return TimeStepMin[step];
+}
+
+double PViewDataList::getMax(int step)
+{
+  if(step < 0) return Max;
+  return TimeStepMax[step];
+}
+
+void PViewDataList::_stat(List_T *D, List_T *C, int nb)
+{
+  // compute statistics for text lists
+  for(int i = 0; i < List_Nbr(D); i += nb){
+    double beg, end;
+    List_Read(D, i + nb - 1, &beg);
+    if(i > List_Nbr(D) - 2 * nb)
+      end = (double)List_Nbr(C);
+    else
+      List_Read(D, i + nb + nb - 1, &end);
+    char *c = (char*)List_Pointer(C, (int)beg);
+    int nbtime = 0;
+    for(int j = 0; j < (int)(end - beg); j++)
+      if(c[j] == '\0') nbtime++;
+    if(nbtime > NbTimeStep) 
+      NbTimeStep = nbtime;
+  }
+  if(nb == 5){
+    for(int i = 0; i < List_Nbr(D); i += nb){
+      double x, y, z;
+      List_Read(D, i, &x);
+      List_Read(D, i + 1, &y);
+      List_Read(D, i + 2, &z);
+      BBox += SPoint3(x, y, z);
+    }
+  }
+}
+
+void PViewDataList::_stat(List_T *list, int nbcomp, int nbelm, int nbnod)
+{
+  // compute statistics for element lists
+  if(!nbelm) return;
+
+  int nb = List_Nbr(list) / nbelm;
+  for(int i = 0; i < List_Nbr(list); i += nb){
+    int N = nb - 3 * nbnod;
+    double *X = (double *)List_Pointer_Fast(list, i);
+    double *Y = (double *)List_Pointer_Fast(list, i + 1 * nbnod);
+    double *Z = (double *)List_Pointer_Fast(list, i + 2 * nbnod);
+    double *V = (double *)List_Pointer_Fast(list, i + 3 * nbnod);
+
+    // update bounding box
+    for(int j = 0; j < nbnod; j++)
+      BBox += SPoint3(X[j], Y[j], Z[j]);
+
+    // update num time steps
+    if(Min == VAL_INF || Max == -VAL_INF){
+      NbTimeStep = N / (nbcomp * nbnod);
+      TimeStepMin.clear();
+      TimeStepMax.clear();
+      for(int j = 0; j < NbTimeStep; j++){
+	TimeStepMin.push_back(VAL_INF);
+	TimeStepMax.push_back(-VAL_INF);
+      }
+    }
+    else if(N / (nbcomp * nbnod) < NbTimeStep){
+      // if some elts have less steps, reduce the total number!
+      NbTimeStep = N / (nbcomp * nbnod);
+    }
+    
+    // update min/max
+    for(int j = 0; j < N; j += nbcomp) {
+      double l0;
+      if(nbcomp == 1)
+	l0 = V[j];
+      else if(nbcomp == 3)
+	l0 = sqrt(DSQR(V[j]) + DSQR(V[j + 1]) + DSQR(V[j + 2]));
+      else
+	l0 = ComputeVonMises(V + j); // FIXME: can do better?
+      Min = std::min(l0, Min);
+      Max = std::max(l0, Max);
+      int ts = j / (nbcomp * nbnod);
+      if(ts < NbTimeStep){ // security
+	TimeStepMin[ts] = std::min(l0, TimeStepMin[ts]);
+	TimeStepMax[ts] = std::max(l0, TimeStepMax[ts]);
+      }
+    }
+  }
+}
+
+void PViewDataList::_setLast(int ele, int dim, int nbnod, int nbcomp, int nbedg,
+			     List_T *list, int nblist)
+{
+  _lastDimension = dim;
+  _lastNumNodes = nbnod;
+  _lastNumComponents = nbcomp;
+  _lastNumEdges = nbedg;
+  int nb = List_Nbr(list) / nblist;
+  _lastXYZ = (double*)List_Pointer_Fast(list, ele * nb);
+  _lastVal = (double*)List_Pointer_Fast(list, ele * nb + 3 * _lastNumNodes);
+}
+
+void PViewDataList::_setLast(int ele)
+{
+  _lastElement = ele;
+  if(ele < _index[2]){ // points
+    if(ele < _index[0]) _setLast(ele, 0, 1, 1, 0, SP, NbSP);
+    else if(ele < _index[1]) _setLast(ele - _index[0], 0, 1, 3, 0, VP, NbVP);
+    else _setLast(ele - _index[1], 0, 1, 9, 0, TP, NbTP);
+  }
+  else if(ele < _index[5]){ // lines
+    if(ele < _index[3]) _setLast(ele - _index[2], 1, 2, 1, 1, SL, NbSL);
+    else if(ele < _index[4]) _setLast(ele - _index[3], 1, 2, 3, 1, VL, NbVL);
+    else _setLast(ele - _index[4], 1, 2, 9, 1, TL, NbTL);
+  }
+  else if(ele < _index[8]){ // triangles
+    if(ele < _index[6]) _setLast(ele - _index[5], 2, 3, 1, 3, ST, NbST);
+    else if(ele < _index[7]) _setLast(ele - _index[6], 2, 3, 3, 3, VT, NbVT);
+    else _setLast(ele - _index[7], 2, 3, 9, 3, TT, NbTT);
+  }
+  else if(ele < _index[11]){ // quadrangles
+    if(ele < _index[9]) _setLast(ele - _index[8], 2, 4, 1, 4, SQ, NbSQ);
+    else if(ele < _index[10]) _setLast(ele - _index[9], 2, 4, 3, 4, VQ, NbVQ);
+    else _setLast(ele - _index[10], 2, 4, 9, 4, TQ, NbTQ);
+  }
+  else if(ele < _index[14]){ // tetrahedra
+    if(ele < _index[12]) _setLast(ele - _index[11], 3, 4, 1, 6, SS, NbSS);
+    else if(ele < _index[13]) _setLast(ele - _index[12], 3, 4, 3, 6, VS, NbVS);
+    else _setLast(ele - _index[13], 3, 2, 9, 6, TS, NbTS);
+  }
+  else if(ele < _index[17]){ // hexahedra
+    if(ele < _index[15]) _setLast(ele - _index[14], 3, 8, 1, 12, SH, NbSH);
+    else if(ele < _index[16]) _setLast(ele - _index[15], 3, 8, 3, 12, VH, NbVH);
+    else _setLast(ele - _index[16], 3, 8, 9, 12, TH, NbTH);
+  }
+  else if(ele < _index[20]){ // prisms
+    if(ele < _index[18]) _setLast(ele - _index[17], 3, 6, 1, 9, SI, NbSI);
+    else if(ele < _index[19]) _setLast(ele - _index[18], 3, 6, 3, 9, VI, NbVI);
+    else _setLast(ele - _index[19], 3, 6, 9, 9, TI, NbTI);
+  }
+  else{ // pyramids
+    if(ele < _index[21]) _setLast(ele - _index[20], 3, 5, 1, 15, SY, NbSY);
+    else if(ele < _index[22]) _setLast(ele - _index[21], 3, 5, 3, 15, VY, NbVY);
+    else _setLast(ele - _index[22], 3, 5, 9, 15, TY, NbTY);
+  }
+}
+
+int PViewDataList::getDimension(int ele)
+{
+  if(ele != _lastElement) _setLast(ele);
+  return _lastDimension;
+}
+
+int PViewDataList::getNumNodes(int ele)
+{
+  if(ele != _lastElement) _setLast(ele);
+  return _lastNumNodes;
+}
+
+void PViewDataList::getNode(int ele, int nod, double &x, double &y, double &z)
+{
+  if(ele != _lastElement) _setLast(ele);
+  x = _lastXYZ[nod];
+  y = _lastXYZ[_lastNumNodes + nod];
+  z = _lastXYZ[2 * _lastNumNodes + nod];
+}
+
+int PViewDataList::getNumComponents(int ele)
+{
+  if(ele != _lastElement) _setLast(ele);
+  return _lastNumComponents;
+}
+
+void PViewDataList::getValue(int ele, int nod, int comp, int step, double &val)
+{
+  if(ele != _lastElement) _setLast(ele);
+  val = _lastVal[step * _lastNumNodes  * _lastNumComponents + 
+		 nod * _lastNumComponents +
+		 comp];
+}
+
+int PViewDataList::getNumEdges(int ele)
+{
+  if(ele != _lastElement) _setLast(ele);
+  return _lastNumEdges;
+}
+
+void PViewDataList::_getString(int dim, int i, int timestep, std::string &str, 
+			       double &x, double &y, double &z, double &style)
+{
+  // 3D: T3D is a list of double: x,y,z,style,index,x,y,z,style,index,...
+  //     T3C is a list of chars: string\0,string\0,string\0,string\0,...
+  //     Parser format is: T3(x,y,z,style){"str","str",...};
+  // 2D: T2D is a list of double: x,y,style,index,x,y,style,index,...
+  //     T2C is a list of chars: string\0,string\0,string\0,string\0,...
+  //     Parser format is: T2(x,y,style){"str","str",...};
+
+  int nb = (dim == 2) ? NbT2 : NbT3;
+  List_T *td = (dim == 2) ? T2D : T3D;
+  List_T *tc = (dim == 2) ? T2C : T3C;
+  int nbd = (dim == 2) ? 4 : 5;
+
+  int index, nbchar;
+  double *d1 = (double *)List_Pointer(td, i * nbd);
+  double *d2 = (double *)List_Pointer_Test(td, (i + 1) * nbd);
+  if(dim == 2) {
+    x = d1[0];
+    y = d1[1];
+    z = 0.;
+    style = d1[2];
+    index = (int)d1[3];
+    if(d2)
+      nbchar = (int)d2[3] - index;
+    else
+      nbchar = List_Nbr(tc) - index;
+  }
+  else {
+    x = d1[0];
+    y = d1[1];
+    z = d1[2];
+    style = d1[3];
+    index = (int)d1[4];
+    if(d2)
+      nbchar = (int)d2[4] - index;
+    else
+      nbchar = List_Nbr(tc) - index;
+  }
+  
+  char *c = (char *)List_Pointer(tc, index);
+  int k = 0, l = 0;
+  while(k < nbchar && l != timestep) {
+    if(c[k++] == '\0')
+      l++;
+  }
+  if(k < nbchar && l == timestep)
+    str = std::string(&c[k]);
+  else
+    str = std::string(c);
+}
+
+void PViewDataList::getString2D(int i, int step, std::string &str, 
+				double &x, double &y, double &style)
+{
+  double z;
+  _getString(2, i, step, str, x, y, z, style);
+}
+
+void PViewDataList::getString3D(int i, int step, std::string &str, 
+				double &x, double &y, double &z, double &style)
+{
+  _getString(3, i, step, str, x, y, z, style);
+}
+
+static void generateConnectivities(List_T *list, int nbList, 
+				   int nbTimeStep, int nbVert, 
+				   smooth_data &data)
+{
+  if(!nbList) return;
+  double *vals = new double[nbTimeStep];
+  int nb = List_Nbr(list) / nbList;
+  for(int i = 0; i < List_Nbr(list); i += nb) {
+    double *x = (double *)List_Pointer_Fast(list, i);
+    double *y = (double *)List_Pointer_Fast(list, i + nbVert);
+    double *z = (double *)List_Pointer_Fast(list, i + 2 * nbVert);
+    double *v = (double *)List_Pointer_Fast(list, i + 3 * nbVert);
+    for(int j = 0; j < nbVert; j++) {
+      for(int k = 0; k < nbTimeStep; k++)
+        vals[k] = v[j + k * nbVert];
+      data.add(x[j], y[j], z[j], nbTimeStep, vals);
+    }
+  }
+  delete [] vals;
+}
+
+static void smoothList(List_T *list, int nbList, double &min, double &max, 
+		       std::vector<double> &tsmin, std::vector<double> &tsmax, 
+		       int nbTimeStep, int nbVert, smooth_data &data)
+{
+  if(!nbList) return;
+  double *vals = new double[nbTimeStep];
+  int nb = List_Nbr(list)/nbList;
+  for(int i = 0; i < List_Nbr(list); i += nb) {
+    double *x = (double *)List_Pointer_Fast(list, i);
+    double *y = (double *)List_Pointer_Fast(list, i + nbVert);
+    double *z = (double *)List_Pointer_Fast(list, i + 2 * nbVert);
+    double *v = (double *)List_Pointer_Fast(list, i + 3 * nbVert);
+    for(int j = 0; j < nbVert; j++) {
+      if(data.get(x[j], y[j], z[j], nbTimeStep, vals)){
+	for(int k = 0; k < nbTimeStep; k++) {
+	  double dd = vals[k];
+          v[j + k * nbVert] = dd;
+	  min = std::min(min, dd);
+	  max = std::max(max, dd);
+          tsmin[k] = std::min(tsmin[k], dd);
+          tsmax[k] = std::max(tsmax[k], dd);
+        }
+      }
+    }
+  }
+  delete [] vals;
+}
+
+void PViewDataList::smooth()
+{
+  double old_eps = xyzv::eps;
+  xyzv::eps = CTX.lc * 1.e-8;
+  
+  if(NbSL || NbST || NbSQ || NbSS || NbSH || NbSI || NbSY) {
+    Min = VAL_INF;
+    Max = -VAL_INF;
+    TimeStepMin.clear();
+    TimeStepMax.clear();
+    for(int j = 0; j < NbTimeStep; j++){
+      TimeStepMin.push_back(VAL_INF);
+      TimeStepMax.push_back(-VAL_INF);
+    }
+    smooth_data data;
+    generateConnectivities(SL, NbSL, NbTimeStep, 2, data);
+    generateConnectivities(ST, NbST, NbTimeStep, 3, data);
+    generateConnectivities(SQ, NbSQ, NbTimeStep, 4, data);
+    generateConnectivities(SS, NbSS, NbTimeStep, 4, data);
+    generateConnectivities(SH, NbSH, NbTimeStep, 8, data);
+    generateConnectivities(SI, NbSI, NbTimeStep, 6, data);
+    generateConnectivities(SY, NbSY, NbTimeStep, 5, data);
+    smoothList(SL, NbSL, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 2, data);
+    smoothList(ST, NbST, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 3, data);
+    smoothList(SQ, NbSQ, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 4, data);
+    smoothList(SS, NbSS, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 4, data);
+    smoothList(SH, NbSH, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 8, data);
+    smoothList(SI, NbSI, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 6, data);
+    smoothList(SY, NbSY, Min, Max, TimeStepMin, TimeStepMax, NbTimeStep, 5, data);
+  }
+
+  xyzv::eps = old_eps;  
+}
diff --git a/Post/PViewDataList.h b/Post/PViewDataList.h
new file mode 100644
index 0000000000000000000000000000000000000000..145cadffbb54f8dd9fb30f3db340fdabecb9ce85
--- /dev/null
+++ b/Post/PViewDataList.h
@@ -0,0 +1,117 @@
+#ifndef _PVIEW_DATA_LIST_H_
+#define _PVIEW_DATA_LIST_H_
+
+// Copyright (C) 1997-2007 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 <map>
+#include <vector>
+#include <string>
+#include "PViewData.h"
+#include "SBoundingBox3d.h"
+#include "List.h"
+
+#define VAL_INF 1.e200
+
+// data container using old-style lists of `discontinuous' element
+class PViewDataList : public PViewData {
+ public: 
+  // FIXME: all these members will be made private once the plugins
+  // have been rewritten
+  int DataSize; // size(double) or sizeof(float)
+  int NbTimeStep;
+  double Min, Max;
+  std::vector<double> TimeStepMin, TimeStepMax;
+  SBoundingBox3d BBox;
+  List_T *Time;
+  int NbSP, NbVP, NbTP;
+  List_T *SP, *VP, *TP; // points
+  int NbSL, NbVL, NbTL, NbSL2, NbVL2, NbTL2;
+  List_T *SL, *VL, *TL, *SL2, *VL2, *TL2; // lines
+  int NbST, NbVT, NbTT, NbST2, NbVT2, NbTT2;
+  List_T *ST, *VT, *TT, *ST2, *VT2, *TT2; // triangles
+  int NbSQ, NbVQ, NbTQ, NbSQ2, NbVQ2, NbTQ2;
+  List_T *SQ, *VQ, *TQ, *SQ2, *VQ2, *TQ2; // quadrangles
+  int NbSS, NbVS, NbTS, NbSS2, NbVS2, NbTS2;
+  List_T *SS, *VS, *TS, *SS2, *VS2, *TS2; // tetrahedra
+  int NbSH, NbVH, NbTH, NbSH2, NbVH2, NbTH2;
+  List_T *SH, *VH, *TH, *SH2, *VH2, *TH2; // hexahedra
+  int NbSI, NbVI, NbTI, NbSI2, NbVI2, NbTI2;
+  List_T *SI, *VI, *TI, *SI2, *VI2, *TI2; // prisms
+  int NbSY, NbVY, NbTY, NbSY2, NbVY2, NbTY2;
+  List_T *SY, *VY, *TY, *SY2, *VY2, *TY2; // pyramids
+  int NbT2, NbT3;
+  List_T *T2D, *T2C, *T3D, *T3C; // 2D and 3D text strings
+  std::map<int, List_T*> *Grains; // For LMGC90, grains shapes
+  std::map<int, int> *DisplayListsOfGrains; // For LMGC90, grains shapes
+ private:
+  int _index[24];
+  int _lastElement, _lastDimension;
+  int _lastNumNodes, _lastNumComponents, _lastNumEdges;
+  double *_lastXYZ, *_lastVal;
+  void _stat(List_T *D, List_T *C, int nb);
+  void _stat(List_T *list, int nbcomp, int nbelm, int nbnod);
+  void _setLast(int ele);
+  void _setLast(int ele, int dim, int nbnod, int nbcomp, int nbedg,
+		List_T *list, int nblist);
+  void _getString(int dim, int i, int timestep, std::string &str, 
+		  double &x, double &y, double &z, double &style);
+ public:
+  PViewDataList(bool allocate=true);
+  ~PViewDataList();
+  void finalize();
+  int getNumTimeSteps(){ return NbTimeStep; }
+  double getTime(int step);
+  double getMin(int step=-1);
+  double getMax(int step=-1);
+  SBoundingBox3d getBoundingBox(){ return BBox; }
+  int getNumScalars(){ return NbSP + NbSL + NbST + NbSQ + NbSS + NbSH + NbSI + NbSY; }
+  int getNumVectors(){ return NbVP + NbVL + NbVT + NbVQ + NbVS + NbVH + NbVI + NbVY; }
+  int getNumTensors(){ return NbTP + NbTL + NbTT + NbTQ + NbTS + NbTH + NbTI + NbTY; }
+  int getNumPoints(){ return NbSP + NbVP + NbTP; }
+  int getNumLines(){ return NbSL + NbVL + NbTL; }
+  int getNumTriangles(){ return NbST + NbVT + NbTT; }
+  int getNumQuadrangles(){ return NbSQ + NbVQ + NbTQ; }
+  int getNumTetrahedra(){ return NbSS + NbVS + NbTS; }
+  int getNumHexahedra(){ return NbSH + NbVH + NbTH; }
+  int getNumPrisms(){ return NbSI + NbVI + NbTI; }
+  int getNumPyramids(){ return NbSY + NbVY + NbTY; }
+  int getNumElements()
+  {
+    return getNumPoints() + getNumLines() + getNumTriangles() + 
+      getNumQuadrangles() + getNumTetrahedra() + getNumHexahedra() + 
+      getNumPrisms() + getNumPyramids();
+  }
+  int getDimension(int ele);
+  int getNumNodes(int ele);
+  void getNode(int ele, int nod, double &x, double &y, double &z);
+  int getNumComponents(int ele);
+  void getValue(int ele, int node, int comp, int step, double &val);
+  int getNumEdges(int ele);
+  int getNumStrings2D(){ return NbT2; }
+  int getNumStrings3D(){ return NbT3; }
+  void getString2D(int i, int step, std::string &str, 
+		   double &x, double &y, double &style);
+  void getString3D(int i, int step, std::string &str, 
+		   double &x, double &y, double &z, double &style);
+  void smooth();
+  bool read(std::string filename);
+};
+
+#endif
diff --git a/Post/PViewDataListIO.cpp b/Post/PViewDataListIO.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9aa8d845bca029f44ca36287da5d2198a12df181
--- /dev/null
+++ b/Post/PViewDataListIO.cpp
@@ -0,0 +1,301 @@
+// $Id: PViewDataListIO.cpp,v 1.1 2007-09-01 16:06:24 geuzaine Exp $
+//
+// Copyright (C) 1997-2007 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>.
+//
+// Contributor(s):
+// 
+
+#include "PViewDataList.h"
+#include "Message.h"
+
+bool PViewDataList::read(std::string filename)
+{
+  FILE *fp = fopen(filename.c_str(), "rb");
+  if(!fp){
+    Msg(GERROR, "Unable to open file '%s'", filename.c_str());
+    return false;
+  }
+
+  char str[256], name[256];
+  int format, size, swap, t2l, t3l;
+  double version;
+
+  while(1) {
+
+    do {
+      if(!fgets(str, 256, fp) || feof(fp))
+        break;
+    } while(str[0] != '$');
+    
+    if(feof(fp))
+      break;
+
+    if(!strncmp(&str[1], "PostFormat", 10)) {
+      if(!fscanf(fp, "%lf %d %d\n", &version, &format, &size)){
+        Msg(GERROR, "Read error");
+        return false;
+      }
+      if(version < 1.0) {
+        Msg(GERROR, "Post-processing file too old (ver. %g < 1.0)", version);
+        return false;
+      }
+      if(size == sizeof(double))
+        Msg(DEBUG, "Data is in double precision format (size==%d)", size);
+      else {
+        Msg(GERROR, "Unknown data size (%d) in post-processing file", size);
+        return false;
+      }
+      if(format == 0)
+        format = LIST_FORMAT_ASCII;
+      else if(format == 1)
+        format = LIST_FORMAT_BINARY;
+      else {
+        Msg(GERROR, "Unknown format for view");
+        return false;
+      }
+    }
+
+    if(!strncmp(&str[1], "View", 4)) {
+      if(version <= 1.0) {
+        Msg(DEBUG, "Detected post-processing view format <= 1.0");
+        if(!fscanf(fp, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
+		   name, &NbTimeStep,
+		   &NbSP, &NbVP, &NbTP, &NbSL, &NbVL, &NbTL,
+		   &NbST, &NbVT, &NbTT, &NbSS, &NbVS, &NbTS)){
+	  Msg(GERROR, "Read error");
+	  return false;
+	}
+        NbT2 = t2l = NbT3 = t3l = 0;
+      }
+      else if(version == 1.1) {
+        Msg(DEBUG, "Detected post-processing view format 1.1");
+        if(!fscanf(fp, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
+		   name, &NbTimeStep, &NbSP, &NbVP, &NbTP, &NbSL,
+		   &NbVL, &NbTL, &NbST, &NbVT, &NbTT, &NbSS,
+		   &NbVS, &NbTS, &NbT2, &t2l, &NbT3, &t3l)){
+	  Msg(GERROR, "Read error");
+	  return false;
+	}
+      }
+      else if(version == 1.2 || version == 1.3) {
+        Msg(DEBUG, "Detected post-processing view format %g", version);
+        if(!fscanf(fp, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d "
+		   "%d %d %d %d %d %d %d %d %d %d %d %d %d\n",
+		   name, &NbTimeStep,
+		   &NbSP, &NbVP, &NbTP, &NbSL, &NbVL, &NbTL,
+		   &NbST, &NbVT, &NbTT, &NbSQ, &NbVQ, &NbTQ,
+		   &NbSS, &NbVS, &NbTS, &NbSH, &NbVH, &NbTH,
+		   &NbSI, &NbVI, &NbTI, &NbSY, &NbVY, &NbTY,
+		   &NbT2, &t2l, &NbT3, &t3l)){
+	  Msg(GERROR, "Read error");
+	  return false;
+	}
+      }
+      else if(version == 1.4) {
+        Msg(DEBUG, "Detected post-processing view format 1.4");
+        if(!fscanf(fp, "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d "
+		   "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d "
+		   "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
+		   name, &NbTimeStep,
+		   &NbSP, &NbVP, &NbTP, &NbSL, &NbVL, &NbTL,
+		   &NbST, &NbVT, &NbTT, &NbSQ, &NbVQ, &NbTQ,
+		   &NbSS, &NbVS, &NbTS, &NbSH, &NbVH, &NbTH,
+		   &NbSI, &NbVI, &NbTI, &NbSY, &NbVY, &NbTY,
+		   &NbSL2, &NbVL2, &NbTL2, &NbST2, &NbVT2, &NbTT2,
+		   &NbSQ2, &NbVQ2, &NbTQ2, &NbSS2, &NbVS2, &NbTS2,
+		   &NbSH2, &NbVH2, &NbTH2, &NbSI2, &NbVI2, &NbTI2,
+		   &NbSY2, &NbVY2, &NbTY2, &NbT2, &t2l, &NbT3, &t3l)){
+	  Msg(GERROR, "Read error");
+	  return false;
+	}
+      }
+      else {
+        Msg(GERROR, "Unknown post-processing file format (version %g)", version);
+        return false;
+      }
+      
+      for(int i = 0; i < (int)strlen(name); i++)
+        if(name[i] == '^')
+          name[i] = ' ';
+      
+      swap = 0;
+      if(format == LIST_FORMAT_BINARY) {
+	int testone;
+        if(!fread(&testone, sizeof(int), 1, fp)){
+	  Msg(GERROR, "Read error");
+	  return false;
+	}
+        if(testone != 1) {
+          Msg(INFO, "Swapping bytes from binary file");
+          swap = 1;
+        }
+      }
+
+      DataSize = size;
+      
+      // Time values
+      Time = List_CreateFromFile(NbTimeStep, 100, size, fp, format, swap);
+
+      // Note: if nb==0, we still allocates the lists (so that they
+      // are ready to be filled later, e.g. in plugins)
+
+#define LCD List_CreateFromFile(nb, 1000, size, fp, format, swap)
+      int nb;
+      // Points
+      nb = NbSP ? NbSP * (NbTimeStep * 1 + 3) : 0; SP = LCD;
+      nb = NbVP ? NbVP * (NbTimeStep * 3 + 3) : 0; VP = LCD;
+      nb = NbTP ? NbTP * (NbTimeStep * 9 + 3) : 0; TP = LCD;
+
+      // Lines
+      nb = NbSL ? NbSL * (NbTimeStep * 2 * 1 + 6) : 0; SL = LCD;
+      nb = NbVL ? NbVL * (NbTimeStep * 2 * 3 + 6) : 0; VL = LCD;
+      nb = NbTL ? NbTL * (NbTimeStep * 2 * 9 + 6) : 0; TL = LCD;
+
+      // Triangles
+      nb = NbST ? NbST * (NbTimeStep * 3 * 1 + 9) : 0; ST = LCD;
+      nb = NbVT ? NbVT * (NbTimeStep * 3 * 3 + 9) : 0; VT = LCD;
+      nb = NbTT ? NbTT * (NbTimeStep * 3 * 9 + 9) : 0; TT = LCD;
+
+      // Quadrangles
+      nb = NbSQ ? NbSQ * (NbTimeStep * 4 * 1 + 12) : 0; SQ = LCD;
+      nb = NbVQ ? NbVQ * (NbTimeStep * 4 * 3 + 12) : 0; VQ = LCD;
+      nb = NbTQ ? NbTQ * (NbTimeStep * 4 * 9 + 12) : 0; TQ = LCD;
+
+      // Tetrahedra
+      nb = NbSS ? NbSS * (NbTimeStep * 4 * 1 + 12) : 0; SS = LCD;
+      nb = NbVS ? NbVS * (NbTimeStep * 4 * 3 + 12) : 0; VS = LCD;
+      nb = NbTS ? NbTS * (NbTimeStep * 4 * 9 + 12) : 0; TS = LCD;
+
+      // Hexahedra
+      nb = NbSH ? NbSH * (NbTimeStep * 8 * 1 + 24) : 0; SH = LCD;
+      nb = NbVH ? NbVH * (NbTimeStep * 8 * 3 + 24) : 0; VH = LCD;
+      nb = NbTH ? NbTH * (NbTimeStep * 8 * 9 + 24) : 0; TH = LCD;
+
+      // Prisms
+      nb = NbSI ? NbSI * (NbTimeStep * 6 * 1 + 18) : 0; SI = LCD;
+      nb = NbVI ? NbVI * (NbTimeStep * 6 * 3 + 18) : 0; VI = LCD;
+      nb = NbTI ? NbTI * (NbTimeStep * 6 * 9 + 18) : 0; TI = LCD;
+
+      // Pyramids
+      nb = NbSY ? NbSY * (NbTimeStep * 5 * 1 + 15) : 0; SY = LCD;
+      nb = NbVY ? NbVY * (NbTimeStep * 5 * 3 + 15) : 0; VY = LCD;
+      nb = NbTY ? NbTY * (NbTimeStep * 5 * 9 + 15) : 0; TY = LCD;
+
+      // 2nd order Lines
+      nb = NbSL2 ? NbSL2 * (NbTimeStep * 3 * 1 + 9) : 0; SL2 = LCD;
+      nb = NbVL2 ? NbVL2 * (NbTimeStep * 3 * 3 + 9) : 0; VL2 = LCD;
+      nb = NbTL2 ? NbTL2 * (NbTimeStep * 3 * 9 + 9) : 0; TL2 = LCD;
+
+      // 2nd order Triangles
+      nb = NbST2 ? NbST2 * (NbTimeStep * 6 * 1 + 18) : 0; ST2 = LCD;
+      nb = NbVT2 ? NbVT2 * (NbTimeStep * 6 * 3 + 18) : 0; VT2 = LCD;
+      nb = NbTT2 ? NbTT2 * (NbTimeStep * 6 * 9 + 18) : 0; TT2 = LCD;
+
+      // 2nd order Quadrangles
+      nb = NbSQ2 ? NbSQ2 * (NbTimeStep * 9 * 1 + 27) : 0; SQ2 = LCD;
+      nb = NbVQ2 ? NbVQ2 * (NbTimeStep * 9 * 3 + 27) : 0; VQ2 = LCD;
+      nb = NbTQ2 ? NbTQ2 * (NbTimeStep * 9 * 9 + 27) : 0; TQ2 = LCD;
+
+      // 2nd order Tetrahedra
+      nb = NbSS2 ? NbSS2 * (NbTimeStep * 10 * 1 + 30) : 0; SS2 = LCD;
+      nb = NbVS2 ? NbVS2 * (NbTimeStep * 10 * 3 + 30) : 0; VS2 = LCD;
+      nb = NbTS2 ? NbTS2 * (NbTimeStep * 10 * 9 + 30) : 0; TS2 = LCD;
+
+      // 2nd order Hexahedra
+      nb = NbSH2 ? NbSH2 * (NbTimeStep * 27 * 1 + 81) : 0; SH2 = LCD;
+      nb = NbVH2 ? NbVH2 * (NbTimeStep * 27 * 3 + 81) : 0; VH2 = LCD;
+      nb = NbTH2 ? NbTH2 * (NbTimeStep * 27 * 9 + 81) : 0; TH2 = LCD;
+
+      // 2nd order Prisms
+      nb = NbSI2 ? NbSI2 * (NbTimeStep * 18 * 1 + 54) : 0; SI2 = LCD;
+      nb = NbVI2 ? NbVI2 * (NbTimeStep * 18 * 3 + 54) : 0; VI2 = LCD;
+      nb = NbTI2 ? NbTI2 * (NbTimeStep * 18 * 9 + 54) : 0; TI2 = LCD;
+
+      // 2nd order Pyramids
+      nb = NbSY2 ? NbSY2 * (NbTimeStep * 14 * 1 + 42) : 0; SY2 = LCD;
+      nb = NbVY2 ? NbVY2 * (NbTimeStep * 14 * 3 + 42) : 0; VY2 = LCD;
+      nb = NbTY2 ? NbTY2 * (NbTimeStep * 14 * 9 + 42) : 0; TY2 = LCD;
+#undef LCD
+
+      // 2D strings
+      nb = NbT2 ? NbT2 * 4 : 0;
+      T2D = List_CreateFromFile(nb, 100, size, fp, format, swap);
+      if(version <= 1.2)
+	T2C = List_CreateFromFileOld(t2l, 100, sizeof(char), fp, format, swap);
+      else
+	T2C = List_CreateFromFile(t2l, 100, sizeof(char), fp, format, swap);
+
+      // 3D strings
+      nb = NbT3 ? NbT3 * 5 : 0;
+      T3D = List_CreateFromFile(nb, 100, size, fp, format, swap);
+      if(version <= 1.2)
+	T3C = List_CreateFromFileOld(t3l, 100, sizeof(char), fp, format, swap);
+      else
+	T3C = List_CreateFromFile(t3l, 100, sizeof(char), fp, format, swap);
+
+      Msg(DEBUG,
+          "Read View '%s' (%d TimeSteps): "
+	  "SP(%d/%d) VP(%d/%d) TP(%d/%d) "
+	  "SL(%d/%d) VL(%d/%d) TL(%d/%d) "
+	  "ST(%d/%d) VT(%d/%d) TT(%d/%d) "
+	  "SQ(%d/%d) VQ(%d/%d) TQ(%d/%d) "
+	  "SS(%d/%d) VS(%d/%d) TS(%d/%d) "
+	  "SH(%d/%d) VH(%d/%d) TH(%d/%d) "
+	  "SI(%d/%d) VI(%d/%d) TI(%d/%d) "
+	  "SY(%d/%d) VY(%d/%d) TY(%d/%d) " 
+	  "SL2(%d/%d) VL2(%d/%d) TL2(%d/%d) "
+	  "ST2(%d/%d) VT2(%d/%d) TT2(%d/%d) "
+	  "SQ2(%d/%d) VQ2(%d/%d) TQ2(%d/%d) "
+	  "SS2(%d/%d) VS2(%d/%d) TS2(%d/%d) " 
+	  "SH2(%d/%d) VH2(%d/%d) TH2(%d/%d) "
+	  "SI2(%d/%d) VI2(%d/%d) TI2(%d/%d) "
+	  "SY2(%d/%d) VY2(%d/%d) TY2(%d/%d) "
+	  "T2(%d/%d/%d) T3(%d/%d/%d) ", 
+	  name, NbTimeStep,
+          NbSP, List_Nbr(SP), NbVP, List_Nbr(VP), NbTP, List_Nbr(TP),
+          NbSL, List_Nbr(SL), NbVL, List_Nbr(VL), NbTL, List_Nbr(TL),
+          NbST, List_Nbr(ST), NbVT, List_Nbr(VT), NbTT, List_Nbr(TT),
+          NbSQ, List_Nbr(SQ), NbVQ, List_Nbr(VQ), NbTQ, List_Nbr(TQ),
+          NbSS, List_Nbr(SS), NbVS, List_Nbr(VS), NbTS, List_Nbr(TS),
+          NbSH, List_Nbr(SH), NbVH, List_Nbr(VH), NbTH, List_Nbr(TH),
+          NbSI, List_Nbr(SI), NbVI, List_Nbr(VI), NbTI, List_Nbr(TI),
+          NbSY, List_Nbr(SY), NbVY, List_Nbr(VY), NbTY, List_Nbr(TY),
+          NbSL2, List_Nbr(SL2), NbVL2, List_Nbr(VL2), NbTL2, List_Nbr(TL2),
+          NbST2, List_Nbr(ST2), NbVT2, List_Nbr(VT2), NbTT2, List_Nbr(TT2),
+          NbSQ2, List_Nbr(SQ2), NbVQ2, List_Nbr(VQ2), NbTQ2, List_Nbr(TQ2),
+          NbSS2, List_Nbr(SS2), NbVS2, List_Nbr(VS2), NbTS2, List_Nbr(TS2),
+          NbSH2, List_Nbr(SH2), NbVH2, List_Nbr(VH2), NbTH2, List_Nbr(TH2),
+          NbSI2, List_Nbr(SI2), NbVI2, List_Nbr(VI2), NbTI2, List_Nbr(TI2),
+          NbSY2, List_Nbr(SY2), NbVY2, List_Nbr(VY2), NbTY2, List_Nbr(TY2),
+	  NbT2, List_Nbr(T2D), List_Nbr(T2C), 
+	  NbT3, List_Nbr(T3D), List_Nbr(T3C));
+      
+      finalize();
+    }
+
+    do {
+      if(!fgets(str, 256, fp) || feof(fp))
+        Msg(GERROR, "Prematured end of file");
+    } while(str[0] != '$');
+    
+  }
+
+  return true;
+}