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

progress on new post-pro

parent ae8754f8
No related branches found
No related tags found
No related merge requests found
...@@ -31,13 +31,18 @@ ...@@ -31,13 +31,18 @@
// abstract interface to post-processing view data // abstract interface to post-processing view data
class PViewData { class PViewData {
private:
// flag to mark that the data is 'dirty' and should not be displayed
bool _dirty;
public: public:
PViewData(){} PViewData() : _dirty(true) {}
virtual ~PViewData(){} virtual ~PViewData(){}
virtual bool getDirty(){ return _dirty; }
virtual void setDirty(bool val){ _dirty = val; }
virtual void finalize(){} virtual void finalize(){}
virtual int getNumTimeSteps() = 0; virtual int getNumTimeSteps() = 0;
virtual int getMin(int step=-1) = 0; virtual double getMin(int step=-1) = 0;
virtual int getMax(int step=-1) = 0; virtual double getMax(int step=-1) = 0;
virtual SBoundingBox3d getBoundingBox() = 0; virtual SBoundingBox3d getBoundingBox() = 0;
virtual int getNumPoints(){ return 0; } virtual int getNumPoints(){ return 0; }
virtual int getNumLines(){ return 0; } virtual int getNumLines(){ return 0; }
...@@ -53,7 +58,7 @@ class PViewData { ...@@ -53,7 +58,7 @@ class PViewData {
virtual int getNumNodes(int ele) = 0; virtual int getNumNodes(int ele) = 0;
virtual void getNode(int ele, int nod, double &x, double &y, double &z) = 0; virtual void getNode(int ele, int nod, double &x, double &y, double &z) = 0;
virtual int getNumComponents(int ele) = 0; virtual int getNumComponents(int ele) = 0;
virtual void getValue(int ele, int node, int step, int comp, double &val) = 0; virtual void getValue(int ele, int node, int comp, int step, double &val) = 0;
virtual bool read(std::string filename){} virtual bool read(std::string filename){}
}; };
...@@ -101,8 +106,8 @@ class PViewDataList : public PViewData { ...@@ -101,8 +106,8 @@ class PViewDataList : public PViewData {
~PViewDataList(); ~PViewDataList();
void finalize(); void finalize();
int getNumTimeSteps(){ return NbTimeStep; } int getNumTimeSteps(){ return NbTimeStep; }
int getMin(int step=-1){ return Min; } double getMin(int step=-1);
int getMax(int step=-1){ return Max; } double getMax(int step=-1);
SBoundingBox3d getBoundingBox(){ return BBox; } SBoundingBox3d getBoundingBox(){ return BBox; }
int getNumPoints(){ return NbSP + NbVP + NbTP; } int getNumPoints(){ return NbSP + NbVP + NbTP; }
int getNumLines(){ return NbSL + NbVL + NbTL; } int getNumLines(){ return NbSL + NbVL + NbTL; }
...@@ -122,7 +127,7 @@ class PViewDataList : public PViewData { ...@@ -122,7 +127,7 @@ class PViewDataList : public PViewData {
int getNumNodes(int ele); int getNumNodes(int ele);
void getNode(int ele, int nod, double &x, double &y, double &z); void getNode(int ele, int nod, double &x, double &y, double &z);
int getNumComponents(int ele); int getNumComponents(int ele);
void getValue(int ele, int node, int step, int comp, double &val); void getValue(int ele, int node, int comp, int step, double &val);
bool read(std::string filename); bool read(std::string filename);
}; };
...@@ -135,15 +140,15 @@ class PViewDataGModel : public PViewData { ...@@ -135,15 +140,15 @@ class PViewDataGModel : public PViewData {
PViewDataGModel(){} PViewDataGModel(){}
~PViewDataGModel(){} ~PViewDataGModel(){}
int getNumTimeSteps(){ return 1; } int getNumTimeSteps(){ return 1; }
int getMin(int step=-1){ return 0.; } double getMin(int step=-1){ return 0.; }
int getMax(int step=-1){ return 1.; } double getMax(int step=-1){ return 1.; }
SBoundingBox3d getBoundingBox(){ return SBoundingBox3d(); } SBoundingBox3d getBoundingBox(){ return SBoundingBox3d(); }
int getNumElements(){ return _model->numElements(); } int getNumElements(){ return _model->numElements(); }
int getDimension(int ele){ return 0; } int getDimension(int ele){ return 0; }
int getNumNodes(int ele){ return 0; } int getNumNodes(int ele){ return 0; }
void getNode(int ele, int nod, double &x, double &y, double &z){} void getNode(int ele, int nod, double &x, double &y, double &z){}
int getNumComponents(int ele){ return 1; } int getNumComponents(int ele){ return 1; }
void getValue(int ele, int node, int step, int comp, double &val){} void getValue(int ele, int node, int comp, int step, double &val){}
}; };
#endif #endif
// $Id: PViewOptions.cpp,v 1.1 2007-08-21 19:05:43 geuzaine Exp $ // $Id: PViewOptions.cpp,v 1.2 2007-08-24 20:14:19 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -72,5 +72,28 @@ PViewOptions::PViewOptions() ...@@ -72,5 +72,28 @@ PViewOptions::PViewOptions()
UseGenRaise = 0; UseGenRaise = 0;
GenRaiseFactor = 0.; GenRaiseFactor = 0.;
GmshColorTable CT; ColorTable_InitParam(2, &CT);
ColorTable_Recompute(&CT);
}
// val in [min, max]
unsigned int PViewOptions::getColor(double val, double min, double max)
{
//int index = v->GIFV(min, max, v->CT.size, val);
if(CT.size == 1) return CT.table[0];
int index = (min == max) ? CT.size / 2 :
(int)((val - min) * (CT.size - 1) / (max - min));
return CT.table[index];
}
// i in [0, nb - 1]
unsigned int PViewOptions::getColor(int i, int nb)
{
int index = (nb == 1) ? CT.size / 2 :
(int)(i / (double)(nb - 1) * (CT.size - 1) + 0.5);
return CT.table[index];
} }
...@@ -63,7 +63,7 @@ class PViewOptions { ...@@ -63,7 +63,7 @@ class PViewOptions {
enum RangeType { enum RangeType {
Default, Default,
Custom, Custom,
PerStep PerTimeStep
}; };
enum ScaleType { enum ScaleType {
Linear, Linear,
...@@ -77,7 +77,7 @@ class PViewOptions { ...@@ -77,7 +77,7 @@ class PViewOptions {
int Axes, AxesAutoPosition, AxesTics[3]; int Axes, AxesAutoPosition, AxesTics[3];
char AxesFormat[3][256], AxesLabel[3][256]; char AxesFormat[3][256], AxesLabel[3][256];
double AxesPosition[6]; double AxesPosition[6];
double CustomMin, CustomMax; double CustomMin, CustomMax, TmpMin, TmpMax;
double Offset[3], Raise[3], Transform[3][3], DisplacementFactor, Explode; double Offset[3], Raise[3], Transform[3][3], DisplacementFactor, Explode;
double ArrowSize, ArrowRelHeadRadius, ArrowRelStemRadius, ArrowRelStemLength; double ArrowSize, ArrowRelHeadRadius, ArrowRelStemRadius, ArrowRelStemLength;
double Normals, Tangents; double Normals, Tangents;
...@@ -113,6 +113,8 @@ class PViewOptions { ...@@ -113,6 +113,8 @@ class PViewOptions {
// static reference container that contains default values // static reference container that contains default values
static PViewOptions reference; static PViewOptions reference;
PViewOptions(); PViewOptions();
unsigned int getColor(int i, int nb);
unsigned int getColor(double val, double min, double max);
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment