26
26
std::vector<MFace> _faces;
29
MPolyhedron(std::vector<MVertex*> v, int num=0, int part=0)
30
: MElement(num, part), _owner(false), _orig(0)
29
MPolyhedron(std::vector<MVertex*> v, int num = 0, int part = 0,
30
bool owner = false, MElement* orig = NULL)
31
: MElement(num, part), _owner(owner), _orig(orig)
33
34
Msg::Error("Got %d vertices for polyhedron", (int)v.size());
37
38
_parts.push_back(new MTetrahedron(v[i], v[i + 1], v[i + 2], v[i + 3]));
40
MPolyhedron(std::vector<MTetrahedron*> vT, int num=0, int part=0)
41
: MElement(num, part), _owner(false), _orig(0)
43
for(unsigned int i = 0; i < vT.size(); i++)
44
_parts.push_back(vT[i]);
47
MPolyhedron(std::vector<MTetrahedron*> vT, MElement* orig, bool owner, int num=0, int part=0)
41
MPolyhedron(std::vector<MTetrahedron*> vT, int num = 0, int part = 0,
42
bool owner = false, MElement* orig = NULL)
48
43
: MElement(num, part), _owner(owner), _orig(orig)
50
45
for(unsigned int i = 0; i < vT.size(); i++)
110
105
virtual int getVolumeSign() { return (getVolume() >= 0) ? 1 : -1; }
111
virtual const gmshFunctionSpace* getFunctionSpace(int order=-1) const
106
virtual const functionSpace* getFunctionSpace(int order=-1) const
113
108
return _orig->getFunctionSpace(order);
131
126
return _parts.size() * getNGQTetPts(pOrder);
133
128
virtual void writeMSH(FILE *fp, double version=1.0, bool binary=false,
134
int num=0, int elementary=1, int physical=1);
129
int num=0, int elementary=1, int physical=1, int parentNum=0);
135
130
virtual MElement *getParent() const { return _orig; }
131
virtual void setParent(MElement *p) { _orig = p; }
136
132
virtual int getNumChildren() const { return _parts.size(); }
137
133
virtual MElement *getChild(int i) const { return _parts[i]; }
134
virtual bool ownsParent() const { return _owner; }
140
137
class MPolygon : public MElement {
147
144
std::vector<MEdge> _edges;
148
145
void _initVertices();
150
MPolygon(std::vector<MVertex*> v, int num=0, int part=0)
151
: MElement(num, part), _owner(false), _orig(0)
147
MPolygon(std::vector<MVertex*> v, int num = 0, int part = 0,
148
bool owner = false, MElement* orig = NULL)
149
: MElement(num, part), _owner(owner), _orig(orig)
153
151
for(unsigned int i = 0; i < v.size() / 3; i++)
154
152
_parts.push_back(new MTriangle(v[i * 3], v[i * 3 + 1], v[i * 3 + 2]));
157
MPolygon(std::vector<MElement*> vT, int num=0, int part=0)
158
: MElement(num, part), _owner(false), _orig(0)
155
MPolygon(std::vector<MTriangle*> vT, int num = 0, int part = 0,
156
bool owner = false, MElement* orig = NULL)
157
: MElement(num, part), _owner(owner), _orig(orig)
160
159
for(unsigned int i = 0; i < vT.size(); i++){
161
160
MTriangle *t = (MTriangle*) vT[i];
166
MPolygon(std::vector<MTriangle*> vT, int num=0, int part=0)
167
: MElement(num, part), _owner(false), _orig(0)
169
for(unsigned int i = 0; i < vT.size(); i++)
170
_parts.push_back(vT[i]);
173
MPolygon(std::vector<MTriangle*> vT, MElement* orig, bool owner, int num=0, int part=0)
174
: MElement(num, part), _owner(owner), _orig(orig)
176
for(unsigned int i = 0; i < vT.size(); i++)
177
_parts.push_back(vT[i]);
223
208
virtual int getType() const { return TYPE_POLYG; }
224
209
virtual int getTypeForMSH() const { return MSH_POLYG_; }
225
virtual const gmshFunctionSpace* getFunctionSpace(int order=-1) const
210
virtual const functionSpace* getFunctionSpace(int order=-1) const
227
212
return _orig->getFunctionSpace(order);
245
230
return _parts.size() * getNGQTPts(pOrder);
247
232
virtual void writeMSH(FILE *fp, double version=1.0, bool binary=false,
248
int num=0, int elementary=1, int physical=1);
233
int num=0, int elementary=1, int physical=1, int parentNum=0);
249
234
virtual MElement *getParent() const { return _orig; }
235
virtual void setParent(MElement *p) { _orig = p; }
250
236
virtual int getNumChildren() const { return _parts.size(); }
251
237
virtual MElement *getChild(int i) const { return _parts[i]; }
238
virtual bool ownsParent() const { return _owner; }
254
241
class MTriangleBorder : public MTriangle {
264
251
~MTriangleBorder() {}
265
252
MPolyhedron* getDomain(int i) const { return _domains[i]; }
266
virtual MElement *getParent() const { return _domains[0]->getParent(); }
267
virtual const gmshFunctionSpace* getFunctionSpace(int order=-1) const
253
virtual MElement *getParent() const {
254
if(_domains[0]) return _domains[0]->getParent();
255
if(_domains[1]) return _domains[1]->getParent();
258
virtual const functionSpace* getFunctionSpace(int order=-1) const
269
260
return getParent()->getFunctionSpace(order);
300
291
~MLineBorder() {}
301
292
MPolygon* getDomain(int i) const { return _domains[i]; }
302
virtual MElement *getParent() const { return _domains[0]->getParent(); }
303
virtual const gmshFunctionSpace* getFunctionSpace(int order=-1) const
293
virtual MElement *getParent() const {
294
if(_domains[0]) return _domains[0]->getParent();
295
if(_domains[1]) return _domains[1]->getParent();
298
virtual const functionSpace* getFunctionSpace(int order=-1) const
305
300
return getParent()->getFunctionSpace(order);