From 3b6b6b53c9cbafb1883105d32f4ff7aebd046b25 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 11 Sep 2007 22:53:35 +0000
Subject: [PATCH] cleanups

---
 Fltk/GUI.cpp           |  4 ++--
 Plugin/Plugin.h        | 16 ++++++----------
 Post/AdaptiveViews.cpp | 39 +++++++++++++++------------------------
 Post/AdaptiveViews.h   | 14 ++++++--------
 Post/Makefile          |  4 ++--
 Post/PViewData.h       |  3 ---
 Post/PViewDataList.cpp |  3 +--
 Post/PViewDataList.h   |  2 +-
 8 files changed, 33 insertions(+), 52 deletions(-)

diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 13c3396e3d..22fb054318 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.637 2007-09-10 05:31:35 geuzaine Exp $
+// $Id: GUI.cpp,v 1.638 2007-09-11 22:53:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -3144,7 +3144,7 @@ void GUI::create_option_window()
       view_value[33] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Maximum recursion level");
       view_value[33]->align(FL_ALIGN_RIGHT);
       view_value[33]->minimum(0);
-      view_value[33]->maximum(MAX_LEVEL_OF_ZOOM);
+      view_value[33]->maximum(8);
       view_value[33]->step(1);
       view_value[33]->value(0);
       view_value[33]->when(FL_WHEN_RELEASE);
diff --git a/Plugin/Plugin.h b/Plugin/Plugin.h
index d3b0853ae9..f927a6209a 100644
--- a/Plugin/Plugin.h
+++ b/Plugin/Plugin.h
@@ -20,16 +20,12 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-// To create a plugin for gmsh:
-// 1) Create a dynamin lib (.so) containing 1 symbol 
-//    GMSH_Plugin * GMSH_RegisterPlugin ();
-// 2) When there is an unacceptable error in the plugin,
-//    just throw this, the plugin manager will be able to 
-//    catch the exception.
-
-//  Some Plugins are default gmsh plugins and are insterted
-//  directly in the executable. I think that it's a good 
-//  way to start.
+// To create a plugin:
+// 1) Create a dynamic lib containing GMSH_RegisterPlugin();
+// 2) When there is an unacceptable error in the plugin, just throw
+//    this, the plugin manager will be able to catch the exception.
+//  Some Plugins are default gmsh plugins and are insterted directly
+//  in the executable. I think that it's a good way to start.
 
 #include <string.h>
 #include <stdio.h>
diff --git a/Post/AdaptiveViews.cpp b/Post/AdaptiveViews.cpp
index 628fc9dc38..86cb1e2566 100644
--- a/Post/AdaptiveViews.cpp
+++ b/Post/AdaptiveViews.cpp
@@ -18,13 +18,11 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
-#include <stdio.h>
 #include <math.h>
 #include <list>
 #include <set>
 #include "AdaptiveViews.h"
 #include "Plugin.h"
-#include "OS.h"
 
 // A recursive effective implementation
 
@@ -38,7 +36,6 @@ std::list<adapt_tet*> adapt_tet::all_elems;
 std::list<adapt_quad*> adapt_quad::all_elems;
 std::list<adapt_hex*> adapt_hex::all_elems;
 
-#define MAX_NB_NOD 8
 int adapt_edge::nbNod = 2;
 int adapt_triangle::nbNod = 3;
 int adapt_tet::nbNod = 4;
@@ -135,8 +132,7 @@ void adapt_edge::Recur_Create(adapt_edge *e, int maxlevel, int level,
                               Double_Matrix *coeffs, Double_Matrix *eexps)
 {
   all_elems.push_back(e);
-  if(level++ >= maxlevel)
-    return;
+  if(level++ >= maxlevel) return;
 
   /*
      p1    p12    p2
@@ -159,8 +155,7 @@ void adapt_triangle::Recur_Create(adapt_triangle *t, int maxlevel, int level,
                                   Double_Matrix *eexps)
 {
   all_elems.push_back(t);
-  if(level++ >= maxlevel)
-    return;
+  if(level++ >= maxlevel) return;
 
   /*
      p3
@@ -197,8 +192,7 @@ void adapt_quad::Recur_Create(adapt_quad *q, int maxlevel, int level,
                               Double_Matrix *coeffs, Double_Matrix *eexps)
 {
   all_elems.push_back(q);
-  if(level++ >= maxlevel)
-    return;
+  if(level++ >= maxlevel) return;
 
   /*
      p4   p34    p3
@@ -241,8 +235,7 @@ void adapt_tet::Recur_Create(adapt_tet *t, int maxlevel, int level,
                              Double_Matrix *coeffs, Double_Matrix *eexps)
 {
   all_elems.push_back(t);
-  if(level++ >= maxlevel)
-    return;
+  if(level++ >= maxlevel) return;
 
   adapt_point *p0 = t->p[0];
   adapt_point *p1 = t->p[1];
@@ -293,8 +286,7 @@ void adapt_hex::Recur_Create(adapt_hex *h, int maxlevel, int level,
                              Double_Matrix *coeffs, Double_Matrix *eexps)
 {
   all_elems.push_back(h);
-  if(level++ >= maxlevel)
-    return;
+  if(level++ >= maxlevel) return;
 
   adapt_point *p0 = h->p[0];
   adapt_point *p1 = h->p[1];
@@ -387,7 +379,6 @@ void adapt_triangle::Error(double AVG, double tol)
   Recur_Error(t, AVG, tol);
 }
 
-
 void adapt_quad::Error(double AVG, double tol)
 {
   adapt_quad *q = *all_elems.begin();
@@ -680,8 +671,8 @@ int Adaptive_Post_View::zoomElement(int ielem,
 {
   const int nbNod = ELEM::nbNod;
 
-  typename std::set < adapt_point >::iterator it = adapt_point::all_points.begin();
-  typename std::set < adapt_point >::iterator ite = adapt_point::all_points.end();
+  typename std::set<adapt_point>::iterator it = adapt_point::all_points.begin();
+  typename std::set<adapt_point>::iterator ite = adapt_point::all_points.end();
 
   const int N = _coefs->size1();
   
@@ -897,8 +888,8 @@ void Adaptive_Post_View::setAdaptiveResolutionLevel_TEMPL(int level, int levelma
 
   double sf[100];
   ELEM::Create(level, _coefs, _eexps);
-  std::set < adapt_point >::iterator it = adapt_point::all_points.begin();
-  std::set < adapt_point >::iterator ite = adapt_point::all_points.end();
+  std::set<adapt_point>::iterator it = adapt_point::all_points.begin();
+  std::set<adapt_point>::iterator ite = adapt_point::all_points.end();
 
   if(_Interpolate)
     delete _Interpolate;
@@ -1059,18 +1050,18 @@ Adaptive_Post_View::Adaptive_Post_View(PViewDataList *data,
                                        List_T *_pol,
 				       List_T *_cGeom,
 				       List_T *_polGeom)
-  :tol(1.e-3), _coefsGeom(0), _eexpsGeom(0)
+  : tol(1.e-3), _coefsGeom(0), _eexpsGeom(0)
 {
 
   _Interpolate = _Geometry = 0;
   _coefs = new Double_Matrix(List_Nbr(_c), List_Nbr(_c));
-  _eexps  = new Double_Matrix(List_Nbr(_c), 3);
+  _eexps = new Double_Matrix(List_Nbr(_c), 3);
 
   _STvalX = _STvalY = _STvalZ =0;
 
   for(int i = 0; i < List_Nbr(_c); ++i) {
-    List_T **line = (List_T **) List_Pointer_Fast(_c, i);
-    List_T **eexp = (List_T **) List_Pointer_Fast(_pol, i);
+    List_T **line = (List_T**)List_Pointer_Fast(_c, i);
+    List_T **eexp = (List_T**)List_Pointer_Fast(_pol, i);
 
     double dpowu, dpowv, dpoww;
 
@@ -1093,8 +1084,8 @@ Adaptive_Post_View::Adaptive_Post_View(PViewDataList *data,
     _coefsGeom = new Double_Matrix(List_Nbr(_cGeom), List_Nbr(_cGeom));
     _eexpsGeom = new Double_Matrix(List_Nbr(_cGeom), 3);
     for(int i = 0; i < List_Nbr(_cGeom); ++i) {
-      List_T **line = (List_T **) List_Pointer_Fast(_cGeom, i);
-      List_T **eexp = (List_T **) List_Pointer_Fast(_polGeom, i);
+      List_T **line = (List_T**)List_Pointer_Fast(_cGeom, i);
+      List_T **eexp = (List_T**)List_Pointer_Fast(_polGeom, i);
       double dpowu, dpowv, dpoww;
       List_Read(*eexp, 0, &dpowu);
       List_Read(*eexp, 1, &dpowv);
diff --git a/Post/AdaptiveViews.h b/Post/AdaptiveViews.h
index 23c178d15f..a7c2670f49 100644
--- a/Post/AdaptiveViews.h
+++ b/Post/AdaptiveViews.h
@@ -25,8 +25,6 @@
 #include "List.h"
 #include "GmshMatrix.h"
 
-#define MAX_LEVEL_OF_ZOOM 8
-
 class PViewDataList;
 class GMSH_Post_Plugin;
 
@@ -38,8 +36,8 @@ class GMSH_Post_Plugin;
 class adapt_point
 {
  public:
-  double x,y,z;
-  double X,Y,Z,val,valx,valy,valz;
+  double x, y, z;
+  double X, Y, Z, val, valx, valy, valz;
   double shape_functions[128];
   static adapt_point *New(double x, double y, double z, 
 			  Double_Matrix *coeffs, Double_Matrix *eexps);
@@ -58,7 +56,7 @@ class adapt_point
 class adapt_edge
 {
  public:
-  adapt_edge(adapt_point *p1,adapt_point *p2)
+  adapt_edge(adapt_point *p1, adapt_point *p2)
     : visible(false)
   {
     p[0] = p1;
@@ -266,7 +264,7 @@ public:
     setAdaptiveResolutionLevel(data, level);
   }
   void setAdaptiveResolutionLevel(PViewDataList *data, int levelmax, 
-				  GMSH_Post_Plugin *plug = 0);
+				  GMSH_Post_Plugin *plug=0);
   template <class ELEM>
   void setAdaptiveResolutionLevel_TEMPL(int level, int lemvelmax,
 					GMSH_Post_Plugin *plug, List_T **myList,
@@ -280,11 +278,11 @@ public:
 };
 
 template <class ELEM>
-void cleanElement ()
+void cleanElement()
 {  
   typename std::list<ELEM*>::iterator it = ELEM::all_elems.begin();
   typename std::list<ELEM*>::iterator ite = ELEM::all_elems.end();
-  for (; it != ite; ++it){
+  for(; it != ite; ++it){
     delete *it;
   }
   ELEM::all_elems.clear();
diff --git a/Post/Makefile b/Post/Makefile
index d60279f65f..b77257dae2 100644
--- a/Post/Makefile
+++ b/Post/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.15 2007-09-11 15:29:02 geuzaine Exp $
+# $Id: Makefile,v 1.16 2007-09-11 22:53:35 geuzaine Exp $
 #
 # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 #
@@ -99,7 +99,7 @@ AdaptiveViews.o: AdaptiveViews.cpp AdaptiveViews.h ../DataStr/List.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
+  ../Post/AdaptiveViews.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/PViewData.h b/Post/PViewData.h
index 9764e4b088..6f11a09952 100644
--- a/Post/PViewData.h
+++ b/Post/PViewData.h
@@ -24,7 +24,6 @@
 #include <vector>
 #include "SBoundingBox3d.h"
 
-class GMSH_Post_Plugin;
 class nameData;
 
 // abstract interface to post-processing view data
@@ -87,8 +86,6 @@ class PViewData {
   virtual bool combineTime(nameData &nd){ return false; }
   virtual bool combineSpace(nameData &nd){ return false; }
   virtual bool isAdaptive(){ return false; }
-  virtual void setGlobalResolutionLevel(int level){}
-  virtual void setAdaptiveResolutionLevel(int level, GMSH_Post_Plugin *plugin=0){}
 
   // I/O routines
   virtual bool writePOS(std::string name, bool binary=false, bool parsed=true,
diff --git a/Post/PViewDataList.cpp b/Post/PViewDataList.cpp
index 0f9739e4c4..d4126325f9 100644
--- a/Post/PViewDataList.cpp
+++ b/Post/PViewDataList.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewDataList.cpp,v 1.7 2007-09-11 15:29:02 geuzaine Exp $
+// $Id: PViewDataList.cpp,v 1.8 2007-09-11 22:53:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -884,4 +884,3 @@ bool PViewDataList::combineTime(nameData &nd)
   setFileName(std::string(name) + ".pos");
   return finalize();
 }
-
diff --git a/Post/PViewDataList.h b/Post/PViewDataList.h
index c532a63ff9..fcc65a4250 100644
--- a/Post/PViewDataList.h
+++ b/Post/PViewDataList.h
@@ -29,7 +29,7 @@
 
 #define VAL_INF 1.e200
 
-// data container using old-style lists of `discontinuous' element
+// list-based datasets (all elements are discontinuous)
 class PViewDataList : public PViewData {
  public: 
   // FIXME: all these members will be made private once the plugins
-- 
GitLab