4
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
6
// This program is free software; you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation; either version 2 of the License, or
9
// (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21
// Please report all bugs and problems to <gmsh@geuz.org>.
25
#include "SBoundingBox3d.h"
27
#define VAL_INF 1.e200
32
// abstract interface to post-processing view data
35
// flag to mark that the data is 'dirty' and should not be displayed
39
// name of the file the data was loaded from
40
std::string _fileName;
41
// index of the view in the file
45
virtual ~PViewData(){}
46
virtual bool getDirty(){ return _dirty; }
47
virtual void setDirty(bool val){ _dirty = val; }
48
virtual bool finalize(){ _dirty = false; return true; }
49
virtual std::string getName(){ return _name; }
50
virtual void setName(std::string val){ _name = val; }
51
virtual std::string getFileName(){ return _fileName; }
52
virtual void setFileName(std::string val){ _fileName = val; }
53
virtual int getFileIndex(){ return _fileIndex; }
54
virtual void setFileIndex(int val){ _fileIndex = val; }
55
virtual int getNumTimeSteps() = 0;
56
virtual double getTime(int step){ return 0.; }
57
virtual double getMin(int step=-1) = 0;
58
virtual double getMax(int step=-1) = 0;
59
virtual SBoundingBox3d getBoundingBox(int step=-1) = 0;
60
virtual int getNumScalars(int step=-1){ return 0; }
61
virtual int getNumVectors(int step=-1){ return 0; }
62
virtual int getNumTensors(int step=-1){ return 0; }
63
virtual int getNumPoints(int step=-1){ return 0; }
64
virtual int getNumLines(int step=-1){ return 0; }
65
virtual int getNumTriangles(int step=-1){ return 0; }
66
virtual int getNumQuadrangles(int step=-1){ return 0; }
67
virtual int getNumTetrahedra(int step=-1){ return 0; }
68
virtual int getNumHexahedra(int step=-1){ return 0; }
69
virtual int getNumPrisms(int step=-1){ return 0; }
70
virtual int getNumPyramids(int step=-1){ return 0; }
71
// Returns the number of geometrical entities in the view
72
virtual int getNumEntities(int step=-1) = 0;
73
// Returns the number of elements in the ent-th entity, or the total
74
// number of elements if ent < 0
75
virtual int getNumElements(int step=-1, int ent=-1) = 0;
76
// Returns the geometrical dimension of the ele-th element in the
78
virtual int getDimension(int step, int ent, int ele) = 0;
79
// Returns the number of nodes of the ele-th element in the ent-th
81
virtual int getNumNodes(int step, int ent, int ele) = 0;
82
// Gets/Sets the coordinates and tag of the nod-th node from the
83
// ele-th element in the ent-th entity (if the node has a tag,
84
// getNode returns it)
85
virtual int getNode(int step, int ent, int ele, int nod,
86
double &x, double &y, double &z) = 0;
87
virtual void setNode(int step, int ent, int ele, int nod,
88
double x, double y, double z);
89
virtual void tagNode(int step, int ent, int ele, int nod, int tag){}
90
// Returns the number of componts available for the ele-th element
91
// in the ent-th entity
92
virtual int getNumComponents(int step, int ent, int ele) = 0;
93
// Gets/sets the comp-th component (at the step-th time step)
94
// associated with the node-th node from the ele-th element in the
96
virtual void getValue(int step, int ent, int ele, int nod, int comp, double &val) = 0;
97
virtual void setValue(int step, int ent, int ele, int nod, int comp, double val);
98
// Returns a scalar value (same as value for scalars, norm for
99
// vectors, etc.) associated with the node-th node from the ele-th
100
// element in the ent-th entity
101
virtual void getScalarValue(int step, int ent, int ele, int nod, double &val);
102
// Returns the number of edges of the ele-th element in the ent-th
104
virtual int getNumEdges(int step, int ent, int ele) = 0;
105
virtual int getNumStrings2D(){ return 0; }
106
virtual int getNumStrings3D(){ return 0; }
107
virtual void getString2D(int i, int step, std::string &str,
108
double &x, double &y, double &style){}
109
virtual void getString3D(int i, int step, std::string &str,
110
double &x, double &y, double &z, double &style){}
111
virtual void revertElement(int step, int ent, int ele){}
112
virtual bool empty();
113
virtual void smooth(){}
114
virtual bool combineTime(nameData &nd){ return false; }
115
virtual bool combineSpace(nameData &nd){ return false; }
116
virtual bool isAdaptive(){ return false; }
117
virtual bool skipEntity(int step, int ent){ return false; }
118
virtual bool skipElement(int step, int ent, int ele,
119
bool checkVisibility=false){ return false; }
120
virtual bool hasTimeStep(int step){ return step < getNumTimeSteps(); }
121
virtual bool hasPartition(int part){ return false; }
122
virtual bool hasMultipleMeshes(){ return false; }
123
virtual bool hasModel(GModel *model, int step=-1){ return false; }
124
virtual bool useGaussPoints(){ return false; }
127
virtual bool writeSTL(std::string fileName);
128
virtual bool writeTXT(std::string fileName);
129
virtual bool writePOS(std::string fileName, bool binary=false, bool parsed=true,
131
virtual bool writeMSH(std::string fileName, bool binary=false);
132
virtual bool writeMED(std::string fileName);
138
std::vector<int> indices;
139
std::vector<PViewData*> data;