Skip to content
Snippets Groups Projects
Commit 8cd4bf8a authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

doc

parent a28587b4
Branches
Tags
No related merge requests found
...@@ -30,7 +30,7 @@ class VertexArray; ...@@ -30,7 +30,7 @@ class VertexArray;
class smooth_normals; class smooth_normals;
class GMSH_Post_Plugin; class GMSH_Post_Plugin;
// a post-processing view // A post-processing view.
class PView{ class PView{
private: private:
static int _globalNum; static int _globalNum;
...@@ -50,29 +50,46 @@ class PView{ ...@@ -50,29 +50,46 @@ class PView{
PViewData *_data; PViewData *_data;
// initialize private stuff // initialize private stuff
void _init(); void _init();
public: 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); PView(bool allocate=true);
// constructs a new view using the given data // construct a new view using the given data
PView(PViewData *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); 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, PView(std::string xname, std::string yname,
std::vector<double> &x, std::vector<double> &y); std::vector<double> &x, std::vector<double> &y);
// default destructor // default destructor
~PView(); ~PView();
// delete the vertex arrays, used to draw the view efficiently
void deleteVertexArrays(); void deleteVertexArrays();
// get/set the display options
PViewOptions *getOptions(){ return _options; } PViewOptions *getOptions(){ return _options; }
void setOptions(PViewOptions *val=0); void setOptions(PViewOptions *val=0);
// get/set the view data
PViewData *getData(bool useAdaptiveIfAvailable=false); PViewData *getData(bool useAdaptiveIfAvailable=false);
void setData(PViewData *val){ _data = val; } void setData(PViewData *val){ _data = val; }
// get the view number (unique and immutable)
int getNum(){ return _num; } int getNum(){ return _num; }
// get/set the view index (in the view list)
int getIndex(){ return _index; } int getIndex(){ return _index; }
void setIndex(int val){ _index = val; } void setIndex(int val){ _index = val; }
// get/set the changed flag
bool &getChanged(){ return _changed; } bool &getChanged(){ return _changed; }
void setChanged(bool val); void setChanged(bool val);
// check if the view is an alias ("light copy") of another view
int getAliasOf(){ return _aliasOf; } int getAliasOf(){ return _aliasOf; }
// get/set the eye position (for transparency calculations)
SPoint3 &getEye(){ return _eye; } SPoint3 &getEye(){ return _eye; }
void setEye(SPoint3 &p){ _eye = p; } void setEye(SPoint3 &p){ _eye = p; }
...@@ -88,14 +105,13 @@ class PView{ ...@@ -88,14 +105,13 @@ class PView{
static PView *getViewByName(std::string name, int timeStep=-1, static PView *getViewByName(std::string name, int timeStep=-1,
int partition=-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); static bool readPOS(std::string fileName, int fileIndex=-1);
// read view(s) from MSH file
static bool readMSH(std::string fileName, int fileIndex=-1); static bool readMSH(std::string fileName, int fileIndex=-1);
// read view(s) from MED file
static bool readMED(std::string fileName, int fileIndex=-1); 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); bool write(std::string fileName, int format, bool append=false);
// vertex arrays to draw the elements efficiently // vertex arrays to draw the elements efficiently
......
...@@ -32,7 +32,7 @@ class adaptiveData; ...@@ -32,7 +32,7 @@ class adaptiveData;
class GModel; class GModel;
class nameData; class nameData;
// abstract interface to post-processing view data // The abstract interface to post-processing view data.
class PViewData { class PViewData {
private: private:
// flag to mark that the data is 'dirty' and should not be displayed // flag to mark that the data is 'dirty' and should not be displayed
...@@ -43,29 +43,51 @@ class PViewData { ...@@ -43,29 +43,51 @@ class PViewData {
std::string _fileName; std::string _fileName;
// index of the view in the file // index of the view in the file
int _fileIndex; int _fileIndex;
protected: protected:
// adaptive visualization data // adaptive visualization data
adaptiveData *_adaptive; adaptiveData *_adaptive;
// interpolation matrices, indexed by the number of edges per // interpolation matrices, indexed by the number of edges per
// element (1 for lines, 3 for triangles, etc.) // element (1 for lines, 3 for triangles, etc.)
std::map<int, std::vector<List_T*> > _interpolation; std::map<int, std::vector<List_T*> > _interpolation;
public: public:
PViewData(); PViewData();
virtual ~PViewData(); virtual ~PViewData();
// get/set the dirty ("not ready for display") flag
virtual bool getDirty(){ return _dirty; } virtual bool getDirty(){ return _dirty; }
virtual void setDirty(bool val){ _dirty = val; } virtual void setDirty(bool val){ _dirty = val; }
// finalize the view data (compute min/max, etc.)
virtual bool finalize(); virtual bool finalize();
// get/set name
virtual std::string getName(){ return _name; } virtual std::string getName(){ return _name; }
virtual void setName(std::string val){ _name = val; } virtual void setName(std::string val){ _name = val; }
// get/set filename
virtual std::string getFileName(){ return _fileName; } virtual std::string getFileName(){ return _fileName; }
virtual void setFileName(std::string val){ _fileName = val; } virtual void setFileName(std::string val){ _fileName = val; }
// get/set index of view data in file
virtual int getFileIndex(){ return _fileIndex; } virtual int getFileIndex(){ return _fileIndex; }
virtual void setFileIndex(int val){ _fileIndex = val; } virtual void setFileIndex(int val){ _fileIndex = val; }
// get number of time steps in the data
virtual int getNumTimeSteps() = 0; virtual int getNumTimeSteps() = 0;
// get the time value associated with the step-th time step
virtual double getTime(int step){ return 0.; } 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 getMin(int step=-1) = 0;
virtual double getMax(int step=-1) = 0; virtual double getMax(int step=-1) = 0;
// get the bounding box
virtual SBoundingBox3d getBoundingBox(int step=-1) = 0; 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 getNumScalars(int step=-1){ return 0; }
virtual int getNumVectors(int step=-1){ return 0; } virtual int getNumVectors(int step=-1){ return 0; }
virtual int getNumTensors(int step=-1){ return 0; } virtual int getNumTensors(int step=-1){ return 0; }
...@@ -77,18 +99,23 @@ class PViewData { ...@@ -77,18 +99,23 @@ class PViewData {
virtual int getNumHexahedra(int step=-1){ return 0; } virtual int getNumHexahedra(int step=-1){ return 0; }
virtual int getNumPrisms(int step=-1){ return 0; } virtual int getNumPrisms(int step=-1){ return 0; }
virtual int getNumPyramids(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; 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 // number of elements if ent < 0
virtual int getNumElements(int step=-1, int ent=-1) = 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 // ent-th entity
virtual int getDimension(int step, int ent, int ele) = 0; 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 // entity
virtual int getNumNodes(int step, int ent, int ele) = 0; 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, // ele-th element in the ent-th entity (if the node has a tag,
// getNode returns it) // getNode returns it)
virtual int getNode(int step, int ent, int ele, int nod, virtual int getNode(int step, int ent, int ele, int nod,
...@@ -96,52 +123,66 @@ class PViewData { ...@@ -96,52 +123,66 @@ class PViewData {
virtual void setNode(int step, int ent, int ele, int nod, virtual void setNode(int step, int ent, int ele, int nod,
double x, double y, double z); double x, double y, double z);
virtual void tagNode(int step, int ent, int ele, int nod, int tag){} 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; 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; 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; 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 // associated with the node-th node from the ele-th element in the
// ent-th entity // ent-th entity
virtual void getValue(int step, int ent, int ele, int nod, int comp, 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); 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 // vectors, etc.) associated with the node-th node from the ele-th
// element in the ent-th entity // element in the ent-th entity
void getScalarValue(int step, int ent, int ele, int nod, double &val); 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 // entity
virtual int getNumEdges(int step, int ent, int ele) = 0; 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 getNumStrings2D(){ return 0; }
virtual int getNumStrings3D(){ 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, virtual void getString2D(int i, int step, std::string &str,
double &x, double &y, double &style){} double &x, double &y, double &style){}
virtual void getString3D(int i, int step, std::string &str, virtual void getString3D(int i, int step, std::string &str,
double &x, double &y, double &z, double &style){} 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){} virtual void revertElement(int step, int ent, int ele){}
// Cheks if the view is empty
// check if the view is empty
virtual bool 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; } 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, virtual bool skipElement(int step, int ent, int ele,
bool checkVisibility=false){ return false; } 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 hasTimeStep(int step){ return step < getNumTimeSteps(); }
virtual bool hasPartition(int part){ return false; } virtual bool hasPartition(int part){ return false; }
virtual bool hasMultipleMeshes(){ return false; } virtual bool hasMultipleMeshes(){ return false; }
virtual bool hasModel(GModel *model, int step=-1){ 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; } virtual bool useGaussPoints(){ return false; }
// check if the view is adaptive // check if the view is adaptive
bool isAdaptive(){ return _adaptive ? true : false; } bool isAdaptive(){ return _adaptive ? true : false; }
// return the adaptive data // return the adaptive data
adaptiveData *getAdaptiveData(){ return _adaptive; } adaptiveData *getAdaptiveData(){ return _adaptive; }
...@@ -149,13 +190,13 @@ class PViewData { ...@@ -149,13 +190,13 @@ class PViewData {
// number of edges // number of edges
void setInterpolationScheme(int type, List_T *coef, List_T *pol, void setInterpolationScheme(int type, List_T *coef, List_T *pol,
List_T *coefGeo=0, List_T *polGeo=0); List_T *coefGeo=0, List_T *polGeo=0);
inline bool haveInterpolationScheme(){ return !_interpolation.empty(); }
int getInterpolationScheme(int type, std::vector<List_T*> &p); 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(); 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 combineTime(nameData &nd);
virtual bool combineSpace(nameData &nd); virtual bool combineSpace(nameData &nd);
......
...@@ -117,7 +117,7 @@ class stepData{ ...@@ -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 { class PViewDataGModel : public PViewData {
public: public:
enum DataType { enum DataType {
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
#include "SBoundingBox3d.h" #include "SBoundingBox3d.h"
#include "ListUtils.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 { class PViewDataList : public PViewData {
public: public:
// FIXME: all these members will be made private once the plugins // FIXME: all these members will be made private once the plugins
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "ColorTable.h" #include "ColorTable.h"
#include "SBoundingBox3d.h" #include "SBoundingBox3d.h"
// The display options of a post-processing view.
class PViewOptions { class PViewOptions {
public: public:
enum PlotType { enum PlotType {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment