From aa2cff582a381316a42ec3bec958a2b4c8bd239d Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 22 Apr 2008 09:29:29 +0000 Subject: [PATCH] added some comments --- Post/PViewData.cpp | 4 ++-- Post/PViewData.h | 24 ++++++++++++++++++++---- Post/adaptiveData.cpp | 10 +++++----- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Post/PViewData.cpp b/Post/PViewData.cpp index 524491bc5e..1db74af407 100644 --- a/Post/PViewData.cpp +++ b/Post/PViewData.cpp @@ -1,4 +1,4 @@ -// $Id: PViewData.cpp,v 1.18 2008-04-22 07:37:16 geuzaine Exp $ +// $Id: PViewData.cpp,v 1.19 2008-04-22 09:29:29 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -40,7 +40,7 @@ PViewData::~PViewData() bool PViewData::finalize() { if(!_adaptive && _interpolation.size()){ - Msg(INFO, "Initializing adaptive data %p interp size= %d", + Msg(INFO, "Initializing adaptive data %p interp size=%d", this, _interpolation.size()); _adaptive = new adaptiveData(this); _adaptive->initWithLowResolution(0); diff --git a/Post/PViewData.h b/Post/PViewData.h index c0fc853e36..9b9bdddb5d 100644 --- a/Post/PViewData.h +++ b/Post/PViewData.h @@ -101,10 +101,11 @@ class PViewData { // Returns the number of values available for the ele-th element // in the ent-th entity virtual int getNumValues(int step, int ent, int ele) = 0; + // Gets the idx'th value for the ele-th element in the ent-th entity + virtual void getValue(int step, int ent, int ele, int idx, double &val) = 0; // Gets/sets the comp-th component (at the step-th time step) // associated with the node-th node from the ele-th element in the // ent-th entity - virtual void getValue(int step, int ent, int ele, int idx, double &val) = 0; virtual void getValue(int step, int ent, int ele, int nod, int comp, double &val) = 0; virtual void setValue(int step, int ent, int ele, int nod, int comp, double val); // Returns a scalar value (same as value for scalars, norm for @@ -114,32 +115,47 @@ class PViewData { // Returns the number of edges of the ele-th element in the ent-th // entity virtual int getNumEdges(int step, int ent, int ele) = 0; + // Returns the number of 2D/3D strings in the view virtual int getNumStrings2D(){ return 0; } virtual int getNumStrings3D(){ return 0; } + // Returns the i-th 2D/3D string in the view virtual void getString2D(int i, int step, std::string &str, double &x, double &y, double &style){} virtual void getString3D(int i, int step, std::string &str, double &x, double &y, double &z, double &style){} + // Change the orientation of the ele-th element virtual void revertElement(int step, int ent, int ele){} + // Cheks if the view is empty virtual bool empty(); - virtual void smooth(){} - virtual bool combineTime(nameData &nd){ return false; } - virtual bool combineSpace(nameData &nd){ return false; } + // Cheks if we should skip the ent-th entity virtual bool skipEntity(int step, int ent){ return false; } + // Cheks if we should skip the ele-th entity virtual bool skipElement(int step, int ent, int ele, bool checkVisibility=false){ return false; } + virtual bool hasTimeStep(int step){ return step < getNumTimeSteps(); } virtual bool hasPartition(int part){ return false; } virtual bool hasMultipleMeshes(){ return false; } virtual bool hasModel(GModel *model, int step=-1){ return false; } virtual bool useGaussPoints(){ return false; } + // check if the view is adaptive bool isAdaptive(){ return _adaptive ? true : false; } + // return the adaptive data adaptiveData *getAdaptiveData(){ return _adaptive; } + + // set/get the interpolation matrices for elements with "type" + // number of edges void setInterpolationScheme(int type, List_T *coef, List_T *pol, List_T *coefGeo=0, List_T *polGeo=0); int getInterpolationScheme(int type, std::vector<List_T*> &p); + // Smoothes the data in the view (makes it C0) + virtual void smooth(){} + + virtual bool combineTime(nameData &nd){ return false; } + virtual bool combineSpace(nameData &nd){ return false; } + // I/O routines virtual bool writeSTL(std::string fileName); virtual bool writeTXT(std::string fileName); diff --git a/Post/adaptiveData.cpp b/Post/adaptiveData.cpp index 69a10fe8c5..032af26d2a 100644 --- a/Post/adaptiveData.cpp +++ b/Post/adaptiveData.cpp @@ -897,9 +897,10 @@ void adaptiveElements<T>::initWithLowResolution(PViewData *data, int step) template <class T> void adaptiveElements<T>::changeResolution(int level, double tol, GMSH_Post_Plugin *plug) { - if(!_val) return; // error - - //if(level == _resolutionLevel && tol == _tolerance && !plug) return; + if(!_val){ + Msg(GERROR, "Trying to change resolution in wrong state"); + return; + } _resolutionLevel = level; _tolerance = tol; @@ -1026,11 +1027,10 @@ int adaptiveElements<T>::_zoomElement(int ielem, int level, GMSH_Post_Plugin *pl return 0; } - adaptivePoint **p; for(typename std::list<T*>::iterator it = T::all.begin(); it != T::all.end(); it++){ if((*it)->visible){ - p = (*it)->p; + adaptivePoint **p = (*it)->p; for(int k = 0; k < T::numNodes; ++k) List_Add(_listEle, &p[k]->X); for(int k = 0; k < T::numNodes; ++k) List_Add(_listEle, &p[k]->Y); for(int k = 0; k < T::numNodes; ++k) List_Add(_listEle, &p[k]->Z); -- GitLab