diff --git a/Common/Makefile b/Common/Makefile
index 202b3e9dfad594d65823a2120b11db610e685dec..ff518fde71f31765269b9e8b7f596607b68bdde0 100644
--- a/Common/Makefile
+++ b/Common/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.140 2007-09-10 04:47:02 geuzaine Exp $
+# $Id: Makefile,v 1.141 2007-09-11 14:01:54 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -77,7 +77,7 @@ Options.o: Options.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
   ../Mesh/Generator.h Context.h Options.h ../Mesh/BackgroundMesh.h \
   ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Common/Options.h \
-  ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \
+  ../Common/Message.h ../Post/PViewDataList.h ../Post/PViewData.h \
   ../Post/AdaptiveViews.h ../Common/GmshMatrix.h ../Fltk/Solvers.h \
   ../Fltk/GUI.h ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h \
   ../Common/GmshUI.h ../Fltk/Popup_Button.h \
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index dda33e34b1559bf97f5007fc9b69067d50e5cd65..7404044cd9928aaa7abbec3a376786c3e9418790 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.543 2007-09-10 05:31:35 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.544 2007-09-11 14:01:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -4530,11 +4530,9 @@ void view_plugin_run_cb(CALLBACK_ARGS)
   // run on all selected views
   for(int i = 1; i <= WID->plugin_view_browser->size(); i++) {
     if(WID->plugin_view_browser->selected(i)) {
-      try {
-	if(i - 1 >= 0 && i - 1 < PView::list.size()){
-	  Msg(FATAL, "need to reinterface plugin execute with pview");
-	  //p->execute(PView::list[i - 1]);
-	}
+      try{
+	if(i - 1 >= 0 && i - 1 < PView::list.size())
+	  p->execute(PView::list[i - 1]);
 	else
 	  p->execute(0);
       }
@@ -4546,6 +4544,7 @@ void view_plugin_run_cb(CALLBACK_ARGS)
     }
   }
 
+  WID->update_views();
   CTX.post.plugin_draw_function = NULL;
   Draw();
 }
diff --git a/Fltk/Makefile b/Fltk/Makefile
index beb495a569b0785ddddc84fd2227ed021be80a0f..2bd3c2683385aee869da10fbc7845c2a5f654138 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.148 2007-09-10 04:47:02 geuzaine Exp $
+# $Id: Makefile,v 1.149 2007-09-11 14:01:54 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -76,10 +76,11 @@ Main.o: Main.cpp GUI.h Opengl_Window.h Colorbar_Window.h \
   ../Mesh/Generator.h ../Parser/CreateFile.h ../Graphics/Draw.h \
   ../Common/Context.h ../Common/Options.h ../Parser/Parser.h \
   ../Parser/OpenFile.h ../Common/CommandLine.h Solvers.h \
-  ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Post/Views.h \
-  ../Post/ColorTable.h ../Common/VertexArray.h ../Post/AdaptiveViews.h \
-  ../Common/GmshMatrix.h ../Geo/GModel.h ../Geo/GVertex.h \
-  ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
+  ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Post/PViewData.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../Common/GmshMatrix.h ../Geo/GModel.h \
+  ../Geo/GVertex.h ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.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 \
@@ -90,9 +91,8 @@ Main.o: Main.cpp GUI.h Opengl_Window.h Colorbar_Window.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 ../Mesh/Field.h \
-  ../Post/PView.h ../Post/PViewData.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Post/OctreePost.h ../Common/Octree.h \
-  ../Common/OctreeInternals.h ../Mesh/BackgroundMesh.h
+  ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h \
+  ../Mesh/BackgroundMesh.h
 Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
@@ -108,11 +108,11 @@ GUI.o: GUI.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   Colorbar_Window.h Popup_Button.h SpherePosition_Widget.h Callbacks.h \
   Win32Icon.h ../Parser/OpenFile.h ../Common/CommandLine.h \
   ../Mesh/Generator.h Solvers.h ../Plugin/PluginManager.h \
-  ../Plugin/Plugin.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 \
-  Shortcut_Window.h ../Post/PView.h ../Post/PViewData.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h
+  ../Plugin/Plugin.h ../Post/PView.h ../Common/VertexArray.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
+  ../Post/PViewData.h ../Post/PViewOptions.h ../Post/ColorTable.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Post/AdaptiveViews.h \
+  ../Common/GmshMatrix.h Shortcut_Window.h
 GUI_Extras.o: GUI_Extras.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 \
@@ -197,8 +197,8 @@ Callbacks.o: Callbacks.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Post/ColorTable.h ../Parser/CreateFile.h ../Parser/OpenFile.h \
   ../Common/CommandLine.h ../Common/Options.h GUI.h Opengl_Window.h \
   Colorbar_Window.h Popup_Button.h SpherePosition_Widget.h GUI_Extras.h \
-  Callbacks.h ../Plugin/Plugin.h ../Post/Views.h ../Post/ColorTable.h \
-  ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
+  Callbacks.h ../Plugin/Plugin.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
   ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Common/Visibility.h \
   ../Common/GmshDefines.h Solvers.h ../Common/OS.h ../Mesh/Field.h \
   ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h \
diff --git a/Parser/Makefile b/Parser/Makefile
index cbae760d4460ad5670bea03fdfd0de2cb077747f..c65cc1ef375e355e5d21dda6e4918b1c5f34bdeb 100644
--- a/Parser/Makefile
+++ b/Parser/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.126 2007-09-10 04:47:07 geuzaine Exp $
+# $Id: Makefile,v 1.127 2007-09-11 14:01:54 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -78,31 +78,30 @@ depend:
 # DO NOT DELETE THIS LINE
 Gmsh.tab.o: Gmsh.tab.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/Views.h ../Post/ColorTable.h ../DataStr/List.h \
-  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/AdaptiveViews.h \
+  ../Post/PView.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
   ../Common/GmshMatrix.h ../Parallel/ParUtil.h ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
   ../Common/Context.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 ../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 \
-  ../Geo/Geo.h ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h \
-  ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint2.h ../Geo/ExtrudeParams.h \
-  ../Geo/GeoInterpolation.h ../Geo/Geo.h ../Mesh/Generator.h \
-  ../Graphics/Draw.h ../Post/PView.h ../Post/PViewData.h \
-  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
-  ../Post/PViewData.h ../Post/AdaptiveViews.h ../Common/Colors.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 ../Geo/Geo.h \
+  ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \
+  ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint2.h ../Geo/ExtrudeParams.h ../Geo/GeoInterpolation.h \
+  ../Geo/Geo.h ../Mesh/Generator.h ../Graphics/Draw.h ../Common/Colors.h \
   ../Common/Options.h Parser.h OpenFile.h ../Common/CommandLine.h \
   FunctionManager.h ../Common/OS.h CreateFile.h ../Mesh/Field.h \
   ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h \
diff --git a/Plugin/Annotate.cpp b/Plugin/Annotate.cpp
index 11c112fbd9062255770e60f965469c6b1e252dce..54ff53dc5ccdf85a0739375741c6b0c46878745b 100644
--- a/Plugin/Annotate.cpp
+++ b/Plugin/Annotate.cpp
@@ -1,4 +1,4 @@
-// $Id: Annotate.cpp,v 1.16 2007-05-04 10:45:08 geuzaine Exp $
+// $Id: Annotate.cpp,v 1.17 2007-09-11 14:01:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,14 +19,9 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include <iostream>
 #include <vector>
-#include "Plugin.h"
 #include "Annotate.h"
-#include "List.h"
-#include "Views.h"
 #include "Context.h"
-#include "Numeric.h"
 
 #if defined(HAVE_FLTK)
 #include "GmshUI.h"
@@ -253,7 +248,7 @@ void GMSH_AnnotatePlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "Annotate failed...");
 }
 
-Post_View *GMSH_AnnotatePlugin::execute(Post_View * v)
+PView *GMSH_AnnotatePlugin::execute(PView *v)
 {
   double X = AnnotateOptions_Number[0].def;
   double Y = AnnotateOptions_Number[1].def;
@@ -263,36 +258,32 @@ Post_View *GMSH_AnnotatePlugin::execute(Post_View * v)
   char *text = AnnotateOptions_String[0].def;
   double style = getStyle();
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
 
   if(dim3){
-    List_Add(v1->T3D, &X);
-    List_Add(v1->T3D, &Y);
-    List_Add(v1->T3D, &Z);
-    List_Add(v1->T3D, &style); 
-    double d = List_Nbr(v1->T3C);
-    List_Add(v1->T3D, &d); 
+    List_Add(data1->T3D, &X);
+    List_Add(data1->T3D, &Y);
+    List_Add(data1->T3D, &Z);
+    List_Add(data1->T3D, &style); 
+    double d = List_Nbr(data1->T3C);
+    List_Add(data1->T3D, &d); 
     for(int i = 0; i < (int)strlen(text)+1; i++) 
-      List_Add(v1->T3C, &text[i]); 
-    v1->NbT3++;
+      List_Add(data1->T3C, &text[i]); 
+    data1->NbT3++;
   }
   else{
-    List_Add(v1->T2D, &X);
-    List_Add(v1->T2D, &Y);
-    List_Add(v1->T2D, &style); 
-    double d = List_Nbr(v1->T2C);
-    List_Add(v1->T2D, &d); 
+    List_Add(data1->T2D, &X);
+    List_Add(data1->T2D, &Y);
+    List_Add(data1->T2D, &style); 
+    double d = List_Nbr(data1->T2C);
+    List_Add(data1->T2D, &d); 
     for(int i = 0; i < (int)strlen(text)+1; i++) 
-      List_Add(v1->T2C, &text[i]); 
-    v1->NbT2++;
+      List_Add(data1->T2C, &text[i]); 
+    data1->NbT2++;
   }
 
   return v1;
diff --git a/Plugin/Annotate.h b/Plugin/Annotate.h
index 8f51cde3821c144a23143526552fd0f3a2527211..871b3f5d2d9f28d85129d21f9f4c6d130a9e1672 100644
--- a/Plugin/Annotate.h
+++ b/Plugin/Annotate.h
@@ -42,7 +42,7 @@ public:
   StringXNumber* getOption(int iopt);  
   int getNbOptionsStr() const;
   StringXString* getOptionStr(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 
   static double callbackX(int, int, double);
   static double callbackY(int, int, double);
diff --git a/Plugin/Curl.cpp b/Plugin/Curl.cpp
index a710f7dfbefa053e92b0bb57bb48b639b159a019..625ecb3ece470090005138cf95aed4139d88073f 100644
--- a/Plugin/Curl.cpp
+++ b/Plugin/Curl.cpp
@@ -1,4 +1,4 @@
-// $Id: Curl.cpp,v 1.4 2007-05-04 10:45:08 geuzaine Exp $
+// $Id: Curl.cpp,v 1.5 2007-09-11 14:01:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,16 +19,9 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Curl.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
 #include "ShapeFunctions.h"
 
-extern Context_T CTX;
-
 StringXNumber CurlOptions_Number[] = {
   {GMSH_FULLRC, "iView", NULL, -1.}
 };
@@ -110,37 +103,35 @@ static void curl(int inNb, List_T *inList, int *outNb, List_T *outList,
   }
 }
 
-Post_View *GMSH_CurlPlugin::execute(Post_View * v)
+PView *GMSH_CurlPlugin::execute(PView *v)
 {
   int iView = (int)CurlOptions_Number[0].def;
   
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-  
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-  
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
-
-  curl(v1->NbVL, v1->VL, &v2->NbVL, v2->VL, 1, 2, v1->NbTimeStep);
-  curl(v1->NbVT, v1->VT, &v2->NbVT, v2->VT, 2, 3, v1->NbTimeStep);
-  curl(v1->NbVQ, v1->VQ, &v2->NbVQ, v2->VQ, 2, 4, v1->NbTimeStep);
-  curl(v1->NbVS, v1->VS, &v2->NbVS, v2->VS, 3, 4, v1->NbTimeStep);
-  curl(v1->NbVH, v1->VH, &v2->NbVH, v2->VH, 3, 8, v1->NbTimeStep);
-  curl(v1->NbVI, v1->VI, &v2->NbVI, v2->VI, 3, 6, v1->NbTimeStep);
-  curl(v1->NbVY, v1->VY, &v2->NbVY, v2->VY, 3, 5, v1->NbTimeStep);
-
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++)
-    List_Add(v2->Time, List_Pointer(v1->Time, i));
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_Curl", v1->Name);
-  sprintf(filename, "%s_Curl.pos", v1->Name);
-  EndView(v2, 1, filename, name);
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *v2 = new PView(true);
+
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
+
+  int nts = data1->getNumTimeSteps();
+  curl(data1->NbVL, data1->VL, &data2->NbVL, data2->VL, 1, 2, nts);
+  curl(data1->NbVT, data1->VT, &data2->NbVT, data2->VT, 2, 3, nts);
+  curl(data1->NbVQ, data1->VQ, &data2->NbVQ, data2->VQ, 2, 4, nts);
+  curl(data1->NbVS, data1->VS, &data2->NbVS, data2->VS, 3, 4, nts);
+  curl(data1->NbVH, data1->VH, &data2->NbVH, data2->VH, 3, 8, nts);
+  curl(data1->NbVI, data1->VI, &data2->NbVI, data2->VI, 3, 6, nts);
+  curl(data1->NbVY, data1->VY, &data2->NbVY, data2->VY, 3, 5, nts);
+
+  for(int i = 0; i < List_Nbr(data1->Time); i++)
+    List_Add(data2->Time, List_Pointer(data1->Time, i));
+  data2->setName(data1->getName() + "_Curl");
+  data2->setFileName(data1->getName() + "_Curl.pos");
+  data2->finalize();
   
   return v2;
 }
diff --git a/Plugin/Curl.h b/Plugin/Curl.h
index 14c2e2069b47a05f3ef9b4b382c15b6505f59aa2..57b4d02c4768dbef796860280d173051654c343d 100644
--- a/Plugin/Curl.h
+++ b/Plugin/Curl.h
@@ -36,7 +36,7 @@ class GMSH_CurlPlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/CutGrid.cpp b/Plugin/CutGrid.cpp
index 985bededfee3f31f9ce3ed03efe7dabd9ec2e01c..b2e1f77631c7a70c7726ec5bdc3c49231ec0f64c 100644
--- a/Plugin/CutGrid.cpp
+++ b/Plugin/CutGrid.cpp
@@ -1,4 +1,4 @@
-// $Id: CutGrid.cpp,v 1.22 2007-09-10 04:47:07 geuzaine Exp $
+// $Id: CutGrid.cpp,v 1.23 2007-09-11 14:01:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -21,7 +21,6 @@
 
 #include "OctreePost.h"
 #include "CutGrid.h"
-#include "List.h"
 #include "Context.h"
 
 #if defined(HAVE_FLTK)
@@ -247,7 +246,7 @@ void GMSH_CutGridPlugin::getPoint(int iU, int iV, double *X)
     v  * (CutGridOptions_Number[8].def-CutGridOptions_Number[2].def) ;
 }
 
-void GMSH_CutGridPlugin::addInView(Post_View *v, int connect, int nbcomp, 
+void GMSH_CutGridPlugin::addInView(PViewDataList *data, int connect, int nbcomp, 
 				   double ***pnts, double ***vals, 
 				   List_T *P, int *nP, 
 				   List_T *L, int *nL, 
@@ -261,7 +260,7 @@ void GMSH_CutGridPlugin::addInView(Post_View *v, int connect, int nbcomp,
 	List_Add(P, &pnts[i][j][1]);
 	List_Add(P, &pnts[i][j][2]);
 	(*nP)++;
-	for(int k = 0; k < v->NbTimeStep; ++k){
+	for(int k = 0; k < data->getNumTimeSteps(); ++k){
 	  for(int l = 0; l < nbcomp; ++l)
 	    List_Add(P, &vals[i][j][nbcomp*k+l]);
 	}
@@ -277,7 +276,7 @@ void GMSH_CutGridPlugin::addInView(Post_View *v, int connect, int nbcomp,
 	List_Add(L, &pnts[0][i][1]); List_Add(L, &pnts[0][i+1][1]);
 	List_Add(L, &pnts[0][i][2]); List_Add(L, &pnts[0][i+1][2]);
 	(*nL)++;
-	for(int k = 0; k < v->NbTimeStep; ++k){
+	for(int k = 0; k < data->getNumTimeSteps(); ++k){
 	  for(int l = 0; l < nbcomp; ++l)
 	    List_Add(L, &vals[0][i  ][nbcomp*k+l]);
 	  for(int l = 0; l < nbcomp; ++l)
@@ -291,7 +290,7 @@ void GMSH_CutGridPlugin::addInView(Post_View *v, int connect, int nbcomp,
 	List_Add(L, &pnts[i][0][1]); List_Add(L, &pnts[i+1][0][1]);
 	List_Add(L, &pnts[i][0][2]); List_Add(L, &pnts[i+1][0][2]);
 	(*nL)++;
-	for(int k = 0; k < v->NbTimeStep; ++k){
+	for(int k = 0; k < data->getNumTimeSteps(); ++k){
 	  for(int l = 0; l < nbcomp; ++l)
 	    List_Add(L, &vals[i  ][0][nbcomp*k+l]);
 	  for(int l = 0; l < nbcomp; ++l)
@@ -309,7 +308,7 @@ void GMSH_CutGridPlugin::addInView(Post_View *v, int connect, int nbcomp,
 	  List_Add(Q, &pnts[i  ][j  ][2]); List_Add(Q, &pnts[i+1][j  ][2]);
 	  List_Add(Q, &pnts[i+1][j+1][2]); List_Add(Q, &pnts[i  ][j+1][2]);
 	  (*nQ)++;
-	  for(int k = 0; k < v->NbTimeStep; ++k){
+	  for(int k = 0; k < data->getNumTimeSteps(); ++k){
 	    for(int l = 0; l < nbcomp; ++l)
 	      List_Add(Q, &vals[i  ][j  ][nbcomp*k+l]);
 	    for(int l = 0; l < nbcomp; ++l)
@@ -325,25 +324,31 @@ void GMSH_CutGridPlugin::addInView(Post_View *v, int connect, int nbcomp,
   }	
 }
 
-Post_View * GMSH_CutGridPlugin::GenerateView(Post_View * v, int connect)
+PView *GMSH_CutGridPlugin::GenerateView(PView *v1, int connect)
 {
   if(getNbU() <= 0 || getNbV() <= 0)
-    return v;
+    return v1;
 
-  Msg(FATAL, "XXXXXXXXXXXXXXXXXXXXX");
-  return 0;
-  /*
-  Post_View * View = BeginView(1);
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v1;
 
-  OctreePost o(v);
+  PView *v2 = new PView(true);
+
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v1;
+ 
+  OctreePost o(v1);
 
   int nbs = 0, nbv = 0, nbt = 0;
 
-  if(v->NbST || v->NbSQ || v->NbSS || v->NbSH || v->NbSI || v->NbSY)
+  if(data1->NbST || data1->NbSQ || data1->NbSS || 
+     data1->NbSH || data1->NbSI || data1->NbSY)
     nbs = 1;
-  if(v->NbVT || v->NbVQ || v->NbVS || v->NbVH || v->NbVI || v->NbVY)
+  if(data1->NbVT || data1->NbVQ || data1->NbVS || 
+     data1->NbVH || data1->NbVI || data1->NbVY)
     nbv = 1;
-  if(v->NbTT || v->NbTQ || v->NbTS || v->NbTH || v->NbTI || v->NbTY)
+  if(data1->NbTT || data1->NbTQ || data1->NbTS || 
+     data1->NbTH || data1->NbTI || data1->NbTY)
     nbt = 1;
 
   int maxcomp = nbt ? 9 : (nbv ? 3 : 1);
@@ -355,7 +360,7 @@ Post_View * GMSH_CutGridPlugin::GenerateView(Post_View * v, int connect)
     vals[i] = new double* [getNbV()];
     for(int j = 0; j < getNbV(); j++){
       pnts[i][j] = new double[3];
-      vals[i][j] = new double[maxcomp * v->NbTimeStep];
+      vals[i][j] = new double[maxcomp * data1->getNumTimeSteps()];
       getPoint(i, j, pnts[i][j]);
     }
   }
@@ -364,24 +369,24 @@ Post_View * GMSH_CutGridPlugin::GenerateView(Post_View * v, int connect)
     for(int i = 0; i < getNbU(); i++)
       for(int j = 0; j < getNbV(); j++)
 	o.searchScalar(pnts[i][j][0], pnts[i][j][1], pnts[i][j][2], vals[i][j]);
-    addInView(v, connect, 1, pnts, vals,
-	      View->SP, &View->NbSP, View->SL, &View->NbSL, View->SQ, &View->NbSQ);
+    addInView(data1, connect, 1, pnts, vals, data2->SP, &data2->NbSP, data2->SL, 
+	      &data2->NbSL, data2->SQ, &data2->NbSQ);
   }
 
   if(nbv){
     for(int i = 0; i < getNbU(); i++)
       for(int j = 0; j < getNbV(); j++)
 	o.searchVector(pnts[i][j][0], pnts[i][j][1], pnts[i][j][2], vals[i][j]);
-    addInView(v, connect, 3, pnts, vals,
-	      View->VP, &View->NbVP, View->VL, &View->NbVL, View->VQ, &View->NbVQ);
+    addInView(data1, connect, 3, pnts, vals, data2->VP, &data2->NbVP, data2->VL, 
+	      &data2->NbVL, data2->VQ, &data2->NbVQ);
   }
 
   if(nbt){
     for(int i = 0; i < getNbU(); i++)
       for(int j = 0; j < getNbV(); j++)
 	o.searchTensor(pnts[i][j][0], pnts[i][j][1], pnts[i][j][2], vals[i][j]);
-    addInView(v, connect, 9, pnts, vals,
-	      View->TP, &View->NbTP, View->TL, &View->NbTL, View->TQ, &View->NbTQ);
+    addInView(data1, connect, 9, pnts, vals, data2->TP, &data2->NbTP, data2->TL,
+	      &data2->NbTL, data2->TQ, &data2->NbTQ);
   }
 
   for(int i = 0; i < getNbU(); i++){
@@ -395,30 +400,21 @@ Post_View * GMSH_CutGridPlugin::GenerateView(Post_View * v, int connect)
   delete [] pnts;
   delete [] vals;
 
-  char name[1024], filename[1024];
-  sprintf(name, "%s_CutGrid", v->Name);
-  sprintf(filename, "%s_CutGrid.pos", v->Name);
-  EndView(View, v->NbTimeStep, filename, name);
 
-  return View;
+  data2->setName(data1->getName() + "_CutGrid");
+  data2->setFileName(data1->getName() + "_CutGrid.pos");
+  data2->finalize();
 
-  */
+  return v2;
 }
 
-Post_View *GMSH_CutGridPlugin::execute(Post_View * v)
+PView *GMSH_CutGridPlugin::execute(PView *v)
 {
   int connectPoints = (int)CutGridOptions_Number[11].def;
   int iView = (int)CutGridOptions_Number[12].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
   return GenerateView(v1, connectPoints);
 }
diff --git a/Plugin/CutGrid.h b/Plugin/CutGrid.h
index 10b95522c0a8fb9bf7bfaf978d68bc8c3e9ba634..83746ad28607845f117c3990a7c82527fc8859d2 100644
--- a/Plugin/CutGrid.h
+++ b/Plugin/CutGrid.h
@@ -31,12 +31,12 @@ class GMSH_CutGridPlugin : public GMSH_Post_Plugin
 {
   static double callback(int num, int action, double value, double *opt,
 			 double step, double min, double max);
-  void addInView(Post_View *v, int connect, int nbcomp, 
+  void addInView(PViewDataList *data, int connect, int nbcomp, 
 		 double ***pnts, double ***vals, 
 		 List_T *P, int *nP, 
 		 List_T *L, int *nL, 
 		 List_T *Q, int *nQ);
-  Post_View * GenerateView (Post_View * v, int connectPoints);
+  PView *GenerateView (PView *v, int connectPoints);
 public:
   GMSH_CutGridPlugin();
   void getName  (char *name) const;
@@ -46,7 +46,7 @@ public:
   void catchErrorMessage (char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber *getOption (int iopt);  
-  Post_View *execute (Post_View *);
+  PView *execute (PView *);
 
   static int getNbU ();
   static int getNbV ();
diff --git a/Plugin/CutMap.cpp b/Plugin/CutMap.cpp
index 0da3c707271c9c15fcdaa679cd708612f09df7c3..e4a808cd705c7ef244ef24c2efa6e2cb6c66198e 100644
--- a/Plugin/CutMap.cpp
+++ b/Plugin/CutMap.cpp
@@ -1,4 +1,4 @@
-// $Id: CutMap.cpp,v 1.53 2007-05-04 10:45:08 geuzaine Exp $
+// $Id: CutMap.cpp,v 1.54 2007-09-11 14:01:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -20,7 +20,6 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include "CutMap.h"
-#include "List.h"
 #include "Context.h"
 
 extern Context_T CTX;
@@ -54,14 +53,13 @@ double GMSH_CutMapPlugin::callbackA(int num, int action, double value)
   if(action > 0){
     int iview = (int)CutMapOptions_Number[6].def;
     if(iview < 0) iview = num;
-    Post_View **vv = (Post_View **)List_Pointer_Test(CTX.post.list, iview);
-    if(vv){
-      min = (*vv)->Min;
-      max = (*vv)->Max;
+    if(iview >= 0 && iview < PView::list.size()){
+      min = PView::list[iview]->getData()->getMin();
+      max = PView::list[iview]->getData()->getMax();
     }
   }
   switch(action){ // configure the input field
-  case 1: return (min-max)/200.;
+  case 1: return (min - max) / 200.;
   case 2: return min;
   case 3: return max;
   default: break;
@@ -153,7 +151,7 @@ double GMSH_CutMapPlugin::levelset(double x, double y, double z, double val) con
   return val - CutMapOptions_Number[0].def;
 }
 
-Post_View *GMSH_CutMapPlugin::execute(Post_View * v)
+PView *GMSH_CutMapPlugin::execute(PView *v)
 {
   int iView = (int)CutMapOptions_Number[6].def;
   _valueIndependent = 0;
@@ -164,15 +162,8 @@ Post_View *GMSH_CutMapPlugin::execute(Post_View * v)
   _targetError = CutMapOptions_Number[5].def;
   _orientation = GMSH_LevelsetPlugin::MAP;
   
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-  
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-  
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
   return GMSH_LevelsetPlugin::execute(v1);
 }
diff --git a/Plugin/CutMap.h b/Plugin/CutMap.h
index e45f2d5dc5b037b701ee71fb8e9149c4723017da..def7eb068d0e165addf1c6808445274cb8c0ae76 100644
--- a/Plugin/CutMap.h
+++ b/Plugin/CutMap.h
@@ -37,7 +37,7 @@ class GMSH_CutMapPlugin : public GMSH_LevelsetPlugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption (int iopt);  
-  Post_View *execute (Post_View *);
+  PView *execute (PView *);
   static double callbackA(int, int, double);
   static double callbackVol(int, int, double);
   static double callbackRecur(int, int, double);
diff --git a/Plugin/CutParametric.cpp b/Plugin/CutParametric.cpp
index d40d53706bbf5f67030f1a4c515b8d485368fe82..84be40e861ee2e2d13c6782681675d4a959ef7c6 100644
--- a/Plugin/CutParametric.cpp
+++ b/Plugin/CutParametric.cpp
@@ -1,4 +1,4 @@
-// $Id: CutParametric.cpp,v 1.21 2007-09-10 04:47:08 geuzaine Exp $
+// $Id: CutParametric.cpp,v 1.22 2007-09-11 14:01:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,11 +19,10 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <math.h>
 #include "OctreePost.h"
 #include "CutParametric.h"
-#include "List.h"
 #include "Context.h"
-#include <math.h>
 
 #if defined(HAVE_FLTK)
 #include "GmshUI.h"
@@ -290,76 +289,77 @@ static void addInView(int connect, int i, int nbcomp, int nbtime,
   }
 }
 
-Post_View *GMSH_CutParametricPlugin::execute(Post_View * v)
+PView *GMSH_CutParametricPlugin::execute(PView *v)
 {
   int iView = (int)CutParametricOptions_Number[4].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
 
   if(!fillXYZ())
     return v;
 
-  Msg(FATAL, "XXXXXXXXXXXXXXX");
-  return 0;
-
-  /*
   int nbU = (int)CutParametricOptions_Number[2].def;
   int connect = (int)CutParametricOptions_Number[3].def;
   if(nbU < 2) connect = 0;
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
   OctreePost o(v1);
 
-  Post_View *v2 = BeginView(1);
-  double *res0 = new double[9*v1->NbTimeStep];
-  double *res1 = new double[9*v1->NbTimeStep];
+  PView *v2 = new PView(true);
+
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
+
+  double *res0 = new double[9 * data1->getNumTimeSteps()];
+  double *res1 = new double[9 * data1->getNumTimeSteps()];
   double x0 = 0., y0 = 0., z0 = 0., x1 = 0., y1 = 0., z1 = 0.;
 
-  for(int k = 0; k < 9*v1->NbTimeStep; ++k) res0[k] = res1[k] = 0.;
+  for(int k = 0; k < 9 * data1->getNumTimeSteps(); ++k) res0[k] = res1[k] = 0.;
 
   for(int i = 0; i < nbU; ++i){
     if(i && connect){
       x0 = x1;
       y0 = y1;
       z0 = z1;
-      for(int k = 0; k < 9*v1->NbTimeStep; ++k) res0[k] = res1[k];
+      for(int k = 0; k < 9 * data1->getNumTimeSteps(); ++k) res0[k] = res1[k];
     }
 
     x1 = x[i];
     y1 = y[i];
     z1 = z[i];
 
-    if(v1->NbST || v1->NbSQ || v1->NbSS || v1->NbSH || v1->NbSI || v1->NbSY){
+    if(data1->NbST || data1->NbSQ || data1->NbSS || 
+       data1->NbSH || data1->NbSI || data1->NbSY){
       o.searchScalar(x1, y1, z1, res1);
-      addInView(connect, i, 1, v1->NbTimeStep, x0, y0, z0, res0, x1, y1, z1, res1,
-		v2->SP, &v2->NbSP, v2->SL, &v2->NbSL);
+      addInView(connect, i, 1, data1->getNumTimeSteps(), 
+		x0, y0, z0, res0, x1, y1, z1, res1,
+		data2->SP, &data2->NbSP, data2->SL, &data2->NbSL);
     }
-    if(v1->NbVT || v1->NbVQ || v1->NbVS || v1->NbVH || v1->NbVI || v1->NbVY){
+    if(data1->NbVT || data1->NbVQ || data1->NbVS || 
+       data1->NbVH || data1->NbVI || data1->NbVY){
       o.searchVector(x1, y1, z1, res1);
-      addInView(connect, i, 3, v1->NbTimeStep, x0, y0, z0, res0, x1, y1, z1, res1,
-		v2->VP, &v2->NbVP, v2->VL, &v2->NbVL);
+      addInView(connect, i, 3, data1->getNumTimeSteps(), 
+		x0, y0, z0, res0, x1, y1, z1, res1,
+		data2->VP, &data2->NbVP, data2->VL, &data2->NbVL);
     }
-    if(v1->NbTT || v1->NbTQ || v1->NbTS || v1->NbTH || v1->NbTI || v1->NbTY){
+    if(data1->NbTT || data1->NbTQ || data1->NbTS ||
+       data1->NbTH || data1->NbTI || data1->NbTY){
       o.searchTensor(x1, y1, z1, res1);
-      addInView(connect, i, 9, v1->NbTimeStep, x0, y0, z0, res0, x1, y1, z1, res1,
-		v2->TP, &v2->NbTP, v2->TL, &v2->NbTL);
+      addInView(connect, i, 9, data1->getNumTimeSteps(),
+		x0, y0, z0, res0, x1, y1, z1, res1,
+		data2->TP, &data2->NbTP, data2->TL, &data2->NbTL);
     }
   }
-
-  char name[1024], filename[1024];
-  sprintf(name, "%s_CutParametric", v1->Name);
-  sprintf(filename, "%s_CutParametric.pos", v1->Name);
-  EndView(v2, 1, filename, name);
-
+    
   delete [] res0;
   delete [] res1;
 
+  data2->setName(data1->getName() + "_CutParametric");
+  data2->setFileName(data1->getName() + "_CutParametric.pos");
+  data2->finalize();
+
   return v2;
-  */
 }
diff --git a/Plugin/CutParametric.h b/Plugin/CutParametric.h
index 3a8f0056971d57dbdf14880ddd6285352c568dd5..c6158e8ca55c7de3ecefe2d91fa027eaad6bc3b6 100644
--- a/Plugin/CutParametric.h
+++ b/Plugin/CutParametric.h
@@ -40,16 +40,14 @@ private:
   static std::vector<double> x, y, z;
 public:
   GMSH_CutParametricPlugin();
-  void getName  (char *name) const;
-  void getInfos (char *author, 
-  		 char *copyright,
-  		 char *help_text) const;
-  void catchErrorMessage (char *errorMessage) const;
+  void getName(char *name) const;
+  void getInfos(char *author, char *copyright, char *help_text) const;
+  void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
-  StringXNumber *getOption (int iopt);  
+  StringXNumber *getOption(int iopt);  
   int getNbOptionsStr() const;
   StringXString* getOptionStr(int iopt);  
-  Post_View *execute (Post_View *);
+  PView *execute(PView *);
 
   static double callbackMinU(int, int, double);
   static double callbackMaxU(int, int, double);
diff --git a/Plugin/CutPlane.cpp b/Plugin/CutPlane.cpp
index c1b2dc7b6323662ae35c442943e9ef76357f37ef..cf6cc4459f8091d85e62ee62487ef2d04eb5f18f 100644
--- a/Plugin/CutPlane.cpp
+++ b/Plugin/CutPlane.cpp
@@ -1,4 +1,4 @@
-// $Id: CutPlane.cpp,v 1.52 2007-05-04 10:45:08 geuzaine Exp $
+// $Id: CutPlane.cpp,v 1.53 2007-09-11 14:01:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -61,16 +61,17 @@ void GMSH_CutPlanePlugin::draw()
 #if defined(HAVE_FLTK)
   int num = (int)CutPlaneOptions_Number[7].def;
   if(num < 0) num = iview;
-  Post_View **vv = (Post_View **)List_Pointer_Test(CTX.post.list, num);
-  if(!vv) return;
-  glColor4ubv((GLubyte *) & CTX.color.fg);
-  glLineWidth(CTX.line_width);
-  Draw_PlaneInBoundingBox((*vv)->BBox[0], (*vv)->BBox[2], (*vv)->BBox[4],
-			  (*vv)->BBox[1], (*vv)->BBox[3], (*vv)->BBox[5],
-			  CutPlaneOptions_Number[0].def,
-			  CutPlaneOptions_Number[1].def,
-			  CutPlaneOptions_Number[2].def,
-			  CutPlaneOptions_Number[3].def);
+  if(num >= 0 && num < PView::list.size()){
+    glColor4ubv((GLubyte *) & CTX.color.fg);
+    glLineWidth(CTX.line_width);
+    SBoundingBox3d bb = PView::list[num]->getData()->getBoundingBox();
+    Draw_PlaneInBoundingBox(bb.min().x(), bb.min().y(), bb.min().z(), 
+			    bb.max().x(), bb.max().y(), bb.max().z(), 
+			    CutPlaneOptions_Number[0].def,
+			    CutPlaneOptions_Number[1].def,
+			    CutPlaneOptions_Number[2].def,
+			    CutPlaneOptions_Number[3].def);
+  }
 #endif
 }
 
@@ -176,19 +177,19 @@ double GMSH_CutPlanePlugin::levelset(double x, double y, double z, double val) c
     CutPlaneOptions_Number[2].def * z + CutPlaneOptions_Number[3].def;
 }
 
-bool GMSH_CutPlanePlugin::geometrical_filter(Double_Matrix *geometrical_nodes_positions) const
+bool GMSH_CutPlanePlugin::geometricalFilter(Double_Matrix *node_positions) const
 {
-  const double l0 = levelset((*geometrical_nodes_positions)(0,0),
-			     (*geometrical_nodes_positions)(0,1),
-			     (*geometrical_nodes_positions)(0,2),1);
-  for (int i=1;i<geometrical_nodes_positions->size1();i++)
-    if (levelset((*geometrical_nodes_positions)(i,0),
-		 (*geometrical_nodes_positions)(i,1),
-		 (*geometrical_nodes_positions)(i,2),1) * l0 < 0) return true;
+  const double l0 = levelset((*node_positions)(0, 0),
+			     (*node_positions)(0, 1),
+			     (*node_positions)(0, 2), 1);
+  for (int i = 1; i < node_positions->size1(); i++)
+    if (levelset((*node_positions)(i, 0),
+		 (*node_positions)(i, 1),
+		 (*node_positions)(i, 2), 1) * l0 < 0) return true;
   return false;
 }
 
-Post_View *GMSH_CutPlanePlugin::execute(Post_View * v)
+PView *GMSH_CutPlanePlugin::execute(PView *v)
 {
   int iView = (int)CutPlaneOptions_Number[7].def;
   _ref[0] = CutPlaneOptions_Number[0].def;
@@ -202,15 +203,8 @@ Post_View *GMSH_CutPlanePlugin::execute(Post_View * v)
   _recurLevel = (int)CutPlaneOptions_Number[5].def;
   _targetError = CutPlaneOptions_Number[6].def;
   
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-  
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-  
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
   return GMSH_LevelsetPlugin::execute(v1);
 }
diff --git a/Plugin/CutPlane.h b/Plugin/CutPlane.h
index 676c0eb9854b38d204713ab7cfd89501b92e889a..1960565bf86d8122cbe4ee50fe7272aedac673e2 100644
--- a/Plugin/CutPlane.h
+++ b/Plugin/CutPlane.h
@@ -40,8 +40,8 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber *getOption(int iopt);  
-  Post_View *execute(Post_View *);
-  virtual bool geometrical_filter ( Double_Matrix * geometrical_nodes_positions ) const;
+  PView *execute(PView *);
+  virtual bool geometricalFilter(Double_Matrix *) const;
 
   static double callbackA(int, int, double);
   static double callbackB(int, int, double);
diff --git a/Plugin/CutSphere.cpp b/Plugin/CutSphere.cpp
index b4778bda6f8d0336052e86990be0f63acf0cedc9..9d8a6f41be8fbdf9f4acde819e4b8a2f83981e17 100644
--- a/Plugin/CutSphere.cpp
+++ b/Plugin/CutSphere.cpp
@@ -1,4 +1,4 @@
-// $Id: CutSphere.cpp,v 1.47 2007-05-04 10:45:08 geuzaine Exp $
+// $Id: CutSphere.cpp,v 1.48 2007-09-11 14:01:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -176,7 +176,7 @@ double GMSH_CutSpherePlugin::levelset(double x, double y, double z,
   return (x - a) * (x - a) + (y - b) * (y - b) + (z - c) * (z - c) - r * r;
 }
 
-Post_View *GMSH_CutSpherePlugin::execute(Post_View * v)
+PView *GMSH_CutSpherePlugin::execute(PView *v)
 {
   int iView = (int)CutSphereOptions_Number[6].def;
   _ref[0] = CutSphereOptions_Number[0].def;
@@ -190,15 +190,8 @@ Post_View *GMSH_CutSpherePlugin::execute(Post_View * v)
   _valueTimeStep = -1;
   _orientation = GMSH_LevelsetPlugin::SPHERE;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
   return GMSH_LevelsetPlugin::execute(v1);
 }
diff --git a/Plugin/CutSphere.h b/Plugin/CutSphere.h
index 235e7fa0d3a0fbbb1ab4cc59754c662ca20f878c..994919f047394d4e1a2fc8ee21ba355e953bd8c1 100644
--- a/Plugin/CutSphere.h
+++ b/Plugin/CutSphere.h
@@ -39,7 +39,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 
   static double callbackX(int, int, double);
   static double callbackY(int, int, double);
diff --git a/Plugin/Divergence.cpp b/Plugin/Divergence.cpp
index ad324523962c9dbce0b6ed495e9cba54271f665c..7152eb5e4f1ffa9a617c77f5d61d7c7db321a793 100644
--- a/Plugin/Divergence.cpp
+++ b/Plugin/Divergence.cpp
@@ -1,4 +1,4 @@
-// $Id: Divergence.cpp,v 1.4 2007-05-04 10:45:08 geuzaine Exp $
+// $Id: Divergence.cpp,v 1.5 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,16 +19,9 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Divergence.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
 #include "ShapeFunctions.h"
 
-extern Context_T CTX;
-
 StringXNumber DivergenceOptions_Number[] = {
   {GMSH_FULLRC, "iView", NULL, -1.}
 };
@@ -108,37 +101,35 @@ static void divergence(int inNb, List_T *inList, int *outNb, List_T *outList,
   }
 }
 
-Post_View *GMSH_DivergencePlugin::execute(Post_View * v)
+PView *GMSH_DivergencePlugin::execute(PView *v)
 {
   int iView = (int)DivergenceOptions_Number[0].def;
   
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-  
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-  
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
-
-  divergence(v1->NbVL, v1->VL, &v2->NbSL, v2->SL, 1, 2, v1->NbTimeStep);
-  divergence(v1->NbVT, v1->VT, &v2->NbST, v2->ST, 2, 3, v1->NbTimeStep);
-  divergence(v1->NbVQ, v1->VQ, &v2->NbSQ, v2->SQ, 2, 4, v1->NbTimeStep);
-  divergence(v1->NbVS, v1->VS, &v2->NbSS, v2->SS, 3, 4, v1->NbTimeStep);
-  divergence(v1->NbVH, v1->VH, &v2->NbSH, v2->SH, 3, 8, v1->NbTimeStep);
-  divergence(v1->NbVI, v1->VI, &v2->NbSI, v2->SI, 3, 6, v1->NbTimeStep);
-  divergence(v1->NbVY, v1->VY, &v2->NbSY, v2->SY, 3, 5, v1->NbTimeStep);
-
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++)
-    List_Add(v2->Time, List_Pointer(v1->Time, i));
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_Divergence", v1->Name);
-  sprintf(filename, "%s_Divergence.pos", v1->Name);
-  EndView(v2, 1, filename, name);
-  
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *v2 = new PView(true);
+
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
+
+  int nts = data1->getNumTimeSteps();
+  divergence(data1->NbVL, data1->VL, &data2->NbSL, data2->SL, 1, 2, nts);
+  divergence(data1->NbVT, data1->VT, &data2->NbST, data2->ST, 2, 3, nts);
+  divergence(data1->NbVQ, data1->VQ, &data2->NbSQ, data2->SQ, 2, 4, nts);
+  divergence(data1->NbVS, data1->VS, &data2->NbSS, data2->SS, 3, 4, nts);
+  divergence(data1->NbVH, data1->VH, &data2->NbSH, data2->SH, 3, 8, nts);
+  divergence(data1->NbVI, data1->VI, &data2->NbSI, data2->SI, 3, 6, nts);
+  divergence(data1->NbVY, data1->VY, &data2->NbSY, data2->SY, 3, 5, nts);
+
+  for(int i = 0; i < List_Nbr(data1->Time); i++)
+    List_Add(data2->Time, List_Pointer(data1->Time, i));
+  data2->setName(data1->getName() + "_Divergence");
+  data2->setFileName(data1->getName() + "_Divergence.pos");
+  data2->finalize();
+
   return v2;
 }
diff --git a/Plugin/Divergence.h b/Plugin/Divergence.h
index 2fbbe64c44cdb68e3fe457cefa9329cf211508d6..b5b8135c28ebce25044de4ce36b66a43313e17f7 100644
--- a/Plugin/Divergence.h
+++ b/Plugin/Divergence.h
@@ -36,7 +36,7 @@ class GMSH_DivergencePlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Eigenvalues.cpp b/Plugin/Eigenvalues.cpp
index 4fb91b051a6bca92dd14ad098b65beab99baaeba..68726123950f2716bb77979a72ffb16b98538341 100644
--- a/Plugin/Eigenvalues.cpp
+++ b/Plugin/Eigenvalues.cpp
@@ -1,4 +1,4 @@
-// $Id: Eigenvalues.cpp,v 1.4 2007-05-04 10:45:08 geuzaine Exp $
+// $Id: Eigenvalues.cpp,v 1.5 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,16 +19,9 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Eigenvalues.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Malloc.h"
 #include "Numeric.h"
 
-extern Context_T CTX;
-
 StringXNumber EigenvaluesOptions_Number[] = {
   {GMSH_FULLRC, "iView", NULL, -1.}
 };
@@ -114,57 +107,55 @@ static void eigenvalues(List_T *inList, int inNb,
   }
 }
 
-Post_View *GMSH_EigenvaluesPlugin::execute(Post_View * v)
+PView *GMSH_EigenvaluesPlugin::execute(PView *v)
 {
   int iView = (int)EigenvaluesOptions_Number[0].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *min = BeginView(1);
-  Post_View *mid = BeginView(1);
-  Post_View *max = BeginView(1);
-
-  eigenvalues(v1->TP, v1->NbTP, 1, v1->NbTimeStep,
-	      min->SP, &min->NbSP, mid->SP, &mid->NbSP, max->SP, &max->NbSP);
-  eigenvalues(v1->TL, v1->NbTL, 2, v1->NbTimeStep,
-	      min->SL, &min->NbSL, mid->SL, &mid->NbSL, max->SL, &max->NbSL);
-  eigenvalues(v1->TT, v1->NbTT, 3, v1->NbTimeStep,
-	      min->ST, &min->NbST, mid->ST, &mid->NbST, max->ST, &max->NbST);
-  eigenvalues(v1->TQ, v1->NbTQ, 4, v1->NbTimeStep,
-	      min->SQ, &min->NbSQ, mid->SQ, &mid->NbSQ, max->SQ, &max->NbSQ);
-  eigenvalues(v1->TS, v1->NbTS, 4, v1->NbTimeStep,
-	      min->SS, &min->NbSS, mid->SS, &mid->NbSS, max->SS, &max->NbSS);
-  eigenvalues(v1->TH, v1->NbTH, 8, v1->NbTimeStep,
-	      min->SH, &min->NbSH, mid->SH, &mid->NbSH, max->SH, &max->NbSH);
-  eigenvalues(v1->TI, v1->NbTI, 6, v1->NbTimeStep,
-	      min->SI, &min->NbSI, mid->SI, &mid->NbSI, max->SI, &max->NbSI);
-  eigenvalues(v1->TY, v1->NbTY, 5, v1->NbTimeStep,
-	      min->SY, &min->NbSY, mid->SY, &mid->NbSY, max->SY, &max->NbSY);
-
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++){
-    List_Add(min->Time, List_Pointer(v1->Time, i));
-    List_Add(mid->Time, List_Pointer(v1->Time, i));
-    List_Add(max->Time, List_Pointer(v1->Time, i));
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *min = new PView(true);
+  PView *mid = new PView(true);
+  PView *max = new PView(true);
+
+  PViewDataList *dmin = getDataList(min);
+  PViewDataList *dmid = getDataList(mid);
+  PViewDataList *dmax = getDataList(max);
+
+  eigenvalues(data1->TP, data1->NbTP, 1, data1->getNumTimeSteps(),
+	      dmin->SP, &dmin->NbSP, dmid->SP, &dmid->NbSP, dmax->SP, &dmax->NbSP);
+  eigenvalues(data1->TL, data1->NbTL, 2, data1->getNumTimeSteps(),
+	      dmin->SL, &dmin->NbSL, dmid->SL, &dmid->NbSL, dmax->SL, &dmax->NbSL);
+  eigenvalues(data1->TT, data1->NbTT, 3, data1->getNumTimeSteps(),
+	      dmin->ST, &dmin->NbST, dmid->ST, &dmid->NbST, dmax->ST, &dmax->NbST);
+  eigenvalues(data1->TQ, data1->NbTQ, 4, data1->getNumTimeSteps(),
+	      dmin->SQ, &dmin->NbSQ, dmid->SQ, &dmid->NbSQ, dmax->SQ, &dmax->NbSQ);
+  eigenvalues(data1->TS, data1->NbTS, 4, data1->getNumTimeSteps(),
+	      dmin->SS, &dmin->NbSS, dmid->SS, &dmid->NbSS, dmax->SS, &dmax->NbSS);
+  eigenvalues(data1->TH, data1->NbTH, 8, data1->getNumTimeSteps(),
+	      dmin->SH, &dmin->NbSH, dmid->SH, &dmid->NbSH, dmax->SH, &dmax->NbSH);
+  eigenvalues(data1->TI, data1->NbTI, 6, data1->getNumTimeSteps(),
+	      dmin->SI, &dmin->NbSI, dmid->SI, &dmid->NbSI, dmax->SI, &dmax->NbSI);
+  eigenvalues(data1->TY, data1->NbTY, 5, data1->getNumTimeSteps(),
+	      dmin->SY, &dmin->NbSY, dmid->SY, &dmid->NbSY, dmax->SY, &dmax->NbSY);
+
+  for(int i = 0; i < List_Nbr(data1->Time); i++){
+    List_Add(dmin->Time, List_Pointer(data1->Time, i));
+    List_Add(dmid->Time, List_Pointer(data1->Time, i));
+    List_Add(dmax->Time, List_Pointer(data1->Time, i));
   }
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_MinEigenvalues", v1->Name);
-  sprintf(filename, "%s_MinEigenvalues.pos", v1->Name);
-  EndView(min, 1, filename, name);
-  sprintf(name, "%s_MidEigenvalue", v1->Name);
-  sprintf(filename, "%s_MidEigenvalues.pos", v1->Name);
-  EndView(mid, 1, filename, name);
-  sprintf(name, "%s_MaxEigenvalue", v1->Name);
-  sprintf(filename, "%s_MaxEigenvalues.pos", v1->Name);
-  EndView(max, 1, filename, name);
-
-  return NULL;
+  dmin->setName(data1->getName() + "_MinEigenvalues");
+  dmin->setFileName(data1->getName() + "_MinEigenvalues.pos");
+  dmin->finalize();
+  dmid->setName(data1->getName() + "_MidEigenvalues");
+  dmid->setFileName(data1->getName() + "_MidEigenvalues.pos");
+  dmid->finalize();
+  dmax->setName(data1->getName() + "_MaxEigenvalues");
+  dmax->setFileName(data1->getName() + "_MaxEigenvalues.pos");
+  dmax->finalize();
+
+  return 0;
 }
diff --git a/Plugin/Eigenvalues.h b/Plugin/Eigenvalues.h
index bf9dc90f13004f392c41d22bc98160f872fd002f..24488bf62735087f19bab6f6ff4882a13dd9397f 100644
--- a/Plugin/Eigenvalues.h
+++ b/Plugin/Eigenvalues.h
@@ -21,7 +21,6 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include "Plugin.h"
-#include "List.h"
 
 extern "C"
 {
@@ -37,7 +36,7 @@ class GMSH_EigenvaluesPlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Eigenvectors.cpp b/Plugin/Eigenvectors.cpp
index 884280e3222667ce84daa8363a2c60e9251b8d2f..e18df2460b47d04813cdf8b95bd86bdd79026224 100644
--- a/Plugin/Eigenvectors.cpp
+++ b/Plugin/Eigenvectors.cpp
@@ -1,4 +1,4 @@
-// $Id: Eigenvectors.cpp,v 1.8 2007-05-04 10:45:08 geuzaine Exp $
+// $Id: Eigenvectors.cpp,v 1.9 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,17 +19,10 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Eigenvectors.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Malloc.h"
 #include "Numeric.h"
 #include "EigSolve.h"
 
-extern Context_T CTX;
-
 StringXNumber EigenvectorsOptions_Number[] = {
   {GMSH_FULLRC, "ScaleByEigenvalues", NULL, 1.},
   {GMSH_FULLRC, "iView", NULL, -1.}
@@ -139,58 +132,56 @@ static void eigenvectors(List_T *inList, int inNb,
     Msg(GERROR, "%d tensors have complex eigenvalues/eigenvectors", nbcomplex);
 }
 
-Post_View *GMSH_EigenvectorsPlugin::execute(Post_View * v)
+PView *GMSH_EigenvectorsPlugin::execute(PView *v)
 {
   int scale = (int)EigenvectorsOptions_Number[0].def;
   int iView = (int)EigenvectorsOptions_Number[1].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *min = new PView(true);
+  PView *mid = new PView(true);
+  PView *max = new PView(true);
+
+  PViewDataList *dmin = getDataList(min);
+  PViewDataList *dmid = getDataList(mid);
+  PViewDataList *dmax = getDataList(max);
+
+  eigenvectors(data1->TP, data1->NbTP, 1, data1->getNumTimeSteps(), scale,
+	       dmin->VP, &dmin->NbVP, dmid->VP, &dmid->NbVP, dmax->VP, &dmax->NbVP);
+  eigenvectors(data1->TL, data1->NbTL, 2, data1->getNumTimeSteps(), scale,
+	       dmin->VL, &dmin->NbVL, dmid->VL, &dmid->NbVL, dmax->VL, &dmax->NbVL);
+  eigenvectors(data1->TT, data1->NbTT, 3, data1->getNumTimeSteps(), scale,
+	       dmin->VT, &dmin->NbVT, dmid->VT, &dmid->NbVT, dmax->VT, &dmax->NbVT);
+  eigenvectors(data1->TQ, data1->NbTQ, 4, data1->getNumTimeSteps(), scale,
+	       dmin->VQ, &dmin->NbVQ, dmid->VQ, &dmid->NbVQ, dmax->VQ, &dmax->NbVQ);
+  eigenvectors(data1->TS, data1->NbTS, 4, data1->getNumTimeSteps(), scale,
+	       dmin->VS, &dmin->NbVS, dmid->VS, &dmid->NbVS, dmax->VS, &dmax->NbVS);
+  eigenvectors(data1->TH, data1->NbTH, 8, data1->getNumTimeSteps(), scale,
+	       dmin->VH, &dmin->NbVH, dmid->VH, &dmid->NbVH, dmax->VH, &dmax->NbVH);
+  eigenvectors(data1->TI, data1->NbTI, 6, data1->getNumTimeSteps(), scale,
+	       dmin->VI, &dmin->NbVI, dmid->VI, &dmid->NbVI, dmax->VI, &dmax->NbVI);
+  eigenvectors(data1->TY, data1->NbTY, 5, data1->getNumTimeSteps(), scale,
+	       dmin->VY, &dmin->NbVY, dmid->VY, &dmid->NbVY, dmax->VY, &dmax->NbVY);
+
+  for(int i = 0; i < List_Nbr(data1->Time); i++){
+    List_Add(dmin->Time, List_Pointer(data1->Time, i));
+    List_Add(dmid->Time, List_Pointer(data1->Time, i));
+    List_Add(dmax->Time, List_Pointer(data1->Time, i));
   }
+  dmin->setName(data1->getName() + "_MinEigenvectors");
+  dmin->setFileName(data1->getName() + "_MinEigenvectors.pos");
+  dmin->finalize();
+  dmid->setName(data1->getName() + "_MidEigenvectors");
+  dmid->setFileName(data1->getName() + "_MidEigenvectors.pos");
+  dmid->finalize();
+  dmax->setName(data1->getName() + "_MaxEigenvectors");
+  dmax->setFileName(data1->getName() + "_MaxEigenvectors.pos");
+  dmax->finalize();
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *min = BeginView(1);
-  Post_View *mid = BeginView(1);
-  Post_View *max = BeginView(1);
-
-  eigenvectors(v1->TP, v1->NbTP, 1, v1->NbTimeStep, scale,
-	       min->VP, &min->NbVP, mid->VP, &mid->NbVP, max->VP, &max->NbVP);
-  eigenvectors(v1->TL, v1->NbTL, 2, v1->NbTimeStep, scale,
-	       min->VL, &min->NbVL, mid->VL, &mid->NbVL, max->VL, &max->NbVL);
-  eigenvectors(v1->TT, v1->NbTT, 3, v1->NbTimeStep, scale,
-	       min->VT, &min->NbVT, mid->VT, &mid->NbVT, max->VT, &max->NbVT);
-  eigenvectors(v1->TQ, v1->NbTQ, 4, v1->NbTimeStep, scale,
-	       min->VQ, &min->NbVQ, mid->VQ, &mid->NbVQ, max->VQ, &max->NbVQ);
-  eigenvectors(v1->TS, v1->NbTS, 4, v1->NbTimeStep, scale,
-	       min->VS, &min->NbVS, mid->VS, &mid->NbVS, max->VS, &max->NbVS);
-  eigenvectors(v1->TH, v1->NbTH, 8, v1->NbTimeStep, scale,
-	       min->VH, &min->NbVH, mid->VH, &mid->NbVH, max->VH, &max->NbVH);
-  eigenvectors(v1->TI, v1->NbTI, 6, v1->NbTimeStep, scale,
-	       min->VI, &min->NbVI, mid->VI, &mid->NbVI, max->VI, &max->NbVI);
-  eigenvectors(v1->TY, v1->NbTY, 5, v1->NbTimeStep, scale,
-	       min->VY, &min->NbVY, mid->VY, &mid->NbVY, max->VY, &max->NbVY);
-
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++){
-    List_Add(min->Time, List_Pointer(v1->Time, i));
-    List_Add(mid->Time, List_Pointer(v1->Time, i));
-    List_Add(max->Time, List_Pointer(v1->Time, i));
-  }
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_MinEigenvectors", v1->Name);
-  sprintf(filename, "%s_MinEigenvectors.pos", v1->Name);
-  EndView(min, 1, filename, name);
-  sprintf(name, "%s_MidEigenvector", v1->Name);
-  sprintf(filename, "%s_MidEigenvectors.pos", v1->Name);
-  EndView(mid, 1, filename, name);
-  sprintf(name, "%s_MaxEigenvector", v1->Name);
-  sprintf(filename, "%s_MaxEigenvectors.pos", v1->Name);
-  EndView(max, 1, filename, name);
-
-  return NULL;
+  return 0;
 }
diff --git a/Plugin/Eigenvectors.h b/Plugin/Eigenvectors.h
index b6a6275ef0245107ce63b81743985b4f25b14942..67bca856c3a00acfbd99abc9d37b5637788fd48c 100644
--- a/Plugin/Eigenvectors.h
+++ b/Plugin/Eigenvectors.h
@@ -21,7 +21,6 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include "Plugin.h"
-#include "List.h"
 
 extern "C"
 {
@@ -37,7 +36,7 @@ class GMSH_EigenvectorsPlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Evaluate.cpp b/Plugin/Evaluate.cpp
index b4f186577ec73e2859980b703e73efe4173b3774..17f26759f3a5d66a37990a0655b6546753310601 100644
--- a/Plugin/Evaluate.cpp
+++ b/Plugin/Evaluate.cpp
@@ -1,4 +1,4 @@
-// $Id: Evaluate.cpp,v 1.30 2007-09-10 04:47:08 geuzaine Exp $
+// $Id: Evaluate.cpp,v 1.31 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,19 +19,12 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Evaluate.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
 
 #if defined(HAVE_MATH_EVAL)
 #include "matheval.h"
 #endif
 
-extern Context_T CTX;
-
 StringXNumber EvaluateOptions_Number[] = {
   {GMSH_FULLRC, "Component", NULL, -1.},
   {GMSH_FULLRC, "TimeStep", NULL, -1.},
@@ -141,8 +134,8 @@ void GMSH_EvaluatePlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "Evaluate failed...");
 }
 
-void GMSH_EvaluatePlugin::evaluate(Post_View *v1, List_T *list1, int nbElm1,
-				   Post_View *v2, List_T *list2, int nbElm2,
+void GMSH_EvaluatePlugin::evaluate(PView *v1, List_T *list1, int nbElm1,
+				   PView *v2, List_T *list2, int nbElm2,
 				   int nbNod, int nbComp, int comp, 
 				   int timeStep1, int timeStep2,
 				   char *expression)
@@ -156,10 +149,6 @@ void GMSH_EvaluatePlugin::evaluate(Post_View *v1, List_T *list1, int nbElm1,
   if(!nbElm1)
     return;
 
-  Msg(FATAL, "XXXXXXXXXXXXXXXXXXXXXX");
-  return;
-
-  /*
   void *f = evaluator_create(expression);
 
   if(!f){
@@ -172,7 +161,7 @@ void GMSH_EvaluatePlugin::evaluate(Post_View *v1, List_T *list1, int nbElm1,
     _octree = new OctreePost(v2);
   }
 
-  v1->Changed = 1;
+  v1->setChanged(true);
 
   int nb = List_Nbr(list1) / nbElm1;
   int nb2 = nbElm2 ? List_Nbr(list2) / nbElm2 : 0;
@@ -211,7 +200,7 @@ void GMSH_EvaluatePlugin::evaluate(Post_View *v1, List_T *list1, int nbElm1,
 	for(int k = 0; k < nbComp; k++) w[k] = val2[k];
       }
       
-      double time = *(double*)List_Pointer(v1->Time, timeStep1);
+      double time = v1->getData()->getTime(timeStep1);
       double tstep = timeStep1; 
       char *names[] = { "x", "y", "z", "Time", "TimeStep",
 			"v", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8",
@@ -224,12 +213,10 @@ void GMSH_EvaluatePlugin::evaluate(Post_View *v1, List_T *list1, int nbElm1,
   }
 
   evaluator_destroy(f);
-
-  */
 #endif
 }
 
-Post_View *GMSH_EvaluatePlugin::execute(Post_View * v)
+PView *GMSH_EvaluatePlugin::execute(PView *v)
 {
   int comp = (int)EvaluateOptions_Number[0].def;
   int timeStep = (int)EvaluateOptions_Number[1].def;
@@ -238,44 +225,43 @@ Post_View *GMSH_EvaluatePlugin::execute(Post_View * v)
   int iView = (int)EvaluateOptions_Number[4].def;
   char *expr = EvaluateOptions_String[0].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
 
-  if(timeStep > v1->NbTimeStep - 1){
+  if(timeStep > data1->getNumTimeSteps() - 1){
     Msg(GERROR, "Invalid time step (%d) in View[%d]: using step 0 instead",
-	timeStep, v1->Index);
+	timeStep, v1->getIndex());
     timeStep = 0;
   }
 
-  Post_View *v2 = v1;
+  PView *v2 = v1;
 
   if(externalView >= 0){
-    if(!List_Pointer_Test(CTX.post.list, externalView))
+    if(externalView < PView::list.size())
       Msg(GERROR, "View[%d] does not exist: using self", externalView);
     else
-      v2 = *(Post_View **)List_Pointer(CTX.post.list, externalView);
+      v2 = PView::list[externalView];
   }
 
-  if(externalTimeStep < 0 && v2->NbTimeStep != v1->NbTimeStep){
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
+
+  if(externalTimeStep < 0 && data2->getNumTimeSteps() != data1->getNumTimeSteps()){
     Msg(GERROR, "Number of time steps don't match: using step 0");
     externalTimeStep = 0;
   }
-  else if(externalTimeStep > v2->NbTimeStep-1){
+  else if(externalTimeStep > data2->getNumTimeSteps() - 1){
     Msg(GERROR, "Invalid time step (%d) in View[%d]: using step 0 instead",
-	externalTimeStep, v2->Num);
+	externalTimeStep, v2->getIndex());
     externalTimeStep = 0;
   }
 
-  _octree = NULL;
+  _octree = 0;
 
-  for(int tt = 0; tt < v1->NbTimeStep; tt++){
+  for(int tt = 0; tt < data1->getNumTimeSteps(); tt++){
     if(timeStep < 0 || timeStep == tt){
 
       int t2;
@@ -284,38 +270,62 @@ Post_View *GMSH_EvaluatePlugin::execute(Post_View * v)
       else
 	t2 = externalTimeStep;
 
-      evaluate(v1, v1->SP, v1->NbSP, v2, v2->SP, v2->NbSP, 1, 1, 0, tt, t2, expr);
-      evaluate(v1, v1->SL, v1->NbSL, v2, v2->SL, v2->NbSL, 2, 1, 0, tt, t2, expr);
-      evaluate(v1, v1->ST, v1->NbST, v2, v2->ST, v2->NbST, 3, 1, 0, tt, t2, expr);
-      evaluate(v1, v1->SQ, v1->NbSQ, v2, v2->SQ, v2->NbSQ, 4, 1, 0, tt, t2, expr);      
-      evaluate(v1, v1->SS, v1->NbSS, v2, v2->SS, v2->NbSS, 4, 1, 0, tt, t2, expr);
-      evaluate(v1, v1->SH, v1->NbSH, v2, v2->SH, v2->NbSH, 8, 1, 0, tt, t2, expr);      
-      evaluate(v1, v1->SI, v1->NbSI, v2, v2->SI, v2->NbSI, 6, 1, 0, tt, t2, expr);
-      evaluate(v1, v1->SY, v1->NbSY, v2, v2->SY, v2->NbSY, 5, 1, 0, tt, t2, expr);
+      evaluate(v1, data1->SP, data1->NbSP, 
+	       v2, data2->SP, data2->NbSP, 1, 1, 0, tt, t2, expr);
+      evaluate(v1, data1->SL, data1->NbSL, 
+	       v2, data2->SL, data2->NbSL, 2, 1, 0, tt, t2, expr);
+      evaluate(v1, data1->ST, data1->NbST, 
+	       v2, data2->ST, data2->NbST, 3, 1, 0, tt, t2, expr);
+      evaluate(v1, data1->SQ, data1->NbSQ,
+	       v2, data2->SQ, data2->NbSQ, 4, 1, 0, tt, t2, expr);      
+      evaluate(v1, data1->SS, data1->NbSS, 
+	       v2, data2->SS, data2->NbSS, 4, 1, 0, tt, t2, expr);
+      evaluate(v1, data1->SH, data1->NbSH,
+	       v2, data2->SH, data2->NbSH, 8, 1, 0, tt, t2, expr);      
+      evaluate(v1, data1->SI, data1->NbSI, 
+	       v2, data2->SI, data2->NbSI, 6, 1, 0, tt, t2, expr);
+      evaluate(v1, data1->SY, data1->NbSY, 
+	       v2, data2->SY, data2->NbSY, 5, 1, 0, tt, t2, expr);
 
       for(int cc = 0; cc < 3; cc++){
 	if(comp < 0 || comp == cc){
-	  evaluate(v1, v1->VP, v1->NbVP, v2, v2->VP, v2->NbVP, 1, 3, cc, tt, t2, expr);
-	  evaluate(v1, v1->VL, v1->NbVL, v2, v2->VL, v2->NbVL, 2, 3, cc, tt, t2, expr);
-	  evaluate(v1, v1->VT, v1->NbVT, v2, v2->VT, v2->NbVT, 3, 3, cc, tt, t2, expr);
-	  evaluate(v1, v1->VQ, v1->NbVQ, v2, v2->VQ, v2->NbVQ, 4, 3, cc, tt, t2, expr);
-	  evaluate(v1, v1->VS, v1->NbVS, v2, v2->VS, v2->NbVS, 4, 3, cc, tt, t2, expr);
-	  evaluate(v1, v1->VH, v1->NbVH, v2, v2->VH, v2->NbVH, 8, 3, cc, tt, t2, expr);
-	  evaluate(v1, v1->VI, v1->NbVI, v2, v2->VI, v2->NbVI, 6, 3, cc, tt, t2, expr);
-	  evaluate(v1, v1->VY, v1->NbVY, v2, v2->VY, v2->NbVY, 5, 3, cc, tt, t2, expr);
+	  evaluate(v1, data1->VP, data1->NbVP, 
+		   v2, data2->VP, data2->NbVP, 1, 3, cc, tt, t2, expr);
+	  evaluate(v1, data1->VL, data1->NbVL,
+		   v2, data2->VL, data2->NbVL, 2, 3, cc, tt, t2, expr);
+	  evaluate(v1, data1->VT, data1->NbVT,
+		   v2, data2->VT, data2->NbVT, 3, 3, cc, tt, t2, expr);
+	  evaluate(v1, data1->VQ, data1->NbVQ,
+		   v2, data2->VQ, data2->NbVQ, 4, 3, cc, tt, t2, expr);
+	  evaluate(v1, data1->VS, data1->NbVS,
+		   v2, data2->VS, data2->NbVS, 4, 3, cc, tt, t2, expr);
+	  evaluate(v1, data1->VH, data1->NbVH,
+		   v2, data2->VH, data2->NbVH, 8, 3, cc, tt, t2, expr);
+	  evaluate(v1, data1->VI, data1->NbVI,
+		   v2, data2->VI, data2->NbVI, 6, 3, cc, tt, t2, expr);
+	  evaluate(v1, data1->VY, data1->NbVY,
+		   v2, data2->VY, data2->NbVY, 5, 3, cc, tt, t2, expr);
 	}
       }
 
       for(int cc = 0; cc < 9; cc++){
 	if(comp < 0 || comp == cc){
-	  evaluate(v1, v1->TP, v1->NbTP, v2, v2->TP, v2->NbTP, 1, 9, cc, tt, t2, expr);
-	  evaluate(v1, v1->TL, v1->NbTL, v2, v2->TL, v2->NbTL, 2, 9, cc, tt, t2, expr);
-	  evaluate(v1, v1->TT, v1->NbTT, v2, v2->TT, v2->NbTT, 3, 9, cc, tt, t2, expr);      
-	  evaluate(v1, v1->TQ, v1->NbTQ, v2, v2->TQ, v2->NbTQ, 4, 9, cc, tt, t2, expr);
-	  evaluate(v1, v1->TS, v1->NbTS, v2, v2->TS, v2->NbTS, 4, 9, cc, tt, t2, expr);
-	  evaluate(v1, v1->TH, v1->NbTH, v2, v2->TH, v2->NbTH, 8, 9, cc, tt, t2, expr);
-	  evaluate(v1, v1->TI, v1->NbTI, v2, v2->TI, v2->NbTI, 6, 9, cc, tt, t2, expr);
-	  evaluate(v1, v1->TY, v1->NbTY, v2, v2->TY, v2->NbTY, 5, 9, cc, tt, t2, expr);
+	  evaluate(v1, data1->TP, data1->NbTP,
+		   v2, data2->TP, data2->NbTP, 1, 9, cc, tt, t2, expr);
+	  evaluate(v1, data1->TL, data1->NbTL,
+		   v2, data2->TL, data2->NbTL, 2, 9, cc, tt, t2, expr);
+	  evaluate(v1, data1->TT, data1->NbTT,
+		   v2, data2->TT, data2->NbTT, 3, 9, cc, tt, t2, expr);      
+	  evaluate(v1, data1->TQ, data1->NbTQ,
+		   v2, data2->TQ, data2->NbTQ, 4, 9, cc, tt, t2, expr);
+	  evaluate(v1, data1->TS, data1->NbTS,
+		   v2, data2->TS, data2->NbTS, 4, 9, cc, tt, t2, expr);
+	  evaluate(v1, data1->TH, data1->NbTH,
+		   v2, data2->TH, data2->NbTH, 8, 9, cc, tt, t2, expr);
+	  evaluate(v1, data1->TI, data1->NbTI,
+		   v2, data2->TI, data2->NbTI, 6, 9, cc, tt, t2, expr);
+	  evaluate(v1, data1->TY, data1->NbTY,
+		   v2, data2->TY, data2->NbTY, 5, 9, cc, tt, t2, expr);
 	}
       }
     }
@@ -323,10 +333,7 @@ Post_View *GMSH_EvaluatePlugin::execute(Post_View * v)
 
   if(_octree) delete _octree;
 
-  // recompute min/max, etc.:
-  v1->Min = VAL_INF;
-  v1->Max = -VAL_INF;
-  EndView(v1, 0, v1->FileName, v1->Name);
+  data1->finalize();
 
   return v1;
 }
diff --git a/Plugin/Evaluate.h b/Plugin/Evaluate.h
index 95923321050bf24f4de49b306335cfc6b14ab527..e58cbf486f9e60192343c9629700f7c9c04d7560 100644
--- a/Plugin/Evaluate.h
+++ b/Plugin/Evaluate.h
@@ -32,8 +32,8 @@ class GMSH_EvaluatePlugin : public GMSH_Post_Plugin
 {
 private:
   OctreePost *_octree;
-  void evaluate(Post_View *v, List_T *list, int nbElm,
-		Post_View *v2, List_T *list2, int nbElm2,
+  void evaluate(PView *v1, List_T *list1, int nbElm1,
+		PView *v2, List_T *list2, int nbElm2,
 		int nbNod, int nbComp, int comp, 
 		int timeStep, int timeStep2,
 		char *expression);
@@ -46,7 +46,7 @@ public:
   StringXNumber* getOption(int iopt);  
   int getNbOptionsStr() const;
   StringXString* getOptionStr(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Extract.cpp b/Plugin/Extract.cpp
index 79703e2f5c88765791cba3930800ca102b9ca12e..8628b80899949cc9d9c5ab08f099bf230e067d2d 100644
--- a/Plugin/Extract.cpp
+++ b/Plugin/Extract.cpp
@@ -1,4 +1,4 @@
-// $Id: Extract.cpp,v 1.23 2007-05-04 10:45:08 geuzaine Exp $
+// $Id: Extract.cpp,v 1.24 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,19 +19,12 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Extract.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Malloc.h"
 
 #if defined(HAVE_MATH_EVAL)
 #include "matheval.h"
 #endif
 
-extern Context_T CTX;
-
 StringXNumber ExtractOptions_Number[] = {
   {GMSH_FULLRC, "TimeStep", NULL, -1.},
   {GMSH_FULLRC, "iView", NULL, -1.}
@@ -229,7 +222,7 @@ static void extract(char *expr[9], List_T *inList, int inNb,
 #endif
 }
 
-Post_View *GMSH_ExtractPlugin::execute(Post_View * v)
+PView *GMSH_ExtractPlugin::execute(PView *v)
 {
   int step = (int)ExtractOptions_Number[0].def;
   int iView = (int)ExtractOptions_Number[1].def;
@@ -243,93 +236,92 @@ Post_View *GMSH_ExtractPlugin::execute(Post_View * v)
 		    ExtractOptions_String[7].def,
 		    ExtractOptions_String[8].def };
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *v2 = new PView(true);
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
 
   if(step < 0){
-    step = - v1->NbTimeStep;
+    step = - data1->getNumTimeSteps();
   }
-  else if(step > v1->NbTimeStep-1){
+  else if(step > data1->getNumTimeSteps() - 1){
     Msg(GERROR, "Invalid time step (%d) in View[%d]: using all steps instead",
-	step, v1->Num);
-    step = - v1->NbTimeStep;
+	step, v1->getIndex());
+    step = - data1->getNumTimeSteps();
   }
 
   // points
-  extract(expr, v1->SP, v1->NbSP, v2->SP, &v2->NbSP, v2->VP, &v2->NbVP, v2->TP, &v2->NbTP, 
-	  step, 1, 1);
-  extract(expr, v1->VP, v1->NbVP, v2->SP, &v2->NbSP, v2->VP, &v2->NbVP, v2->TP, &v2->NbTP, 
-	  step, 1, 3);
-  extract(expr, v1->TP, v1->NbTP, v2->SP, &v2->NbSP, v2->VP, &v2->NbVP, v2->TP, &v2->NbTP, 
-	  step, 1, 9);
+  extract(expr, data1->SP, data1->NbSP, data2->SP, &data2->NbSP, 
+	  data2->VP, &data2->NbVP, data2->TP, &data2->NbTP, step, 1, 1);
+  extract(expr, data1->VP, data1->NbVP, data2->SP, &data2->NbSP,
+	  data2->VP, &data2->NbVP, data2->TP, &data2->NbTP, step, 1, 3);
+  extract(expr, data1->TP, data1->NbTP, data2->SP, &data2->NbSP,
+	  data2->VP, &data2->NbVP, data2->TP, &data2->NbTP, step, 1, 9);
   // lines			                                  	              	
-  extract(expr, v1->SL, v1->NbSL, v2->SL, &v2->NbSL, v2->VL, &v2->NbVL, v2->TL, &v2->NbTL, 
-	  step, 2, 1);
-  extract(expr, v1->VL, v1->NbVL, v2->SL, &v2->NbSL, v2->VL, &v2->NbVL, v2->TL, &v2->NbTL, 
-	  step, 2, 3);
-  extract(expr, v1->TL, v1->NbTL, v2->SL, &v2->NbSL, v2->VL, &v2->NbVL, v2->TL, &v2->NbTL, 
-	  step, 2, 9);
+  extract(expr, data1->SL, data1->NbSL, data2->SL, &data2->NbSL,
+	  data2->VL, &data2->NbVL, data2->TL, &data2->NbTL, step, 2, 1);
+  extract(expr, data1->VL, data1->NbVL, data2->SL, &data2->NbSL,
+	  data2->VL, &data2->NbVL, data2->TL, &data2->NbTL, step, 2, 3);
+  extract(expr, data1->TL, data1->NbTL, data2->SL, &data2->NbSL,
+	  data2->VL, &data2->NbVL, data2->TL, &data2->NbTL, step, 2, 9);
   // triangles			                                  	              	
-  extract(expr, v1->ST, v1->NbST, v2->ST, &v2->NbST, v2->VT, &v2->NbVT, v2->TT, &v2->NbTT, 
-	  step, 3, 1);
-  extract(expr, v1->VT, v1->NbVT, v2->ST, &v2->NbST, v2->VT, &v2->NbVT, v2->TT, &v2->NbTT, 
-	  step, 3, 3);
-  extract(expr, v1->TT, v1->NbTT, v2->ST, &v2->NbST, v2->VT, &v2->NbVT, v2->TT, &v2->NbTT, 
-	  step, 3, 9);
+  extract(expr, data1->ST, data1->NbST, data2->ST, &data2->NbST,
+	  data2->VT, &data2->NbVT, data2->TT, &data2->NbTT, step, 3, 1);
+  extract(expr, data1->VT, data1->NbVT, data2->ST, &data2->NbST,
+	  data2->VT, &data2->NbVT, data2->TT, &data2->NbTT, step, 3, 3);
+  extract(expr, data1->TT, data1->NbTT, data2->ST, &data2->NbST,
+	  data2->VT, &data2->NbVT, data2->TT, &data2->NbTT, step, 3, 9);
   // quadrangles		                                  	              	
-  extract(expr, v1->SQ, v1->NbSQ, v2->SQ, &v2->NbSQ, v2->VQ, &v2->NbVQ, v2->TQ, &v2->NbTQ, 
-	  step, 4, 1);
-  extract(expr, v1->VQ, v1->NbVQ, v2->SQ, &v2->NbSQ, v2->VQ, &v2->NbVQ, v2->TQ, &v2->NbTQ, 
-	  step, 4, 3);
-  extract(expr, v1->TQ, v1->NbTQ, v2->SQ, &v2->NbSQ, v2->VQ, &v2->NbVQ, v2->TQ, &v2->NbTQ, 
-	  step, 4, 9);
+  extract(expr, data1->SQ, data1->NbSQ, data2->SQ, &data2->NbSQ,
+	  data2->VQ, &data2->NbVQ, data2->TQ, &data2->NbTQ, step, 4, 1);
+  extract(expr, data1->VQ, data1->NbVQ, data2->SQ, &data2->NbSQ,
+	  data2->VQ, &data2->NbVQ, data2->TQ, &data2->NbTQ, step, 4, 3);
+  extract(expr, data1->TQ, data1->NbTQ, data2->SQ, &data2->NbSQ,
+	  data2->VQ, &data2->NbVQ, data2->TQ, &data2->NbTQ, step, 4, 9);
   // tets			                                  	              	
-  extract(expr, v1->SS, v1->NbSS, v2->SS, &v2->NbSS, v2->VS, &v2->NbVS, v2->TS, &v2->NbTS, 
-	  step, 4, 1);
-  extract(expr, v1->VS, v1->NbVS, v2->SS, &v2->NbSS, v2->VS, &v2->NbVS, v2->TS, &v2->NbTS, 
-	  step, 4, 3);
-  extract(expr, v1->TS, v1->NbTS, v2->SS, &v2->NbSS, v2->VS, &v2->NbVS, v2->TS, &v2->NbTS, 
-	  step, 4, 9);
+  extract(expr, data1->SS, data1->NbSS, data2->SS, &data2->NbSS,
+	  data2->VS, &data2->NbVS, data2->TS, &data2->NbTS, step, 4, 1);
+  extract(expr, data1->VS, data1->NbVS, data2->SS, &data2->NbSS,
+	  data2->VS, &data2->NbVS, data2->TS, &data2->NbTS, step, 4, 3);
+  extract(expr, data1->TS, data1->NbTS, data2->SS, &data2->NbSS,
+	  data2->VS, &data2->NbVS, data2->TS, &data2->NbTS, step, 4, 9);
   // hexas			                                  	              	
-  extract(expr, v1->SH, v1->NbSH, v2->SH, &v2->NbSH, v2->VH, &v2->NbVH, v2->TH, &v2->NbTH, 
-	  step, 8, 1);
-  extract(expr, v1->VH, v1->NbVH, v2->SH, &v2->NbSH, v2->VH, &v2->NbVH, v2->TH, &v2->NbTH, 
-	  step, 8, 3);
-  extract(expr, v1->TH, v1->NbTH, v2->SH, &v2->NbSH, v2->VH, &v2->NbVH, v2->TH, &v2->NbTH, 
-	  step, 8, 9);
+  extract(expr, data1->SH, data1->NbSH, data2->SH, &data2->NbSH,
+	  data2->VH, &data2->NbVH, data2->TH, &data2->NbTH, step, 8, 1);
+  extract(expr, data1->VH, data1->NbVH, data2->SH, &data2->NbSH,
+	  data2->VH, &data2->NbVH, data2->TH, &data2->NbTH, step, 8, 3);
+  extract(expr, data1->TH, data1->NbTH, data2->SH, &data2->NbSH,
+	  data2->VH, &data2->NbVH, data2->TH, &data2->NbTH, step, 8, 9);
   // prisms			                                  	              	
-  extract(expr, v1->SI, v1->NbSI, v2->SI, &v2->NbSI, v2->VI, &v2->NbVI, v2->TI, &v2->NbTI, 
-	  step, 6, 1);
-  extract(expr, v1->VI, v1->NbVI, v2->SI, &v2->NbSI, v2->VI, &v2->NbVI, v2->TI, &v2->NbTI, 
-	  step, 6, 3);
-  extract(expr, v1->TI, v1->NbTI, v2->SI, &v2->NbSI, v2->VI, &v2->NbVI, v2->TI, &v2->NbTI, 
-	  step, 6, 9);
+  extract(expr, data1->SI, data1->NbSI, data2->SI, &data2->NbSI,
+	  data2->VI, &data2->NbVI, data2->TI, &data2->NbTI, step, 6, 1);
+  extract(expr, data1->VI, data1->NbVI, data2->SI, &data2->NbSI,
+	  data2->VI, &data2->NbVI, data2->TI, &data2->NbTI, step, 6, 3);
+  extract(expr, data1->TI, data1->NbTI, data2->SI, &data2->NbSI,
+	  data2->VI, &data2->NbVI, data2->TI, &data2->NbTI, step, 6, 9);
   // pyramids			                                  	              	
-  extract(expr, v1->SY, v1->NbSY, v2->SY, &v2->NbSY, v2->VY, &v2->NbVY, v2->TY, &v2->NbTY, 
-	  step, 5, 1);
-  extract(expr, v1->VY, v1->NbVY, v2->SY, &v2->NbSY, v2->VY, &v2->NbVY, v2->TY, &v2->NbTY, 
-	  step, 5, 3);
-  extract(expr, v1->TY, v1->NbTY, v2->SY, &v2->NbSY, v2->VY, &v2->NbVY, v2->TY, &v2->NbTY, 
-	  step, 5, 9);
+  extract(expr, data1->SY, data1->NbSY, data2->SY, &data2->NbSY,
+	  data2->VY, &data2->NbVY, data2->TY, &data2->NbTY, step, 5, 1);
+  extract(expr, data1->VY, data1->NbVY, data2->SY, &data2->NbSY,
+	  data2->VY, &data2->NbVY, data2->TY, &data2->NbTY, step, 5, 3);
+  extract(expr, data1->TY, data1->NbTY, data2->SY, &data2->NbSY,
+	  data2->VY, &data2->NbVY, data2->TY, &data2->NbTY, step, 5, 9);
 
-  // copy time data
   if(step < 0)
-    for(int i = 0; i < List_Nbr(v1->Time); i++)
-      List_Add(v2->Time, List_Pointer(v1->Time, i));
+    for(int i = 0; i < List_Nbr(data1->Time); i++)
+      List_Add(data2->Time, List_Pointer(data1->Time, i));
   else
-    List_Add(v2->Time, List_Pointer(v1->Time, step));
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_Extract", v1->Name);
-  sprintf(filename, "%s_Extract.pos", v1->Name);
-  EndView(v2, 1, filename, name);
+    List_Add(data2->Time, List_Pointer(data1->Time, step));
+
+  data2->setName(data1->getName() + "_Extract");
+  data2->setFileName(data1->getName() + "_Extract.pos");
+  data2->finalize();
+
   return v2;
 }
diff --git a/Plugin/Extract.h b/Plugin/Extract.h
index 714fb164262c4fd10a246b2c9bb14fb7ae834cdb..78f321598a5307b5a685141d36e82e114c36477e 100644
--- a/Plugin/Extract.h
+++ b/Plugin/Extract.h
@@ -21,7 +21,6 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include "Plugin.h"
-#include "List.h"
 
 extern "C"
 {
@@ -39,7 +38,7 @@ class GMSH_ExtractPlugin : public GMSH_Post_Plugin
   StringXNumber* getOption(int iopt);  
   int getNbOptionsStr() const;
   StringXString* getOptionStr(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/ExtractEdges.cpp b/Plugin/ExtractEdges.cpp
index ce7725c19b2db284d4fe4fd2375f221f2342f6c0..6be4ce8c2a82a9227baddac272c9ac950519168f 100644
--- a/Plugin/ExtractEdges.cpp
+++ b/Plugin/ExtractEdges.cpp
@@ -1,4 +1,4 @@
-// $Id: ExtractEdges.cpp,v 1.5 2007-09-10 04:47:08 geuzaine Exp $
+// $Id: ExtractEdges.cpp,v 1.6 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,17 +19,9 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "ExtractEdges.h"
-#include "List.h"
-#include "Tree.h"
-#include "Views.h"
-#include "Context.h"
-#include "Malloc.h"
 #include "BDS.h"
 
-extern Context_T CTX;
-
 StringXNumber ExtractEdgesOptions_Number[] = {
   {GMSH_FULLRC, "Angle", NULL, 22.},
   {GMSH_FULLRC, "iView", NULL, -1.}
@@ -81,21 +73,21 @@ void GMSH_ExtractEdgesPlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "Extract Edges failed...");
 }
 
-Post_View *GMSH_ExtractEdgesPlugin::execute(Post_View * v)
+PView *GMSH_ExtractEdgesPlugin::execute(PView *v)
 {
   int iView = (int)ExtractEdgesOptions_Number[1].def;
   double angle = ExtractEdgesOptions_Number[0].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *v2 = new PView(true);
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
 
   BDS_Mesh bds;
   //bds.import_view(v1, CTX.lc * 1.e-12);
@@ -108,21 +100,21 @@ Post_View *GMSH_ExtractEdgesPlugin::execute(Post_View * v)
   while (it != ite){
     BDS_GeomEntity *g = (*it)->g;
     if(g && g->classif_degree == 1) {
-      List_Add(v2->SL, &(*it)->p1->X); List_Add(v2->SL, &(*it)->p2->X);
-      List_Add(v2->SL, &(*it)->p1->Y); List_Add(v2->SL, &(*it)->p2->Y);
-      List_Add(v2->SL, &(*it)->p1->Z); List_Add(v2->SL, &(*it)->p2->Z);
+      List_Add(data2->SL, &(*it)->p1->X); List_Add(data2->SL, &(*it)->p2->X);
+      List_Add(data2->SL, &(*it)->p1->Y); List_Add(data2->SL, &(*it)->p2->Y);
+      List_Add(data2->SL, &(*it)->p1->Z); List_Add(data2->SL, &(*it)->p2->Z);
       double val = g->classif_tag;
-      List_Add(v2->SL, &val);
-      List_Add(v2->SL, &val);
-      v2->NbSL++;
+      List_Add(data2->SL, &val);
+      List_Add(data2->SL, &val);
+      data2->NbSL++;
     }
     ++it;
   }
 
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_ExtractEdges", v1->Name);
-  sprintf(filename, "%s_ExtractEdges.pos", v1->Name);
-  EndView(v2, 1, filename, name);
+
+  data2->setName(data1->getName() + "_ExtractEdges");
+  data2->setFileName(data1->getName() + "_ExtractEdges.pos");
+  data2->finalize();
+
   return v2;
 }
diff --git a/Plugin/ExtractEdges.h b/Plugin/ExtractEdges.h
index b7fa7f92e02c919a5090f1bc21549544ff5d1a77..9c7db2f988dab6dae58ed6955b26c4f5a4504e76 100644
--- a/Plugin/ExtractEdges.h
+++ b/Plugin/ExtractEdges.h
@@ -36,7 +36,7 @@ class GMSH_ExtractEdgesPlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/ExtractElements.cpp b/Plugin/ExtractElements.cpp
index afd2ae7dc9a03fec8d20bc0fa23d4a509142c82b..c876d9fc8c0177457a198b0151fc97b947e8f192 100644
--- a/Plugin/ExtractElements.cpp
+++ b/Plugin/ExtractElements.cpp
@@ -1,4 +1,4 @@
-// $Id: ExtractElements.cpp,v 1.8 2007-05-04 10:45:09 geuzaine Exp $
+// $Id: ExtractElements.cpp,v 1.9 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,14 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "ExtractElements.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Malloc.h"
-
-extern Context_T CTX;
 
 StringXNumber ExtractElementsOptions_Number[] = {
   {GMSH_FULLRC, "MinVal", NULL, 0.},
@@ -122,69 +115,66 @@ static void extract(List_T *inList, int inNb,
   }
 }
 
-Post_View *GMSH_ExtractElementsPlugin::execute(Post_View * v)
+PView *GMSH_ExtractElementsPlugin::execute(PView *v)
 {
   int step = (int)ExtractElementsOptions_Number[2].def;
   int iView = (int)ExtractElementsOptions_Number[3].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *v2 = new PView(true);
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
 
-  if(step < 0 || step > v1->NbTimeStep-1){
+  if(step < 0 || step > data1->getNumTimeSteps() - 1){
     Msg(GERROR, "Invalid time step (%d) in View[%d]: using first step instead",
-	step, v1->Num);
+	step, v1->getIndex());
     step = 0;
   }
 
   // points
-  extract(v1->SP, v1->NbSP, v2->SP, &v2->NbSP, step, 1, 1);
-  extract(v1->VP, v1->NbVP, v2->SP, &v2->NbSP, step, 1, 3);
-  extract(v1->TP, v1->NbTP, v2->SP, &v2->NbSP, step, 1, 9);
+  extract(data1->SP, data1->NbSP, data2->SP, &data2->NbSP, step, 1, 1);
+  extract(data1->VP, data1->NbVP, data2->VP, &data2->NbVP, step, 1, 3);
+  extract(data1->TP, data1->NbTP, data2->TP, &data2->NbTP, step, 1, 9);
   // lines			                	
-  extract(v1->SL, v1->NbSL, v2->SL, &v2->NbSL, step, 2, 1);
-  extract(v1->VL, v1->NbVL, v2->SL, &v2->NbSL, step, 2, 3);
-  extract(v1->TL, v1->NbTL, v2->SL, &v2->NbSL, step, 2, 9);
+  extract(data1->SL, data1->NbSL, data2->SL, &data2->NbSL, step, 2, 1);
+  extract(data1->VL, data1->NbVL, data2->VL, &data2->NbVL, step, 2, 3);
+  extract(data1->TL, data1->NbTL, data2->TL, &data2->NbTL, step, 2, 9);
   // triangles			                	
-  extract(v1->ST, v1->NbST, v2->ST, &v2->NbST, step, 3, 1);
-  extract(v1->VT, v1->NbVT, v2->ST, &v2->NbST, step, 3, 3);
-  extract(v1->TT, v1->NbTT, v2->ST, &v2->NbST, step, 3, 9);
+  extract(data1->ST, data1->NbST, data2->ST, &data2->NbST, step, 3, 1);
+  extract(data1->VT, data1->NbVT, data2->VT, &data2->NbVT, step, 3, 3);
+  extract(data1->TT, data1->NbTT, data2->TT, &data2->NbTT, step, 3, 9);
   // quadrangles		                	
-  extract(v1->SQ, v1->NbSQ, v2->SQ, &v2->NbSQ, step, 4, 1);
-  extract(v1->VQ, v1->NbVQ, v2->SQ, &v2->NbSQ, step, 4, 3);
-  extract(v1->TQ, v1->NbTQ, v2->SQ, &v2->NbSQ, step, 4, 9);
+  extract(data1->SQ, data1->NbSQ, data2->SQ, &data2->NbSQ, step, 4, 1);
+  extract(data1->VQ, data1->NbVQ, data2->VQ, &data2->NbVQ, step, 4, 3);
+  extract(data1->TQ, data1->NbTQ, data2->TQ, &data2->NbTQ, step, 4, 9);
   // tets			                	
-  extract(v1->SS, v1->NbSS, v2->SS, &v2->NbSS, step, 4, 1);
-  extract(v1->VS, v1->NbVS, v2->SS, &v2->NbSS, step, 4, 3);
-  extract(v1->TS, v1->NbTS, v2->SS, &v2->NbSS, step, 4, 9);
+  extract(data1->SS, data1->NbSS, data2->SS, &data2->NbSS, step, 4, 1);
+  extract(data1->VS, data1->NbVS, data2->VS, &data2->NbVS, step, 4, 3);
+  extract(data1->TS, data1->NbTS, data2->TS, &data2->NbTS, step, 4, 9);
   // hexas			                	
-  extract(v1->SH, v1->NbSH, v2->SH, &v2->NbSH, step, 8, 1);
-  extract(v1->VH, v1->NbVH, v2->SH, &v2->NbSH, step, 8, 3);
-  extract(v1->TH, v1->NbTH, v2->SH, &v2->NbSH, step, 8, 9);
+  extract(data1->SH, data1->NbSH, data2->SH, &data2->NbSH, step, 8, 1);
+  extract(data1->VH, data1->NbVH, data2->VH, &data2->NbVH, step, 8, 3);
+  extract(data1->TH, data1->NbTH, data2->TH, &data2->NbTH, step, 8, 9);
   // prisms			                	
-  extract(v1->SI, v1->NbSI, v2->SI, &v2->NbSI, step, 6, 1);
-  extract(v1->VI, v1->NbVI, v2->SI, &v2->NbSI, step, 6, 3);
-  extract(v1->TI, v1->NbTI, v2->SI, &v2->NbSI, step, 6, 9);
+  extract(data1->SI, data1->NbSI, data2->SI, &data2->NbSI, step, 6, 1);
+  extract(data1->VI, data1->NbVI, data2->VI, &data2->NbVI, step, 6, 3);
+  extract(data1->TI, data1->NbTI, data2->TI, &data2->NbTI, step, 6, 9);
   // pyramids			                	
-  extract(v1->SY, v1->NbSY, v2->SY, &v2->NbSY, step, 5, 1);
-  extract(v1->VY, v1->NbVY, v2->SY, &v2->NbSY, step, 5, 3);
-  extract(v1->TY, v1->NbTY, v2->SY, &v2->NbSY, step, 5, 9);
-
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++)
-    List_Add(v2->Time, List_Pointer(v1->Time, i));
-
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_ExtractElements", v1->Name);
-  sprintf(filename, "%s_ExtractElements.pos", v1->Name);
-  EndView(v2, 1, filename, name);
+  extract(data1->SY, data1->NbSY, data2->SY, &data2->NbSY, step, 5, 1);
+  extract(data1->VY, data1->NbVY, data2->VY, &data2->NbVY, step, 5, 3);
+  extract(data1->TY, data1->NbTY, data2->TY, &data2->NbTY, step, 5, 9);
+
+  for(int i = 0; i < List_Nbr(data1->Time); i++)
+    List_Add(data2->Time, List_Pointer(data1->Time, i));
+  data2->setName(data1->getName() + "_ExtractElements");
+  data2->setFileName(data1->getName() + "_ExtractElements.pos");
+  data2->finalize();
+
   return v2;
 }
diff --git a/Plugin/ExtractElements.h b/Plugin/ExtractElements.h
index 5deef20cbef4013897a14cf8bc9676f2bd389f70..ae69a88e8fc4a5572176ddebbe98797f358d9dde 100644
--- a/Plugin/ExtractElements.h
+++ b/Plugin/ExtractElements.h
@@ -21,7 +21,6 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include "Plugin.h"
-#include "List.h"
 
 extern "C"
 {
@@ -37,7 +36,7 @@ class GMSH_ExtractElementsPlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/FieldView.cpp b/Plugin/FieldView.cpp
index 2376a455561dab4bba84b59320edd087114e5d4e..a858e22a51014bce1c910f4076facde0755daa94 100644
--- a/Plugin/FieldView.cpp
+++ b/Plugin/FieldView.cpp
@@ -1,4 +1,4 @@
-// $Id: FieldView.cpp,v 1.2 2007-09-04 13:47:05 remacle Exp $
+// $Id: FieldView.cpp,v 1.3 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,16 +19,8 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
-#include "Field.h"
 #include "FieldView.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
-#include "ShapeFunctions.h"
-
-extern Context_T CTX;
+#include "Field.h"
 
 StringXNumber FieldViewOptions_Number[] = {
   {GMSH_FULLRC, "Component", NULL, -1.},
@@ -78,12 +70,10 @@ void GMSH_FieldViewPlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "FieldView failed...");
 }
 
-
-static void evaluate(Field *field,Post_View *v1, List_T *list1, int nbElm1, int nbNod, int nbComp, int comp )
+static void evaluate(Field *field, List_T *list1, int nbElm1, int nbNod, 
+		     int nbComp, int comp )
 {
-  if(!nbElm1)
-    return;
-  v1->Changed = 1;
+  if(!nbElm1) return;
   int nb = List_Nbr(list1) / nbElm1;
   for(int i = 0, i2 = 0; i < List_Nbr(list1); i += nb) {
     double *x = (double *)List_Pointer_Fast(list1, i);
@@ -94,67 +84,66 @@ static void evaluate(Field *field,Post_View *v1, List_T *list1, int nbElm1, int
       double *val1 = (double *)List_Pointer_Fast(list1, 
 						 i + 3 * nbNod + 
 						 nbNod * nbComp * 0 + nbComp * j);
-      val1[comp] =(*field)(x[j],y[j],z[j]);
+      val1[comp] = (*field)(x[j],y[j],z[j]);
     }
   }
 }
 
-
-Post_View *GMSH_FieldViewPlugin::execute(Post_View * v)
+PView *GMSH_FieldViewPlugin::execute(PView *v)
 {
   int comp = (int)FieldViewOptions_Number[0].def;
   int iView = (int)FieldViewOptions_Number[1].def;
-	int iField=(int)FieldViewOptions_Number[2].def;
-	Field *field=fields.get(iField);
+  int iField = (int)FieldViewOptions_Number[2].def;
+
+  Field *field = fields.get(iField);
   if(!field){
     Msg(GERROR, "Field[%d] does not exist", iField);
     return v;
-	}
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
   }
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-      evaluate(field, v1, v1->SP, v1->NbSP, 1, 1, 0);
-      evaluate(field, v1, v1->SL, v1->NbSL, 2, 1, 0);
-      evaluate(field, v1, v1->ST, v1->NbST, 3, 1, 0);
-      evaluate(field, v1, v1->SQ, v1->NbSQ, 4, 1, 0);      
-      evaluate(field, v1, v1->SS, v1->NbSS, 4, 1, 0);
-      evaluate(field, v1, v1->SH, v1->NbSH, 8, 1, 0);      
-      evaluate(field, v1, v1->SI, v1->NbSI, 6, 1, 0);
-      evaluate(field, v1, v1->SY, v1->NbSY, 5, 1, 0);
-
-      for(int cc = 0; cc < 3; cc++){
-	if(comp < 0 || comp == cc){
-	  evaluate(field, v1, v1->VP, v1->NbVP, 1, 3, cc);
-	  evaluate(field, v1, v1->VL, v1->NbVL, 2, 3, cc);
-	  evaluate(field, v1, v1->VT, v1->NbVT, 3, 3, cc);
-	  evaluate(field, v1, v1->VQ, v1->NbVQ, 4, 3, cc);
-	  evaluate(field, v1, v1->VS, v1->NbVS, 4, 3, cc);
-	  evaluate(field, v1, v1->VH, v1->NbVH, 8, 3, cc);
-	  evaluate(field, v1, v1->VI, v1->NbVI, 6, 3, cc);
-	  evaluate(field, v1, v1->VY, v1->NbVY, 5, 3, cc);
-	}
-      }
-
-      for(int cc = 0; cc < 9; cc++){
-	if(comp < 0 || comp == cc){
-	  evaluate(field, v1, v1->TP, v1->NbTP, 1, 9, cc);
-	  evaluate(field, v1, v1->TL, v1->NbTL, 2, 9, cc);
-	  evaluate(field, v1, v1->TT, v1->NbTT, 3, 9, cc);      
-	  evaluate(field, v1, v1->TQ, v1->NbTQ, 4, 9, cc);
-	  evaluate(field, v1, v1->TS, v1->NbTS, 4, 9, cc);
-	  evaluate(field, v1, v1->TH, v1->NbTH, 8, 9, cc);
-	  evaluate(field, v1, v1->TI, v1->NbTI, 6, 9, cc);
-	  evaluate(field, v1, v1->TY, v1->NbTY, 5, 9, cc);
-	}
-      }
-  // recompute min/max, etc.:
-  v1->Min = VAL_INF;
-  v1->Max = -VAL_INF;
-  EndView(v1, 0, v1->FileName, v1->Name);
+
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  evaluate(field, data1->SP, data1->NbSP, 1, 1, 0);
+  evaluate(field, data1->SL, data1->NbSL, 2, 1, 0);
+  evaluate(field, data1->ST, data1->NbST, 3, 1, 0);
+  evaluate(field, data1->SQ, data1->NbSQ, 4, 1, 0);      
+  evaluate(field, data1->SS, data1->NbSS, 4, 1, 0);
+  evaluate(field, data1->SH, data1->NbSH, 8, 1, 0);      
+  evaluate(field, data1->SI, data1->NbSI, 6, 1, 0);
+  evaluate(field, data1->SY, data1->NbSY, 5, 1, 0);
+
+  for(int cc = 0; cc < 3; cc++){
+    if(comp < 0 || comp == cc){
+      evaluate(field, data1->VP, data1->NbVP, 1, 3, cc);
+      evaluate(field, data1->VL, data1->NbVL, 2, 3, cc);
+      evaluate(field, data1->VT, data1->NbVT, 3, 3, cc);
+      evaluate(field, data1->VQ, data1->NbVQ, 4, 3, cc);
+      evaluate(field, data1->VS, data1->NbVS, 4, 3, cc);
+      evaluate(field, data1->VH, data1->NbVH, 8, 3, cc);
+      evaluate(field, data1->VI, data1->NbVI, 6, 3, cc);
+      evaluate(field, data1->VY, data1->NbVY, 5, 3, cc);
+    }
+  }
+  
+  for(int cc = 0; cc < 9; cc++){
+    if(comp < 0 || comp == cc){
+      evaluate(field, data1->TP, data1->NbTP, 1, 9, cc);
+      evaluate(field, data1->TL, data1->NbTL, 2, 9, cc);
+      evaluate(field, data1->TT, data1->NbTT, 3, 9, cc);      
+      evaluate(field, data1->TQ, data1->NbTQ, 4, 9, cc);
+      evaluate(field, data1->TS, data1->NbTS, 4, 9, cc);
+      evaluate(field, data1->TH, data1->NbTH, 8, 9, cc);
+      evaluate(field, data1->TI, data1->NbTI, 6, 9, cc);
+      evaluate(field, data1->TY, data1->NbTY, 5, 9, cc);
+    }
+  }
+  
+  data1->finalize();
+  v1->setChanged(true);
 
   return v1;
 }
diff --git a/Plugin/FieldView.h b/Plugin/FieldView.h
index 75dc0a3647c6459c25abd259f37888c3ba6e2dd2..494432cfd207efc855ec162a7d54efe029b2b473 100644
--- a/Plugin/FieldView.h
+++ b/Plugin/FieldView.h
@@ -36,7 +36,7 @@ class GMSH_FieldViewPlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Gradient.cpp b/Plugin/Gradient.cpp
index e0ffb3b02345b89a5220c702d1f67ace46962329..08ae327c22c3e40875d3efea75046e7425eb0f99 100644
--- a/Plugin/Gradient.cpp
+++ b/Plugin/Gradient.cpp
@@ -1,4 +1,4 @@
-// $Id: Gradient.cpp,v 1.9 2007-09-04 13:47:05 remacle Exp $
+// $Id: Gradient.cpp,v 1.10 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,16 +19,9 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Gradient.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
 #include "ShapeFunctions.h"
 
-extern Context_T CTX;
-
 StringXNumber GradientOptions_Number[] = {
   {GMSH_FULLRC, "iView", NULL, -1.}
 };
@@ -112,45 +105,43 @@ static void gradient(int inNb, List_T *inList, int *outNb, List_T *outList,
   }
 }
 
-Post_View *GMSH_GradientPlugin::execute(Post_View * v)
+PView *GMSH_GradientPlugin::execute(PView *v)
 {
   int iView = (int)GradientOptions_Number[0].def;
   
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-  
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-  
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
-  
-  gradient(v1->NbSL, v1->SL, &v2->NbVL, v2->VL, 1, 2, 1, v1->NbTimeStep);
-  gradient(v1->NbST, v1->ST, &v2->NbVT, v2->VT, 2, 3, 1, v1->NbTimeStep);
-  gradient(v1->NbSQ, v1->SQ, &v2->NbVQ, v2->VQ, 2, 4, 1, v1->NbTimeStep);
-  gradient(v1->NbSS, v1->SS, &v2->NbVS, v2->VS, 3, 4, 1, v1->NbTimeStep);
-  gradient(v1->NbSH, v1->SH, &v2->NbVH, v2->VH, 3, 8, 1, v1->NbTimeStep);
-  gradient(v1->NbSI, v1->SI, &v2->NbVI, v2->VI, 3, 6, 1, v1->NbTimeStep);
-  gradient(v1->NbSY, v1->SY, &v2->NbVY, v2->VY, 3, 5, 1, v1->NbTimeStep);
-
-  gradient(v1->NbVL, v1->VL, &v2->NbTL, v2->TL, 1, 2, 3, v1->NbTimeStep);
-  gradient(v1->NbVT, v1->VT, &v2->NbTT, v2->TT, 2, 3, 3, v1->NbTimeStep);
-  gradient(v1->NbVQ, v1->VQ, &v2->NbTQ, v2->TQ, 2, 4, 3, v1->NbTimeStep);
-  gradient(v1->NbVS, v1->VS, &v2->NbTS, v2->TS, 3, 4, 3, v1->NbTimeStep);
-  gradient(v1->NbVH, v1->VH, &v2->NbTH, v2->TH, 3, 8, 3, v1->NbTimeStep);
-  gradient(v1->NbVI, v1->VI, &v2->NbTI, v2->TI, 3, 6, 3, v1->NbTimeStep);
-  gradient(v1->NbVY, v1->VY, &v2->NbTY, v2->TY, 3, 5, 3, v1->NbTimeStep);
-
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++)
-    List_Add(v2->Time, List_Pointer(v1->Time, i));
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_Gradient", v1->Name);
-  sprintf(filename, "%s_Gradient.pos", v1->Name);
-  EndView(v2, 1, filename, name);
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *v2 = new PView(true);
+
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
+
+  int nts = data1->getNumTimeSteps();
+  gradient(data1->NbSL, data1->SL, &data2->NbVL, data2->VL, 1, 2, 1, nts);
+  gradient(data1->NbST, data1->ST, &data2->NbVT, data2->VT, 2, 3, 1, nts);
+  gradient(data1->NbSQ, data1->SQ, &data2->NbVQ, data2->VQ, 2, 4, 1, nts);
+  gradient(data1->NbSS, data1->SS, &data2->NbVS, data2->VS, 3, 4, 1, nts);
+  gradient(data1->NbSH, data1->SH, &data2->NbVH, data2->VH, 3, 8, 1, nts);
+  gradient(data1->NbSI, data1->SI, &data2->NbVI, data2->VI, 3, 6, 1, nts);
+  gradient(data1->NbSY, data1->SY, &data2->NbVY, data2->VY, 3, 5, 1, nts);
+
+  gradient(data1->NbVL, data1->VL, &data2->NbTL, data2->TL, 1, 2, 3, nts);
+  gradient(data1->NbVT, data1->VT, &data2->NbTT, data2->TT, 2, 3, 3, nts);
+  gradient(data1->NbVQ, data1->VQ, &data2->NbTQ, data2->TQ, 2, 4, 3, nts);
+  gradient(data1->NbVS, data1->VS, &data2->NbTS, data2->TS, 3, 4, 3, nts);
+  gradient(data1->NbVH, data1->VH, &data2->NbTH, data2->TH, 3, 8, 3, nts);
+  gradient(data1->NbVI, data1->VI, &data2->NbTI, data2->TI, 3, 6, 3, nts);
+  gradient(data1->NbVY, data1->VY, &data2->NbTY, data2->TY, 3, 5, 3, nts);
+
+  for(int i = 0; i < List_Nbr(data1->Time); i++)
+    List_Add(data2->Time, List_Pointer(data1->Time, i));
+  data2->setName(data1->getName() + "_Gradient");
+  data2->setFileName(data1->getName() + "_Gradient.pos");
+  data2->finalize();
   
   return v2;
 }
diff --git a/Plugin/Gradient.h b/Plugin/Gradient.h
index 420933e7f54713bc28691a81a2f445313977d354..5852725dd7de2ebe0ee128fd0f874427a0f25cdd 100644
--- a/Plugin/Gradient.h
+++ b/Plugin/Gradient.h
@@ -36,7 +36,7 @@ class GMSH_GradientPlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/HarmonicToTime.cpp b/Plugin/HarmonicToTime.cpp
index a0bdf82022ae9f6be19813842b8271e4bc22b4dc..8b34994be5d8c73921d7a78c3583da6e670d66f9 100644
--- a/Plugin/HarmonicToTime.cpp
+++ b/Plugin/HarmonicToTime.cpp
@@ -1,4 +1,4 @@
-// $Id: HarmonicToTime.cpp,v 1.11 2007-09-04 13:47:05 remacle Exp $
+// $Id: HarmonicToTime.cpp,v 1.12 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,14 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "HarmonicToTime.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
-
-extern Context_T CTX;
 
 StringXNumber HarmonicToTimeOptions_Number[] = {
   {GMSH_FULLRC, "RealPart", NULL, 0.},
@@ -114,24 +107,21 @@ static void h2t(int nb1, List_T *list1, int *nb2, List_T *list2,
   *nb2 = nb1;
 }
 
-Post_View *GMSH_HarmonicToTimePlugin::execute(Post_View * v)
+PView *GMSH_HarmonicToTimePlugin::execute(PView * v)
 {
   int rIndex = (int)HarmonicToTimeOptions_Number[0].def;
   int iIndex = (int)HarmonicToTimeOptions_Number[1].def;
   int nSteps = (int)HarmonicToTimeOptions_Number[2].def;
   int iView = (int)HarmonicToTimeOptions_Number[3].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  if(rIndex < 0 || rIndex >= v1->NbTimeStep ||
-     iIndex < 0 || iIndex >= v1->NbTimeStep){
+  if(rIndex < 0 || rIndex >= data1->getNumTimeSteps() ||
+     iIndex < 0 || iIndex >= data1->getNumTimeSteps()){
     Msg(GERROR, "Wrong real or imaginary part index");
     return v1;
   }
@@ -141,43 +131,43 @@ Post_View *GMSH_HarmonicToTimePlugin::execute(Post_View * v)
     return v1;
   }
 
-  Post_View *v2 = BeginView(1);
-
-  h2t(v1->NbSP, v1->SP, &v2->NbSP, v2->SP, 1, 1, rIndex, iIndex, nSteps);
-  h2t(v1->NbVP, v1->VP, &v2->NbVP, v2->VP, 1, 3, rIndex, iIndex, nSteps);
-  h2t(v1->NbTP, v1->TP, &v2->NbTP, v2->TP, 1, 9, rIndex, iIndex, nSteps);
-  h2t(v1->NbSL, v1->SL, &v2->NbSL, v2->SL, 2, 1, rIndex, iIndex, nSteps);
-  h2t(v1->NbVL, v1->VL, &v2->NbVL, v2->VL, 2, 3, rIndex, iIndex, nSteps);
-  h2t(v1->NbTL, v1->TL, &v2->NbTL, v2->TL, 2, 9, rIndex, iIndex, nSteps);
-  h2t(v1->NbST, v1->ST, &v2->NbST, v2->ST, 3, 1, rIndex, iIndex, nSteps);
-  h2t(v1->NbVT, v1->VT, &v2->NbVT, v2->VT, 3, 3, rIndex, iIndex, nSteps);
-  h2t(v1->NbTT, v1->TT, &v2->NbTT, v2->TT, 3, 9, rIndex, iIndex, nSteps);
-  h2t(v1->NbSQ, v1->SQ, &v2->NbSQ, v2->SQ, 4, 1, rIndex, iIndex, nSteps);
-  h2t(v1->NbVQ, v1->VQ, &v2->NbVQ, v2->VQ, 4, 3, rIndex, iIndex, nSteps);
-  h2t(v1->NbTQ, v1->TQ, &v2->NbTQ, v2->TQ, 4, 9, rIndex, iIndex, nSteps);
-  h2t(v1->NbSS, v1->SS, &v2->NbSS, v2->SS, 4, 1, rIndex, iIndex, nSteps);
-  h2t(v1->NbVS, v1->VS, &v2->NbVS, v2->VS, 4, 3, rIndex, iIndex, nSteps);
-  h2t(v1->NbTS, v1->TS, &v2->NbTS, v2->TS, 4, 9, rIndex, iIndex, nSteps);
-  h2t(v1->NbSH, v1->SH, &v2->NbSH, v2->SH, 8, 1, rIndex, iIndex, nSteps);
-  h2t(v1->NbVH, v1->VH, &v2->NbVH, v2->VH, 8, 3, rIndex, iIndex, nSteps);
-  h2t(v1->NbTH, v1->TH, &v2->NbTH, v2->TH, 8, 9, rIndex, iIndex, nSteps);
-  h2t(v1->NbSI, v1->SI, &v2->NbSI, v2->SI, 6, 1, rIndex, iIndex, nSteps);
-  h2t(v1->NbVI, v1->VI, &v2->NbVI, v2->VI, 6, 3, rIndex, iIndex, nSteps);
-  h2t(v1->NbTI, v1->TI, &v2->NbTI, v2->TI, 6, 9, rIndex, iIndex, nSteps);
-  h2t(v1->NbSY, v1->SY, &v2->NbSY, v2->SY, 5, 1, rIndex, iIndex, nSteps);
-  h2t(v1->NbVY, v1->VY, &v2->NbVY, v2->VY, 5, 3, rIndex, iIndex, nSteps);
-  h2t(v1->NbTY, v1->TY, &v2->NbTY, v2->TY, 5, 9, rIndex, iIndex, nSteps);
-
-  // copy time data
+  PView *v2 = new PView(true);
+
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
+
+  h2t(data1->NbSP, data1->SP, &data2->NbSP, data2->SP, 1, 1, rIndex, iIndex, nSteps);
+  h2t(data1->NbVP, data1->VP, &data2->NbVP, data2->VP, 1, 3, rIndex, iIndex, nSteps);
+  h2t(data1->NbTP, data1->TP, &data2->NbTP, data2->TP, 1, 9, rIndex, iIndex, nSteps);
+  h2t(data1->NbSL, data1->SL, &data2->NbSL, data2->SL, 2, 1, rIndex, iIndex, nSteps);
+  h2t(data1->NbVL, data1->VL, &data2->NbVL, data2->VL, 2, 3, rIndex, iIndex, nSteps);
+  h2t(data1->NbTL, data1->TL, &data2->NbTL, data2->TL, 2, 9, rIndex, iIndex, nSteps);
+  h2t(data1->NbST, data1->ST, &data2->NbST, data2->ST, 3, 1, rIndex, iIndex, nSteps);
+  h2t(data1->NbVT, data1->VT, &data2->NbVT, data2->VT, 3, 3, rIndex, iIndex, nSteps);
+  h2t(data1->NbTT, data1->TT, &data2->NbTT, data2->TT, 3, 9, rIndex, iIndex, nSteps);
+  h2t(data1->NbSQ, data1->SQ, &data2->NbSQ, data2->SQ, 4, 1, rIndex, iIndex, nSteps);
+  h2t(data1->NbVQ, data1->VQ, &data2->NbVQ, data2->VQ, 4, 3, rIndex, iIndex, nSteps);
+  h2t(data1->NbTQ, data1->TQ, &data2->NbTQ, data2->TQ, 4, 9, rIndex, iIndex, nSteps);
+  h2t(data1->NbSS, data1->SS, &data2->NbSS, data2->SS, 4, 1, rIndex, iIndex, nSteps);
+  h2t(data1->NbVS, data1->VS, &data2->NbVS, data2->VS, 4, 3, rIndex, iIndex, nSteps);
+  h2t(data1->NbTS, data1->TS, &data2->NbTS, data2->TS, 4, 9, rIndex, iIndex, nSteps);
+  h2t(data1->NbSH, data1->SH, &data2->NbSH, data2->SH, 8, 1, rIndex, iIndex, nSteps);
+  h2t(data1->NbVH, data1->VH, &data2->NbVH, data2->VH, 8, 3, rIndex, iIndex, nSteps);
+  h2t(data1->NbTH, data1->TH, &data2->NbTH, data2->TH, 8, 9, rIndex, iIndex, nSteps);
+  h2t(data1->NbSI, data1->SI, &data2->NbSI, data2->SI, 6, 1, rIndex, iIndex, nSteps);
+  h2t(data1->NbVI, data1->VI, &data2->NbVI, data2->VI, 6, 3, rIndex, iIndex, nSteps);
+  h2t(data1->NbTI, data1->TI, &data2->NbTI, data2->TI, 6, 9, rIndex, iIndex, nSteps);
+  h2t(data1->NbSY, data1->SY, &data2->NbSY, data2->SY, 5, 1, rIndex, iIndex, nSteps);
+  h2t(data1->NbVY, data1->VY, &data2->NbVY, data2->VY, 5, 3, rIndex, iIndex, nSteps);
+  h2t(data1->NbTY, data1->TY, &data2->NbTY, data2->TY, 5, 9, rIndex, iIndex, nSteps);
+
   for(int i = 0; i < nSteps; i++){
-    double p = 2.*M_PI*i/(double)nSteps;
-    List_Add(v2->Time, &p);
+    double p = 2. * M_PI * i / (double)nSteps;
+    List_Add(data2->Time, &p);
   }
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_HarmonicToTime", v1->Name);
-  sprintf(filename, "%s_HarmonicToTime.pos", v1->Name);
-  EndView(v2, 1, filename, name);
+  data2->setName(data1->getName() + "_HarmonicToTime");
+  data2->setFileName(data1->getName() + "_HarmonicToTime.pos");
+  data2->finalize();
 
   return v2;
 }
diff --git a/Plugin/HarmonicToTime.h b/Plugin/HarmonicToTime.h
index 79650a415ca5faf7e48cdf83739815c5c90c092b..6ea964894f812cf40b0a03e27ff8c1b00cdd7e98 100644
--- a/Plugin/HarmonicToTime.h
+++ b/Plugin/HarmonicToTime.h
@@ -36,7 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Integrate.cpp b/Plugin/Integrate.cpp
index ec065deed6a06fb98c1c622f1bb14e7b556dcb54..35a036ec4ea308667414d0695f65b2d254a187e6 100644
--- a/Plugin/Integrate.cpp
+++ b/Plugin/Integrate.cpp
@@ -1,4 +1,4 @@
-// $Id: Integrate.cpp,v 1.21 2007-09-04 13:47:05 remacle Exp $
+// $Id: Integrate.cpp,v 1.22 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,16 +19,9 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Integrate.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
 #include "ShapeFunctions.h"
 
-extern Context_T CTX;
-
 StringXNumber IntegrateOptions_Number[] = {
   {GMSH_FULLRC, "iView", NULL, -1.}
 };
@@ -111,57 +104,54 @@ static double integrate(int nbList, List_T *list, int dim,
   return res;
 }
 
-Post_View *GMSH_IntegratePlugin::execute(Post_View * v)
+PView *GMSH_IntegratePlugin::execute(PView * v)
 {
   int iView = (int)IntegrateOptions_Number[1].def;
   
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-  
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-  
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *v2 = new PView(true);
+
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
   
-  double x = (v1->BBox[0]+v1->BBox[1])/2.;
-  double y = (v1->BBox[2]+v1->BBox[3])/2.;
-  double z = (v1->BBox[4]+v1->BBox[5])/2.;
-  List_Add(v2->SP, &x);
-  List_Add(v2->SP, &y);
-  List_Add(v2->SP, &z);
-  for(int ts = 0; ts < v1->NbTimeStep; ts++){
+  double x = data1->getBoundingBox().center().x();
+  double y = data1->getBoundingBox().center().y();
+  double z = data1->getBoundingBox().center().z();
+  List_Add(data2->SP, &x);
+  List_Add(data2->SP, &y);
+  List_Add(data2->SP, &z);
+  for(int ts = 0; ts < data1->getNumTimeSteps(); ts++){
     double val = 0;
     // scalar fields
-    val += integrate(v1->NbSP, v1->SP, 0, 1, 1, ts);
-    val += integrate(v1->NbSL, v1->SL, 1, 2, 1, ts);
-    val += integrate(v1->NbST, v1->ST, 2, 3, 1, ts);
-    val += integrate(v1->NbSQ, v1->SQ, 2, 4, 1, ts);
-    val += integrate(v1->NbSS, v1->SS, 3, 4, 1, ts);
-    val += integrate(v1->NbSH, v1->SH, 3, 8, 1, ts);
-    val += integrate(v1->NbSI, v1->SI, 3, 6, 1, ts);
-    val += integrate(v1->NbSY, v1->SY, 3, 5, 1, ts);
+    val += integrate(data1->NbSP, data1->SP, 0, 1, 1, ts);
+    val += integrate(data1->NbSL, data1->SL, 1, 2, 1, ts);
+    val += integrate(data1->NbST, data1->ST, 2, 3, 1, ts);
+    val += integrate(data1->NbSQ, data1->SQ, 2, 4, 1, ts);
+    val += integrate(data1->NbSS, data1->SS, 3, 4, 1, ts);
+    val += integrate(data1->NbSH, data1->SH, 3, 8, 1, ts);
+    val += integrate(data1->NbSI, data1->SI, 3, 6, 1, ts);
+    val += integrate(data1->NbSY, data1->SY, 3, 5, 1, ts);
     // circulations
-    val += integrate(v1->NbVL, v1->VL, 1, 2, 3, ts);
+    val += integrate(data1->NbVL, data1->VL, 1, 2, 3, ts);
     // fluxes
-    val += integrate(v1->NbVT, v1->VT, 2, 3, 3, ts);
-    val += integrate(v1->NbVQ, v1->VQ, 2, 4, 3, ts);
+    val += integrate(data1->NbVT, data1->VT, 2, 3, 3, ts);
+    val += integrate(data1->NbVQ, data1->VQ, 2, 4, 3, ts);
     Msg(INFO, "Step %d: integral = %.16g", ts, val);
-    List_Add(v2->SP, &val);
+    List_Add(data2->SP, &val);
   }
-  v2->NbSP = 1;
-  v2->IntervalsType = DRAW_POST_NUMERIC;
+  data2->NbSP = 1;
+  v2->getOptions()->IntervalsType = PViewOptions::Numeric;
   
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++)
-    List_Add(v2->Time, List_Pointer(v1->Time, i));
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_Integrate", v1->Name);
-  sprintf(filename, "%s_Integrate.pos", v1->Name);
-  EndView(v2, 1, filename, name);
+  for(int i = 0; i < List_Nbr(data1->Time); i++)
+    List_Add(data2->Time, List_Pointer(data1->Time, i));
+  data2->setName(data1->getName() + "_Integrate");
+  data2->setFileName(data1->getName() + "_Integrate.pos");
+  data2->finalize();
   
   return v2;
 }
diff --git a/Plugin/Integrate.h b/Plugin/Integrate.h
index c2d75392a7481616ec4e30756f83152ecee3e053..fe209cf2b1a0d194a2af89f61659a3b78c54c706 100644
--- a/Plugin/Integrate.h
+++ b/Plugin/Integrate.h
@@ -36,7 +36,7 @@ class GMSH_IntegratePlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Lambda2.cpp b/Plugin/Lambda2.cpp
index 5efec69ece35f1be2f47f5c5baf2d6fc72790c0b..18c73aeced525f5c04e032ac57d239003f1fc7da 100644
--- a/Plugin/Lambda2.cpp
+++ b/Plugin/Lambda2.cpp
@@ -1,4 +1,4 @@
-// $Id: Lambda2.cpp,v 1.11 2006-11-27 22:22:32 geuzaine Exp $
+// $Id: Lambda2.cpp,v 1.12 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,17 +19,8 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Lambda2.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
 #include "ShapeFunctions.h"
-#include <math.h>
-#include <stdio.h>
-
-extern Context_T CTX;
 
 StringXNumber Lambda2Options_Number[] = {
   {GMSH_FULLRC, "Eigenvalue", NULL, 2.},
@@ -253,50 +244,49 @@ static void eigen(List_T *inList, int inNb,
   }
 }
 
-Post_View *GMSH_Lambda2Plugin::execute(Post_View * v)
+PView *GMSH_Lambda2Plugin::execute(PView *v)
 {
   int ev = (int)Lambda2Options_Number[0].def;
   int iView = (int)Lambda2Options_Number[1].def;
   
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-  
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);  
-  Post_View *v2 = BeginView(1);
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *v2 = new PView(true);
+
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
   
   // assume that the tensors contain the velocity gradient tensor
-  eigen(v1->TP, v1->NbTP, v2->SP, &v2->NbSP, v1->NbTimeStep, 1, 9, ev);
-  eigen(v1->TL, v1->NbTL, v2->SL, &v2->NbSL, v1->NbTimeStep, 2, 9, ev);
-  eigen(v1->TT, v1->NbTT, v2->ST, &v2->NbST, v1->NbTimeStep, 3, 9, ev);
-  eigen(v1->TQ, v1->NbTQ, v2->SQ, &v2->NbSQ, v1->NbTimeStep, 4, 9, ev);
-  eigen(v1->TS, v1->NbTS, v2->SS, &v2->NbSS, v1->NbTimeStep, 4, 9, ev);
-  eigen(v1->TH, v1->NbTH, v2->SH, &v2->NbSH, v1->NbTimeStep, 8, 9, ev);
-  eigen(v1->TI, v1->NbTI, v2->SI, &v2->NbSI, v1->NbTimeStep, 6, 9, ev);
-  eigen(v1->TY, v1->NbTY, v2->SY, &v2->NbSY, v1->NbTimeStep, 5, 9, ev);
+  int nts = data1->getNumTimeSteps();
+  eigen(data1->TP, data1->NbTP, data2->SP, &data2->NbSP, nts, 1, 9, ev);
+  eigen(data1->TL, data1->NbTL, data2->SL, &data2->NbSL, nts, 2, 9, ev);
+  eigen(data1->TT, data1->NbTT, data2->ST, &data2->NbST, nts, 3, 9, ev);
+  eigen(data1->TQ, data1->NbTQ, data2->SQ, &data2->NbSQ, nts, 4, 9, ev);
+  eigen(data1->TS, data1->NbTS, data2->SS, &data2->NbSS, nts, 4, 9, ev);
+  eigen(data1->TH, data1->NbTH, data2->SH, &data2->NbSH, nts, 8, 9, ev);
+  eigen(data1->TI, data1->NbTI, data2->SI, &data2->NbSI, nts, 6, 9, ev);
+  eigen(data1->TY, data1->NbTY, data2->SY, &data2->NbSY, nts, 5, 9, ev);
 
   // assume that the vectors contain the velocities
   // FIXME: only implemented for tri/tet at the moment
-  //eigen(v1->VP, v1->NbVP, v2->SP, &v2->NbSP, v1->NbTimeStep, 1, 3, ev);
-  //eigen(v1->VL, v1->NbVL, v2->SL, &v2->NbSL, v1->NbTimeStep, 2, 3, ev);
-  eigen(v1->VT, v1->NbVT, v2->ST, &v2->NbST, v1->NbTimeStep, 3, 3, ev);
-  //eigen(v1->VQ, v1->NbVQ, v2->SQ, &v2->NbSQ, v1->NbTimeStep, 4, 3, ev);
-  eigen(v1->VS, v1->NbVS, v2->SS, &v2->NbSS, v1->NbTimeStep, 4, 3, ev);
-  //eigen(v1->VH, v1->NbVH, v2->SH, &v2->NbSH, v1->NbTimeStep, 8, 3, ev);
-  //eigen(v1->VI, v1->NbVI, v2->SI, &v2->NbSI, v1->NbTimeStep, 6, 3, ev);
-  //eigen(v1->VY, v1->NbVY, v2->SY, &v2->NbSY, v1->NbTimeStep, 5, 3, ev);
+  //eigen(data1->VP, data1->NbVP, data2->SP, &data2->NbSP, nts, 1, 3, ev);
+  //eigen(data1->VL, data1->NbVL, data2->SL, &data2->NbSL, nts, 2, 3, ev);
+  eigen(data1->VT, data1->NbVT, data2->ST, &data2->NbST, nts, 3, 3, ev);
+  //eigen(data1->VQ, data1->NbVQ, data2->SQ, &data2->NbSQ, nts, 4, 3, ev);
+  eigen(data1->VS, data1->NbVS, data2->SS, &data2->NbSS, nts, 4, 3, ev);
+  //eigen(data1->VH, data1->NbVH, data2->SH, &data2->NbSH, nts, 8, 3, ev);
+  //eigen(data1->VI, data1->NbVI, data2->SI, &data2->NbSI, nts, 6, 3, ev);
+  //eigen(data1->VY, data1->NbVY, data2->SY, &data2->NbSY, nts, 5, 3, ev);
+
+  for(int i = 0; i < List_Nbr(data1->Time); i++)
+    List_Add(data2->Time, List_Pointer(data1->Time, i));
+  data2->setName(data1->getName() + "_Lambda2");
+  data2->setFileName(data1->getName() + "_Lambda2.pos");
+  data2->finalize();
 
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++)
-    List_Add(v2->Time, List_Pointer(v1->Time, i));
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_Lambda2", v1->Name);
-  sprintf(filename, "%s_Lambda2.pos", v1->Name);
-  EndView(v2, 1, filename, name);
   return v2;
 }
diff --git a/Plugin/Lambda2.h b/Plugin/Lambda2.h
index 0961e7f17de80384da7945ab6fe371b6c0235eac..03cc513778c030130c4200bae4a617afdf3a3a93 100644
--- a/Plugin/Lambda2.h
+++ b/Plugin/Lambda2.h
@@ -21,12 +21,6 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include "Plugin.h"
-#include "List.h"
-#include "Numeric.h"
-#include <algorithm>
-#include <functional>
-#include <math.h>
-#include <stdio.h>
 
 extern "C"
 {
@@ -42,8 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Levelset.cpp b/Plugin/Levelset.cpp
index 7cefa8e5f3bb21e34bf535bea7e75889881139d2..09c32d7fdddd05318e0b1946ad8da3d041e81d18 100644
--- a/Plugin/Levelset.cpp
+++ b/Plugin/Levelset.cpp
@@ -1,4 +1,4 @@
-// $Id: Levelset.cpp,v 1.33 2007-09-04 13:47:05 remacle Exp $
+// $Id: Levelset.cpp,v 1.34 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -22,14 +22,7 @@
 #include "Levelset.h"
 #include "MakeSimplex.h"
 #include "List.h"
-#include "Tools.h"
-#include "Views.h"
-#include "Iso.h"
 #include "Numeric.h"
-#include "Context.h"
-#include "Malloc.h"
-
-extern Context_T CTX;
 
 GMSH_LevelsetPlugin::GMSH_LevelsetPlugin()
 {
@@ -189,60 +182,60 @@ void GMSH_LevelsetPlugin::evalLevelset(int nbNod, int nbComp,
 
 void GMSH_LevelsetPlugin::addElement(int timeStep, int np, int nbEdg, int dNbComp,
 				     double xp[12], double yp[12], double zp[12],
-				     double valp[12][9], std::vector<Post_View *> &out)
+				     double valp[12][9], std::vector<PViewDataList *> &out)
 {
-  // select the output view
-  Post_View *view = _valueIndependent ? out[0] : out[timeStep];
+  // select the output data
+  PViewDataList *data = _valueIndependent ? out[0] : out[timeStep];
   List_T *list;
   int *nbPtr;
   switch(np){
   case 1:
-    if(dNbComp == 1)      { list = view->SP; nbPtr = &view->NbSP; }
-    else if(dNbComp == 3) { list = view->VP; nbPtr = &view->NbVP; }
-    else                  { list = view->TP; nbPtr = &view->NbTP; }
+    if(dNbComp == 1)      { list = data->SP; nbPtr = &data->NbSP; }
+    else if(dNbComp == 3) { list = data->VP; nbPtr = &data->NbVP; }
+    else                  { list = data->TP; nbPtr = &data->NbTP; }
     break;
   case 2:
-    if(dNbComp == 1)      { list = view->SL; nbPtr = &view->NbSL; }
-    else if(dNbComp == 3) { list = view->VL; nbPtr = &view->NbVL; }
-    else                  { list = view->TL; nbPtr = &view->NbTL; }
+    if(dNbComp == 1)      { list = data->SL; nbPtr = &data->NbSL; }
+    else if(dNbComp == 3) { list = data->VL; nbPtr = &data->NbVL; }
+    else                  { list = data->TL; nbPtr = &data->NbTL; }
     break;
   case 3:
-    if(dNbComp == 1)      { list = view->ST; nbPtr = &view->NbST; }
-    else if(dNbComp == 3) { list = view->VT; nbPtr = &view->NbVT; }
-    else                  { list = view->TT; nbPtr = &view->NbTT; }
+    if(dNbComp == 1)      { list = data->ST; nbPtr = &data->NbST; }
+    else if(dNbComp == 3) { list = data->VT; nbPtr = &data->NbVT; }
+    else                  { list = data->TT; nbPtr = &data->NbTT; }
     break;
   case 4:
     if(!_extractVolume || nbEdg <= 4){
-      if(dNbComp == 1)      { list = view->SQ; nbPtr = &view->NbSQ; }
-      else if(dNbComp == 3) { list = view->VQ; nbPtr = &view->NbVQ; }
-      else                  { list = view->TQ; nbPtr = &view->NbTQ; }
+      if(dNbComp == 1)      { list = data->SQ; nbPtr = &data->NbSQ; }
+      else if(dNbComp == 3) { list = data->VQ; nbPtr = &data->NbVQ; }
+      else                  { list = data->TQ; nbPtr = &data->NbTQ; }
     }
     else{
-      if(dNbComp == 1)      { list = view->SS; nbPtr = &view->NbSS; }
-      else if(dNbComp == 3) { list = view->VS; nbPtr = &view->NbVS; }
-      else                  { list = view->TS; nbPtr = &view->NbTS; }
+      if(dNbComp == 1)      { list = data->SS; nbPtr = &data->NbSS; }
+      else if(dNbComp == 3) { list = data->VS; nbPtr = &data->NbVS; }
+      else                  { list = data->TS; nbPtr = &data->NbTS; }
     }
     break;
   case 5:
-    if(dNbComp == 1)      { list = view->SY; nbPtr = &view->NbSY; }
-    else if(dNbComp == 3) { list = view->VY; nbPtr = &view->NbVY; }
-    else                  { list = view->TY; nbPtr = &view->NbTY; }
+    if(dNbComp == 1)      { list = data->SY; nbPtr = &data->NbSY; }
+    else if(dNbComp == 3) { list = data->VY; nbPtr = &data->NbVY; }
+    else                  { list = data->TY; nbPtr = &data->NbTY; }
     break;
   case 6:
-    if(dNbComp == 1)      { list = view->SI; nbPtr = &view->NbSI; }
-    else if(dNbComp == 3) { list = view->VI; nbPtr = &view->NbVI; }
-    else                  { list = view->TI; nbPtr = &view->NbTI; }
+    if(dNbComp == 1)      { list = data->SI; nbPtr = &data->NbSI; }
+    else if(dNbComp == 3) { list = data->VI; nbPtr = &data->NbVI; }
+    else                  { list = data->TI; nbPtr = &data->NbTI; }
     break;
   case 8: // should never happen
-    if(dNbComp == 1)      { list = view->SH; nbPtr = &view->NbSH; }
-    else if(dNbComp == 3) { list = view->VH; nbPtr = &view->NbVH; }
-    else                  { list = view->TH; nbPtr = &view->NbTH; }
+    if(dNbComp == 1)      { list = data->SH; nbPtr = &data->NbSH; }
+    else if(dNbComp == 3) { list = data->VH; nbPtr = &data->NbVH; }
+    else                  { list = data->TH; nbPtr = &data->NbTH; }
     break;
   default:
     return;
   }
 
-  // copy the elements in the output view
+  // copy the elements in the output data
   if(!timeStep || !_valueIndependent) {
     for(int k = 0; k < np; k++) 
       List_Add(list, &xp[k]);
@@ -262,7 +255,7 @@ void GMSH_LevelsetPlugin::nonZeroLevelset(int timeStep,
 					  double *x, double *y, double *z, 
 					  double *iVal, int iNbComp,
 					  double *dVal, int dNbComp,
-					  std::vector<Post_View *> &out)
+					  std::vector<PViewDataList*> &out)
 {
   double levels[8], scalarVal[8];
   
@@ -295,7 +288,7 @@ int GMSH_LevelsetPlugin::zeroLevelset(int timeStep,
 				      double *x, double *y, double *z, 
 				      double *iVal, int iNbComp,
 				      double *dVal, int dNbComp,
-				      std::vector<Post_View *> &out)
+				      std::vector<PViewDataList*> &out)
 {
   double levels[8], scalarVal[8];
 
@@ -405,25 +398,24 @@ int GMSH_LevelsetPlugin::zeroLevelset(int timeStep,
   return 0;
 }
 
-void GMSH_LevelsetPlugin::executeList(Post_View * iView, List_T * iList, 
+void GMSH_LevelsetPlugin::executeList(PViewDataList *iData, List_T *iList,
 				      int iNbElm, int iNbComp,
-				      Post_View * dView, List_T * dList, 
+				      PViewDataList *dData, List_T *dList,
 				      int dNbElm, int dNbComp,
 				      int nbNod, int nbEdg, int exn[12][2], 
-				      std::vector<Post_View *> &out)
+				      std::vector<PViewDataList*> &out)
 {
   if(!iNbElm || !dNbElm) 
     return;
   
   if(iNbElm != dNbElm) {
-    Msg(GERROR, "View[%d] and View[%d] have a different number of elements (%d != %d)",
-	iView->Index, dView->Index, iNbElm, dNbElm);
+    Msg(GERROR, "Views have a different number of elements (%d != %d)", iNbElm, dNbElm);
     return;
   }
 
   int dTimeStep = _valueTimeStep;
-  if(dTimeStep >= dView->NbTimeStep) {
-    Msg(GERROR, "Wrong time step %d in View[%d]", dTimeStep, dView->Index);
+  if(dTimeStep >= dData->getNumTimeSteps()) {
+    Msg(GERROR, "Wrong time step %d in view", dTimeStep);
     return;
   }
 
@@ -436,10 +428,10 @@ void GMSH_LevelsetPlugin::executeList(Post_View * iView, List_T * iList,
 
     if(nbNod == 1 || nbNod == 2 || nbNod == 3 || (nbNod == 4 && nbEdg == 6)) {
       // easy for simplices: at most one element is created per time step 
-      for(int iTS = 0; iTS < iView->NbTimeStep; iTS++) {
+      for(int iTS = 0; iTS < iData->getNumTimeSteps(); iTS++) {
 	int dTS = (dTimeStep < 0) ? iTS : dTimeStep;
 	// don't compute the zero levelset of the value view
-	if(dTimeStep < 0 || iView != dView || dTS != iTS) {
+	if(dTimeStep < 0 || iData != dData || dTS != iTS) {
 	  double *iVal = (double *)List_Pointer_Fast(iList, i + 3 * nbNod + 
 						     iNbComp * nbNod * iTS); 
 	  double *dVal = (double *)List_Pointer_Fast(dList, j + 3 * nbNod + 
@@ -473,10 +465,10 @@ void GMSH_LevelsetPlugin::executeList(Post_View * iView, List_T * iList,
 	if(zeroLevelset(0, nbNod, nbEdg, exn, x, y, z, NULL, 0, 
 			NULL, 0, out)) {
 	  for(int k = 0; k < iDec.numSimplices(); k++) {
-	    for(int iTS = 0; iTS < iView->NbTimeStep; iTS++) {
+	    for(int iTS = 0; iTS < iData->getNumTimeSteps(); iTS++) {
 	      int dTS = (dTimeStep < 0) ? iTS : dTimeStep;
 	      // don't compute the zero levelset of the value view
-	      if(dTimeStep < 0 || iView != dView || dTS != iTS) {
+	      if(dTimeStep < 0 || iData != dData || dTS != iTS) {
 		double *iVal = (double *)List_Pointer_Fast(iList, i + 3 * nbNod + 
 							   iNbComp * nbNod * iTS); 
 		double *dVal = (double *)List_Pointer_Fast(dList, j + 3 * nbNod + 
@@ -493,10 +485,10 @@ void GMSH_LevelsetPlugin::executeList(Post_View * iView, List_T * iList,
 	  }
 	}
 	else if(_extractVolume){
-	  for(int iTS = 0; iTS < iView->NbTimeStep; iTS++) {
+	  for(int iTS = 0; iTS < iData->getNumTimeSteps(); iTS++) {
 	    int dTS = (dTimeStep < 0) ? iTS : dTimeStep;
 	    // don't compute the zero levelset of the value view
-	    if(dTimeStep < 0 || iView != dView || dTS != iTS) {
+	    if(dTimeStep < 0 || iData != dData || dTS != iTS) {
 	      double *iVal = (double *)List_Pointer_Fast(iList, i + 3 * nbNod + 
 							 iNbComp * nbNod * iTS); 
 	      double *dVal = (double *)List_Pointer_Fast(dList, j + 3 * nbNod + 
@@ -510,10 +502,10 @@ void GMSH_LevelsetPlugin::executeList(Post_View * iView, List_T * iList,
       else{
 	// since we generate one view for each time step, we can
 	// generate multiple elements per time step without problem.
-	for(int iTS = 0; iTS < iView->NbTimeStep; iTS++) {
+	for(int iTS = 0; iTS < iData->getNumTimeSteps(); iTS++) {
 	  int dTS = (dTimeStep < 0) ? iTS : dTimeStep;
 	  // don't compute the zero levelset of the value view
-	  if(dTimeStep < 0 || iView != dView || dTS != iTS) {
+	  if(dTimeStep < 0 || iData != dData || dTS != iTS) {
 	    double *iVal = (double *)List_Pointer_Fast(iList, i + 3 * nbNod +
 						       iNbComp * nbNod * iTS); 
 	    double *dVal = (double *)List_Pointer_Fast(dList, j + 3 * nbNod +
@@ -544,40 +536,41 @@ void GMSH_LevelsetPlugin::executeList(Post_View * iView, List_T * iList,
   }
 }
   
-Post_View *GMSH_LevelsetPlugin::execute(Post_View * v)
+PView *GMSH_LevelsetPlugin::execute(PView *v)
 {
-  Post_View *w;
-  std::vector<Post_View *> out;
-
-  if(v->adaptive)
-    v->adaptive->setTolerance(_targetError);
-  if(v->adaptive && v->NbST)
-    v->setAdaptiveResolutionLevel(_recurLevel, this);
-  if(v->adaptive && v->NbSS)
-    v->setAdaptiveResolutionLevel(_recurLevel, this);
-  if(v->adaptive && v->NbSQ)
-    v->setAdaptiveResolutionLevel(_recurLevel, this);
-  if(v->adaptive && v->NbSH)
-    v->setAdaptiveResolutionLevel(_recurLevel, this);
-  
+  PView *w;
+  std::vector<PViewDataList*> out;
+
+  PViewDataList *dv = getDataList(v);
+  if(!dv) return v;
+
+  if(dv->isAdaptive()){
+    dv->adaptive->setTolerance(_targetError);
+    if(dv->NbST || dv->NbSS || dv->NbSQ || dv->NbSH)
+      dv->setAdaptiveResolutionLevel(_recurLevel, this);
+  }
+
   if(_valueView < 0) {
     w = v;
   }
-  else if(!List_Pointer_Test(CTX.post.list, _valueView)) {
-    Msg(GERROR, "View[%d] does not exist: reverting to View[%d]", _valueView, 
-	v->Index);
+  else if(_valueView < 0 || _valueView > PView::list.size() - 1){
+    Msg(GERROR, "View[%d] does not exist: reverting to View[%d]", 
+	_valueView, v->getIndex());
     w = v;
   }
   else{
-    w = *(Post_View **)List_Pointer(CTX.post.list, _valueView);
+    w = PView::list[_valueView];
   }
 
+  PViewDataList *dw = getDataList(w);
+  if(!dw) return v;
+
   if(_valueIndependent) {
-    out.push_back(BeginView(1));
+    out.push_back(getDataList(new PView(true)));
   }
   else{
-    for(int ts = 0; ts < v->NbTimeStep; ts++)
-      out.push_back(BeginView(1));
+    for(int ts = 0; ts < dv->getNumTimeSteps(); ts++)
+      out.push_back(getDataList(new PView(true)));
   }
 
   // We should definitely recode the View interface in C++ (and define
@@ -588,189 +581,189 @@ Post_View *GMSH_LevelsetPlugin::execute(Post_View * v)
   // as the levelset view (v).
 
   // points
-  executeList(v, v->SP, v->NbSP, 1, w, w->SP, w->NbSP, 1, 1, 0, 0, out);
-  if(v != w) {
-    executeList(v, v->SP, v->NbSP, 1, w, w->VP, w->NbVP, 3, 1, 0, 0, out);
-    executeList(v, v->SP, v->NbSP, 1, w, w->TP, w->NbTP, 9, 1, 0, 0, out);
+  executeList(dv, dv->SP, dv->NbSP, 1, dw, dw->SP, dw->NbSP, 1, 1, 0, 0, out);
+  if(dv != dw) {
+    executeList(dv, dv->SP, dv->NbSP, 1, dw, dw->VP, dw->NbVP, 3, 1, 0, 0, out);
+    executeList(dv, dv->SP, dv->NbSP, 1, dw, dw->TP, dw->NbTP, 9, 1, 0, 0, out);
   }
 
-  if(v != w) {
-    executeList(v, v->VP, v->NbVP, 3, w, w->SP, w->NbSP, 1, 1, 0, 0, out);
+  if(dv != dw) {
+    executeList(dv, dv->VP, dv->NbVP, 3, dw, dw->SP, dw->NbSP, 1, 1, 0, 0, out);
   }
-  executeList(v, v->VP, v->NbVP, 3, w, w->VP, w->NbVP, 3, 1, 0, 0, out);
-  if(v != w) {
-    executeList(v, v->VP, v->NbVP, 3, w, w->TP, w->NbTP, 9, 1, 0, 0, out);
+  executeList(dv, dv->VP, dv->NbVP, 3, dw, dw->VP, dw->NbVP, 3, 1, 0, 0, out);
+  if(dv != dw) {
+    executeList(dv, dv->VP, dv->NbVP, 3, dw, dw->TP, dw->NbTP, 9, 1, 0, 0, out);
   }
 
-  if(v != w) {
-    executeList(v, v->TP, v->NbTP, 9, w, w->SP, w->NbSP, 1, 1, 0, 0, out);
-    executeList(v, v->TP, v->NbTP, 9, w, w->VP, w->NbVP, 3, 1, 0, 0, out);
+  if(dv != dw) {
+    executeList(dv, dv->TP, dv->NbTP, 9, dw, dw->SP, dw->NbSP, 1, 1, 0, 0, out);
+    executeList(dv, dv->TP, dv->NbTP, 9, dw, dw->VP, dw->NbVP, 3, 1, 0, 0, out);
   }
-  executeList(v, v->TP, v->NbTP, 9, w, w->TP, w->NbTP, 9, 1, 0, 0, out);
+  executeList(dv, dv->TP, dv->NbTP, 9, dw, dw->TP, dw->NbTP, 9, 1, 0, 0, out);
 
   // lines
   int exnLin[12][2] = {{0,1}};
-  executeList(v, v->SL, v->NbSL, 1, w, w->SL, w->NbSL, 1, 2, 1, exnLin, out);
-  if(v != w) {
-    executeList(v, v->SL, v->NbSL, 1, w, w->VL, w->NbVL, 3, 2, 1, exnLin, out);
-    executeList(v, v->SL, v->NbSL, 1, w, w->TL, w->NbTL, 9, 2, 1, exnLin, out);
+  executeList(dv, dv->SL, dv->NbSL, 1, dw, dw->SL, dw->NbSL, 1, 2, 1, exnLin, out);
+  if(dv != dw) {
+    executeList(dv, dv->SL, dv->NbSL, 1, dw, dw->VL, dw->NbVL, 3, 2, 1, exnLin, out);
+    executeList(dv, dv->SL, dv->NbSL, 1, dw, dw->TL, dw->NbTL, 9, 2, 1, exnLin, out);
   }
 
-  if(v != w) {
-    executeList(v, v->VL, v->NbVL, 3, w, w->SL, w->NbSL, 1, 2, 1, exnLin, out);
+  if(dv != dw) {
+    executeList(dv, dv->VL, dv->NbVL, 3, dw, dw->SL, dw->NbSL, 1, 2, 1, exnLin, out);
   }
-  executeList(v, v->VL, v->NbVL, 3, w, w->VL, w->NbVL, 3, 2, 1, exnLin, out);
-  if(v != w) {
-    executeList(v, v->VL, v->NbVL, 3, w, w->TL, w->NbTL, 9, 2, 1, exnLin, out);
+  executeList(dv, dv->VL, dv->NbVL, 3, dw, dw->VL, dw->NbVL, 3, 2, 1, exnLin, out);
+  if(dv != dw) {
+    executeList(dv, dv->VL, dv->NbVL, 3, dw, dw->TL, dw->NbTL, 9, 2, 1, exnLin, out);
   }
 
-  if(v != w) {
-    executeList(v, v->TL, v->NbTL, 9, w, w->SL, w->NbSL, 1, 2, 1, exnLin, out);
-    executeList(v, v->TL, v->NbTL, 9, w, w->VL, w->NbVL, 3, 2, 1, exnLin, out);
+  if(dv != dw) {
+    executeList(dv, dv->TL, dv->NbTL, 9, dw, dw->SL, dw->NbSL, 1, 2, 1, exnLin, out);
+    executeList(dv, dv->TL, dv->NbTL, 9, dw, dw->VL, dw->NbVL, 3, 2, 1, exnLin, out);
   }
-  executeList(v, v->TL, v->NbTL, 9, w, w->TL, w->NbTL, 9, 2, 1, exnLin, out);
+  executeList(dv, dv->TL, dv->NbTL, 9, dw, dw->TL, dw->NbTL, 9, 2, 1, exnLin, out);
 
   // triangles
   int exnTri[12][2] = {{0,1}, {0,2}, {1,2}};
-  executeList(v, v->ST, v->NbST, 1, w, w->ST, w->NbST, 1, 3, 3, exnTri, out);
-  if(v != w) {
-    executeList(v, v->ST, v->NbST, 1, w, w->VT, w->NbVT, 3, 3, 3, exnTri, out);
-    executeList(v, v->ST, v->NbST, 1, w, w->TT, w->NbTT, 9, 3, 3, exnTri, out);
+  executeList(dv, dv->ST, dv->NbST, 1, dw, dw->ST, dw->NbST, 1, 3, 3, exnTri, out);
+  if(dv != dw) {
+    executeList(dv, dv->ST, dv->NbST, 1, dw, dw->VT, dw->NbVT, 3, 3, 3, exnTri, out);
+    executeList(dv, dv->ST, dv->NbST, 1, dw, dw->TT, dw->NbTT, 9, 3, 3, exnTri, out);
   }
 
-  if(v != w) {
-    executeList(v, v->VT, v->NbVT, 3, w, w->ST, w->NbST, 1, 3, 3, exnTri, out);
+  if(dv != dw) {
+    executeList(dv, dv->VT, dv->NbVT, 3, dw, dw->ST, dw->NbST, 1, 3, 3, exnTri, out);
   }
-  executeList(v, v->VT, v->NbVT, 3, w, w->VT, w->NbVT, 3, 3, 3, exnTri, out);
-  if(v != w) {
-    executeList(v, v->VT, v->NbVT, 3, w, w->TT, w->NbTT, 9, 3, 3, exnTri, out);
+  executeList(dv, dv->VT, dv->NbVT, 3, dw, dw->VT, dw->NbVT, 3, 3, 3, exnTri, out);
+  if(dv != dw) {
+    executeList(dv, dv->VT, dv->NbVT, 3, dw, dw->TT, dw->NbTT, 9, 3, 3, exnTri, out);
   }
 
-  if(v != w) {
-    executeList(v, v->TT, v->NbTT, 9, w, w->ST, w->NbST, 1, 3, 3, exnTri, out);
-    executeList(v, v->TT, v->NbTT, 9, w, w->VT, w->NbVT, 3, 3, 3, exnTri, out);
+  if(dv != dw) {
+    executeList(dv, dv->TT, dv->NbTT, 9, dw, dw->ST, dw->NbST, 1, 3, 3, exnTri, out);
+    executeList(dv, dv->TT, dv->NbTT, 9, dw, dw->VT, dw->NbVT, 3, 3, 3, exnTri, out);
   }
-  executeList(v, v->TT, v->NbTT, 9, w, w->TT, w->NbTT, 9, 3, 3, exnTri, out);
+  executeList(dv, dv->TT, dv->NbTT, 9, dw, dw->TT, dw->NbTT, 9, 3, 3, exnTri, out);
 
   // tets
   int exnTet[12][2] = {{0,1},{0,2},{0,3},{1,2},{1,3},{2,3}};
-  executeList(v, v->SS, v->NbSS, 1, w, w->SS, w->NbSS, 1, 4, 6, exnTet, out);
-  if(v != w) {
-    executeList(v, v->SS, v->NbSS, 1, w, w->VS, w->NbVS, 3, 4, 6, exnTet, out);
-    executeList(v, v->SS, v->NbSS, 1, w, w->TS, w->NbTS, 9, 4, 6, exnTet, out);
+  executeList(dv, dv->SS, dv->NbSS, 1, dw, dw->SS, dw->NbSS, 1, 4, 6, exnTet, out);
+  if(dv != dw) {
+    executeList(dv, dv->SS, dv->NbSS, 1, dw, dw->VS, dw->NbVS, 3, 4, 6, exnTet, out);
+    executeList(dv, dv->SS, dv->NbSS, 1, dw, dw->TS, dw->NbTS, 9, 4, 6, exnTet, out);
   }
 
-  if(v != w) {
-    executeList(v, v->VS, v->NbVS, 3, w, w->SS, w->NbSS, 1, 4, 6, exnTet, out);
+  if(dv != dw) {
+    executeList(dv, dv->VS, dv->NbVS, 3, dw, dw->SS, dw->NbSS, 1, 4, 6, exnTet, out);
   }
-  executeList(v, v->VS, v->NbVS, 3, w, w->VS, w->NbVS, 3, 4, 6, exnTet, out);
-  if(v != w) {
-    executeList(v, v->VS, v->NbVS, 3, w, w->TS, w->NbTS, 9, 4, 6, exnTet, out);
+  executeList(dv, dv->VS, dv->NbVS, 3, dw, dw->VS, dw->NbVS, 3, 4, 6, exnTet, out);
+  if(dv != dw) {
+    executeList(dv, dv->VS, dv->NbVS, 3, dw, dw->TS, dw->NbTS, 9, 4, 6, exnTet, out);
   }
 
-  if(v != w) {
-    executeList(v, v->TS, v->NbTS, 9, w, w->SS, w->NbSS, 1, 4, 6, exnTet, out);
-    executeList(v, v->TS, v->NbTS, 9, w, w->VS, w->NbVS, 3, 4, 6, exnTet, out);
+  if(dv != dw) {
+    executeList(dv, dv->TS, dv->NbTS, 9, dw, dw->SS, dw->NbSS, 1, 4, 6, exnTet, out);
+    executeList(dv, dv->TS, dv->NbTS, 9, dw, dw->VS, dw->NbVS, 3, 4, 6, exnTet, out);
   }
-  executeList(v, v->TS, v->NbTS, 9, w, w->TS, w->NbTS, 9, 4, 6, exnTet, out);
+  executeList(dv, dv->TS, dv->NbTS, 9, dw, dw->TS, dw->NbTS, 9, 4, 6, exnTet, out);
 
   // quads
   int exnQua[12][2] = {{0,1}, {0,3}, {1,2}, {2,3}};
-  executeList(v, v->SQ, v->NbSQ, 1, w, w->SQ, w->NbSQ, 1, 4, 4, exnQua, out);
-  if(v != w) {
-    executeList(v, v->SQ, v->NbSQ, 1, w, w->VQ, w->NbVQ, 3, 4, 4, exnQua, out);
-    executeList(v, v->SQ, v->NbSQ, 1, w, w->TQ, w->NbTQ, 9, 4, 4, exnQua, out);
+  executeList(dv, dv->SQ, dv->NbSQ, 1, dw, dw->SQ, dw->NbSQ, 1, 4, 4, exnQua, out);
+  if(dv != dw) {
+    executeList(dv, dv->SQ, dv->NbSQ, 1, dw, dw->VQ, dw->NbVQ, 3, 4, 4, exnQua, out);
+    executeList(dv, dv->SQ, dv->NbSQ, 1, dw, dw->TQ, dw->NbTQ, 9, 4, 4, exnQua, out);
   }
 
-  if(v != w) {
-    executeList(v, v->VQ, v->NbVQ, 3, w, w->SQ, w->NbSQ, 1, 4, 4, exnQua, out);
+  if(dv != dw) {
+    executeList(dv, dv->VQ, dv->NbVQ, 3, dw, dw->SQ, dw->NbSQ, 1, 4, 4, exnQua, out);
   }
-  executeList(v, v->VQ, v->NbVQ, 3, w, w->VQ, w->NbVQ, 3, 4, 4, exnQua, out);
-  if(v != w) {
-    executeList(v, v->VQ, v->NbVQ, 3, w, w->TQ, w->NbTQ, 9, 4, 4, exnQua, out);
+  executeList(dv, dv->VQ, dv->NbVQ, 3, dw, dw->VQ, dw->NbVQ, 3, 4, 4, exnQua, out);
+  if(dv != dw) {
+    executeList(dv, dv->VQ, dv->NbVQ, 3, dw, dw->TQ, dw->NbTQ, 9, 4, 4, exnQua, out);
   }
 
-  if(v != w) {
-    executeList(v, v->TQ, v->NbTQ, 9, w, w->SQ, w->NbSQ, 1, 4, 4, exnQua, out);
-    executeList(v, v->TQ, v->NbTQ, 9, w, w->VQ, w->NbVQ, 3, 4, 4, exnQua, out);
+  if(dv != dw) {
+    executeList(dv, dv->TQ, dv->NbTQ, 9, dw, dw->SQ, dw->NbSQ, 1, 4, 4, exnQua, out);
+    executeList(dv, dv->TQ, dv->NbTQ, 9, dw, dw->VQ, dw->NbVQ, 3, 4, 4, exnQua, out);
   }
-  executeList(v, v->TQ, v->NbTQ, 9, w, w->TQ, w->NbTQ, 9, 4, 4, exnQua, out);
+  executeList(dv, dv->TQ, dv->NbTQ, 9, dw, dw->TQ, dw->NbTQ, 9, 4, 4, exnQua, out);
 
   // hexes
   int exnHex[12][2] = {{0,1}, {0,3}, {0,4}, {1,2}, {1,5}, {2,3},
 		       {2,6}, {3,7}, {4,5}, {4,7}, {5,6}, {6,7}};
-  executeList(v, v->SH, v->NbSH, 1, w, w->SH, w->NbSH, 1, 8, 12, exnHex, out);
-  if(v != w) {
-    executeList(v, v->SH, v->NbSH, 1, w, w->VH, w->NbVH, 3, 8, 12, exnHex, out);
-    executeList(v, v->SH, v->NbSH, 1, w, w->TH, w->NbTH, 9, 8, 12, exnHex, out);
+  executeList(dv, dv->SH, dv->NbSH, 1, dw, dw->SH, dw->NbSH, 1, 8, 12, exnHex, out);
+  if(dv != dw) {
+    executeList(dv, dv->SH, dv->NbSH, 1, dw, dw->VH, dw->NbVH, 3, 8, 12, exnHex, out);
+    executeList(dv, dv->SH, dv->NbSH, 1, dw, dw->TH, dw->NbTH, 9, 8, 12, exnHex, out);
   }
 
-  if(v != w) {
-    executeList(v, v->VH, v->NbVH, 3, w, w->SH, w->NbSH, 1, 8, 12, exnHex, out);
+  if(dv != dw) {
+    executeList(dv, dv->VH, dv->NbVH, 3, dw, dw->SH, dw->NbSH, 1, 8, 12, exnHex, out);
   }
-  executeList(v, v->VH, v->NbVH, 3, w, w->VH, w->NbVH, 3, 8, 12, exnHex, out);
-  if(v != w) {
-    executeList(v, v->VH, v->NbVH, 3, w, w->TH, w->NbTH, 9, 8, 12, exnHex, out);
+  executeList(dv, dv->VH, dv->NbVH, 3, dw, dw->VH, dw->NbVH, 3, 8, 12, exnHex, out);
+  if(dv != dw) {
+    executeList(dv, dv->VH, dv->NbVH, 3, dw, dw->TH, dw->NbTH, 9, 8, 12, exnHex, out);
   }
 
-  if(v != w) {
-    executeList(v, v->TH, v->NbTH, 9, w, w->SH, w->NbSH, 1, 8, 12, exnHex, out);
-    executeList(v, v->TH, v->NbTH, 9, w, w->VH, w->NbVH, 3, 8, 12, exnHex, out);
+  if(dv != dw) {
+    executeList(dv, dv->TH, dv->NbTH, 9, dw, dw->SH, dw->NbSH, 1, 8, 12, exnHex, out);
+    executeList(dv, dv->TH, dv->NbTH, 9, dw, dw->VH, dw->NbVH, 3, 8, 12, exnHex, out);
   }
-  executeList(v, v->TH, v->NbTH, 9, w, w->TH, w->NbTH, 9, 8, 12, exnHex, out);
+  executeList(dv, dv->TH, dv->NbTH, 9, dw, dw->TH, dw->NbTH, 9, 8, 12, exnHex, out);
 
   // prisms
   int exnPri[12][2] = {{0,1}, {0,2}, {0,3}, {1,2}, {1,4}, {2,5},
 		       {3,4}, {3,5}, {4,5}};
-  executeList(v, v->SI, v->NbSI, 1, w, w->SI, w->NbSI, 1, 6, 9, exnPri, out);
-  if(v != w) {
-    executeList(v, v->SI, v->NbSI, 1, w, w->VI, w->NbVI, 3, 6, 9, exnPri, out);
-    executeList(v, v->SI, v->NbSI, 1, w, w->TI, w->NbTI, 9, 6, 9, exnPri, out);
+  executeList(dv, dv->SI, dv->NbSI, 1, dw, dw->SI, dw->NbSI, 1, 6, 9, exnPri, out);
+  if(dv != dw) {
+    executeList(dv, dv->SI, dv->NbSI, 1, dw, dw->VI, dw->NbVI, 3, 6, 9, exnPri, out);
+    executeList(dv, dv->SI, dv->NbSI, 1, dw, dw->TI, dw->NbTI, 9, 6, 9, exnPri, out);
   }
 
-  if(v != w) {
-    executeList(v, v->VI, v->NbVI, 3, w, w->SI, w->NbSI, 1, 6, 9, exnPri, out);
+  if(dv != dw) {
+    executeList(dv, dv->VI, dv->NbVI, 3, dw, dw->SI, dw->NbSI, 1, 6, 9, exnPri, out);
   }
-  executeList(v, v->VI, v->NbVI, 3, w, w->VI, w->NbVI, 3, 6, 9, exnPri, out);
-  if(v != w) {
-    executeList(v, v->VI, v->NbVI, 3, w, w->TI, w->NbTI, 9, 6, 9, exnPri, out);
+  executeList(dv, dv->VI, dv->NbVI, 3, dw, dw->VI, dw->NbVI, 3, 6, 9, exnPri, out);
+  if(dv != dw) {
+    executeList(dv, dv->VI, dv->NbVI, 3, dw, dw->TI, dw->NbTI, 9, 6, 9, exnPri, out);
   }
  
-  if(v != w) {
-    executeList(v, v->TI, v->NbTI, 9, w, w->SI, w->NbSI, 1, 6, 9, exnPri, out);
-    executeList(v, v->TI, v->NbTI, 9, w, w->VI, w->NbVI, 3, 6, 9, exnPri, out);
+  if(dv != dw) {
+    executeList(dv, dv->TI, dv->NbTI, 9, dw, dw->SI, dw->NbSI, 1, 6, 9, exnPri, out);
+    executeList(dv, dv->TI, dv->NbTI, 9, dw, dw->VI, dw->NbVI, 3, 6, 9, exnPri, out);
   }
-  executeList(v, v->TI, v->NbTI, 9, w, w->TI, w->NbTI, 9, 6, 9, exnPri, out);
+  executeList(dv, dv->TI, dv->NbTI, 9, dw, dw->TI, dw->NbTI, 9, 6, 9, exnPri, out);
 
   // pyramids
   int exnPyr[12][2] = {{0,1}, {0,3}, {0,4}, {1,2}, {1,4}, {2,3}, {2,4}, {3,4}};
-  executeList(v, v->SY, v->NbSY, 1, w, w->SY, w->NbSY, 1, 5, 8, exnPyr, out);
-  if(v != w) {
-    executeList(v, v->SY, v->NbSY, 1, w, w->VY, w->NbVY, 3, 5, 8, exnPyr, out);
-    executeList(v, v->SY, v->NbSY, 1, w, w->TY, w->NbTY, 9, 5, 8, exnPyr, out);
+  executeList(dv, dv->SY, dv->NbSY, 1, dw, dw->SY, dw->NbSY, 1, 5, 8, exnPyr, out);
+  if(dv != dw) {
+    executeList(dv, dv->SY, dv->NbSY, 1, dw, dw->VY, dw->NbVY, 3, 5, 8, exnPyr, out);
+    executeList(dv, dv->SY, dv->NbSY, 1, dw, dw->TY, dw->NbTY, 9, 5, 8, exnPyr, out);
   }
 
-  if(v != w) {
-    executeList(v, v->VY, v->NbVY, 3, w, w->SY, w->NbSY, 1, 5, 8, exnPyr, out);
+  if(dv != dw) {
+    executeList(dv, dv->VY, dv->NbVY, 3, dw, dw->SY, dw->NbSY, 1, 5, 8, exnPyr, out);
   }
-  executeList(v, v->VY, v->NbVY, 3, w, w->VY, w->NbVY, 3, 5, 8, exnPyr, out);
-  if(v != w) {
-    executeList(v, v->VY, v->NbVY, 3, w, w->TY, w->NbTY, 9, 5, 8, exnPyr, out);
+  executeList(dv, dv->VY, dv->NbVY, 3, dw, dw->VY, dw->NbVY, 3, 5, 8, exnPyr, out);
+  if(dv != dw) {
+    executeList(dv, dv->VY, dv->NbVY, 3, dw, dw->TY, dw->NbTY, 9, 5, 8, exnPyr, out);
   }
 
-  if(v != w) {
-    executeList(v, v->TY, v->NbTY, 9, w, w->SY, w->NbSY, 1, 5, 8, exnPyr, out);
-    executeList(v, v->TY, v->NbTY, 9, w, w->VY, w->NbVY, 3, 5, 8, exnPyr, out);
+  if(dv != dw) {
+    executeList(dv, dv->TY, dv->NbTY, 9, dw, dw->SY, dw->NbSY, 1, 5, 8, exnPyr, out);
+    executeList(dv, dv->TY, dv->NbTY, 9, dw, dw->VY, dw->NbVY, 3, 5, 8, exnPyr, out);
   }
-  executeList(v, v->TY, v->NbTY, 9, w, w->TY, w->NbTY, 9, 5, 8, exnPyr, out);
+  executeList(dv, dv->TY, dv->NbTY, 9, dw, dw->TY, dw->NbTY, 9, 5, 8, exnPyr, out);
 
   for(unsigned int i = 0; i < out.size(); i++) {
     // FIXME: create time data
-    // finalize
-    char name[1024], filename[1024];
-    sprintf(name, "%s_Levelset_%d", v->Name, i);
-    sprintf(filename, "%s_Levelset_%d.pos", v->Name, i);
-    EndView(out[i], 1, filename, name);
+    char tmp[246];
+    sprintf(tmp, "_Levelset_%d", i);
+    out[i]->setName(dv->getName() + tmp);
+    out[i]->setFileName(dv->getFileName() + tmp + ".pos");
+    out[i]->finalize();
   }
 
   return 0;
@@ -923,7 +916,7 @@ static bool recur_sign_change (adapt_quad *q, double val,
   }      
 }
 
-void GMSH_LevelsetPlugin::assign_specific_visibility () const
+void GMSH_LevelsetPlugin::assignSpecificVisibility () const
 {
   if(adapt_triangle::all_elems.size()){
     adapt_triangle *t = *adapt_triangle::all_elems.begin();
diff --git a/Plugin/Levelset.h b/Plugin/Levelset.h
index bbc7db7aab1f64c88479fcc05d3f664cfd0a6369..7f7050572530617356d0998ba0240ffc2c4815dd 100644
--- a/Plugin/Levelset.h
+++ b/Plugin/Levelset.h
@@ -37,28 +37,28 @@ private:
   double _invert;
   void addElement(int timeStep, int np, int nbEdg, int dNbComp,
 		  double xp[12], double yp[12], double zp[12],
-		  double valp[12][9], std::vector<Post_View *> &out);
+		  double valp[12][9], std::vector<PViewDataList*> &out);
   void evalLevelset(int nbNod, int nbComp,
 		    double *x, double *y, double *z, double *val,
 		    double *levels, double *scalarVal);
   void nonZeroLevelset(int timeStep, int nbVert, int nbEdg, int exn[12][2],
 		       double *x, double *y, double *z, 
 		       double *iVal, int iNbComp, double *dVal, int dNbComp,
-		       std::vector<Post_View*> &out);
+		       std::vector<PViewDataList*> &out);
   int zeroLevelset(int timeStep, int nbVert, int nbEdg, int exn[12][2],
 		   double *x, double *y, double *z, 
 		   double *iVal, int iNbComp, double *dVal, int dNbComp,
-		   std::vector<Post_View*> &out);
-  void executeList(Post_View * iView, List_T * iList, 
+		   std::vector<PViewDataList*> &out);
+  void executeList(PViewDataList *iData, List_T *iList, 
 		   int iNbElm, int iNbComp,
-		   Post_View * dView, List_T * dList, 
+		   PViewDataList *dData, List_T *dList, 
 		   int dNbElm, int dNbComp,
 		   int nbVert, int nbEdg, int exn[12][2], 
-		   std::vector<Post_View *> &out);
-  virtual void assign_specific_visibility () const;
+		   std::vector<PViewDataList*> &out);
+  virtual void assignSpecificVisibility () const;
 public:
   GMSH_LevelsetPlugin();
-  virtual Post_View *execute(Post_View *);
+  virtual PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/MakeSimplex.cpp b/Plugin/MakeSimplex.cpp
index e99ec1f8e78eb2fa1cc7bb2e499d012ee5ba9c01..fd48217f895539fd01056ee91c6b12f479b033fb 100644
--- a/Plugin/MakeSimplex.cpp
+++ b/Plugin/MakeSimplex.cpp
@@ -1,4 +1,4 @@
-// $Id: MakeSimplex.cpp,v 1.2 2007-09-04 13:47:05 remacle Exp $
+// $Id: MakeSimplex.cpp,v 1.3 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,16 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "MakeSimplex.h"
-#include "List.h"
-#include "Tree.h"
-#include "Views.h"
-#include "Context.h"
-#include "Malloc.h"
-#include "Numeric.h"
-
-extern Context_T CTX;
 
 StringXNumber MakeSimplexOptions_Number[] = {
   {GMSH_FULLRC, "iView", NULL, -1.}
@@ -83,18 +74,16 @@ void GMSH_MakeSimplexPlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "MakeSimplex failed...");
 }
 
-static void decomposeList(Post_View *v, int nbNod, int nbComp,
+static void decomposeList(PViewDataList *data, int nbNod, int nbComp,
 			  List_T **listIn, int *nbIn, List_T *listOut, int *nbOut)
 {
   double xNew[4], yNew[4], zNew[4];
-  double *valNew = new double[v->NbTimeStep * nbComp * nbNod];
-  MakeSimplex dec(nbNod, nbComp, v->NbTimeStep);
+  double *valNew = new double[data->getNumTimeSteps() * nbComp * nbNod];
+  MakeSimplex dec(nbNod, nbComp, data->getNumTimeSteps());
 
   if(!(*nbIn))
     return;
 
-  v->Changed = 1;
-
   int nb = List_Nbr(*listIn) / (*nbIn);
   for(int i = 0; i < List_Nbr(*listIn); i += nb){
     double *x = (double *)List_Pointer(*listIn, i);
@@ -109,7 +98,7 @@ static void decomposeList(Post_View *v, int nbNod, int nbComp,
 	List_Add(listOut, &yNew[k]);
       for(int k = 0; k < dec.numSimplexNodes(); k++)
 	List_Add(listOut, &zNew[k]);
-      for(int k = 0; k < dec.numSimplexNodes()*v->NbTimeStep*nbComp; k++)
+      for(int k = 0; k < dec.numSimplexNodes() * data->getNumTimeSteps() * nbComp; k++)
 	List_Add(listOut, &valNew[k]);
       (*nbOut)++;
     }
@@ -121,45 +110,43 @@ static void decomposeList(Post_View *v, int nbNod, int nbComp,
   *nbIn = 0;
 }
 
-Post_View *GMSH_MakeSimplexPlugin::execute(Post_View * v)
+PView *GMSH_MakeSimplexPlugin::execute(PView *v)
 {
   int iView = (int)MakeSimplexOptions_Number[0].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
 
   // Bail out if the view is an alias or if other views duplicate it
-  if(v1->AliasOf || v1->Links) {
+  if(v1->getAliasOf() || v1->getLinks()) {
     Msg(GERROR, "MakeSimplex cannot be applied to an aliased view");
     return 0;
   }
 
   // quads
-  decomposeList(v1, 4, 1, &v1->SQ, &v1->NbSQ, v1->ST, &v1->NbST);
-  decomposeList(v1, 4, 3, &v1->VQ, &v1->NbVQ, v1->VT, &v1->NbVT);
-  decomposeList(v1, 4, 9, &v1->TQ, &v1->NbTQ, v1->TT, &v1->NbTT);
+  decomposeList(data1, 4, 1, &data1->SQ, &data1->NbSQ, data1->ST, &data1->NbST);
+  decomposeList(data1, 4, 3, &data1->VQ, &data1->NbVQ, data1->VT, &data1->NbVT);
+  decomposeList(data1, 4, 9, &data1->TQ, &data1->NbTQ, data1->TT, &data1->NbTT);
 		          
   // hexas	          
-  decomposeList(v1, 8, 1, &v1->SH, &v1->NbSH, v1->SS, &v1->NbSS);
-  decomposeList(v1, 8, 3, &v1->VH, &v1->NbVH, v1->VS, &v1->NbVS);
-  decomposeList(v1, 8, 9, &v1->TH, &v1->NbTH, v1->TS, &v1->NbTS);
+  decomposeList(data1, 8, 1, &data1->SH, &data1->NbSH, data1->SS, &data1->NbSS);
+  decomposeList(data1, 8, 3, &data1->VH, &data1->NbVH, data1->VS, &data1->NbVS);
+  decomposeList(data1, 8, 9, &data1->TH, &data1->NbTH, data1->TS, &data1->NbTS);
 		          
   // prisms	          
-  decomposeList(v1, 6, 1, &v1->SI, &v1->NbSI, v1->SS, &v1->NbSS);
-  decomposeList(v1, 6, 3, &v1->VI, &v1->NbVI, v1->VS, &v1->NbVS);
-  decomposeList(v1, 6, 9, &v1->TI, &v1->NbTI, v1->TS, &v1->NbTS);
+  decomposeList(data1, 6, 1, &data1->SI, &data1->NbSI, data1->SS, &data1->NbSS);
+  decomposeList(data1, 6, 3, &data1->VI, &data1->NbVI, data1->VS, &data1->NbVS);
+  decomposeList(data1, 6, 9, &data1->TI, &data1->NbTI, data1->TS, &data1->NbTS);
 		          
   // pyramids	          
-  decomposeList(v1, 5, 1, &v1->SY, &v1->NbSY, v1->SS, &v1->NbSS);
-  decomposeList(v1, 5, 3, &v1->VY, &v1->NbVY, v1->VS, &v1->NbVS);
-  decomposeList(v1, 5, 9, &v1->TY, &v1->NbTY, v1->TS, &v1->NbTS);
+  decomposeList(data1, 5, 1, &data1->SY, &data1->NbSY, data1->SS, &data1->NbSS);
+  decomposeList(data1, 5, 3, &data1->VY, &data1->NbVY, data1->VS, &data1->NbVS);
+  decomposeList(data1, 5, 9, &data1->TY, &data1->NbTY, data1->TS, &data1->NbTS);
+
+  v1->setChanged(true);
 
   return v1;
 }
diff --git a/Plugin/MakeSimplex.h b/Plugin/MakeSimplex.h
index 9dad922b310f453e3b7df83c1b83ddd52161f220..4900b02a6861446df553de77d2752b15558ad699 100644
--- a/Plugin/MakeSimplex.h
+++ b/Plugin/MakeSimplex.h
@@ -36,7 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 class MakeSimplex{
diff --git a/Plugin/Makefile b/Plugin/Makefile
index a9ead8e1967969f5e818b604e68f5637d2979dd9..71596eef71edf4e928a8589de474b040df463b04 100644
--- a/Plugin/Makefile
+++ b/Plugin/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.130 2007-09-10 04:47:08 geuzaine Exp $
+# $Id: Makefile,v 1.131 2007-09-11 14:01:55 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -27,7 +27,7 @@ INCLUDE = -I../Common -I../Graphics -I../DataStr -I../Geo -I../Mesh\
           -I../contrib/Triangle -I../contrib/MathEval
 CFLAGS  = ${OPTIM} ${FLAGS} ${INCLUDE}
 
-SRC = Plugin.cpp\
+SRC = Plugin.cpp PluginManager.cpp\
         Levelset.cpp\
           CutPlane.cpp CutSphere.cpp CutMap.cpp \
         Smooth.cpp CutParametric.cpp\
@@ -70,192 +70,227 @@ depend:
 
 # DO NOT DELETE THIS LINE
 Plugin.o: Plugin.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \
-  ../DataStr/List.h ../Common/VertexArray.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
-  ../Post/AdaptiveViews.h ../Common/GmshMatrix.h PluginManager.h CutMap.h \
-  Levelset.h CutGrid.h StreamLines.h CutPlane.h CutParametric.h \
-  CutSphere.h Skin.h ../DataStr/Tree.h ../DataStr/avl.h Extract.h \
-  ExtractElements.h ExtractEdges.h HarmonicToTime.h ModulusPhase.h \
-  Integrate.h Gradient.h Curl.h Divergence.h Annotate.h Remove.h \
-  MakeSimplex.h Smooth.h Transform.h Triangulate.h Warp.h \
+  ../Common/Message.h ../Post/PView.h ../Common/VertexArray.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
+  ../Numeric/Numeric.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Post/AdaptiveViews.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h
+PluginManager.o: PluginManager.cpp Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  PluginManager.h CutMap.h Levelset.h CutGrid.h StreamLines.h CutPlane.h \
+  CutParametric.h CutSphere.h Skin.h ../DataStr/Tree.h ../DataStr/avl.h \
+  Extract.h ExtractElements.h ExtractEdges.h HarmonicToTime.h \
+  ModulusPhase.h Integrate.h Gradient.h Curl.h Divergence.h Annotate.h \
+  Remove.h MakeSimplex.h Smooth.h Transform.h Triangulate.h Warp.h \
   SphericalRaise.h Eigenvectors.h Eigenvalues.h Lambda2.h Evaluate.h \
   ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h \
   Probe.h FieldView.h ../Common/Context.h
 Levelset.o: Levelset.cpp Levelset.h Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  MakeSimplex.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../Graphics/Iso.h ../Common/Context.h \
-  ../DataStr/Malloc.h
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  MakeSimplex.h
 CutPlane.o: CutPlane.cpp CutPlane.h Levelset.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/Views.h ../Post/ColorTable.h ../DataStr/List.h \
-  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/AdaptiveViews.h \
+  ../Post/PView.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
   ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
-  ../Graphics/Draw.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h
+  ../Graphics/Draw.h
 CutSphere.o: CutSphere.cpp CutSphere.h Levelset.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/Views.h ../Post/ColorTable.h ../DataStr/List.h \
-  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/AdaptiveViews.h \
+  ../Post/PView.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
   ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
-  ../Graphics/Draw.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h
+  ../Graphics/Draw.h
 CutMap.o: CutMap.cpp CutMap.h Levelset.h Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
   ../Common/Context.h
 Smooth.o: Smooth.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \
-  ../DataStr/List.h ../Common/VertexArray.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
-  ../Post/AdaptiveViews.h ../Common/GmshMatrix.h Smooth.h \
-  ../Common/Context.h
+  ../Common/Message.h ../Post/PView.h ../Common/VertexArray.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
+  ../Numeric/Numeric.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Post/AdaptiveViews.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h Smooth.h ../Post/Views.h \
+  ../Post/ColorTable.h ../Post/AdaptiveViews.h ../Common/Context.h
 CutParametric.o: CutParametric.cpp ../Post/OctreePost.h \
   ../Common/Octree.h ../Common/OctreeInternals.h CutParametric.h Plugin.h \
   ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
-  ../Post/Views.h ../Post/ColorTable.h ../DataStr/List.h \
-  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
-  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/AdaptiveViews.h \
+  ../Post/PView.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
   ../Common/GmshMatrix.h ../Common/Context.h ../Common/GmshUI.h \
-  ../Graphics/Draw.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h
-Lambda2.o: Lambda2.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \
-  ../DataStr/List.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Graphics/Draw.h
+Lambda2.o: Lambda2.cpp Lambda2.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Common/ShapeFunctions.h
+Eigenvectors.o: Eigenvectors.cpp Eigenvectors.h Plugin.h \
+  ../Common/Options.h ../Post/ColorTable.h ../Common/Message.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 Lambda2.h \
-  ../Common/Context.h ../Common/ShapeFunctions.h
-Eigenvectors.o: Eigenvectors.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  Eigenvectors.h ../Common/Context.h ../DataStr/Malloc.h \
-  ../Numeric/EigSolve.h
-Eigenvalues.o: Eigenvalues.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  Eigenvalues.h ../Common/Context.h ../DataStr/Malloc.h
-StreamLines.o: StreamLines.cpp ../Post/OctreePost.h ../Common/Octree.h \
-  ../Common/OctreeInternals.h StreamLines.h Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ../Common/Context.h ../Common/GmshUI.h ../Graphics/Draw.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Numeric/EigSolve.h
+Eigenvalues.o: Eigenvalues.cpp Eigenvalues.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h
+StreamLines.o: StreamLines.cpp StreamLines.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h \
+  ../Common/Context.h ../Common/GmshUI.h ../Graphics/Draw.h
 CutGrid.o: CutGrid.cpp ../Post/OctreePost.h ../Common/Octree.h \
   ../Common/OctreeInternals.h CutGrid.h Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ../Common/Context.h ../Common/GmshUI.h ../Graphics/Draw.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h
-Transform.o: Transform.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  Transform.h ../Common/Context.h
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Common/Context.h ../Common/GmshUI.h ../Graphics/Draw.h
+Transform.o: Transform.cpp Transform.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h
 Triangulate.o: Triangulate.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 \
-  Plugin.h ../Common/Options.h ../Post/ColorTable.h ../Post/Views.h \
-  ../Post/ColorTable.h ../Common/VertexArray.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
-  ../Post/AdaptiveViews.h ../Common/GmshMatrix.h Triangulate.h \
-  ../Common/Context.h ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/gmshFace.h \
-  ../Geo/Geo.h ../Common/GmshDefines.h ../Geo/gmshSurface.h ../Geo/Pair.h \
-  ../Geo/Range.h ../Geo/SPoint2.h ../Geo/SPoint3.h ../Geo/SVector3.h \
+  ../Geo/gmshFace.h ../Geo/Geo.h ../Common/GmshDefines.h \
+  ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \
+  ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SPoint3.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Geo/SPoint2.h \
-  ../Geo/ExtrudeParams.h ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h \
-  ../Geo/Range.h ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h \
-  ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
-  ../Geo/GEntity.h ../Geo/MVertex.h ../Geo/GPoint.h ../Geo/SPoint2.h \
+  ../Geo/ExtrudeParams.h ../Common/SmoothData.h ../Numeric/Numeric.h \
+  ../Geo/GFace.h ../Geo/GPoint.h ../Geo/GEntity.h ../Geo/Range.h \
+  ../Geo/SPoint3.h ../Geo/SBoundingBox3d.h ../Geo/GEdgeLoop.h \
+  ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.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/MElement.h ../Geo/SPoint2.h \
-  ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h \
-  ../Geo/gmshVertex.h ../Geo/Geo.h ../Geo/GVertex.h ../Geo/Range.h
-Warp.o: Warp.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \
-  ../DataStr/List.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Common/Context.h ../Geo/ExtrudeParams.h ../Geo/MElement.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h \
+  ../Geo/gmshVertex.h ../Geo/Geo.h ../Geo/GVertex.h ../Geo/Range.h \
+  Triangulate.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \
+  ../Post/PView.h ../Common/VertexArray.h ../Post/PViewData.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h
+Warp.o: Warp.cpp Warp.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \
+  ../Common/Message.h ../Post/PView.h ../Common/VertexArray.h \
+  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
+  ../Numeric/Numeric.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Post/AdaptiveViews.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h
+SphericalRaise.o: SphericalRaise.cpp SphericalRaise.h Plugin.h \
+  ../Common/Options.h ../Post/ColorTable.h ../Common/Message.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 Warp.h \
-  ../Common/Context.h
-SphericalRaise.o: SphericalRaise.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h
+Skin.o: Skin.cpp Skin.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \
+  ../Common/Message.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 \
-  SphericalRaise.h ../Common/Context.h
-Skin.o: Skin.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \
-  ../DataStr/List.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Numeric/Numeric.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Post/AdaptiveViews.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../DataStr/Tree.h \
+  ../DataStr/avl.h ../DataStr/Malloc.h ../Common/Context.h
+Extract.o: Extract.cpp Extract.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h
+ExtractElements.o: ExtractElements.cpp ExtractElements.h Plugin.h \
+  ../Common/Options.h ../Post/ColorTable.h ../Common/Message.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 Skin.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../Common/Context.h ../DataStr/Malloc.h
-Extract.o: Extract.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \
-  ../DataStr/List.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h
+ExtractEdges.o: ExtractEdges.cpp ExtractEdges.h Plugin.h \
+  ../Common/Options.h ../Post/ColorTable.h ../Common/Message.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 Extract.h \
-  ../Common/Context.h ../DataStr/Malloc.h
-ExtractElements.o: ExtractElements.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ExtractElements.h ../Common/Context.h ../DataStr/Malloc.h
-ExtractEdges.o: ExtractEdges.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ExtractEdges.h ../DataStr/Tree.h ../DataStr/avl.h ../Common/Context.h \
-  ../DataStr/Malloc.h ../Mesh/BDS.h ../Geo/GFace.h ../Geo/GPoint.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h ../Mesh/BDS.h ../Geo/GFace.h ../Geo/GPoint.h \
   ../Geo/GEntity.h ../Geo/Range.h ../Geo/SPoint3.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/GmshDefines.h \
-  ../Geo/GEdgeLoop.h ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h \
-  ../Geo/GEntity.h ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/GPoint.h \
-  ../Geo/SPoint2.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/MElement.h \
-  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h \
-  ../Post/PView.h ../Post/PViewData.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h
-MakeSimplex.o: MakeSimplex.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  MakeSimplex.h ../DataStr/Tree.h ../DataStr/avl.h ../Common/Context.h \
-  ../DataStr/Malloc.h
-Evaluate.o: Evaluate.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  Evaluate.h ../Post/OctreePost.h ../Common/Octree.h \
-  ../Common/OctreeInternals.h ../Common/Context.h
-FieldView.o: FieldView.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ../Mesh/Field.h ../Post/PView.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Common/GmshDefines.h ../Geo/GEdgeLoop.h \
+  ../Geo/GEdge.h ../Geo/GEntity.h ../Geo/GVertex.h ../Geo/GEntity.h \
+  ../Geo/MVertex.h ../Geo/SPoint3.h ../Geo/GPoint.h ../Geo/SPoint2.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/MElement.h \
+  ../Geo/SPoint2.h ../Geo/SVector3.h ../Geo/Pair.h ../Geo/ExtrudeParams.h
+MakeSimplex.o: MakeSimplex.cpp MakeSimplex.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
-  ../Post/ColorTable.h ../Geo/Geo.h ../Common/GmshDefines.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h
+Evaluate.o: Evaluate.cpp Evaluate.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h
+FieldView.o: FieldView.cpp FieldView.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Mesh/Field.h ../Geo/Geo.h ../Common/GmshDefines.h \
   ../Geo/gmshSurface.h ../Geo/Pair.h ../Geo/Range.h ../Geo/SPoint2.h \
   ../Geo/SPoint3.h ../Geo/SVector3.h ../Geo/SBoundingBox3d.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
@@ -266,64 +301,78 @@ FieldView.o: FieldView.cpp Plugin.h ../Common/Options.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 \
-  ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h \
-  FieldView.h ../Common/ShapeFunctions.h
-Integrate.o: Integrate.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  Integrate.h ../Common/Context.h ../Common/ShapeFunctions.h
-Gradient.o: Gradient.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  Gradient.h ../Common/Context.h ../Common/ShapeFunctions.h
-Curl.o: Curl.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \
-  ../DataStr/List.h ../Common/VertexArray.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
-  ../Post/AdaptiveViews.h ../Common/GmshMatrix.h Curl.h \
-  ../Common/Context.h ../Common/ShapeFunctions.h
-Divergence.o: Divergence.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  Divergence.h ../Common/Context.h ../Common/ShapeFunctions.h
-Annotate.o: Annotate.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
+  ../Post/OctreePost.h ../Common/Octree.h ../Common/OctreeInternals.h
+Integrate.o: Integrate.cpp Integrate.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Common/ShapeFunctions.h
+Gradient.o: Gradient.cpp Gradient.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Common/ShapeFunctions.h
+Curl.o: Curl.cpp Curl.h Plugin.h ../Common/Options.h ../Post/ColorTable.h \
+  ../Common/Message.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 \
-  Annotate.h ../Common/Context.h ../Common/GmshUI.h ../Fltk/GUI.h \
+  ../Numeric/Numeric.h ../Post/PViewData.h ../Geo/SBoundingBox3d.h \
+  ../Geo/SPoint3.h ../Post/PViewOptions.h ../Post/ColorTable.h \
+  ../Post/PViewDataList.h ../Post/PViewData.h ../Post/AdaptiveViews.h \
+  ../DataStr/List.h ../Common/GmshMatrix.h ../Common/ShapeFunctions.h
+Divergence.o: Divergence.cpp Divergence.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Common/ShapeFunctions.h
+Annotate.o: Annotate.cpp Annotate.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Common/Context.h ../Common/GmshUI.h ../Fltk/GUI.h \
   ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h \
   ../Fltk/Popup_Button.h ../Fltk/SpherePosition_Widget.h \
-  ../Graphics/Draw.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h
-Remove.o: Remove.cpp Plugin.h ../Common/Options.h ../Post/ColorTable.h \
-  ../Common/Message.h ../Post/Views.h ../Post/ColorTable.h \
-  ../DataStr/List.h ../Common/VertexArray.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
-  ../Post/AdaptiveViews.h ../Common/GmshMatrix.h Remove.h \
-  ../Common/Context.h
+  ../Graphics/Draw.h
+Remove.o: Remove.cpp Remove.h Plugin.h ../Common/Options.h \
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h
 Probe.o: Probe.cpp Probe.h Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ../Common/Context.h ../Common/GmshUI.h ../Graphics/Draw.h \
-  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/OctreePost.h \
-  ../Common/Octree.h ../Common/OctreeInternals.h
-HarmonicToTime.o: HarmonicToTime.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  HarmonicToTime.h ../Common/Context.h
-ModulusPhase.o: ModulusPhase.cpp Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
-  ../Geo/SVector3.h ../Geo/SPoint3.h ../Common/SmoothData.h \
-  ../Numeric/Numeric.h ../Post/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ModulusPhase.h ../Common/Context.h
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../DataStr/List.h ../Common/GmshMatrix.h \
+  ../Common/Context.h ../Post/OctreePost.h ../Common/Octree.h \
+  ../Common/OctreeInternals.h ../Common/GmshUI.h ../Graphics/Draw.h
+HarmonicToTime.o: HarmonicToTime.cpp HarmonicToTime.h Plugin.h \
+  ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
+  ../Post/PView.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h
+ModulusPhase.o: ModulusPhase.cpp ModulusPhase.h Plugin.h \
+  ../Common/Options.h ../Post/ColorTable.h ../Common/Message.h \
+  ../Post/PView.h ../Common/VertexArray.h ../Geo/SVector3.h \
+  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
+  ../Post/PViewData.h ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h \
+  ../Post/PViewOptions.h ../Post/ColorTable.h ../Post/PViewDataList.h \
+  ../Post/PViewData.h ../Post/AdaptiveViews.h ../DataStr/List.h \
+  ../Common/GmshMatrix.h
diff --git a/Plugin/ModulusPhase.cpp b/Plugin/ModulusPhase.cpp
index c13d215b931be433f48269e5e8299e144bec3dbc..2d7b1e0d27992bb4714ec3f5dfa143799963083d 100644
--- a/Plugin/ModulusPhase.cpp
+++ b/Plugin/ModulusPhase.cpp
@@ -1,4 +1,4 @@
-// $Id: ModulusPhase.cpp,v 1.6 2007-09-04 13:47:05 remacle Exp $
+// $Id: ModulusPhase.cpp,v 1.7 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,14 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "ModulusPhase.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
-
-extern Context_T CTX;
 
 StringXNumber ModulusPhaseOptions_Number[] = {
   {GMSH_FULLRC, "RealPart", NULL, 0.},
@@ -111,43 +104,52 @@ static void mp(int nb1, List_T *list1, int nbNod, int nbComp)
   }
 }
 
-Post_View *GMSH_ModulusPhasePlugin::execute(Post_View * v)
+PView *GMSH_ModulusPhasePlugin::execute(PView *v)
 {
   int rIndex = (int)ModulusPhaseOptions_Number[0].def;
   int iIndex = (int)ModulusPhaseOptions_Number[1].def;
   int iView = (int)ModulusPhaseOptions_Number[2].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  if(rIndex < 0 || rIndex >= v1->NbTimeStep ||
-     iIndex < 0 || iIndex >= v1->NbTimeStep){
+  if(rIndex < 0 || rIndex >= data1->getNumTimeSteps() ||
+     iIndex < 0 || iIndex >= data1->getNumTimeSteps()){
     Msg(GERROR, "Wrong real or imaginary part index");
     return v1;
   }
 
-  mp(v1->NbSP, v1->SP, 1, 1); mp(v1->NbVP, v1->VP, 1, 3); mp(v1->NbTP, v1->TP, 1, 9);
-  mp(v1->NbSL, v1->SL, 2, 1); mp(v1->NbVL, v1->VL, 2, 3); mp(v1->NbTL, v1->TL, 2, 9);
-  mp(v1->NbST, v1->ST, 3, 1); mp(v1->NbVT, v1->VT, 3, 3); mp(v1->NbTT, v1->TT, 3, 9);
-  mp(v1->NbSQ, v1->SQ, 4, 1); mp(v1->NbVQ, v1->VQ, 4, 3); mp(v1->NbTQ, v1->TQ, 4, 9);
-  mp(v1->NbSS, v1->SS, 4, 1); mp(v1->NbVS, v1->VS, 4, 3); mp(v1->NbTS, v1->TS, 4, 9);
-  mp(v1->NbSH, v1->SH, 8, 1); mp(v1->NbVH, v1->VH, 8, 3); mp(v1->NbTH, v1->TH, 8, 9);
-  mp(v1->NbSI, v1->SI, 6, 1); mp(v1->NbVI, v1->VI, 6, 3); mp(v1->NbTI, v1->TI, 6, 9);
-  mp(v1->NbSY, v1->SY, 5, 1); mp(v1->NbVY, v1->VY, 5, 3); mp(v1->NbTY, v1->TY, 5, 9);
-
-  // recompute min/max, etc.:
-  v1->Min = VAL_INF;
-  v1->Max = -VAL_INF;
-  char name[1024], filename[1024];
-  sprintf(name, "%s_ModulusPhase", v1->Name);
-  sprintf(filename, "%s_ModulusPhase.pos", v1->Name);
-  EndView(v1, 0, filename, name);
+  mp(data1->NbSP, data1->SP, 1, 1); 
+  mp(data1->NbVP, data1->VP, 1, 3); 
+  mp(data1->NbTP, data1->TP, 1, 9);
+  mp(data1->NbSL, data1->SL, 2, 1);
+  mp(data1->NbVL, data1->VL, 2, 3); 
+  mp(data1->NbTL, data1->TL, 2, 9);
+  mp(data1->NbST, data1->ST, 3, 1); 
+  mp(data1->NbVT, data1->VT, 3, 3); 
+  mp(data1->NbTT, data1->TT, 3, 9);
+  mp(data1->NbSQ, data1->SQ, 4, 1); 
+  mp(data1->NbVQ, data1->VQ, 4, 3);
+  mp(data1->NbTQ, data1->TQ, 4, 9);
+  mp(data1->NbSS, data1->SS, 4, 1); 
+  mp(data1->NbVS, data1->VS, 4, 3); 
+  mp(data1->NbTS, data1->TS, 4, 9);
+  mp(data1->NbSH, data1->SH, 8, 1); 
+  mp(data1->NbVH, data1->VH, 8, 3);
+  mp(data1->NbTH, data1->TH, 8, 9);
+  mp(data1->NbSI, data1->SI, 6, 1); 
+  mp(data1->NbVI, data1->VI, 6, 3);
+  mp(data1->NbTI, data1->TI, 6, 9);
+  mp(data1->NbSY, data1->SY, 5, 1);
+  mp(data1->NbVY, data1->VY, 5, 3); 
+  mp(data1->NbTY, data1->TY, 5, 9);
+
+  data1->setName(data1->getName() + "_ModulusPhase");
+  data1->setName(data1->getName() + ".pos");
+  data1->finalize();
 
   return v1;
 }
diff --git a/Plugin/ModulusPhase.h b/Plugin/ModulusPhase.h
index 16d53ae4422803f4dcd235f95bd5f79cf0a2c3e6..6bca00621c09614732441fa682ece11a1d5e9d74 100644
--- a/Plugin/ModulusPhase.h
+++ b/Plugin/ModulusPhase.h
@@ -36,7 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp
index 6b18b63026acc87dfc7332d0b483645fed3baa04..b5e26ebd0e674c9fb57cda9fb32b681455bb5299 100644
--- a/Plugin/Plugin.cpp
+++ b/Plugin/Plugin.cpp
@@ -1,4 +1,4 @@
-// $Id: Plugin.cpp,v 1.90 2007-09-10 04:47:08 geuzaine Exp $
+// $Id: Plugin.cpp,v 1.91 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,304 +19,33 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#if !defined(HAVE_NO_DLL)
-#include <dlfcn.h>
-#endif
-
-#include <map>
-
-#if defined(HAVE_FLTK)
-#include <FL/Fl.H>
-#include <FL/filename.H>
-#endif
-
 #include "Plugin.h"
-#include "PluginManager.h"
-#include "CutMap.h"
-#include "CutGrid.h"
-#include "StreamLines.h"
-#include "CutPlane.h"
-#include "CutParametric.h"
-#include "CutSphere.h"
-#include "Skin.h"
-#include "Extract.h"
-#include "ExtractElements.h"
-#include "ExtractEdges.h"
-#include "HarmonicToTime.h"
-#include "ModulusPhase.h"
-#include "Integrate.h"
-#include "Gradient.h"
-#include "Curl.h"
-#include "Divergence.h"
-#include "Annotate.h"
-#include "Remove.h"
-#include "MakeSimplex.h"
-#include "Smooth.h"
-#include "Transform.h"
-#include "Triangulate.h"
-#include "Warp.h"
-#include "SphericalRaise.h"
-#include "Eigenvectors.h"
-#include "Eigenvalues.h"
-#include "Lambda2.h"
-#include "Evaluate.h"
-#include "Probe.h"
-#include "FieldView.h"
-#include "Context.h"
-
-
-//////////// FIXME ///////////////
-
-Post_View *BeginView(int alloc)
-{
-  return 0;
-}
-void EndView(Post_View *v, int AddInUI, char *FileName, char *Name)
-{
-
-}
-
-//////////////////////////////
-
-
-
 
-
-extern Context_T CTX;
-
-const char *GMSH_PluginEntry = "GMSH_RegisterPlugin";
-
-GMSH_PluginManager *GMSH_PluginManager::_instance = 0;
-
-GMSH_PluginManager::GMSH_PluginManager()
+PView *GMSH_Post_Plugin::getView(int index, PView *view)
 {
-}
-
-GMSH_PluginManager::~GMSH_PluginManager()
-{
-  for(iter it = allPlugins.begin(); it != allPlugins.end(); ++it)
-    delete(*it).second;
-}
+  if(index < 0)
+    index = view ? view->getIndex() : 0;
 
-GMSH_Plugin *GMSH_PluginManager::find(char *pluginName)
-{
-  iter it = allPlugins.find(pluginName);
-  if(it == allPlugins.end())
-    return 0;
-  return (*it).second;
-}
-
-GMSH_Solve_Plugin *GMSH_PluginManager::findSolverPlugin()
-{
-  iter it  = allPlugins.begin();
-  iter ite = allPlugins.end();
-  for (;it!=ite;++it) {
-    GMSH_Plugin *p = (*it).second;
-    if (p->getType() == GMSH_Plugin::GMSH_SOLVE_PLUGIN) {
-      return (GMSH_Solve_Plugin*)(p);
-    }      
+  if(index >= 0 && index < PView::list.size()){
+    return PView::list[index];
   }
-  return 0;
-}
-
-void GMSH_PluginManager::action(char *pluginName, char *action, void *data)
-{
-  GMSH_Plugin *plugin = find(pluginName);
-  if(!plugin)
-    throw "Unknown plugin name";
-
-  if(!strcmp(action, "Run"))
-    plugin->run();
-  else
-    throw "Unknown plugin action";
-}
-
-void GMSH_PluginManager::setPluginOption(char *pluginName, char *option,
-                                         char *value)
-{
-  GMSH_Plugin *plugin = find(pluginName);
-
-  if(!plugin)
-    throw "Unknown plugin name";
-
-  for(int i = 0; i < plugin->getNbOptionsStr(); i++) {
-    StringXString *sxs;
-    // get the ith option of the plugin
-    sxs = plugin->getOptionStr(i);
-    // look if it's the good option name
-    if(!strcmp(sxs->str, option)) {
-      sxs->def = value;
-      return;
-    }
-  }
-
-  throw "Unknown plugin option name";
-}
-
-void GMSH_PluginManager::setPluginOption(char *pluginName, char *option,
-                                         double value)
-{
-  GMSH_Plugin *plugin = find(pluginName);
-
-  if(!plugin)
-    throw "Unknown plugin name";
-
-  for(int i = 0; i < plugin->getNbOptions(); i++) {
-    StringXNumber *sxn;
-    // get the ith option of the plugin
-    sxn = plugin->getOption(i);
-    // look if it's the good option name
-    if(!strcmp(sxn->str, option)) {
-      sxn->def = value;
-      return;
-    }
-  }
-  throw "Unknown plugin option name";
-}
-
-GMSH_PluginManager *GMSH_PluginManager::instance()
-{
-  if(!_instance) {
-    _instance = new GMSH_PluginManager;
+  else{
+    Msg(GERROR, "View[%d] does not exist", index);
+    return 0;
   }
-  return _instance;
 }
 
-void GMSH_PluginManager::registerDefaultPlugins()
+PViewDataList *GMSH_Post_Plugin::getDataList(PView *view)
 {
-  if(CTX.solver.plugins){
-    // nothing here yet
-  }
-
-  if(CTX.post.plugins){
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("StreamLines", GMSH_RegisterStreamLinesPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("CutGrid", GMSH_RegisterCutGridPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("CutMap", GMSH_RegisterCutMapPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("CutPlane", GMSH_RegisterCutPlanePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("CutSphere", GMSH_RegisterCutSpherePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Skin", GMSH_RegisterSkinPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Extract", GMSH_RegisterExtractPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("ExtractElements", GMSH_RegisterExtractElementsPlugin()));
-#if 0 // waiting for BDS rewrite
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("ExtractEdges", GMSH_RegisterExtractEdgesPlugin()));
-#endif
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("MakeSimplex", GMSH_RegisterMakeSimplexPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Smooth", GMSH_RegisterSmoothPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Transform", GMSH_RegisterTransformPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Warp", GMSH_RegisterWarpPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("SphericalRaise", GMSH_RegisterSphericalRaisePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("HarmonicToTime", GMSH_RegisterHarmonicToTimePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("ModulusPhase", GMSH_RegisterModulusPhasePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Integrate", GMSH_RegisterIntegratePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Gradient", GMSH_RegisterGradientPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Curl", GMSH_RegisterCurlPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Divergence", GMSH_RegisterDivergencePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Annotate", GMSH_RegisterAnnotatePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Remove", GMSH_RegisterRemovePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Eigenvectors", GMSH_RegisterEigenvectorsPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Eigenvalues", GMSH_RegisterEigenvaluesPlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Lambda2", GMSH_RegisterLambda2Plugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Probe", GMSH_RegisterProbePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("FieldView", GMSH_RegisterFieldViewPlugin()));
-#if defined(HAVE_TRIANGLE)
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Triangulate", GMSH_RegisterTriangulatePlugin()));
-#endif
-#if defined(HAVE_MATH_EVAL)
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("Evaluate", GMSH_RegisterEvaluatePlugin()));
-    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
-		      ("CutParametric", GMSH_RegisterCutParametricPlugin()));
-#endif
-  }
+  if(!view) return 0;
 
-#if defined(HAVE_FLTK)
-  char *homeplugins = getenv("GMSHPLUGINSHOME");
-  if(!homeplugins)
-    return;
-  struct dirent **list;
-  int nbFiles = fl_filename_list(homeplugins, &list);
-  if(nbFiles <= 0)
-    return;
-  for(int i = 0; i < nbFiles; i++) {
-    char *name = list[i]->d_name;
-    if(strlen(name) > 3) {
-      char ext[6];
-      strcpy(ext, name + (strlen(name) - 3));
-      if(!strcmp(ext, ".so") || !strcmp(ext, "dll")) {
-        addPlugin(homeplugins, name);
-      }
-    }
+  PViewDataList *data = dynamic_cast<PViewDataList*>(view->getData());
+  if(data){
+    return data;
   }
-  for(int i = 0; i < nbFiles; i++)
-    free(list[i]);
-  free(list);
-#endif
-}
-
-void GMSH_PluginManager::addPlugin(char *dirName, char *pluginName)
-{
-#if defined(HAVE_NO_DLL) || !defined(HAVE_FLTK)
-  Msg(WARNING, "No dynamic plugin loading on this platform");
-#else
-  char dynamic_lib[1024];
-  char plugin_name[256];
-  char plugin_author[256];
-  char plugin_copyright[256];
-  char plugin_help[1024];
-  class GMSH_Plugin *(*registerPlugin) (void);
-  sprintf(dynamic_lib, "%s/%s", dirName, pluginName);
-  Msg(INFO, "Opening Plugin '%s'", dynamic_lib);
-  void *hlib = dlopen(dynamic_lib, RTLD_NOW);
-  char *err = (char*)dlerror();
-  if(hlib == NULL) {
-    Msg(WARNING, "Error in opening %s (dlerror = %s)", dynamic_lib, err);
-    return;
-  }
-  registerPlugin = (class GMSH_Plugin * (*)(void))dlsym(hlib, GMSH_PluginEntry);
-  err = (char*)dlerror();
-  if(err != NULL) {
-    Msg(WARNING, "Symbol '%s' missing in plugin '%s' (dlerror = %s)",
-        GMSH_PluginEntry, pluginName, err);
-    return;
-  }
-
-  GMSH_Plugin *p = registerPlugin();
-  p->hlib = hlib;
-  p->getName(plugin_name);
-  p->getInfos(plugin_author, plugin_copyright, plugin_help);
-  if(allPlugins.find(plugin_name) != allPlugins.end()) {
-    Msg(WARNING, "Plugin '%s' multiply defined", pluginName);
-    return;
+  else{
+    // FIXME: do automatic data conversion here
+    Msg(GERROR, "This plugin can only be run on list-based datasets");
+    return 0;
   }
-  allPlugins.insert(std::pair < char *, GMSH_Plugin * >(plugin_name, p));
-  Msg(INFO, "Loaded Plugin '%s' (%s)", plugin_name, plugin_author);
-#endif
 }
diff --git a/Plugin/Plugin.h b/Plugin/Plugin.h
index c795b21ed10869f9ab38c6747da687979dc4d919..d3b0853ae9fa1bc2786536005657a54cf338a634 100644
--- a/Plugin/Plugin.h
+++ b/Plugin/Plugin.h
@@ -36,7 +36,8 @@
 
 #include "Options.h"
 #include "Message.h"
-#include "Views.h"
+#include "PView.h"
+#include "PViewDataList.h"
 #include "GmshMatrix.h"
 
 class PluginDialogBox;
@@ -44,38 +45,38 @@ class Vertex;
 
 class GMSH_Plugin
 {
-public :
-  // a dialog box for user interface
+ public :
+  // 4 kinds of plugins
+  typedef enum {
+    GMSH_CAD_PLUGIN, 
+    GMSH_MESH_PLUGIN, 
+    GMSH_POST_PLUGIN, 
+    GMSH_SOLVE_PLUGIN 
+  } GMSH_PLUGIN_TYPE;
+
+  // a dialog box for the user interface
   PluginDialogBox *dialogBox;
 
-  // this is there for internal use, this variable will be used by the
-  // PluginManager, just forget it
+  // for internal use by PluginManager
   void *hlib;
 
-  // 3 kind of plugins, one for cad, one for mesh, one for postpro
-  typedef enum {GMSH_CAD_PLUGIN, 
-		GMSH_MESH_PLUGIN, 
-		GMSH_POST_PLUGIN, 
-		GMSH_SOLVE_PLUGIN} GMSH_PLUGIN_TYPE ;
-
-  GMSH_Plugin() : dialogBox(0), hlib(0) {;};
-  virtual ~GMSH_Plugin() {;};
-  
-  // returns the type of plugin for downcasting GMSH_Plugin into
-  // GMSH_CAD_Plugin, GMSH_Mesh_Plugin and GMSH_Post_Plugin
+  GMSH_Plugin() : dialogBox(0), hlib(0) {}
+  virtual ~GMSH_Plugin(){}
+
+  // return plugin type, name and info
   virtual GMSH_PLUGIN_TYPE getType() const = 0;
   virtual void getName(char *name) const = 0;
   virtual void getInfos(char *author, char *copyright, char *helpText) const = 0;
 
-  // When an error is thrown by the plugin, the plugin manager will
+  // when an error is thrown by the plugin, the plugin manager will
   // show the message and hopefully continue
   virtual void catchErrorMessage(char *errorMessage) const = 0;
 
-  // gmsh style numeric options
+  // gmsh-style numeric options
   virtual int getNbOptions() const = 0;
   virtual StringXNumber *getOption(int iopt) = 0;
 
-  // gmsh style string options
+  // gmsh-style string options
   virtual int getNbOptionsStr() const = 0;
   virtual StringXString *getOptionStr(int iopt) = 0;
 
@@ -83,51 +84,53 @@ public :
   virtual void run() = 0;
 };
 
-
-// Base class for Post-Processing Plugins. The user can either modify
-// or duplicate a Post_View
-
+// The base class for post-processing plugins. The user can either
+// modify or duplicate a post-processing view
 class GMSH_Post_Plugin : public GMSH_Plugin
 {
-public:
+ public:
   inline GMSH_PLUGIN_TYPE getType() const { return GMSH_Plugin::GMSH_POST_PLUGIN; }
-  virtual int getNbOptionsStr() const { return 0; };
-  virtual StringXString *getOptionStr(int iopt) { return NULL; };
+  virtual int getNbOptionsStr() const { return 0; }
+  virtual StringXString *getOptionStr(int iopt) { return NULL; }
   virtual void run(){ execute(0); }
-  // If returned pointer is the same as the argument, then view is
-  // simply modified, else, a new view is added in the view list
-  virtual Post_View *execute(Post_View *) = 0;
-  virtual void assign_specific_visibility() const {}
-  virtual bool geometrical_filter(Double_Matrix *geometrical_nodes_positions) const {return true;}
-  virtual bool functional_filter(Double_Matrix *function_values) const {return true;}
-};
+  // if the returned pointer is the same as the argument, then the
+  // view is simply modified, else, a new view is added in the view
+  // list
+  virtual PView *execute(PView *) = 0;
+  // get the view given an index and a default value
+  virtual PView *getView(int index, PView *view);
+  // get the data in list format
+  virtual PViewDataList *getDataList(PView *view);
+  virtual void assignSpecificVisibility() const {}
+  virtual bool geometricalFilter(Double_Matrix *) const { return true; }
 
-// A solver plugin. The idea here is to be able to associate some
-// properties to physical entities. The goal is to be able to
-// interface gmsh with a solver (ABAQUS...) i.e. create the input file
-// for the solver.
+};
 
+// The base class for solver plugins. The idea is to be able to
+// associate some properties to physical entities, so that we can
+// interface gmsh with a solver (ABAQUS...), i.e., create the input
+// file for the solver
 class GMSH_Solve_Plugin : public GMSH_Plugin
 {
-public:
-  virtual int getNbOptionsStr() const { return 0; };
-  virtual StringXString *getOptionStr(int iopt) { return NULL; };
-  virtual int getNbOptions() const { return 0; };
-  virtual StringXNumber *getOption(int iopt) { return NULL; };
+ public:
+  virtual int getNbOptionsStr() const { return 0; }
+  virtual StringXString *getOptionStr(int iopt) { return 0; }
+  virtual int getNbOptions() const { return 0; }
+  virtual StringXNumber *getOption(int iopt) { return 0; };
   inline GMSH_PLUGIN_TYPE getType() const { return GMSH_Plugin::GMSH_SOLVE_PLUGIN; }
-  virtual void run() {}; // do nothing
+  virtual void run() {} // do nothing
   // popup dialog box
   virtual void popupPropertiesForPhysicalEntity(int dim) = 0;
-  // add the given group to the solver data's
+  // add the given group to the solver data
   virtual void receiveNewPhysicalGroup(int dim, int id) = 0;
   // load the solver input file related to the gmsh geo file
   virtual void readSolverFile(const char *) = 0;
   // save the solver file  
   virtual void writeSolverFile(const char *) const = 0;
   // enhance graphics for a giver geo point
-  virtual bool GL_enhancePoint(Vertex *v) { return false; };
+  virtual bool GL_enhancePoint(Vertex *v) { return false; }
   // enhance graphics for a giver geo line
-  virtual bool GL_enhanceLine (int CurveId, Vertex *v1, Vertex *v2) { return false; };
+  virtual bool GL_enhanceLine(int CurveId, Vertex *v1, Vertex *v2) { return false; }
 };
 
 #endif
diff --git a/Plugin/PluginManager.cpp b/Plugin/PluginManager.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5571e6aa9b1fa305e670002f1e3784c059c0b08f
--- /dev/null
+++ b/Plugin/PluginManager.cpp
@@ -0,0 +1,303 @@
+// $Id: PluginManager.cpp,v 1.1 2007-09-11 14:01:55 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>.
+
+#if !defined(HAVE_NO_DLL)
+#include <dlfcn.h>
+#endif
+
+#include <map>
+
+#if defined(HAVE_FLTK)
+#include <FL/Fl.H>
+#include <FL/filename.H>
+#endif
+
+#include "Plugin.h"
+#include "PluginManager.h"
+#include "CutMap.h"
+#include "CutGrid.h"
+#include "StreamLines.h"
+#include "CutPlane.h"
+#include "CutParametric.h"
+#include "CutSphere.h"
+#include "Skin.h"
+#include "Extract.h"
+#include "ExtractElements.h"
+#include "ExtractEdges.h"
+#include "HarmonicToTime.h"
+#include "ModulusPhase.h"
+#include "Integrate.h"
+#include "Gradient.h"
+#include "Curl.h"
+#include "Divergence.h"
+#include "Annotate.h"
+#include "Remove.h"
+#include "MakeSimplex.h"
+#include "Smooth.h"
+#include "Transform.h"
+#include "Triangulate.h"
+#include "Warp.h"
+#include "SphericalRaise.h"
+#include "Eigenvectors.h"
+#include "Eigenvalues.h"
+#include "Lambda2.h"
+#include "Evaluate.h"
+#include "Probe.h"
+#include "FieldView.h"
+#include "Context.h"
+
+extern Context_T CTX;
+
+const char *GMSH_PluginEntry = "GMSH_RegisterPlugin";
+
+GMSH_PluginManager *GMSH_PluginManager::_instance = 0;
+
+GMSH_PluginManager::GMSH_PluginManager()
+{
+}
+
+GMSH_PluginManager::~GMSH_PluginManager()
+{
+  for(iter it = allPlugins.begin(); it != allPlugins.end(); ++it)
+    delete(*it).second;
+}
+
+GMSH_Plugin *GMSH_PluginManager::find(char *pluginName)
+{
+  iter it = allPlugins.find(pluginName);
+  if(it == allPlugins.end())
+    return 0;
+  return (*it).second;
+}
+
+GMSH_Solve_Plugin *GMSH_PluginManager::findSolverPlugin()
+{
+  iter it  = allPlugins.begin();
+  iter ite = allPlugins.end();
+  for (; it != ite; ++it) {
+    GMSH_Plugin *p = (*it).second;
+    if(p->getType() == GMSH_Plugin::GMSH_SOLVE_PLUGIN) {
+      return (GMSH_Solve_Plugin*)(p);
+    }      
+  }
+  return 0;
+}
+
+void GMSH_PluginManager::action(char *pluginName, char *action, void *data)
+{
+  GMSH_Plugin *plugin = find(pluginName);
+  if(!plugin)
+    throw "Unknown plugin name";
+
+  if(!strcmp(action, "Run"))
+    plugin->run();
+  else
+    throw "Unknown plugin action";
+}
+
+void GMSH_PluginManager::setPluginOption(char *pluginName, char *option,
+                                         char *value)
+{
+  GMSH_Plugin *plugin = find(pluginName);
+
+  if(!plugin)
+    throw "Unknown plugin name";
+
+  for(int i = 0; i < plugin->getNbOptionsStr(); i++) {
+    StringXString *sxs;
+    // get the ith option of the plugin
+    sxs = plugin->getOptionStr(i);
+    // look if it's the good option name
+    if(!strcmp(sxs->str, option)) {
+      sxs->def = value;
+      return;
+    }
+  }
+
+  throw "Unknown plugin option name";
+}
+
+void GMSH_PluginManager::setPluginOption(char *pluginName, char *option,
+                                         double value)
+{
+  GMSH_Plugin *plugin = find(pluginName);
+
+  if(!plugin)
+    throw "Unknown plugin name";
+
+  for(int i = 0; i < plugin->getNbOptions(); i++) {
+    StringXNumber *sxn;
+    // get the ith option of the plugin
+    sxn = plugin->getOption(i);
+    // look if it's the good option name
+    if(!strcmp(sxn->str, option)) {
+      sxn->def = value;
+      return;
+    }
+  }
+  throw "Unknown plugin option name";
+}
+
+GMSH_PluginManager *GMSH_PluginManager::instance()
+{
+  if(!_instance) {
+    _instance = new GMSH_PluginManager;
+  }
+  return _instance;
+}
+
+void GMSH_PluginManager::registerDefaultPlugins()
+{
+  if(CTX.solver.plugins){
+    // nothing here yet
+  }
+
+  if(CTX.post.plugins){
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("StreamLines", GMSH_RegisterStreamLinesPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("CutGrid", GMSH_RegisterCutGridPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("CutMap", GMSH_RegisterCutMapPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("CutPlane", GMSH_RegisterCutPlanePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("CutSphere", GMSH_RegisterCutSpherePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Skin", GMSH_RegisterSkinPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Extract", GMSH_RegisterExtractPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("ExtractElements", GMSH_RegisterExtractElementsPlugin()));
+#if 0 // waiting for BDS rewrite
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("ExtractEdges", GMSH_RegisterExtractEdgesPlugin()));
+#endif
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("MakeSimplex", GMSH_RegisterMakeSimplexPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Smooth", GMSH_RegisterSmoothPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Transform", GMSH_RegisterTransformPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Warp", GMSH_RegisterWarpPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("SphericalRaise", GMSH_RegisterSphericalRaisePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("HarmonicToTime", GMSH_RegisterHarmonicToTimePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("ModulusPhase", GMSH_RegisterModulusPhasePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Integrate", GMSH_RegisterIntegratePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Gradient", GMSH_RegisterGradientPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Curl", GMSH_RegisterCurlPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Divergence", GMSH_RegisterDivergencePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Annotate", GMSH_RegisterAnnotatePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Remove", GMSH_RegisterRemovePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Eigenvectors", GMSH_RegisterEigenvectorsPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Eigenvalues", GMSH_RegisterEigenvaluesPlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Lambda2", GMSH_RegisterLambda2Plugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Probe", GMSH_RegisterProbePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("FieldView", GMSH_RegisterFieldViewPlugin()));
+#if defined(HAVE_TRIANGLE)
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Triangulate", GMSH_RegisterTriangulatePlugin()));
+#endif
+#if defined(HAVE_MATH_EVAL)
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("Evaluate", GMSH_RegisterEvaluatePlugin()));
+    allPlugins.insert(std::pair < char *, GMSH_Plugin * >
+		      ("CutParametric", GMSH_RegisterCutParametricPlugin()));
+#endif
+  }
+
+#if defined(HAVE_FLTK)
+  char *homeplugins = getenv("GMSHPLUGINSHOME");
+  if(!homeplugins) return;
+  struct dirent **list;
+  int nbFiles = fl_filename_list(homeplugins, &list);
+  if(nbFiles <= 0)
+    return;
+  for(int i = 0; i < nbFiles; i++) {
+    char *name = list[i]->d_name;
+    if(strlen(name) > 3) {
+      char ext[6];
+      strcpy(ext, name + (strlen(name) - 3));
+      if(!strcmp(ext, ".so") || !strcmp(ext, "dll")) {
+        addPlugin(homeplugins, name);
+      }
+    }
+  }
+  for(int i = 0; i < nbFiles; i++)
+    free(list[i]);
+  free(list);
+#endif
+}
+
+void GMSH_PluginManager::addPlugin(char *dirName, char *pluginName)
+{
+#if defined(HAVE_NO_DLL) || !defined(HAVE_FLTK)
+  Msg(WARNING, "No dynamic plugin loading on this platform");
+#else
+  char dynamic_lib[1024];
+  char plugin_name[256];
+  char plugin_author[256];
+  char plugin_copyright[256];
+  char plugin_help[1024];
+  class GMSH_Plugin *(*registerPlugin) (void);
+  sprintf(dynamic_lib, "%s/%s", dirName, pluginName);
+  Msg(INFO, "Opening Plugin '%s'", dynamic_lib);
+  void *hlib = dlopen(dynamic_lib, RTLD_NOW);
+  char *err = (char*)dlerror();
+  if(!hlib){
+    Msg(WARNING, "Error in opening %s (dlerror = %s)", dynamic_lib, err);
+    return;
+  }
+  registerPlugin = (class GMSH_Plugin * (*)(void))dlsym(hlib, GMSH_PluginEntry);
+  err = (char*)dlerror();
+  if(err){
+    Msg(WARNING, "Symbol '%s' missing in plugin '%s' (dlerror = %s)",
+        GMSH_PluginEntry, pluginName, err);
+    return;
+  }
+
+  GMSH_Plugin *p = registerPlugin();
+  p->hlib = hlib;
+  p->getName(plugin_name);
+  p->getInfos(plugin_author, plugin_copyright, plugin_help);
+  if(allPlugins.find(plugin_name) != allPlugins.end()) {
+    Msg(WARNING, "Plugin '%s' multiply defined", pluginName);
+    return;
+  }
+  allPlugins.insert(std::pair < char *, GMSH_Plugin * >(plugin_name, p));
+  Msg(INFO, "Loaded Plugin '%s' (%s)", plugin_name, plugin_author);
+#endif
+}
diff --git a/Plugin/PluginManager.h b/Plugin/PluginManager.h
index 5e2a440b05af080d966d33737f8e6a9b4e91deb0..8c4c893b2d88bcdefcda84d45f9b96aa5efc1340 100644
--- a/Plugin/PluginManager.h
+++ b/Plugin/PluginManager.h
@@ -36,18 +36,16 @@ class GMSH_PluginManager
  private:
   GMSH_PluginManager();
   static GMSH_PluginManager *_instance;
-  std::map<const char*,GMSH_Plugin*,ltstrpg> allPlugins;
+  std::map<const char*, GMSH_Plugin*, ltstrpg> allPlugins;
 
  public :
   virtual ~GMSH_PluginManager();
-  typedef std::map<const char*,GMSH_Plugin*,ltstrpg>::iterator iter;
+  typedef std::map<const char*, GMSH_Plugin*, ltstrpg>::iterator iter;
   
-  // Registering all default plugins that are in
-  // $(GMSHPLUGINSHOME). In fact, we will load all .so files in dir
-  // $(GMSHPLUGINSHOME). Note that loading a .so (or a .o) is not what
-  // is usually called a 'plugin'. We should call the plugins
-  // 'modules'. A plugin is an _executable_, but that can only be
-  // executed from inside another program...
+  // register all the plugins that are in $(GMSHPLUGINSHOME). (Note
+  // that loading a .so is not what is usually called a 'plugin': we
+  // should call the plugins 'modules'... A plugin is an executable,
+  // but that can only be executed from inside another program.)
   void registerDefaultPlugins();
   static GMSH_PluginManager *instance();
 
@@ -62,8 +60,8 @@ class GMSH_PluginManager
   void setPluginOption(char *pluginName, char *option, char *value);
 
   // Iterator on plugins
-  inline iter begin() {return allPlugins.begin();}
-  inline iter end() {return allPlugins.end();}
+  inline iter begin(){ return allPlugins.begin(); }
+  inline iter end(){ return allPlugins.end(); }
 
   // Find a plugin named pluginName
   GMSH_Plugin *find(char *pluginName);
diff --git a/Plugin/Probe.cpp b/Plugin/Probe.cpp
index d9543a707a31c1cd16140879b3c4394bc2b56956..9369e5f5817fb7fed689cc0997c2be3830113754 100644
--- a/Plugin/Probe.cpp
+++ b/Plugin/Probe.cpp
@@ -1,4 +1,4 @@
-// $Id: Probe.cpp,v 1.16 2007-09-10 04:47:08 geuzaine Exp $
+// $Id: Probe.cpp,v 1.17 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -20,16 +20,14 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include "Probe.h"
-#include "List.h"
 #include "Context.h"
+#include "OctreePost.h"
 
 #if defined(HAVE_FLTK)
 #include "GmshUI.h"
 #include "Draw.h"
 #endif
 
-#include "OctreePost.h"
-
 extern Context_T CTX;
 
 int GMSH_ProbePlugin::iview = 0;
@@ -59,34 +57,34 @@ void GMSH_ProbePlugin::draw()
 #if defined(HAVE_FLTK)
   int num = (int)ProbeOptions_Number[3].def;
   if(num < 0) num = iview;
-  Post_View **vv = (Post_View **)List_Pointer_Test(CTX.post.list, num);
-  if(!vv) return;
-  Post_View *v = *vv;
-  double x = ProbeOptions_Number[0].def;
-  double y = ProbeOptions_Number[1].def;
-  double z = ProbeOptions_Number[2].def;
-  glColor4ubv((GLubyte *) & CTX.color.fg);
-  glLineWidth(CTX.line_width);
-  if(x >= v->BBox[0] && x <= v->BBox[1] &&
-     y >= v->BBox[2] && y <= v->BBox[3] &&
-     z >= v->BBox[4] && z <= v->BBox[5]){
-    // we're inside the bounding box: draw a large cross
-    glBegin(GL_LINES);
-    glVertex3d(v->BBox[0],y,z); glVertex3d(v->BBox[1],y,z);
-    glVertex3d(x,v->BBox[2],z); glVertex3d(x,v->BBox[3],z);
-    glVertex3d(x,y,v->BBox[4]); glVertex3d(x,y,v->BBox[5]);
-    glEnd();
-  }
-  else{
-    // draw 10-pixel marker
-    double d = 10 * CTX.pixel_equiv_x / CTX.s[0];
-    glBegin(GL_LINES);
-    glVertex3d(x-d,y,z); glVertex3d(x+d,y,z);
-    glVertex3d(x,y-d,z); glVertex3d(x,y+d,z);
-    glVertex3d(x,y,z-d); glVertex3d(x,y,z+d);
-    glEnd();
+  if(num >= 0 && num < PView::list.size()){
+    double x = ProbeOptions_Number[0].def;
+    double y = ProbeOptions_Number[1].def;
+    double z = ProbeOptions_Number[2].def;
+    glColor4ubv((GLubyte *) & CTX.color.fg);
+    glLineWidth(CTX.line_width);
+    SBoundingBox3d bb = PView::list[num]->getData()->getBoundingBox();
+    if(x >= bb.min().x() && x <= bb.max().x() &&
+       y >= bb.min().y() && y <= bb.max().y() &&
+       z >= bb.min().z() && z <= bb.max().z()){
+      // we're inside the bounding box: draw a large cross
+      glBegin(GL_LINES);
+      glVertex3d(bb.min().x(), y, z); glVertex3d(bb.max().x(), y, z);
+      glVertex3d(x, bb.min().y(), z); glVertex3d(x, bb.max().y(), z);
+      glVertex3d(x, y, bb.min().z()); glVertex3d(x, y, bb.max().z());
+      glEnd();
+    }
+    else{
+      // draw 10-pixel marker
+      double d = 10 * CTX.pixel_equiv_x / CTX.s[0];
+      glBegin(GL_LINES);
+      glVertex3d(x - d, y, z); glVertex3d(x + d, y, z);
+      glVertex3d(x, y - d, z); glVertex3d(x, y + d, z);
+      glVertex3d(x, y, z - d); glVertex3d(x, y, z + d);
+      glEnd();
+    }
+    Draw_Sphere(CTX.point_size, x, y, z, 1);
   }
-  Draw_Sphere(CTX.point_size, x, y, z, 1);
 #endif
 }
 
@@ -94,9 +92,9 @@ double GMSH_ProbePlugin::callback(int num, int action, double value, double *opt
 {
   if(action > 0) iview = num;
   switch(action){ // configure the input field
-  case 1: return CTX.lc/100.;
-  case 2: return -2*CTX.lc;
-  case 3: return 2*CTX.lc;
+  case 1: return CTX.lc / 100.;
+  case 2: return -2 * CTX.lc;
+  case 3: return 2 * CTX.lc;
   default: break;
   }
   *opt = value;
@@ -154,75 +152,65 @@ void GMSH_ProbePlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "Probe failed...");
 }
 
-Post_View *GMSH_ProbePlugin::execute(Post_View * v)
+PView *GMSH_ProbePlugin::execute(PView *v)
 {
   double x = ProbeOptions_Number[0].def;
   double y = ProbeOptions_Number[1].def;
   double z = ProbeOptions_Number[2].def;
   int iView = (int)ProbeOptions_Number[3].def;
   
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-  
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
 
-  Msg(FATAL, "XXXXXXXXXXXXXXXXXXXXX");
-  return 0;
+  PView *v2 = new PView(true);
 
-  /*
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
 
-  double *val = new double[9*v1->NbTimeStep];
+  double *val = new double[9 * data1->getNumTimeSteps()];
   OctreePost o(v1);
 
   if(o.searchScalar(x, y, z, val)){
-    List_Add(v2->SP, &x);
-    List_Add(v2->SP, &y);
-    List_Add(v2->SP, &z);
-    for(int i = 0; i < v1->NbTimeStep; i++)
-      List_Add(v2->SP, &val[i]);
-    v2->NbSP++;
+    List_Add(data2->SP, &x);
+    List_Add(data2->SP, &y);
+    List_Add(data2->SP, &z);
+    for(int i = 0; i < data1->getNumTimeSteps(); i++)
+      List_Add(data2->SP, &val[i]);
+    data2->NbSP++;
   }
 
   if(o.searchVector(x, y, z, val)){
-    List_Add(v2->VP, &x);
-    List_Add(v2->VP, &y);
-    List_Add(v2->VP, &z);
-    for(int i = 0; i < v1->NbTimeStep; i++){
+    List_Add(data2->VP, &x);
+    List_Add(data2->VP, &y);
+    List_Add(data2->VP, &z);
+    for(int i = 0; i < data1->getNumTimeSteps(); i++){
       for(int j = 0; j < 3; j++)
-	List_Add(v2->VP, &val[3*i+j]);
+	List_Add(data2->VP, &val[3*i+j]);
     }
-    v2->NbVP++;
+    data2->NbVP++;
   }
 
   if(o.searchTensor(x, y, z, val)){
-    List_Add(v2->TP, &x);
-    List_Add(v2->TP, &y);
-    List_Add(v2->TP, &z);
-    for(int i = 0; i < v1->NbTimeStep; i++){
+    List_Add(data2->TP, &x);
+    List_Add(data2->TP, &y);
+    List_Add(data2->TP, &z);
+    for(int i = 0; i < data1->getNumTimeSteps(); i++){
       for(int j = 0; j < 9; j++)
-	List_Add(v2->TP, &val[9*i+j]);
+	List_Add(data2->TP, &val[9*i+j]);
     }
-    v2->NbTP++;
+    data2->NbTP++;
   }
 
   delete [] val;
   
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++)
-    List_Add(v2->Time, List_Pointer(v1->Time, i));
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_Probe", v1->Name);
-  sprintf(filename, "%s_Probe.pos", v1->Name);
-  EndView(v2, 1, filename, name);
-  return v2;
-
+  for(int i = 0; i < List_Nbr(data1->Time); i++)
+    List_Add(data2->Time, List_Pointer(data1->Time, i));
+  data2->setName(data1->getName() + "_Probe");
+  data2->setFileName(data1->getName() + "_Probe.pos");
+  data2->finalize();
 
-  */
+  return v2;
 }
diff --git a/Plugin/Probe.h b/Plugin/Probe.h
index ffeef2137b11ced0bf66c09c197a9c1de6e5cec0..3373a83858c6b8ff1b46f787b6e11b7208a54566 100644
--- a/Plugin/Probe.h
+++ b/Plugin/Probe.h
@@ -39,7 +39,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber *getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 
   static double callbackX(int, int, double);
   static double callbackY(int, int, double);
diff --git a/Plugin/Remove.cpp b/Plugin/Remove.cpp
index f6e5a4f6cb15f1726e6e0dc44b49a9193bd60127..5c9ebd326b3c50f450b1a5a0a078fb59840b2d63 100644
--- a/Plugin/Remove.cpp
+++ b/Plugin/Remove.cpp
@@ -1,4 +1,4 @@
-// $Id: Remove.cpp,v 1.10 2007-09-04 13:47:05 remacle Exp $
+// $Id: Remove.cpp,v 1.11 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,14 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Remove.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
-
-extern Context_T CTX;
 
 StringXNumber RemoveOptions_Number[] = {
   {GMSH_FULLRC, "Text2D", NULL, 1.},
@@ -91,21 +84,17 @@ void GMSH_RemovePlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "Remove failed...");
 }
 
-Post_View *GMSH_RemovePlugin::execute(Post_View * v)
+PView *GMSH_RemovePlugin::execute(PView *v)
 {
   int iView = (int)RemoveOptions_Number[13].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
   
-  if(v1->AliasOf || v1->Links){
+  if(v1->getAliasOf() || v1->getLinks()){
     Msg(GERROR, "Cannot remove data from aliased view");
     return v1;
   }
@@ -115,61 +104,54 @@ Post_View *GMSH_RemovePlugin::execute(Post_View * v)
   int tensor = (int)RemoveOptions_Number[12].def;
 
   if(RemoveOptions_Number[0].def){ 
-    v1->NbT2 = 0; List_Reset(v1->T2D); List_Reset(v1->T2C); 
+    data1->NbT2 = 0; List_Reset(data1->T2D); List_Reset(data1->T2C); 
   }
   if(RemoveOptions_Number[1].def){ 
-    v1->NbT3 = 0; List_Reset(v1->T3D); List_Reset(v1->T3C); 
+    data1->NbT3 = 0; List_Reset(data1->T3D); List_Reset(data1->T3C); 
   }
   if(RemoveOptions_Number[2].def){ 
-    if(scalar){ v1->NbSP = 0; List_Reset(v1->SP); }
-    if(vector){ v1->NbVP = 0; List_Reset(v1->VP); }
-    if(tensor){ v1->NbTP = 0; List_Reset(v1->TP); }
+    if(scalar){ data1->NbSP = 0; List_Reset(data1->SP); }
+    if(vector){ data1->NbVP = 0; List_Reset(data1->VP); }
+    if(tensor){ data1->NbTP = 0; List_Reset(data1->TP); }
   }
   if(RemoveOptions_Number[3].def){
-    if(scalar){ v1->NbSL = 0; List_Reset(v1->SL); }
-    if(vector){ v1->NbVL = 0; List_Reset(v1->VL); }
-    if(tensor){ v1->NbTL = 0; List_Reset(v1->TL); }
+    if(scalar){ data1->NbSL = 0; List_Reset(data1->SL); }
+    if(vector){ data1->NbVL = 0; List_Reset(data1->VL); }
+    if(tensor){ data1->NbTL = 0; List_Reset(data1->TL); }
   }
   if(RemoveOptions_Number[4].def){ 
-    if(scalar){ v1->NbST = 0; List_Reset(v1->ST); }
-    if(vector){ v1->NbVT = 0; List_Reset(v1->VT); }
-    if(tensor){ v1->NbTT = 0; List_Reset(v1->TT); }
+    if(scalar){ data1->NbST = 0; List_Reset(data1->ST); }
+    if(vector){ data1->NbVT = 0; List_Reset(data1->VT); }
+    if(tensor){ data1->NbTT = 0; List_Reset(data1->TT); }
   }
   if(RemoveOptions_Number[5].def){ 
-    if(scalar){ v1->NbSQ = 0; List_Reset(v1->SQ); }
-    if(vector){ v1->NbVQ = 0; List_Reset(v1->VQ); }
-    if(tensor){ v1->NbTQ = 0; List_Reset(v1->TQ); }
+    if(scalar){ data1->NbSQ = 0; List_Reset(data1->SQ); }
+    if(vector){ data1->NbVQ = 0; List_Reset(data1->VQ); }
+    if(tensor){ data1->NbTQ = 0; List_Reset(data1->TQ); }
   }
   if(RemoveOptions_Number[6].def){
-    if(scalar){ v1->NbSS = 0; List_Reset(v1->SS); }
-    if(vector){ v1->NbVS = 0; List_Reset(v1->VS); }
-    if(tensor){ v1->NbTS = 0; List_Reset(v1->TS); }
+    if(scalar){ data1->NbSS = 0; List_Reset(data1->SS); }
+    if(vector){ data1->NbVS = 0; List_Reset(data1->VS); }
+    if(tensor){ data1->NbTS = 0; List_Reset(data1->TS); }
   }
   if(RemoveOptions_Number[7].def){
-    if(scalar){ v1->NbSH = 0; List_Reset(v1->SH); }
-    if(vector){ v1->NbVH = 0; List_Reset(v1->VH); }
-    if(tensor){ v1->NbTH = 0; List_Reset(v1->TH); }
+    if(scalar){ data1->NbSH = 0; List_Reset(data1->SH); }
+    if(vector){ data1->NbVH = 0; List_Reset(data1->VH); }
+    if(tensor){ data1->NbTH = 0; List_Reset(data1->TH); }
   }
   if(RemoveOptions_Number[8].def){
-    if(scalar){ v1->NbSI = 0; List_Reset(v1->SI); }
-    if(vector){ v1->NbVI = 0; List_Reset(v1->VI); }
-    if(tensor){ v1->NbTI = 0; List_Reset(v1->TI); }
+    if(scalar){ data1->NbSI = 0; List_Reset(data1->SI); }
+    if(vector){ data1->NbVI = 0; List_Reset(data1->VI); }
+    if(tensor){ data1->NbTI = 0; List_Reset(data1->TI); }
   }
   if(RemoveOptions_Number[9].def){
-    if(scalar){ v1->NbSY = 0; List_Reset(v1->SY); }
-    if(vector){ v1->NbVY = 0; List_Reset(v1->VY); }
-    if(tensor){ v1->NbTY = 0; List_Reset(v1->TY); }
+    if(scalar){ data1->NbSY = 0; List_Reset(data1->SY); }
+    if(vector){ data1->NbVY = 0; List_Reset(data1->VY); }
+    if(tensor){ data1->NbTY = 0; List_Reset(data1->TY); }
   }
-  v1->Changed = 1;
-
-  // recompute min/max, etc.:
-  v1->Min = VAL_INF;
-  v1->Max = -VAL_INF;
-  for(int i = 0; i < 3; i++) {
-    v1->BBox[2 * i] = VAL_INF;
-    v1->BBox[2 * i + 1] = -VAL_INF;
-  }
-  EndView(v1, 0, v1->FileName, v1->Name);
+
+  data1->finalize();
+  v1->setChanged(true);
 
   return v1;
 }
diff --git a/Plugin/Remove.h b/Plugin/Remove.h
index 5de37771d391e98c70496770199e927afef9a1b6..4df97b828154b417c8a1d3e3ec2048dee7640141 100644
--- a/Plugin/Remove.h
+++ b/Plugin/Remove.h
@@ -36,7 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Skin.cpp b/Plugin/Skin.cpp
index 456660c703b50e6354c3082970aaa27b7ce77551..3b68e07d8d9c38162a17d81b57227d704eeb4dd7 100644
--- a/Plugin/Skin.cpp
+++ b/Plugin/Skin.cpp
@@ -1,4 +1,4 @@
-// $Id: Skin.cpp,v 1.34 2007-09-04 13:47:05 remacle Exp $
+// $Id: Skin.cpp,v 1.35 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,13 +19,9 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Skin.h"
-#include "List.h"
-#include "Tree.h"
-#include "Views.h"
-#include "Context.h"
 #include "Malloc.h"
+#include "Context.h"
 
 extern Context_T CTX;
 
@@ -169,22 +165,22 @@ void GMSH_SkinPlugin::skinList(List_T *inList, int inNbList,
   }
 }
 
-Post_View *GMSH_SkinPlugin::execute(Post_View * v)
+PView *GMSH_SkinPlugin::execute(PView *v)
 {
   int iView = (int)SkinOptions_Number[0].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
+  PView *v2 = new PView(true);
 
-  _nbTimeStep = v1->NbTimeStep;
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
+
+  _nbTimeStep = data1->getNumTimeSteps();
 
   int skinTri[6][4] = {{0,1,-1,-1}, {1,2,-1,-1}, {2,0,-1,-1}};
   int skinQua[6][4] = {{0,1,-1,-1}, {1,2,-1,-1}, {2,3,-1,-1}, {3,0,-1,-1}};
@@ -200,23 +196,23 @@ Post_View *GMSH_SkinPlugin::execute(Post_View * v)
   _nbNod = 2;
   // scalar
   _skin = Tree_Create(sizeof(Elm), fcmpElm);
-  _list = v2->SL; _nbList = &v2->NbSL; _nbComp = 1;
-  skinList(v1->ST, v1->NbST, 3, 3, skinTri);
-  skinList(v1->SQ, v1->NbSQ, 4, 4, skinQua);
+  _list = data2->SL; _nbList = &data2->NbSL; _nbComp = 1;
+  skinList(data1->ST, data1->NbST, 3, 3, skinTri);
+  skinList(data1->SQ, data1->NbSQ, 4, 4, skinQua);
   Tree_Action(_skin, addInView);
   Tree_Delete(_skin);
   // vector
   _skin = Tree_Create(sizeof(Elm), fcmpElm);
-  _list = v2->VL; _nbList = &v2->NbVL; _nbComp = 3;
-  skinList(v1->VT, v1->NbVT, 3, 3, skinTri);
-  skinList(v1->VQ, v1->NbVQ, 4, 4, skinQua);
+  _list = data2->VL; _nbList = &data2->NbVL; _nbComp = 3;
+  skinList(data1->VT, data1->NbVT, 3, 3, skinTri);
+  skinList(data1->VQ, data1->NbVQ, 4, 4, skinQua);
   Tree_Action(_skin, addInView);
   Tree_Delete(_skin);
   // tensor
   _skin = Tree_Create(sizeof(Elm), fcmpElm);
-  _list = v2->TL; _nbList = &v2->NbTL; _nbComp = 9;
-  skinList(v1->TT, v1->NbTT, 3, 3, skinTri);
-  skinList(v1->TQ, v1->NbTQ, 4, 4, skinQua);
+  _list = data2->TL; _nbList = &data2->NbTL; _nbComp = 9;
+  skinList(data1->TT, data1->NbTT, 3, 3, skinTri);
+  skinList(data1->TQ, data1->NbTQ, 4, 4, skinQua);
   Tree_Action(_skin, addInView);
   Tree_Delete(_skin);
 
@@ -224,26 +220,26 @@ Post_View *GMSH_SkinPlugin::execute(Post_View * v)
   _nbNod = 3;
   // scalar
   _skin = Tree_Create(sizeof(Elm), fcmpElm);
-  _list = v2->ST; _nbList = &v2->NbST; _nbComp = 1;
-  skinList(v1->SS, v1->NbSS, 4, 4, skinTet);
-  skinList(v1->SI, v1->NbSI, 6, 2, skinPri2);
-  skinList(v1->SY, v1->NbSY, 5, 4, skinPyr2);
+  _list = data2->ST; _nbList = &data2->NbST; _nbComp = 1;
+  skinList(data1->SS, data1->NbSS, 4, 4, skinTet);
+  skinList(data1->SI, data1->NbSI, 6, 2, skinPri2);
+  skinList(data1->SY, data1->NbSY, 5, 4, skinPyr2);
   Tree_Action(_skin, addInView);
   Tree_Delete(_skin);
   // vector
   _skin = Tree_Create(sizeof(Elm), fcmpElm);
-  _list = v2->VT; _nbList = &v2->NbVT; _nbComp = 3;
-  skinList(v1->VS, v1->NbVS, 4, 4, skinTet);
-  skinList(v1->VI, v1->NbVI, 6, 2, skinPri2);
-  skinList(v1->VY, v1->NbVY, 5, 4, skinPyr2);
+  _list = data2->VT; _nbList = &data2->NbVT; _nbComp = 3;
+  skinList(data1->VS, data1->NbVS, 4, 4, skinTet);
+  skinList(data1->VI, data1->NbVI, 6, 2, skinPri2);
+  skinList(data1->VY, data1->NbVY, 5, 4, skinPyr2);
   Tree_Action(_skin, addInView);
   Tree_Delete(_skin);
   // tensor
   _skin = Tree_Create(sizeof(Elm), fcmpElm);
-  _list = v2->TT; _nbList = &v2->NbTT; _nbComp = 9;
-  skinList(v1->TS, v1->NbTS, 4, 4, skinTet);
-  skinList(v1->TI, v1->NbTI, 6, 2, skinPri2);
-  skinList(v1->TY, v1->NbTY, 5, 4, skinPyr2);
+  _list = data2->TT; _nbList = &data2->NbTT; _nbComp = 9;
+  skinList(data1->TS, data1->NbTS, 4, 4, skinTet);
+  skinList(data1->TI, data1->NbTI, 6, 2, skinPri2);
+  skinList(data1->TY, data1->NbTY, 5, 4, skinPyr2);
   Tree_Action(_skin, addInView);
   Tree_Delete(_skin);
 
@@ -251,36 +247,34 @@ Post_View *GMSH_SkinPlugin::execute(Post_View * v)
   _nbNod = 4;
   // scalar
   _skin = Tree_Create(sizeof(Elm), fcmpElm);
-  _list = v2->SQ; _nbList = &v2->NbSQ; _nbComp = 1;
-  skinList(v1->SH, v1->NbSH, 8, 6, skinHex);
-  skinList(v1->SI, v1->NbSI, 6, 3, skinPri1);
-  skinList(v1->SY, v1->NbSY, 5, 1, skinPyr1);
+  _list = data2->SQ; _nbList = &data2->NbSQ; _nbComp = 1;
+  skinList(data1->SH, data1->NbSH, 8, 6, skinHex);
+  skinList(data1->SI, data1->NbSI, 6, 3, skinPri1);
+  skinList(data1->SY, data1->NbSY, 5, 1, skinPyr1);
   Tree_Action(_skin, addInView);
   Tree_Delete(_skin);
   // vector
   _skin = Tree_Create(sizeof(Elm), fcmpElm);
-  _list = v2->VQ; _nbList = &v2->NbVQ; _nbComp = 3;
-  skinList(v1->VH, v1->NbVH, 8, 6, skinHex);
-  skinList(v1->VI, v1->NbVI, 6, 3, skinPri1);
-  skinList(v1->VY, v1->NbVY, 5, 1, skinPyr1);
+  _list = data2->VQ; _nbList = &data2->NbVQ; _nbComp = 3;
+  skinList(data1->VH, data1->NbVH, 8, 6, skinHex);
+  skinList(data1->VI, data1->NbVI, 6, 3, skinPri1);
+  skinList(data1->VY, data1->NbVY, 5, 1, skinPyr1);
   Tree_Action(_skin, addInView);
   Tree_Delete(_skin);
   // tensor
   _skin = Tree_Create(sizeof(Elm), fcmpElm);
-  _list = v2->TQ; _nbList = &v2->NbTQ; _nbComp = 9;
-  skinList(v1->TH, v1->NbTH, 8, 6, skinHex);
-  skinList(v1->TI, v1->NbTI, 6, 3, skinPri1);
-  skinList(v1->TY, v1->NbTY, 5, 1, skinPyr1);
+  _list = data2->TQ; _nbList = &data2->NbTQ; _nbComp = 9;
+  skinList(data1->TH, data1->NbTH, 8, 6, skinHex);
+  skinList(data1->TI, data1->NbTI, 6, 3, skinPri1);
+  skinList(data1->TY, data1->NbTY, 5, 1, skinPyr1);
   Tree_Action(_skin, addInView);
   Tree_Delete(_skin);
 
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++)
-    List_Add(v2->Time, List_Pointer(v1->Time, i));
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_Skin", v1->Name);
-  sprintf(filename, "%s_Skin.pos", v1->Name);
-  EndView(v2, 1, filename, name);
+  for(int i = 0; i < List_Nbr(data1->Time); i++)
+    List_Add(data2->Time, List_Pointer(data1->Time, i));
+  data2->setName(data1->getName() + "_Skin");
+  data2->setFileName(data1->getName() + "_Skin.pos");
+  data2->finalize();
+
   return v2;
 }
diff --git a/Plugin/Skin.h b/Plugin/Skin.h
index 890800f3c3c3fcae3d13686fd63963c6df2c28c7..e2376913a7ced671f677d65bb6f14c11ae7c9104 100644
--- a/Plugin/Skin.h
+++ b/Plugin/Skin.h
@@ -49,7 +49,7 @@ class GMSH_SkinPlugin : public GMSH_Post_Plugin
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Smooth.cpp b/Plugin/Smooth.cpp
index c6958aabb4dc834e526c1ffc09c02bf0df82b1f2..e9a9a0f5d0a64515b925f3ad3d6dbe6afdb10806 100644
--- a/Plugin/Smooth.cpp
+++ b/Plugin/Smooth.cpp
@@ -1,4 +1,4 @@
-// $Id: Smooth.cpp,v 1.26 2007-09-10 04:47:08 geuzaine Exp $
+// $Id: Smooth.cpp,v 1.27 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -78,20 +78,14 @@ void GMSH_SmoothPlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "Smooth failed...");
 }
 
-Post_View *GMSH_SmoothPlugin::execute(Post_View * v)
+PView *GMSH_SmoothPlugin::execute(PView *v)
 {
   int iView = (int)SmoothOptions_Number[0].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
+  v1->getData()->smooth();
 
-  //v1->smooth();
   return v1;
 }
diff --git a/Plugin/Smooth.h b/Plugin/Smooth.h
index 16910c109d44ecb8c50e62c72373d3c596d1938b..1b35bde6befd671eaf7d0103e611f862213654f5 100644
--- a/Plugin/Smooth.h
+++ b/Plugin/Smooth.h
@@ -36,7 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/SphericalRaise.cpp b/Plugin/SphericalRaise.cpp
index 1bed1d4f3f38aab03e87e3cbda29d0bd4c2ba1fe..ad7be87216da63db434bec4ccb571ebdaeb20f04 100644
--- a/Plugin/SphericalRaise.cpp
+++ b/Plugin/SphericalRaise.cpp
@@ -1,4 +1,4 @@
-// $Id: SphericalRaise.cpp,v 1.26 2007-05-05 11:36:32 geuzaine Exp $
+// $Id: SphericalRaise.cpp,v 1.27 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,14 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "SphericalRaise.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
-
-extern Context_T CTX;
 
 StringXNumber SphericalRaiseOptions_Number[] = {
   {GMSH_FULLRC, "Xc", NULL, 0.},
@@ -95,9 +88,9 @@ void GMSH_SphericalRaisePlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "SphericalRaise failed...");
 }
 
-static void sphericalRaiseList(Post_View * v, List_T * list, int nbElm,
-                               int nbNod, int timeStep, double center[3], 
-			       double raise, double offset)
+static void sphericalRaise(PViewData *data, List_T *list, int nbElm,
+			   int nbNod, int timeStep, double center[3], 
+			   double raise, double offset)
 {
   double *x, *y, *z, *val, d[3], coef;
   int nb, i, j;
@@ -105,13 +98,11 @@ static void sphericalRaiseList(Post_View * v, List_T * list, int nbElm,
   if(!nbElm)
     return;
 
-  if(timeStep < 0 || timeStep > v->NbTimeStep - 1){
-    Msg(GERROR, "Invalid TimeStep (%d) in View[%d]", timeStep, v->Index);
+  if(timeStep < 0 || timeStep > data->getNumTimeSteps() - 1){
+    Msg(GERROR, "Invalid TimeStep (%d) in view", timeStep);
     return;
   }
 
-  v->Changed = 1;
-
   // for each element
   //   for each node
   //      compute d=(x-Xc,y-Yc,z-Zc)
@@ -134,37 +125,13 @@ static void sphericalRaiseList(Post_View * v, List_T * list, int nbElm,
       x[j] += coef * d[0];
       y[j] += coef * d[1];
       z[j] += coef * d[2];
-      if(x[j] < v->BBox[0]) v->BBox[0] = x[j];
-      if(x[j] > v->BBox[1]) v->BBox[1] = x[j];
-      if(y[j] < v->BBox[2]) v->BBox[2] = y[j];
-      if(y[j] > v->BBox[3]) v->BBox[3] = y[j];
-      if(z[j] < v->BBox[4]) v->BBox[4] = z[j];
-      if(z[j] > v->BBox[5]) v->BBox[5] = z[j];
     }
   }
 }
 
-static void sphericalRaise(Post_View * v, int timeStep, double center[3], 
-			   double raise, double offset)
-{
-  for(int i = 0; i < 3; i++) {
-    v->BBox[2 * i] = VAL_INF;
-    v->BBox[2 * i + 1] = -VAL_INF;
-  }
-  sphericalRaiseList(v, v->SP, v->NbSP, 1, timeStep, center, raise, offset);
-  sphericalRaiseList(v, v->SL, v->NbSL, 2, timeStep, center, raise, offset);
-  sphericalRaiseList(v, v->ST, v->NbST, 3, timeStep, center, raise, offset);
-  sphericalRaiseList(v, v->SQ, v->NbSQ, 4, timeStep, center, raise, offset);
-  sphericalRaiseList(v, v->SS, v->NbSS, 4, timeStep, center, raise, offset);
-  sphericalRaiseList(v, v->SH, v->NbSH, 8, timeStep, center, raise, offset);
-  sphericalRaiseList(v, v->SI, v->NbSI, 6, timeStep, center, raise, offset);
-  sphericalRaiseList(v, v->SY, v->NbSY, 5, timeStep, center, raise, offset);
-}
-
-Post_View *GMSH_SphericalRaisePlugin::execute(Post_View * v)
+PView *GMSH_SphericalRaisePlugin::execute(PView *v)
 {
   double center[3];
-
   center[0] = SphericalRaiseOptions_Number[0].def;
   center[1] = SphericalRaiseOptions_Number[1].def;
   center[2] = SphericalRaiseOptions_Number[2].def;
@@ -173,17 +140,23 @@ Post_View *GMSH_SphericalRaisePlugin::execute(Post_View * v)
   int timeStep = (int)SphericalRaiseOptions_Number[5].def;
   int iView = (int)SphericalRaiseOptions_Number[6].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  sphericalRaise(data1, data1->SP, data1->NbSP, 1, timeStep, center, raise, offset);
+  sphericalRaise(data1, data1->SL, data1->NbSL, 2, timeStep, center, raise, offset);
+  sphericalRaise(data1, data1->ST, data1->NbST, 3, timeStep, center, raise, offset);
+  sphericalRaise(data1, data1->SQ, data1->NbSQ, 4, timeStep, center, raise, offset);
+  sphericalRaise(data1, data1->SS, data1->NbSS, 4, timeStep, center, raise, offset);
+  sphericalRaise(data1, data1->SH, data1->NbSH, 8, timeStep, center, raise, offset);
+  sphericalRaise(data1, data1->SI, data1->NbSI, 6, timeStep, center, raise, offset);
+  sphericalRaise(data1, data1->SY, data1->NbSY, 5, timeStep, center, raise, offset);
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
+  data1->finalize();
+  v1->setChanged(true);
 
-  sphericalRaise(v1, timeStep, center, raise, offset);
   return v1;
 }
-
diff --git a/Plugin/SphericalRaise.h b/Plugin/SphericalRaise.h
index f956126ca8456c497ba8490b65921653555bbc9a..67663b015cf125a70401f74f1d8ac4d9cd68a5be 100644
--- a/Plugin/SphericalRaise.h
+++ b/Plugin/SphericalRaise.h
@@ -36,7 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/StreamLines.cpp b/Plugin/StreamLines.cpp
index e3f0fd5389d339c3ccdf06af1482b3668ab475ec..d73a7dc76410278e6cb8b1bf93f9d56de57759af 100644
--- a/Plugin/StreamLines.cpp
+++ b/Plugin/StreamLines.cpp
@@ -1,4 +1,4 @@
-// $Id: StreamLines.cpp,v 1.30 2007-09-10 04:47:08 geuzaine Exp $
+// $Id: StreamLines.cpp,v 1.31 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -20,9 +20,8 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include <math.h>
-#include "OctreePost.h"
 #include "StreamLines.h"
-#include "List.h"
+#include "OctreePost.h"
 #include "Context.h"
 
 #if defined(HAVE_FLTK)
@@ -235,49 +234,35 @@ void GMSH_StreamLinesPlugin::getPoint(int iU, int iV, double *X)
     v  * (StreamLinesOptions_Number[8].def-StreamLinesOptions_Number[2].def) ;
 }
 
-Post_View * GMSH_StreamLinesPlugin::GenerateView(int iView, int dView) const 
+PView *GMSH_StreamLinesPlugin::GenerateView(PView *v1, PView *v2)
 {
   const double b1=1./3., b2=2./3., b3=1./3., b4=1./6.;
   const double a1=0.5, a2=0.5, a3=1.0, a4=1.0;
   const double DT = StreamLinesOptions_Number[12].def;
   double XINIT[3], X[3], DX[3], X1[3], X2[3], X3[3], X4[3];
-  double val[3], *val2 = NULL;
-
-  Msg(FATAL, "XXXXXXXXXXXXXXXXXXX");
-  return 0;
-  /*
+  double val[3], *val2 = 0;
 
-  Post_View *View = BeginView(1);
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v1;
 
-  Post_View *v1;
-  if(List_Pointer_Test(CTX.post.list, iView))
-    List_Read(CTX.post.list, iView, &v1);
-  else
-    v1 = NULL;
+  PViewDataList *data2 = v2 ? getDataList(v2) : 0;
 
-  Post_View *v2;
-  if(List_Pointer_Test(CTX.post.list, dView))
-    List_Read(CTX.post.list, dView, &v2);
-  else
-    v2 = NULL;
+  PView *v = new PView(true);
 
-  if(!v1) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return NULL;
-  }
+  PViewDataList *data = getDataList(v);
+  if(!data) return v1;
 
   int timestep = (int)StreamLinesOptions_Number[13].def;
-  if(timestep > v1->NbTimeStep - 1){
-    Msg(GERROR, "Invalid time step (%d) in View[%d]: using step 0 instead",
-	timestep, v1->Index);
+  if(timestep > data1->getNumTimeSteps() - 1){
+    Msg(GERROR, "Invalid time step (%d) in view: using step 0 instead",	timestep);
     timestep = 0;
   }
 
   OctreePost o(v1);
-  OctreePost *o2 = NULL;
+  OctreePost *o2 = 0;
 
-  if(v2){
-    val2 = new double[v2->NbTimeStep];
+  if(data2){
+    val2 = new double[data2->getNumTimeSteps()];
     o2 = new OctreePost(v2);
   }
 
@@ -286,14 +271,14 @@ Post_View * GMSH_StreamLinesPlugin::GenerateView(int iView, int dView) const
       getPoint(i, j, XINIT);
       getPoint(i, j, X);
 	  
-      if(v2){
+      if(data2){
 	o2->searchScalar(X[0], X[1], X[2], val2, -1);
       }
       else{
-	View->NbVP++;
-	List_Add(View->VP, &X[0]);
-	List_Add(View->VP, &X[1]);
-	List_Add(View->VP, &X[2]);	      
+	data->NbVP++;
+	List_Add(data->VP, &X[0]);
+	List_Add(data->VP, &X[1]);
+	List_Add(data->VP, &X[2]);	      
       }
 
       int currentTimeStep = 0;
@@ -303,13 +288,13 @@ Post_View * GMSH_StreamLinesPlugin::GenerateView(int iView, int dView) const
 	double XPREV[3] = { X[0], X[1], X[2] };
 
 	if(timestep < 0){
-	  double T0 = List_Nbr(v1->Time) ? *(double*)List_Pointer(v1->Time, 0) : 0.;
+	  double T0 = data1->getTime(0);
 	  double currentT = T0 + DT * iter;
-	  List_Add(View->Time, &currentT);
-	  for(; currentTimeStep < v1->NbTimeStep - 1 && currentT > 0.5 *
-		(*(double*)List_Pointer(v1->Time, currentTimeStep) +
-		 *(double*)List_Pointer(v1->Time, currentTimeStep + 1));
-              currentTimeStep++);
+	  List_Add(data->Time, &currentT);
+	  for(; currentTimeStep < data1->getNumTimeSteps() - 1 && 
+		currentT > 0.5 * (data1->getTime(currentTimeStep) + 
+				  data1->getTime(currentTimeStep + 1));
+	      currentTimeStep++);
 	}
 	else{
 	  currentTimeStep = timestep;
@@ -341,54 +326,53 @@ Post_View * GMSH_StreamLinesPlugin::GenerateView(int iView, int dView) const
 		   b3*(X3[k]-X[k]) + b4*(X4[k]-X[k])) ;
 	for(int k = 0; k < 3; k++) DX[k] = X[k] - XINIT[k];
 
-	if(v2){
-	  View->NbSL++;
-	  List_Add(View->SL, &XPREV[0]);
-	  List_Add(View->SL, &X[0]);
-	  List_Add(View->SL, &XPREV[1]);
-	  List_Add(View->SL, &X[1]);
-	  List_Add(View->SL, &XPREV[2]);
-	  List_Add(View->SL, &X[2]);
-	  for(int k = 0; k < v2->NbTimeStep; k++)
-	    List_Add(View->SL, &val2[k]);
+	if(data2){
+	  data->NbSL++;
+	  List_Add(data->SL, &XPREV[0]);
+	  List_Add(data->SL, &X[0]);
+	  List_Add(data->SL, &XPREV[1]);
+	  List_Add(data->SL, &X[1]);
+	  List_Add(data->SL, &XPREV[2]);
+	  List_Add(data->SL, &X[2]);
+	  for(int k = 0; k < data2->getNumTimeSteps(); k++)
+	    List_Add(data->SL, &val2[k]);
 	  o2->searchScalar(X[0], X[1], X[2], val2, -1);
-	  for(int k = 0; k < v2->NbTimeStep; k++)
-	    List_Add(View->SL, &val2[k]);
+	  for(int k = 0; k < data2->getNumTimeSteps(); k++)
+	    List_Add(data->SL, &val2[k]);
 	}
 	else{
-	  List_Add(View->VP, &DX[0]);
-	  List_Add(View->VP, &DX[1]);
-	  List_Add(View->VP, &DX[2]);	      
+	  List_Add(data->VP, &DX[0]);
+	  List_Add(data->VP, &DX[1]);
+	  List_Add(data->VP, &DX[2]);	      
 	}
       }
     }
   }
 
-  if(v2){
+  if(data2){
     delete [] val2;
     delete o2;
   }
   else{
-    View->VectorType = DRAW_POST_DISPLACEMENT;
+    v->getOptions()->VectorType = PViewOptions::Displacement;
   }
 
-  char name[1024], filename[1024];
-  sprintf(name, "%s_StreamLines", v1->Name);
-  sprintf(filename, "%s_StreamLines.pos", v1->Name);
-  EndView(View, 1, filename, name);
-
-  return View;
+  data->setName(data1->getName() + "_StreamLines");
+  data->setFileName(data1->getName() + "_StreamLines.pos");
+  data->finalize();
 
-  */
+  return v;
 }
 
-Post_View *GMSH_StreamLinesPlugin::execute(Post_View * v)
+PView *GMSH_StreamLinesPlugin::execute(PView *v)
 {
   int dView = (int)StreamLinesOptions_Number[14].def;
   int iView = (int)StreamLinesOptions_Number[15].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
+  PView *v2 = getView(dView, v);
 
-  return GenerateView(iView, dView);
+  return GenerateView(v1, v2);
 }
diff --git a/Plugin/StreamLines.h b/Plugin/StreamLines.h
index 97f8c30a32c7b0520c413448da14149cc6092652..15096b05bc2927391cdc59edfb168e056013c926 100644
--- a/Plugin/StreamLines.h
+++ b/Plugin/StreamLines.h
@@ -40,12 +40,12 @@ public:
   void catchErrorMessage (char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber *getOption(int iopt);  
-  Post_View *execute(Post_View *);
-  virtual Post_View * GenerateView(int iView, int dView) const ;
+  PView *execute(PView *);
+  virtual PView *GenerateView(PView *v1, PView *v2);
 
   static int getNbU();
   static int getNbV();
-  static void getPoint(int iU, int iV, double *X );
+  static void getPoint(int iU, int iV, double *X);
 
   static double callbackX0(int, int, double);
   static double callbackY0(int, int, double);
diff --git a/Plugin/Transform.cpp b/Plugin/Transform.cpp
index df3f1a387a90aff8094cc442b8ff82dd095d367d..2f55decf826d14968ba1b0f9868a61f34c5d20c0 100644
--- a/Plugin/Transform.cpp
+++ b/Plugin/Transform.cpp
@@ -1,4 +1,4 @@
-// $Id: Transform.cpp,v 1.35 2007-07-09 13:54:37 geuzaine Exp $
+// $Id: Transform.cpp,v 1.36 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,13 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Transform.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-
-extern Context_T CTX;
 
 StringXNumber TransformOptions_Number[] = {
   {GMSH_FULLRC, "A11", NULL, 1.},
@@ -38,8 +32,8 @@ StringXNumber TransformOptions_Number[] = {
   {GMSH_FULLRC, "A32", NULL, 0.},
   {GMSH_FULLRC, "A33", NULL, 1.},
   {GMSH_FULLRC, "Tx", NULL, 0.}, 
-  {GMSH_FULLRC, "Ty", NULL, 0.}, // cannot use T2 (reserve token in parser)
-  {GMSH_FULLRC, "Tz", NULL, 0.}, // cannot use T3 (reserve token in parser)
+  {GMSH_FULLRC, "Ty", NULL, 0.}, // cannot use T2 (reserved token in parser)
+  {GMSH_FULLRC, "Tz", NULL, 0.}, // cannot use T3 (reserved token in parser)
   {GMSH_FULLRC, "SwapOrientation", NULL, 0.},
   {GMSH_FULLRC, "iView", NULL, -1.}
 };
@@ -52,7 +46,6 @@ extern "C"
   }
 }
 
-
 GMSH_TransformPlugin::GMSH_TransformPlugin()
 {
   ;
@@ -107,7 +100,7 @@ static void transform(double mat[3][4], double v[3],
   *z = mat[2][0] * v[0] + mat[2][1] * v[1] + mat[2][2] * v[2] + mat[2][3];
 }
 
-static void transform_list(Post_View *view, List_T *list, int nbList, 
+static void transform_list(PViewDataList *data, List_T *list, int nbList, 
 			   int nbVert, int nbComp, double mat[3][4], int swap)
 {
   if(!nbList) return;
@@ -132,26 +125,20 @@ static void transform_list(Post_View *view, List_T *list, int nbList,
       y[j] = sin(2 * M_PI / alpha * atan2(v[1], v[0])) * alpha / (2 * M_PI) * d;
       z[j] = cos(asin(alpha / (2 * M_PI))) * d;
 #endif
-      if(x[j] < view->BBox[0]) view->BBox[0] = x[j];
-      if(x[j] > view->BBox[1]) view->BBox[1] = x[j];
-      if(y[j] < view->BBox[2]) view->BBox[2] = y[j];
-      if(y[j] > view->BBox[3]) view->BBox[3] = y[j];
-      if(z[j] < view->BBox[4]) view->BBox[4] = z[j];
-      if(z[j] > view->BBox[5]) view->BBox[5] = z[j];
     }
     if(copy){
       for(int j = 0; j < nb; j++)
 	copy[j] = x[j];
       for(int j = 0; j < nbVert; j++){
-	x[j] = copy[nbVert-j-1];
-	x[nbVert+j] = copy[2*nbVert-j-1];
-	x[2*nbVert+j] = copy[3*nbVert-j-1];
+	x[j] = copy[nbVert - j - 1];
+	x[nbVert + j] = copy[2 * nbVert - j - 1];
+	x[2 * nbVert + j] = copy[3 * nbVert - j - 1];
       }
-      for(int ts = 0; ts < view->NbTimeStep; ts++){
+      for(int ts = 0; ts < data->getNumTimeSteps(); ts++){
 	for(int j = 0; j < nbVert; j++){
 	  for(int k = 0; k < nbComp; k++){
-	    x[3*nbVert+nbComp*nbVert*ts+nbComp*j+k] = 
-	      copy[3*nbVert+nbComp*nbVert*ts+nbComp*(nbVert-j-1)+k];
+	    x[3 * nbVert + nbComp * nbVert * ts + nbComp * j + k] = 
+	      copy[3 * nbVert + nbComp * nbVert * ts + nbComp * (nbVert - j - 1) + k];
 	  }
 	}
       }
@@ -161,7 +148,7 @@ static void transform_list(Post_View *view, List_T *list, int nbList,
   if(copy) delete [] copy;
 }
 
-Post_View *GMSH_TransformPlugin::execute(Post_View * v)
+PView *GMSH_TransformPlugin::execute(PView *v)
 {
   double mat[3][4];
 
@@ -182,49 +169,41 @@ Post_View *GMSH_TransformPlugin::execute(Post_View * v)
   int swap = (int)TransformOptions_Number[12].def;
   int iView = (int)TransformOptions_Number[13].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
-
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
-
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-
-  for(int i = 0; i < 3; i++) {
-    v1->BBox[2 * i] = VAL_INF;
-    v1->BBox[2 * i + 1] = -VAL_INF;
-  }
-
-  transform_list(v1, v1->SP, v1->NbSP, 1, 1, mat, swap);
-  transform_list(v1, v1->SL, v1->NbSL, 2, 1, mat, swap);
-  transform_list(v1, v1->ST, v1->NbST, 3, 1, mat, swap);
-  transform_list(v1, v1->SQ, v1->NbSQ, 4, 1, mat, swap);
-  transform_list(v1, v1->SS, v1->NbSS, 4, 1, mat, swap);
-  transform_list(v1, v1->SH, v1->NbSH, 8, 1, mat, swap);
-  transform_list(v1, v1->SI, v1->NbSI, 6, 1, mat, swap);
-  transform_list(v1, v1->SY, v1->NbSY, 5, 1, mat, swap);
-
-  transform_list(v1, v1->VP, v1->NbVP, 1, 3, mat, swap);
-  transform_list(v1, v1->VL, v1->NbVL, 2, 3, mat, swap);
-  transform_list(v1, v1->VT, v1->NbVT, 3, 3, mat, swap);
-  transform_list(v1, v1->VQ, v1->NbVQ, 4, 3, mat, swap);
-  transform_list(v1, v1->VS, v1->NbVS, 4, 3, mat, swap);
-  transform_list(v1, v1->VH, v1->NbVH, 8, 3, mat, swap);
-  transform_list(v1, v1->VI, v1->NbVI, 6, 3, mat, swap);
-  transform_list(v1, v1->VY, v1->NbVY, 5, 3, mat, swap);
-
-  transform_list(v1, v1->TP, v1->NbTP, 1, 9, mat, swap);
-  transform_list(v1, v1->TL, v1->NbTL, 2, 9, mat, swap);
-  transform_list(v1, v1->TT, v1->NbTT, 3, 9, mat, swap);
-  transform_list(v1, v1->TQ, v1->NbTQ, 4, 9, mat, swap);
-  transform_list(v1, v1->TS, v1->NbTS, 4, 9, mat, swap);
-  transform_list(v1, v1->TH, v1->NbTH, 8, 9, mat, swap);
-  transform_list(v1, v1->TI, v1->NbTI, 6, 9, mat, swap);
-  transform_list(v1, v1->TY, v1->NbTY, 5, 9, mat, swap);
-
-  v1->Changed = 1;
-
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
+
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  transform_list(data1, data1->SP, data1->NbSP, 1, 1, mat, swap);
+  transform_list(data1, data1->SL, data1->NbSL, 2, 1, mat, swap);
+  transform_list(data1, data1->ST, data1->NbST, 3, 1, mat, swap);
+  transform_list(data1, data1->SQ, data1->NbSQ, 4, 1, mat, swap);
+  transform_list(data1, data1->SS, data1->NbSS, 4, 1, mat, swap);
+  transform_list(data1, data1->SH, data1->NbSH, 8, 1, mat, swap);
+  transform_list(data1, data1->SI, data1->NbSI, 6, 1, mat, swap);
+  transform_list(data1, data1->SY, data1->NbSY, 5, 1, mat, swap);
+
+  transform_list(data1, data1->VP, data1->NbVP, 1, 3, mat, swap);
+  transform_list(data1, data1->VL, data1->NbVL, 2, 3, mat, swap);
+  transform_list(data1, data1->VT, data1->NbVT, 3, 3, mat, swap);
+  transform_list(data1, data1->VQ, data1->NbVQ, 4, 3, mat, swap);
+  transform_list(data1, data1->VS, data1->NbVS, 4, 3, mat, swap);
+  transform_list(data1, data1->VH, data1->NbVH, 8, 3, mat, swap);
+  transform_list(data1, data1->VI, data1->NbVI, 6, 3, mat, swap);
+  transform_list(data1, data1->VY, data1->NbVY, 5, 3, mat, swap);
+
+  transform_list(data1, data1->TP, data1->NbTP, 1, 9, mat, swap);
+  transform_list(data1, data1->TL, data1->NbTL, 2, 9, mat, swap);
+  transform_list(data1, data1->TT, data1->NbTT, 3, 9, mat, swap);
+  transform_list(data1, data1->TQ, data1->NbTQ, 4, 9, mat, swap);
+  transform_list(data1, data1->TS, data1->NbTS, 4, 9, mat, swap);
+  transform_list(data1, data1->TH, data1->NbTH, 8, 9, mat, swap);
+  transform_list(data1, data1->TI, data1->NbTI, 6, 9, mat, swap);
+  transform_list(data1, data1->TY, data1->NbTY, 5, 9, mat, swap);
+
+  data1->finalize();
+
+  v1->setChanged(true);
   return v1;
 }
diff --git a/Plugin/Transform.h b/Plugin/Transform.h
index 2e9b3478992a978484154e21858883f23fbda541..c516f6dcdc199ed4879c654bdf1ba591406c27fd 100644
--- a/Plugin/Transform.h
+++ b/Plugin/Transform.h
@@ -36,7 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Triangulate.cpp b/Plugin/Triangulate.cpp
index 34fbc2077e55b20bdf65c159c5701bf9a439066b..78d2d0e1238c956f5a99cc518e6340983a8e5dfb 100644
--- a/Plugin/Triangulate.cpp
+++ b/Plugin/Triangulate.cpp
@@ -1,4 +1,4 @@
-// $Id: Triangulate.cpp,v 1.36 2007-09-04 13:47:05 remacle Exp $
+// $Id: Triangulate.cpp,v 1.37 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -21,13 +21,11 @@
 
 #include <vector>
 #include "Gmsh.h"
-#include "Plugin.h"
+#include "gmshFace.h"
+#include "MVertex.h"
 #include "Triangulate.h"
-#include "Views.h"
-#include "Context.h"
 #include "Malloc.h"
-#include "MVertex.h"
-#include "gmshFace.h"
+#include "Context.h"
 
 extern Context_T CTX;
 
@@ -205,33 +203,31 @@ static void Triangulate(int nbIn, List_T *inList, int *nbOut, List_T *outList,
 
 #endif // !HAVE_TRIANGLE
 
-Post_View *GMSH_TriangulatePlugin::execute(Post_View * v)
+PView *GMSH_TriangulatePlugin::execute(PView *v)
 {
   int iView = (int)TriangulateOptions_Number[0].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
+
+  PView *v2 = new PView(true);
+
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
+
+  int nts = data1->getNumTimeSteps();
+  Triangulate(data1->NbSP, data1->SP, &data2->NbST, data2->ST, nts, 1);
+  Triangulate(data1->NbVP, data1->VP, &data2->NbVT, data2->VT, nts, 3);
+  Triangulate(data1->NbTP, data1->TP, &data2->NbTT, data2->TT, nts, 9);
+
+  for(int i = 0; i < List_Nbr(data1->Time); i++)
+    List_Add(data2->Time, List_Pointer(data1->Time, i));
+  data2->setName(data1->getName() + "_Triangulate");
+  data2->setFileName(data1->getName() + "_Triangulate.pos");
+  data2->finalize();
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = BeginView(1);
-
-  Triangulate(v1->NbSP, v1->SP, &v2->NbST, v2->ST, v1->NbTimeStep, 1);
-  Triangulate(v1->NbVP, v1->VP, &v2->NbVT, v2->VT, v1->NbTimeStep, 3);
-  Triangulate(v1->NbTP, v1->TP, &v2->NbTT, v2->TT, v1->NbTimeStep, 9);
-
-  // copy time data
-  for(int i = 0; i < List_Nbr(v1->Time); i++)
-    List_Add(v2->Time, List_Pointer(v1->Time, i));
-  
-  // finalize
-  char name[1024], filename[1024];
-  sprintf(name, "%s_Triangulate", v1->Name);
-  sprintf(filename, "%s_Triangulate.pos", v1->Name);
-  EndView(v2, 1, filename, name);
   return v2;
 }
diff --git a/Plugin/Triangulate.h b/Plugin/Triangulate.h
index 2e87a7b8e36caec7c765d339761da805857c1c82..529cc03828f35b3c065144b316de4f2be3c4ade0 100644
--- a/Plugin/Triangulate.h
+++ b/Plugin/Triangulate.h
@@ -36,7 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Plugin/Warp.cpp b/Plugin/Warp.cpp
index 116d76f7d464246bf17b6cce61b087e998054120..b8c241298a9d198fc33314fa149f75d802592c85 100644
--- a/Plugin/Warp.cpp
+++ b/Plugin/Warp.cpp
@@ -1,4 +1,4 @@
-// $Id: Warp.cpp,v 1.8 2007-09-04 13:47:05 remacle Exp $
+// $Id: Warp.cpp,v 1.9 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -19,16 +19,9 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include "Plugin.h"
 #include "Warp.h"
-#include "List.h"
-#include "Views.h"
-#include "Context.h"
-#include "Numeric.h"
 #include "SmoothData.h"
 
-extern Context_T CTX;
-
 StringXNumber WarpOptions_Number[] = {
   {GMSH_FULLRC, "Factor", NULL, 1.},
   {GMSH_FULLRC, "TimeStep", NULL, 0.},
@@ -107,8 +100,8 @@ static void addNormals(List_T *listElm, int nbElm, int nbNod,
   }
 }
 
-static void warpList(Post_View * iView, List_T * iList, int iNbElm, 
-		     Post_View * dView, List_T * dList, int dNbElm,
+static void warpList(List_T *iList, int iNbElm,
+		     List_T *dList, int dNbElm,
 		     int nbNod, double factor, int TimeStep,
 		     int nbComp, smooth_normals *normals)
 {
@@ -116,13 +109,11 @@ static void warpList(Post_View * iView, List_T * iList, int iNbElm,
     return;
 
   if(!normals && (iNbElm != dNbElm)){
-    Msg(GERROR, "View[%d] and View[%d] have a different number of elements (%d != %d)",
-	iView->Index, dView->Index, iNbElm, dNbElm);
+    Msg(GERROR, "Views have a different number of elements (%d != %d)", 
+	iNbElm, dNbElm);
     return;
   }
   
-  iView->Changed = 1;
-
   // for each element
   //   for each node
   //      (x,y,z) += factor * (valx,valy,valz)
@@ -166,66 +157,56 @@ static void warpList(Post_View * iView, List_T * iList, int iNbElm,
 	y[k] += factor * val[3 * nbNod * TimeStep + 3 * k + 1];
 	z[k] += factor * val[3 * nbNod * TimeStep + 3 * k + 2];
       }
-      if(x[k] < iView->BBox[0]) iView->BBox[0] = x[k];
-      if(x[k] > iView->BBox[1]) iView->BBox[1] = x[k];
-      if(y[k] < iView->BBox[2]) iView->BBox[2] = y[k];
-      if(y[k] > iView->BBox[3]) iView->BBox[3] = y[k];
-      if(z[k] < iView->BBox[4]) iView->BBox[4] = z[k];
-      if(z[k] > iView->BBox[5]) iView->BBox[5] = z[k];
     }
   }
   
 }
 
-static void warp(Post_View * v, Post_View * w, double factor, int ts, double tol)
+static void warp(PViewDataList *data1, PViewDataList *data2, double factor, 
+		 int ts, double tol)
 {
-  for(int i = 0; i < 3; i++) {
-    v->BBox[2 * i] = VAL_INF;
-    v->BBox[2 * i + 1] = -VAL_INF;
-  }
-
   smooth_normals *nn = 0;
   if(WarpOptions_Number[3].def <  0){
     nn = new smooth_normals(tol);
-    addNormals(v->ST, v->NbST, 3, nn);
-    addNormals(v->VT, v->NbVT, 3, nn);
-    addNormals(v->TT, v->NbTT, 3, nn);
-    addNormals(v->SQ, v->NbSQ, 4, nn);
-    addNormals(v->VQ, v->NbVQ, 4, nn);
-    addNormals(v->TQ, v->NbTQ, 4, nn);
+    addNormals(data1->ST, data1->NbST, 3, nn);
+    addNormals(data1->VT, data1->NbVT, 3, nn);
+    addNormals(data1->TT, data1->NbTT, 3, nn);
+    addNormals(data1->SQ, data1->NbSQ, 4, nn);
+    addNormals(data1->VQ, data1->NbVQ, 4, nn);
+    addNormals(data1->TQ, data1->NbTQ, 4, nn);
   }
 
-  warpList(v, v->SP, v->NbSP, w, w->VP, w->NbVP, 1, factor, ts, 1, nn);
-  warpList(v, v->SL, v->NbSL, w, w->VL, w->NbVL, 2, factor, ts, 1, nn);
-  warpList(v, v->ST, v->NbST, w, w->VT, w->NbVT, 3, factor, ts, 1, nn);
-  warpList(v, v->SQ, v->NbSQ, w, w->VQ, w->NbVQ, 4, factor, ts, 1, nn);
-  warpList(v, v->SS, v->NbSS, w, w->VS, w->NbVS, 4, factor, ts, 1, nn);
-  warpList(v, v->SH, v->NbSH, w, w->VH, w->NbVH, 8, factor, ts, 1, nn);
-  warpList(v, v->SI, v->NbSI, w, w->VI, w->NbVI, 6, factor, ts, 1, nn);
-  warpList(v, v->SY, v->NbSY, w, w->VY, w->NbVY, 5, factor, ts, 1, nn);
-			   	       	  	                    
-  warpList(v, v->VP, v->NbVP, w, w->VP, w->NbVP, 1, factor, ts, 3, nn);
-  warpList(v, v->VL, v->NbVL, w, w->VL, w->NbVL, 2, factor, ts, 3, nn);
-  warpList(v, v->VT, v->NbVT, w, w->VT, w->NbVT, 3, factor, ts, 3, nn);
-  warpList(v, v->VQ, v->NbVQ, w, w->VQ, w->NbVQ, 4, factor, ts, 3, nn);
-  warpList(v, v->VS, v->NbVS, w, w->VS, w->NbVS, 4, factor, ts, 3, nn);
-  warpList(v, v->VH, v->NbVH, w, w->VH, w->NbVH, 8, factor, ts, 3, nn);
-  warpList(v, v->VI, v->NbVI, w, w->VI, w->NbVI, 6, factor, ts, 3, nn);
-  warpList(v, v->VY, v->NbVY, w, w->VY, w->NbVY, 5, factor, ts, 3, nn);
-			   	       	  	                    
-  warpList(v, v->TP, v->NbTP, w, w->VP, w->NbVP, 1, factor, ts, 9, nn);
-  warpList(v, v->TL, v->NbTL, w, w->VL, w->NbVL, 2, factor, ts, 9, nn);
-  warpList(v, v->TT, v->NbTT, w, w->VT, w->NbVT, 3, factor, ts, 9, nn);
-  warpList(v, v->TQ, v->NbTQ, w, w->VQ, w->NbVQ, 4, factor, ts, 9, nn);
-  warpList(v, v->TS, v->NbTS, w, w->VS, w->NbVS, 4, factor, ts, 9, nn);
-  warpList(v, v->TH, v->NbTH, w, w->VH, w->NbVH, 8, factor, ts, 9, nn);
-  warpList(v, v->TI, v->NbTI, w, w->VI, w->NbVI, 6, factor, ts, 9, nn);
-  warpList(v, v->TY, v->NbTY, w, w->VY, w->NbVY, 5, factor, ts, 9, nn);
+  warpList(data1->SP, data1->NbSP, data2->VP, data2->NbVP, 1, factor, ts, 1, nn);
+  warpList(data1->SL, data1->NbSL, data2->VL, data2->NbVL, 2, factor, ts, 1, nn);
+  warpList(data1->ST, data1->NbST, data2->VT, data2->NbVT, 3, factor, ts, 1, nn);
+  warpList(data1->SQ, data1->NbSQ, data2->VQ, data2->NbVQ, 4, factor, ts, 1, nn);
+  warpList(data1->SS, data1->NbSS, data2->VS, data2->NbVS, 4, factor, ts, 1, nn);
+  warpList(data1->SH, data1->NbSH, data2->VH, data2->NbVH, 8, factor, ts, 1, nn);
+  warpList(data1->SI, data1->NbSI, data2->VI, data2->NbVI, 6, factor, ts, 1, nn);
+  warpList(data1->SY, data1->NbSY, data2->VY, data2->NbVY, 5, factor, ts, 1, nn);
+	   		   	       	  	                    
+  warpList(data1->VP, data1->NbVP, data2->VP, data2->NbVP, 1, factor, ts, 3, nn);
+  warpList(data1->VL, data1->NbVL, data2->VL, data2->NbVL, 2, factor, ts, 3, nn);
+  warpList(data1->VT, data1->NbVT, data2->VT, data2->NbVT, 3, factor, ts, 3, nn);
+  warpList(data1->VQ, data1->NbVQ, data2->VQ, data2->NbVQ, 4, factor, ts, 3, nn);
+  warpList(data1->VS, data1->NbVS, data2->VS, data2->NbVS, 4, factor, ts, 3, nn);
+  warpList(data1->VH, data1->NbVH, data2->VH, data2->NbVH, 8, factor, ts, 3, nn);
+  warpList(data1->VI, data1->NbVI, data2->VI, data2->NbVI, 6, factor, ts, 3, nn);
+  warpList(data1->VY, data1->NbVY, data2->VY, data2->NbVY, 5, factor, ts, 3, nn);
+	   		   	       	  	                    
+  warpList(data1->TP, data1->NbTP, data2->VP, data2->NbVP, 1, factor, ts, 9, nn);
+  warpList(data1->TL, data1->NbTL, data2->VL, data2->NbVL, 2, factor, ts, 9, nn);
+  warpList(data1->TT, data1->NbTT, data2->VT, data2->NbVT, 3, factor, ts, 9, nn);
+  warpList(data1->TQ, data1->NbTQ, data2->VQ, data2->NbVQ, 4, factor, ts, 9, nn);
+  warpList(data1->TS, data1->NbTS, data2->VS, data2->NbVS, 4, factor, ts, 9, nn);
+  warpList(data1->TH, data1->NbTH, data2->VH, data2->NbVH, 8, factor, ts, 9, nn);
+  warpList(data1->TI, data1->NbTI, data2->VI, data2->NbVI, 6, factor, ts, 9, nn);
+  warpList(data1->TY, data1->NbTY, data2->VY, data2->NbVY, 5, factor, ts, 9, nn);
 
   if(nn) delete nn;
 }
 
-Post_View *GMSH_WarpPlugin::execute(Post_View * v)
+PView *GMSH_WarpPlugin::execute(PView *v)
 {
   double factor = WarpOptions_Number[0].def;
   int TimeStep = (int)WarpOptions_Number[1].def;
@@ -233,32 +214,30 @@ Post_View *GMSH_WarpPlugin::execute(Post_View * v)
   int dView = (int)WarpOptions_Number[3].def;
   int iView = (int)WarpOptions_Number[4].def;
 
-  if(iView < 0)
-    iView = v ? v->Index : 0;
+  PView *v1 = getView(iView, v);
+  if(!v1) return v;
 
-  if(!List_Pointer_Test(CTX.post.list, iView)) {
-    Msg(GERROR, "View[%d] does not exist", iView);
-    return v;
-  }
+  PViewDataList *data1 = getDataList(v1);
+  if(!data1) return v;
 
-  if(dView < 0)
-    dView = iView;
+  if(dView < 0) dView = iView;
 
-  if(!List_Pointer_Test(CTX.post.list, dView)) {
-    Msg(GERROR, "View[%d] does not exist", dView);
-    return v;
-  }
+  PView *v2 = getView(dView, v);
+  if(!v2) return v;
 
-  Post_View *v1 = *(Post_View **)List_Pointer(CTX.post.list, iView);
-  Post_View *v2 = *(Post_View **)List_Pointer(CTX.post.list, dView);
+  PViewDataList *data2 = getDataList(v2);
+  if(!data2) return v;
 
-  if(TimeStep > v2->NbTimeStep - 1){
+  if(TimeStep > data2->getNumTimeSteps() - 1){
     // we allow TimeStep < 0 (to apply fixed warps)
-    Msg(GERROR, "Invalid TimeStep (%d) in View[%d]", TimeStep, v2->Index);
+    Msg(GERROR, "Invalid TimeStep (%d) in View[%d]", TimeStep, v2->getIndex());
     return v;
   }
 
-  warp(v1, v2, factor, TimeStep, AngleTol);
+  warp(data1, data2, factor, TimeStep, AngleTol);
+
+  data1->finalize();
+  v1->setChanged(true);
 
   return v1;
 }
diff --git a/Plugin/Warp.h b/Plugin/Warp.h
index aff1f3a5b8cecd8fc010c370f8a54cb0a22e8108..3c884fffac3cfae086d33c1748c5ff46f69dcae6 100644
--- a/Plugin/Warp.h
+++ b/Plugin/Warp.h
@@ -36,7 +36,7 @@ public:
   void catchErrorMessage(char *errorMessage) const;
   int getNbOptions() const;
   StringXNumber* getOption(int iopt);  
-  Post_View *execute(Post_View *);
+  PView *execute(PView *);
 };
 
 #endif
diff --git a/Post/AdaptiveViews.cpp b/Post/AdaptiveViews.cpp
index 66485fc6b25a667a0aebaab6002fae1687a5515c..9c1493ddfc6c25594fbc93d84ef269c1d9f2ca13 100644
--- a/Post/AdaptiveViews.cpp
+++ b/Post/AdaptiveViews.cpp
@@ -25,8 +25,7 @@
 #include "AdaptiveViews.h"
 #include "Plugin.h"
 #include "OS.h"
-
-
+#include "Views.h"
 
 // A recursive effective implementation
 
@@ -788,7 +787,7 @@ int Adaptive_Post_View::zoomElement(Post_View * view,
   }
 
   if(plug)
-    plug->assign_specific_visibility();
+    plug->assignSpecificVisibility();
 
   double c3 = Cpu();
   itt = ELEM::all_elems.begin();
@@ -939,7 +938,7 @@ void Adaptive_Post_View::setAdaptiveResolutionLevel(Post_View * view,
   // recompute min/max, etc.:
   view->Min = VAL_INF;
   view->Max = -VAL_INF;
-  EndView(view, 0, view->FileName, view->Name);
+  //FIXME xxxxxxxxxxxxxxxxxxx  EndView(view, 0, view->FileName, view->Name);
   view->Changed = 1;
   presentZoomLevel = level;
   presentTol = tol;
diff --git a/Post/Makefile b/Post/Makefile
index dad83c6676a558646ca5d04b62dba07f9dc37055..e332e02453b878a0d09c41afc531ba28b08c9d12 100644
--- a/Post/Makefile
+++ b/Post/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.13 2007-09-10 04:47:08 geuzaine Exp $
+# $Id: Makefile,v 1.14 2007-09-11 14:01:55 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -94,10 +94,12 @@ PViewOptions.o: PViewOptions.cpp PViewOptions.h ColorTable.h \
   ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Common/Message.h
 AdaptiveViews.o: AdaptiveViews.cpp AdaptiveViews.h ../DataStr/List.h \
   ../Common/GmshMatrix.h ../Plugin/Plugin.h ../Common/Options.h \
-  ../Post/ColorTable.h ../Common/Message.h ../Post/Views.h \
-  ../Post/ColorTable.h ../Common/VertexArray.h ../Geo/SVector3.h \
-  ../Geo/SPoint3.h ../Common/SmoothData.h ../Numeric/Numeric.h \
-  ../Post/AdaptiveViews.h ../Common/OS.h
+  ../Post/ColorTable.h ../Common/Message.h ../Post/PView.h \
+  ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
+  ../Common/SmoothData.h ../Numeric/Numeric.h ../Post/PViewData.h \
+  ../Geo/SBoundingBox3d.h ../Geo/SPoint3.h ../Post/PViewOptions.h \
+  ../Post/ColorTable.h ../Post/PViewDataList.h ../Post/PViewData.h \
+  ../Post/AdaptiveViews.h ../Common/OS.h Views.h ColorTable.h
 OctreePost.o: OctreePost.cpp ../Common/Octree.h \
   ../Common/OctreeInternals.h OctreePost.h ../DataStr/List.h PView.h \
   ../Common/VertexArray.h ../Geo/SVector3.h ../Geo/SPoint3.h \
diff --git a/Post/PViewDataList.cpp b/Post/PViewDataList.cpp
index 9fd9fdfc4d36e761f2135aadb9fa3305f5f95fd8..f7f9cc2b40a09c936f27d0ae27dd1fae0b24a934 100644
--- a/Post/PViewDataList.cpp
+++ b/Post/PViewDataList.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewDataList.cpp,v 1.5 2007-09-10 04:47:08 geuzaine Exp $
+// $Id: PViewDataList.cpp,v 1.6 2007-09-11 14:01:55 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -91,27 +91,15 @@ PViewDataList::~PViewDataList()
 
 bool PViewDataList::finalize()
 {
-
   // sanity checks
-  /*
-  if(View->adaptive) return 0; // hope for the best :-)
-
-  char *name[8] = { "point", "line", "triangle", "quadrangle", 
-		    "tetrahedron", "hexahedron", "prism", "pyramid" };
-  char *type[3] = { "scalar", "vector", "tensor" };
-
-  if(8 * 3 != VIEW_NB_ELEMENT_TYPES){
-    Msg(GERROR, "Please upgrade CheckViewErrorFlags!");
-    return 0;
+  if(!adaptive){ // if adaptive, just hope for the best ;-)
+    // check that number of values per element = 
+    // 3 * number of coordinates + (1,2,9) * integer * number of values
   }
-  
-  for(int i = 0; i < VIEW_NB_ELEMENT_TYPES; i++)
-    if(ViewErrorFlags[i])
-      Msg(GERROR, "%d %s %s%s in View[%d] contain%s a wrong number of values",
-	  ViewErrorFlags[i], type[i%3], name[i/3], (ViewErrorFlags[i] > 1) ? "s" : "",
-	  v->Index, (ViewErrorFlags[i] > 1) ? "" : "s");
-  */
 
+  BBox.reset();
+  Min = VAL_INF;
+  Max = -VAL_INF;
 
   // finalize text strings first, to get the max value of NbTimeStep
   // for strings-only views (strings are designed to degrade
@@ -206,13 +194,13 @@ double PViewDataList::getTime(int step)
 
 double PViewDataList::getMin(int step)
 {
-  if(step < 0) return Min;
+  if(step < 0 || step >= TimeStepMin.size()) return Min;
   return TimeStepMin[step];
 }
 
 double PViewDataList::getMax(int step)
 {
-  if(step < 0) return Max;
+  if(step < 0 || step >= TimeStepMax.size()) return Max;
   return TimeStepMax[step];
 }