diff --git a/Post/PView.h b/Post/PView.h index b64f1b7cf05b7b6ebc3412f14abc8d197b1fb4b6..73ebeced45a4a7f602194d8c8df2420fc0a00a65 100644 --- a/Post/PView.h +++ b/Post/PView.h @@ -30,7 +30,7 @@ class VertexArray; class smooth_normals; class GMSH_Post_Plugin; -// a post-processing view +// A post-processing view. class PView{ private: static int _globalNum; @@ -50,29 +50,46 @@ class PView{ PViewData *_data; // initialize private stuff void _init(); + public: - // creates a new view with list-based data, allocated or not + // create a new view with list-based data, allocated or not PView(bool allocate=true); - // constructs a new view using the given data + // construct a new view using the given data PView(PViewData *data); - // constructs a new view, alias of the view "ref" + // construct a new view, alias of the view "ref" PView(PView *ref, bool copyOptions=true); - // constructs a new list-based view from a simple 2D dataset + // construct a new list-based view from a simple 2D dataset PView(std::string xname, std::string yname, std::vector<double> &x, std::vector<double> &y); // default destructor ~PView(); + + // delete the vertex arrays, used to draw the view efficiently void deleteVertexArrays(); + + // get/set the display options PViewOptions *getOptions(){ return _options; } void setOptions(PViewOptions *val=0); + + // get/set the view data PViewData *getData(bool useAdaptiveIfAvailable=false); void setData(PViewData *val){ _data = val; } + + // get the view number (unique and immutable) int getNum(){ return _num; } + + // get/set the view index (in the view list) int getIndex(){ return _index; } void setIndex(int val){ _index = val; } + + // get/set the changed flag bool &getChanged(){ return _changed; } void setChanged(bool val); + + // check if the view is an alias ("light copy") of another view int getAliasOf(){ return _aliasOf; } + + // get/set the eye position (for transparency calculations) SPoint3 &getEye(){ return _eye; } void setEye(SPoint3 &p){ _eye = p; } @@ -88,14 +105,13 @@ class PView{ static PView *getViewByName(std::string name, int timeStep=-1, int partition=-1); - // read view(s) from POS file + // IO read routines (these are global: they can create multiple + // views) static bool readPOS(std::string fileName, int fileIndex=-1); - // read view(s) from MSH file static bool readMSH(std::string fileName, int fileIndex=-1); - // read view(s) from MED file static bool readMED(std::string fileName, int fileIndex=-1); - // write view in given format + // IO write routine bool write(std::string fileName, int format, bool append=false); // vertex arrays to draw the elements efficiently diff --git a/Post/PViewData.h b/Post/PViewData.h index d67dbec19c0d9701c74962810667c41b09765a78..6a06a496e365bfbbf417fad975fb63fb25edb78b 100644 --- a/Post/PViewData.h +++ b/Post/PViewData.h @@ -32,7 +32,7 @@ class adaptiveData; class GModel; class nameData; -// abstract interface to post-processing view data +// The abstract interface to post-processing view data. class PViewData { private: // flag to mark that the data is 'dirty' and should not be displayed @@ -43,29 +43,51 @@ class PViewData { std::string _fileName; // index of the view in the file int _fileIndex; + protected: // adaptive visualization data adaptiveData *_adaptive; // interpolation matrices, indexed by the number of edges per // element (1 for lines, 3 for triangles, etc.) std::map<int, std::vector<List_T*> > _interpolation; + public: PViewData(); virtual ~PViewData(); + + // get/set the dirty ("not ready for display") flag virtual bool getDirty(){ return _dirty; } virtual void setDirty(bool val){ _dirty = val; } + + // finalize the view data (compute min/max, etc.) virtual bool finalize(); + + // get/set name virtual std::string getName(){ return _name; } virtual void setName(std::string val){ _name = val; } + + // get/set filename virtual std::string getFileName(){ return _fileName; } virtual void setFileName(std::string val){ _fileName = val; } + + // get/set index of view data in file virtual int getFileIndex(){ return _fileIndex; } virtual void setFileIndex(int val){ _fileIndex = val; } + + // get number of time steps in the data virtual int getNumTimeSteps() = 0; + + // get the time value associated with the step-th time step virtual double getTime(int step){ return 0.; } + + // get min/max for given step (global over all steps if step=-1) virtual double getMin(int step=-1) = 0; virtual double getMax(int step=-1) = 0; + + // get the bounding box virtual SBoundingBox3d getBoundingBox(int step=-1) = 0; + + // get the number of elements of a giveb type, for a given step virtual int getNumScalars(int step=-1){ return 0; } virtual int getNumVectors(int step=-1){ return 0; } virtual int getNumTensors(int step=-1){ return 0; } @@ -77,18 +99,23 @@ class PViewData { virtual int getNumHexahedra(int step=-1){ return 0; } virtual int getNumPrisms(int step=-1){ return 0; } virtual int getNumPyramids(int step=-1){ return 0; } - // Returns the number of geometrical entities in the view + + // return the number of geometrical entities in the view virtual int getNumEntities(int step=-1) = 0; - // Returns the number of elements in the ent-th entity, or the total + + // return the number of elements in the ent-th entity, or the total // number of elements if ent < 0 virtual int getNumElements(int step=-1, int ent=-1) = 0; - // Returns the geometrical dimension of the ele-th element in the + + // return the geometrical dimension of the ele-th element in the // ent-th entity virtual int getDimension(int step, int ent, int ele) = 0; - // Returns the number of nodes of the ele-th element in the ent-th + + // return the number of nodes of the ele-th element in the ent-th // entity virtual int getNumNodes(int step, int ent, int ele) = 0; - // Gets/Sets the coordinates and tag of the nod-th node from the + + // get/set the coordinates and tag of the nod-th node from the // ele-th element in the ent-th entity (if the node has a tag, // getNode returns it) virtual int getNode(int step, int ent, int ele, int nod, @@ -96,52 +123,66 @@ class PViewData { virtual void setNode(int step, int ent, int ele, int nod, double x, double y, double z); virtual void tagNode(int step, int ent, int ele, int nod, int tag){} - // Returns the number of componts available for the ele-th element - // in the ent-th entity + + // return the number of componts available for the ele-th element in + // the ent-th entity virtual int getNumComponents(int step, int ent, int ele) = 0; - // Returns the number of values available for the ele-th element - // in the ent-th entity + + // return 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 + + // get 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) + + // gets/set 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 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 + + // return a scalar value (same as value for scalars, norm for // vectors, etc.) associated with the node-th node from the ele-th // element in the ent-th entity void getScalarValue(int step, int ent, int ele, int nod, double &val); - // Returns the number of edges of the ele-th element in the ent-th + + // return 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 + + // return 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 + + // return 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 + + // change the orientation of the ele-th element virtual void revertElement(int step, int ent, int ele){} - // Cheks if the view is empty + + // check if the view is empty virtual bool empty(); - // Cheks if we should skip the ent-th entity + + // check if we should skip the given entity/element 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; } + // check if the data has the given step/partition/etc. 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; } + + // true if data is given at Gauss points (instead of vertices) 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; } @@ -149,13 +190,13 @@ class PViewData { // number of edges void setInterpolationScheme(int type, List_T *coef, List_T *pol, List_T *coefGeo=0, List_T *polGeo=0); - inline bool haveInterpolationScheme(){ return !_interpolation.empty(); } int getInterpolationScheme(int type, std::vector<List_T*> &p); + inline bool haveInterpolationScheme(){ return !_interpolation.empty(); } - // Smoothes the data in the view (makes it C0) + // smooth the data in the view (makes it C0) virtual void smooth(); - // Combine time steps or elements from multiple datasets + // combine time steps or elements from multiple datasets virtual bool combineTime(nameData &nd); virtual bool combineSpace(nameData &nd); diff --git a/Post/PViewDataGModel.h b/Post/PViewDataGModel.h index 9cf4cbc8cc9f34fb48712bbc044ab70c74a63d9d..d76e3f4282d42ad1e4c265d2dfc69253e0199439 100644 --- a/Post/PViewDataGModel.h +++ b/Post/PViewDataGModel.h @@ -117,7 +117,7 @@ class stepData{ } }; -// data container using elements from a GModel +// The data container using elements from a GModel. class PViewDataGModel : public PViewData { public: enum DataType { diff --git a/Post/PViewDataList.h b/Post/PViewDataList.h index 25973330d236f8e36118fae99fa44af95049bb6c..f31205a8d2262cef522f65d2f2e4e9b392577824 100644 --- a/Post/PViewDataList.h +++ b/Post/PViewDataList.h @@ -26,7 +26,8 @@ #include "SBoundingBox3d.h" #include "ListUtils.h" -// list-based datasets (all elements are discontinuous) +// The container for list-based datasets (for which all elements are +// discontinuous). class PViewDataList : public PViewData { public: // FIXME: all these members will be made private once the plugins diff --git a/Post/PViewOptions.h b/Post/PViewOptions.h index 8e111aedb2e72cf66b5ba9df63dfa64149a77460..d0655c5bdd53c417ab3dbf8bbff071b1425e6a2d 100644 --- a/Post/PViewOptions.h +++ b/Post/PViewOptions.h @@ -24,6 +24,7 @@ #include "ColorTable.h" #include "SBoundingBox3d.h" +// The display options of a post-processing view. class PViewOptions { public: enum PlotType {