gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
MElementCut.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 //
6 // Contributor(s):
7 // Gaetan Bricteux
8 
9 #ifndef MELEMENTCUT_H
10 #define MELEMENTCUT_H
11 
12 #include "GmshMessage.h"
13 #include "MElement.h"
14 #include "MTetrahedron.h"
15 #include "MTriangle.h"
16 #include "MLine.h"
17 
18 class gLevelset;
19 class GModel;
20 
21 class MPolyhedron : public MElement {
22 protected:
23  bool _owner;
26  std::vector<MTetrahedron *> _parts;
27  std::vector<MVertex *> _vertices;
28  std::vector<MVertex *> _innerVertices;
29  std::vector<MEdge> _edges;
30  std::vector<MFace> _faces;
31  void _init();
32 
33 public:
34  MPolyhedron(std::vector<MVertex *> v, int num = 0, int part = 0,
35  bool owner = false, MElement *orig = nullptr)
36  : MElement(num, part), _owner(owner), _orig(orig), _intpt(nullptr)
37  {
38  if(v.size() % 4) {
39  Msg::Error("Got %d nodes for polyhedron", (int)v.size());
40  return;
41  }
42  for(std::size_t i = 0; i < v.size(); i += 4)
43  _parts.push_back(new MTetrahedron(v[i], v[i + 1], v[i + 2], v[i + 3]));
44  _init();
45  }
46  MPolyhedron(std::vector<MTetrahedron *> vT, int num = 0, int part = 0,
47  bool owner = false, MElement *orig = nullptr)
48  : MElement(num, part), _owner(owner), _orig(orig), _intpt(nullptr)
49  {
50  for(std::size_t i = 0; i < vT.size(); i++) _parts.push_back(vT[i]);
51  _init();
52  }
54  {
55  if(_owner) delete _orig;
56  for(std::size_t i = 0; i < _parts.size(); i++) delete _parts[i];
57  if(_intpt) delete[] _intpt;
58  }
59  virtual int getDim() const { return 3; }
60  virtual std::size_t getNumVertices() const
61  {
62  return _vertices.size() + _innerVertices.size();
63  }
64  virtual int getNumVolumeVertices() const { return _innerVertices.size(); }
65  virtual MVertex *getVertex(int num)
66  {
67  return (num < (int)_vertices.size()) ?
68  _vertices[num] :
69  _innerVertices[num - _vertices.size()];
70  }
71  virtual const MVertex *getVertex(int num) const
72  {
73  return (num < (int)_vertices.size()) ?
74  _vertices[num] :
75  _innerVertices[num - _vertices.size()];
76  }
77  virtual int getNumEdges() const { return _edges.size(); }
78  virtual MEdge getEdge(int num) const { return _edges[num]; }
79  virtual int getNumEdgesRep(bool curved) { return _edges.size(); }
80  virtual void getEdgeRep(bool curved, int num, double *x, double *y, double *z,
81  SVector3 *n)
82  {
83  MEdge e(getEdge(num));
84  for(std::size_t i = 0; i < _faces.size(); i++)
85  for(int j = 0; j < 3; j++)
86  if(_faces[i].getEdge(j) == e)
87  _getEdgeRep(e.getVertex(0), e.getVertex(1), x, y, z, n, i);
88  }
89  virtual void getEdgeVertices(const int num, std::vector<MVertex *> &v) const
90  {
91  v.resize(2);
92  v[0] = _edges[num].getVertex(0);
93  v[1] = _edges[num].getVertex(1);
94  }
95  virtual int getNumFaces() { return _faces.size(); }
96  virtual MFace getFace(int num) const { return _faces[num]; }
97  virtual int getNumFacesRep(bool curved) { return _faces.size(); }
98  virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z,
99  SVector3 *n)
100  {
101  _getFaceRep(_faces[num].getVertex(0), _faces[num].getVertex(1),
102  _faces[num].getVertex(2), x, y, z, n);
103  }
104  virtual void getFaceVertices(const int num, std::vector<MVertex *> &v) const
105  {
106  v.resize(3);
107  v[0] = _faces[num].getVertex(0);
108  v[1] = _faces[num].getVertex(1);
109  v[2] = _faces[num].getVertex(2);
110  }
111  virtual int getType() const { return TYPE_POLYH; }
112  virtual int getTypeForMSH() const { return MSH_POLYH_; }
113  virtual void reverse()
114  {
115  for(std::size_t i = 0; i < _parts.size(); i++) _parts[i]->reverse();
116  _vertices.clear();
117  _innerVertices.clear();
118  _edges.clear();
119  _faces.clear();
120  _init();
121  }
122  virtual double getVolume()
123  {
124  double vol = 0;
125  for(std::size_t i = 0; i < _parts.size(); i++)
126  vol += _parts[i]->getVolume();
127  return vol;
128  }
129  virtual const nodalBasis *getFunctionSpace(int order = -1,
130  bool serendip = false) const
131  {
132  return (_orig ? _orig->getFunctionSpace(order, serendip) : nullptr);
133  }
134  virtual const JacobianBasis *getJacobianFuncSpace(int order = -1) const
135  {
136  return (_orig ? _orig->getJacobianFuncSpace(order) : nullptr);
137  }
138  virtual void getShapeFunctions(double u, double v, double w, double s[],
139  int o) const
140  {
141  if(_orig) _orig->getShapeFunctions(u, v, w, s, o);
142  }
143  virtual void getGradShapeFunctions(double u, double v, double w,
144  double s[][3], int o) const
145  {
146  if(_orig) _orig->getGradShapeFunctions(u, v, w, s, o);
147  }
148  virtual void getHessShapeFunctions(double u, double v, double w,
149  double s[][3][3], int o) const
150  {
151  if(_orig) _orig->getHessShapeFunctions(u, v, w, s, o);
152  }
153  virtual std::size_t getNumShapeFunctions() const
154  {
155  return (_orig ? _orig->getNumShapeFunctions() : 0);
156  }
157  virtual std::size_t getNumPrimaryShapeFunctions() const
158  {
159  return (_orig ? _orig->getNumPrimaryShapeFunctions() : 0);
160  }
161  virtual const MVertex *getShapeFunctionNode(int i) const
162  {
163  return (_orig ? _orig->getShapeFunctionNode(i) : nullptr);
164  }
166  {
167  return (_orig ? _orig->getShapeFunctionNode(i) : nullptr);
168  }
169 
170  // the parametric coordinates of the polyhedron are
171  // the coordinates in the local parent element.
172  virtual bool isInside(double u, double v, double w) const;
173  virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
174  virtual MElement *getParent() const { return _orig; }
175  virtual void setParent(MElement *p, bool owner = false)
176  {
177  _orig = p;
178  _owner = owner;
179  }
180  virtual int getNumChildren() const { return _parts.size(); }
181  virtual MElement *getChild(int i) const { return _parts[i]; }
182  virtual bool ownsParent() const { return _owner; }
183  virtual std::size_t getNumVerticesForMSH() { return _parts.size() * 4; }
184  virtual void getVerticesIdForMSH(std::vector<int> &verts)
185  {
186  std::size_t n = getNumVerticesForMSH();
187  verts.resize(n);
188  for(std::size_t i = 0; i < _parts.size(); i++)
189  for(int j = 0; j < 4; j++)
190  verts[i * 4 + j] = _parts[i]->getVertex(j)->getIndex();
191  }
192  virtual int numCommonNodesInDualGraph(const MElement *const other) const
193  {
194  return 1;
195  }
196 };
197 
198 class MPolygon : public MElement {
199 protected:
200  bool _owner;
203  std::vector<MTriangle *> _parts;
204  std::vector<MVertex *> _vertices;
205  std::vector<MVertex *> _innerVertices;
206  std::vector<MEdge> _edges;
207  void _initVertices();
208 
209 public:
210  MPolygon(std::vector<MVertex *> v, int num = 0, int part = 0,
211  bool owner = false, MElement *orig = nullptr)
212  : MElement(num, part), _owner(owner), _orig(orig), _intpt(nullptr)
213  {
214  for(std::size_t i = 0; i < v.size() / 3; i++)
215  _parts.push_back(new MTriangle(v[i * 3], v[i * 3 + 1], v[i * 3 + 2]));
216  _initVertices();
217  }
218  MPolygon(std::vector<MTriangle *> vT, int num = 0, int part = 0,
219  bool owner = false, MElement *orig = nullptr)
220  : MElement(num, part), _owner(owner), _orig(orig), _intpt(nullptr)
221  {
222  for(std::size_t i = 0; i < vT.size(); i++) {
223  MTriangle *t = (MTriangle *)vT[i];
224  _parts.push_back(t);
225  }
226  _initVertices();
227  }
229  {
230  if(_owner) delete _orig;
231  for(std::size_t i = 0; i < _parts.size(); i++) delete _parts[i];
232  if(_intpt) delete[] _intpt;
233  }
234  virtual int getDim() const { return 2; }
235  virtual std::size_t getNumVertices() const
236  {
237  return _vertices.size() + _innerVertices.size();
238  }
239  virtual int getNumFaceVertices() const { return _innerVertices.size(); }
240  virtual MVertex *getVertex(int num)
241  {
242  return (num < (int)_vertices.size()) ?
243  _vertices[num] :
244  _innerVertices[num - _vertices.size()];
245  }
246  virtual const MVertex *getVertex(int num) const
247  {
248  return (num < (int)_vertices.size()) ?
249  _vertices[num] :
250  _innerVertices[num - _vertices.size()];
251  }
252  virtual int getNumEdges() const { return _edges.size(); }
253  virtual MEdge getEdge(int num) const { return _edges[num]; }
254  virtual int getNumEdgesRep(bool curved) { return getNumEdges(); }
255  virtual void getEdgeRep(bool curved, int num, double *x, double *y, double *z,
256  SVector3 *n)
257  {
258  MEdge e(getEdge(num));
259  _getEdgeRep(e.getVertex(0), e.getVertex(1), x, y, z, n, 0);
260  }
261  virtual void getEdgeVertices(const int num, std::vector<MVertex *> &v) const
262  {
263  v.resize(2);
264  v[0] = _edges[num].getVertex(0);
265  v[1] = _edges[num].getVertex(1);
266  }
267  virtual int getNumFaces() { return 1; }
268  virtual MFace getFace(int num) const { return MFace(_vertices); }
269  virtual int getNumFacesRep(bool curved) { return _parts.size(); }
270  virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z,
271  SVector3 *n)
272  {
273  _getFaceRep(_parts[num]->getVertex(0), _parts[num]->getVertex(1),
274  _parts[num]->getVertex(2), x, y, z, n);
275  }
276  virtual void getFaceVertices(const int num, std::vector<MVertex *> &v) const
277  {
278  v.resize(_vertices.size() + _innerVertices.size());
279  for(std::size_t i = 0; i < _vertices.size() + _innerVertices.size(); i++)
280  v[i] = (i < _vertices.size()) ? _vertices[i] :
281  _innerVertices[i - _vertices.size()];
282  }
283  virtual int getType() const { return TYPE_POLYG; }
284  virtual int getTypeForMSH() const { return MSH_POLYG_; }
285  virtual void reverse()
286  {
287  for(std::size_t i = 0; i < _parts.size(); i++) _parts[i]->reverse();
288  _vertices.clear();
289  _innerVertices.clear();
290  _edges.clear();
291  _initVertices();
292  }
293  virtual MElement *getParent() const { return _orig; }
294  virtual void setParent(MElement *p, bool owner = false)
295  {
296  _orig = p;
297  _owner = owner;
298  }
299  virtual int getNumChildren() const { return _parts.size(); }
300  virtual MElement *getChild(int i) const { return _parts[i]; }
301  virtual bool ownsParent() const { return _owner; }
302  virtual const nodalBasis *getFunctionSpace(int order = -1,
303  bool serendip = false) const
304  {
305  return (_orig ? _orig->getFunctionSpace(order, serendip) : nullptr);
306  }
307  virtual const JacobianBasis *getJacobianFuncSpace(int order = -1) const
308  {
309  return (_orig ? _orig->getJacobianFuncSpace(order) : nullptr);
310  }
311  virtual void getShapeFunctions(double u, double v, double w, double s[],
312  int o) const
313  {
314  if(_orig) _orig->getShapeFunctions(u, v, w, s, o);
315  }
316  virtual void getGradShapeFunctions(double u, double v, double w,
317  double s[][3], int o) const
318  {
319  if(_orig) _orig->getGradShapeFunctions(u, v, w, s, o);
320  }
321  virtual void getHessShapeFunctions(double u, double v, double w,
322  double s[][3][3], int o) const
323  {
324  if(_orig) _orig->getHessShapeFunctions(u, v, w, s, o);
325  }
326  virtual std::size_t getNumShapeFunctions() const
327  {
328  return (_orig ? _orig->getNumShapeFunctions() : 0);
329  }
330  virtual std::size_t getNumPrimaryShapeFunctions() const
331  {
332  return (_orig ? _orig->getNumPrimaryShapeFunctions() : 0);
333  }
334  virtual const MVertex *getShapeFunctionNode(int i) const
335  {
336  return (_orig ? _orig->getShapeFunctionNode(i) : nullptr);
337  }
339  {
340  return (_orig ? _orig->getShapeFunctionNode(i) : nullptr);
341  }
342 
343  // the parametric coordinates of the polygon are
344  // the coordinates in the local parent element.
345  virtual bool isInside(double u, double v, double w) const;
346  virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
347  virtual std::size_t getNumVerticesForMSH() { return _parts.size() * 3; }
348  virtual void getVerticesIdForMSH(std::vector<int> &verts)
349  {
350  std::size_t n = getNumVerticesForMSH();
351  verts.resize(n);
352  for(std::size_t i = 0; i < _parts.size(); i++)
353  for(int j = 0; j < 3; j++)
354  verts[i * 3 + j] = _parts[i]->getVertex(j)->getIndex();
355  }
356  virtual int numCommonNodesInDualGraph(const MElement *const other) const
357  {
358  return 1;
359  }
360 };
361 
362 class MLineChild : public MLine {
363 protected:
364  bool _owner;
367 
368 public:
369  MLineChild(MVertex *v0, MVertex *v1, int num = 0, int part = 0,
370  bool owner = false, MElement *orig = nullptr)
371  : MLine(v0, v1, num, part), _owner(owner), _orig(orig), _intpt(nullptr)
372  {
373  }
374  MLineChild(const std::vector<MVertex *> &v, int num = 0, int part = 0,
375  bool owner = false, MElement *orig = nullptr)
376  : MLine(v, num, part), _owner(owner), _orig(orig), _intpt(nullptr)
377  {
378  }
380  {
381  if(_owner) delete _orig;
382  }
383  virtual int getTypeForMSH() const { return MSH_LIN_C; }
384  virtual const nodalBasis *getFunctionSpace(int order = -1,
385  bool serendip = false) const
386  {
387  if(_orig) return _orig->getFunctionSpace(order, serendip);
388  return nullptr;
389  }
390  virtual const JacobianBasis *getJacobianFuncSpace(int order = -1) const
391  {
392  if(_orig) return _orig->getJacobianFuncSpace(order);
393  return nullptr;
394  }
395  virtual void getShapeFunctions(double u, double v, double w, double s[],
396  int o) const
397  {
398  if(_orig) _orig->getShapeFunctions(u, v, w, s, o);
399  }
400  virtual void getGradShapeFunctions(double u, double v, double w,
401  double s[][3], int o) const
402  {
403  if(_orig) _orig->getGradShapeFunctions(u, v, w, s, o);
404  }
405  virtual void getHessShapeFunctions(double u, double v, double w,
406  double s[][3][3], int o) const
407  {
408  if(_orig) _orig->getHessShapeFunctions(u, v, w, s, o);
409  }
410  // the parametric coordinates of the LineChildren are
411  // the coordinates in the local parent element.
412  virtual bool isInside(double u, double v, double w) const;
413  virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
414  virtual MElement *getParent() const { return _orig; }
415  virtual void setParent(MElement *p, bool owner = false)
416  {
417  _orig = p;
418  _owner = owner;
419  }
420  virtual bool ownsParent() const { return _owner; }
421 };
422 
423 // -------------------- Border classes
424 
425 class MTriangleBorder : public MTriangle {
426 protected:
429 
430 public:
431  MTriangleBorder(MVertex *v0, MVertex *v1, MVertex *v2, int num = 0,
432  int part = 0, MElement *d1 = nullptr, MElement *d2 = nullptr)
433  : MTriangle(v0, v1, v2, num, part), _intpt(nullptr)
434  {
435  _domains[0] = d1;
436  _domains[1] = d2;
437  }
438  MTriangleBorder(const std::vector<MVertex *> &v, int num = 0, int part = 0,
439  MElement *d1 = nullptr, MElement *d2 = nullptr)
440  : MTriangle(v, num, part), _intpt(nullptr)
441  {
442  _domains[0] = d1;
443  _domains[1] = d2;
444  }
446  virtual MElement *getDomain(int i) const { return _domains[i]; }
447  virtual void setDomain(MElement *d, int i) { _domains[i] = d; }
448  virtual MElement *getParent() const
449  {
450  if(_domains[0]) return _domains[0]->getParent();
451  if(_domains[1]) return _domains[1]->getParent();
452  return nullptr;
453  }
454  virtual int getTypeForMSH() const { return MSH_TRI_B; }
455  virtual bool isInside(double u, double v, double w) const;
456  // the integration points of the MTriangleBorder are in the parent element
457  // space
458  virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
459 };
460 
461 class MPolygonBorder : public MPolygon {
462 protected:
465 
466 public:
467  MPolygonBorder(const std::vector<MTriangle *> &v, int num = 0, int part = 0,
468  bool own = false, MElement *p = nullptr,
469  MElement *d1 = nullptr, MElement *d2 = nullptr)
470  : MPolygon(v, num, part, own, p), _intpt(nullptr)
471  {
472  _domains[0] = d1;
473  _domains[1] = d2;
474  }
475  MPolygonBorder(const std::vector<MVertex *> &v, int num = 0, int part = 0,
476  bool own = false, MElement *p = nullptr,
477  MElement *d1 = nullptr, MElement *d2 = nullptr)
478  : MPolygon(v, num, part, own, p), _intpt(nullptr)
479  {
480  _domains[0] = d1;
481  _domains[1] = d2;
482  }
484  virtual MElement *getDomain(int i) const { return _domains[i]; }
485  virtual void setDomain(MElement *d, int i) { _domains[i] = d; }
486  virtual MElement *getParent() const
487  {
488  if(_domains[0]) return _domains[0]->getParent();
489  if(_domains[1]) return _domains[1]->getParent();
490  return nullptr;
491  }
492  virtual int getTypeForMSH() const { return MSH_POLYG_B; }
493 };
494 
495 class MLineBorder : public MLine {
496 protected:
499 
500 public:
501  MLineBorder(MVertex *v0, MVertex *v1, int num = 0, int part = 0,
502  MElement *d1 = nullptr, MElement *d2 = nullptr)
503  : MLine(v0, v1, num, part), _intpt(nullptr)
504  {
505  _domains[0] = d1;
506  _domains[1] = d2;
507  }
508  MLineBorder(const std::vector<MVertex *> &v, int num = 0, int part = 0,
509  MElement *d1 = nullptr, MElement *d2 = nullptr)
510  : MLine(v, num, part), _intpt(nullptr)
511  {
512  _domains[0] = d1;
513  _domains[1] = d2;
514  }
516  virtual MElement *getDomain(int i) const { return _domains[i]; }
517  virtual void setDomain(MElement *d, int i) { _domains[i] = d; }
518  virtual MElement *getParent() const
519  {
520  if(_domains[0]) return _domains[0]->getParent();
521  if(_domains[1]) return _domains[1]->getParent();
522  return nullptr;
523  }
524  virtual int getTypeForMSH() const { return MSH_LIN_B; }
525  virtual bool isInside(double u, double v, double w) const;
526  // the integration points of the MLineBorder are in the parent element space
527  virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts);
528 };
529 
530 // Build a new GModel with elements on each side of the levelset ls.
531 // New physical and elementary entities are created.
532 // The physical and elementary numbers of the elements with ls < 0 are
533 // the physical and elementary number of the elements cut.
534 // The physical and elementary numbers of the elements with ls > 0 are
535 // the maximum physical and elementary numbers existing in their dimension + 1.
536 // The physical and elementary numbers of the elements on the border (ls=0) are
537 // the levelset tag, unless an entity of the same dimension has already this
538 // number, knowing that the elements are cut in ascending dimension order
539 // (points, lines, surfaces and then volumes).
541  std::map<int, std::vector<MElement *> > elements[10],
542  std::map<int, MVertex *> &vertexMap,
543  std::map<int, std::map<int, std::string> > physicals[4],
544  bool cutElem);
545 
546 #endif
MPolygonBorder
Definition: MElementCut.h:461
MTriangleBorder::~MTriangleBorder
~MTriangleBorder()
Definition: MElementCut.h:445
MTriangleBorder
Definition: MElementCut.h:425
MPolygon::getFaceVertices
virtual void getFaceVertices(const int num, std::vector< MVertex * > &v) const
Definition: MElementCut.h:276
MLineBorder::getParent
virtual MElement * getParent() const
Definition: MElementCut.h:518
MTriangleBorder::getTypeForMSH
virtual int getTypeForMSH() const
Definition: MElementCut.h:454
MPolyhedron::numCommonNodesInDualGraph
virtual int numCommonNodesInDualGraph(const MElement *const other) const
Definition: MElementCut.h:192
MTriangle.h
MPolyhedron::getFaceVertices
virtual void getFaceVertices(const int num, std::vector< MVertex * > &v) const
Definition: MElementCut.h:104
MPolygon::getChild
virtual MElement * getChild(int i) const
Definition: MElementCut.h:300
MPolygon::_edges
std::vector< MEdge > _edges
Definition: MElementCut.h:206
MLineChild::_intpt
IntPt * _intpt
Definition: MElementCut.h:366
MEdge
Definition: MEdge.h:14
MLineBorder::MLineBorder
MLineBorder(const std::vector< MVertex * > &v, int num=0, int part=0, MElement *d1=nullptr, MElement *d2=nullptr)
Definition: MElementCut.h:508
MLineChild::MLineChild
MLineChild(MVertex *v0, MVertex *v1, int num=0, int part=0, bool owner=false, MElement *orig=nullptr)
Definition: MElementCut.h:369
MPolygon::getFaceRep
virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n)
Definition: MElementCut.h:270
MPolyhedron::ownsParent
virtual bool ownsParent() const
Definition: MElementCut.h:182
MLineBorder::getIntegrationPoints
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts)
Definition: MElementCut.cpp:454
MPolygon::getShapeFunctions
virtual void getShapeFunctions(double u, double v, double w, double s[], int o) const
Definition: MElementCut.h:311
MPolygon::MPolygon
MPolygon(std::vector< MVertex * > v, int num=0, int part=0, bool owner=false, MElement *orig=nullptr)
Definition: MElementCut.h:210
MPolyhedron::getNumEdgesRep
virtual int getNumEdgesRep(bool curved)
Definition: MElementCut.h:79
MTetrahedron
Definition: MTetrahedron.h:34
MPolyhedron::getChild
virtual MElement * getChild(int i) const
Definition: MElementCut.h:181
MPolygon::numCommonNodesInDualGraph
virtual int numCommonNodesInDualGraph(const MElement *const other) const
Definition: MElementCut.h:356
MPolygon::getIntegrationPoints
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts)
Definition: MElementCut.cpp:279
MLineChild
Definition: MElementCut.h:362
MTriangleBorder::MTriangleBorder
MTriangleBorder(const std::vector< MVertex * > &v, int num=0, int part=0, MElement *d1=nullptr, MElement *d2=nullptr)
Definition: MElementCut.h:438
MPolygon::getNumFaceVertices
virtual int getNumFaceVertices() const
Definition: MElementCut.h:239
MPolyhedron::getJacobianFuncSpace
virtual const JacobianBasis * getJacobianFuncSpace(int order=-1) const
Definition: MElementCut.h:134
MPolygon::getFunctionSpace
virtual const nodalBasis * getFunctionSpace(int order=-1, bool serendip=false) const
Definition: MElementCut.h:302
MPolygon::getType
virtual int getType() const
Definition: MElementCut.h:283
MPolygon::_owner
bool _owner
Definition: MElementCut.h:200
MPolygonBorder::_intpt
IntPt * _intpt
Definition: MElementCut.h:464
MVertex
Definition: MVertex.h:24
MPolygonBorder::MPolygonBorder
MPolygonBorder(const std::vector< MVertex * > &v, int num=0, int part=0, bool own=false, MElement *p=nullptr, MElement *d1=nullptr, MElement *d2=nullptr)
Definition: MElementCut.h:475
MLineBorder::getDomain
virtual MElement * getDomain(int i) const
Definition: MElementCut.h:516
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
MPolyhedron::getEdge
virtual MEdge getEdge(int num) const
Definition: MElementCut.h:78
MPolygonBorder::_domains
MElement * _domains[2]
Definition: MElementCut.h:463
MLineBorder::isInside
virtual bool isInside(double u, double v, double w) const
Definition: MElementCut.cpp:435
MPolygon::_intpt
IntPt * _intpt
Definition: MElementCut.h:202
MTriangleBorder::getDomain
virtual MElement * getDomain(int i) const
Definition: MElementCut.h:446
MElement::getParent
virtual MElement * getParent() const
Definition: MElement.h:231
MPolygon::getNumPrimaryShapeFunctions
virtual std::size_t getNumPrimaryShapeFunctions() const
Definition: MElementCut.h:330
MPolyhedron::MPolyhedron
MPolyhedron(std::vector< MTetrahedron * > vT, int num=0, int part=0, bool owner=false, MElement *orig=nullptr)
Definition: MElementCut.h:46
MPolygon::getVertex
virtual MVertex * getVertex(int num)
Definition: MElementCut.h:240
MElement::getShapeFunctionNode
virtual const MVertex * getShapeFunctionNode(int i) const
Definition: MElement.h:392
SVector3
Definition: SVector3.h:16
MPolygon::getNumFaces
virtual int getNumFaces()
Definition: MElementCut.h:267
MPolyhedron::getVolume
virtual double getVolume()
Definition: MElementCut.h:122
MPolygon::getHessShapeFunctions
virtual void getHessShapeFunctions(double u, double v, double w, double s[][3][3], int o) const
Definition: MElementCut.h:321
MPolyhedron::getFaceRep
virtual void getFaceRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n)
Definition: MElementCut.h:98
MPolyhedron::getType
virtual int getType() const
Definition: MElementCut.h:111
MLineChild::getHessShapeFunctions
virtual void getHessShapeFunctions(double u, double v, double w, double s[][3][3], int o) const
Definition: MElementCut.h:405
MLineBorder
Definition: MElementCut.h:495
MPolyhedron::getFace
virtual MFace getFace(int num) const
Definition: MElementCut.h:96
MTriangleBorder::_intpt
IntPt * _intpt
Definition: MElementCut.h:428
MPolyhedron::getShapeFunctionNode
virtual const MVertex * getShapeFunctionNode(int i) const
Definition: MElementCut.h:161
MPolyhedron::getParent
virtual MElement * getParent() const
Definition: MElementCut.h:174
MPolygon::_parts
std::vector< MTriangle * > _parts
Definition: MElementCut.h:203
GmshMessage.h
MLine.h
MTriangleBorder::MTriangleBorder
MTriangleBorder(MVertex *v0, MVertex *v1, MVertex *v2, int num=0, int part=0, MElement *d1=nullptr, MElement *d2=nullptr)
Definition: MElementCut.h:431
MPolygon::getGradShapeFunctions
virtual void getGradShapeFunctions(double u, double v, double w, double s[][3], int o) const
Definition: MElementCut.h:316
MElement::getHessShapeFunctions
virtual void getHessShapeFunctions(double u, double v, double w, double s[][3][3], int order=-1) const
Definition: MElement.cpp:478
MPolygon::~MPolygon
~MPolygon()
Definition: MElementCut.h:228
MPolygon::getEdgeVertices
virtual void getEdgeVertices(const int num, std::vector< MVertex * > &v) const
Definition: MElementCut.h:261
MPolyhedron::_owner
bool _owner
Definition: MElementCut.h:23
MPolygon::getNumFacesRep
virtual int getNumFacesRep(bool curved)
Definition: MElementCut.h:269
MPolyhedron::_init
void _init()
Definition: MElementCut.cpp:25
MPolyhedron::getFunctionSpace
virtual const nodalBasis * getFunctionSpace(int order=-1, bool serendip=false) const
Definition: MElementCut.h:129
MPolyhedron::getNumEdges
virtual int getNumEdges() const
Definition: MElementCut.h:77
MPolyhedron::setParent
virtual void setParent(MElement *p, bool owner=false)
Definition: MElementCut.h:175
MLine
Definition: MLine.h:21
MLineBorder::setDomain
virtual void setDomain(MElement *d, int i)
Definition: MElementCut.h:517
MLineBorder::_intpt
IntPt * _intpt
Definition: MElementCut.h:498
MLineChild::getTypeForMSH
virtual int getTypeForMSH() const
Definition: MElementCut.h:383
MLineChild::ownsParent
virtual bool ownsParent() const
Definition: MElementCut.h:420
MPolyhedron::getNumVertices
virtual std::size_t getNumVertices() const
Definition: MElementCut.h:60
MSH_LIN_C
#define MSH_LIN_C
Definition: GmshDefines.h:149
MPolygon::getJacobianFuncSpace
virtual const JacobianBasis * getJacobianFuncSpace(int order=-1) const
Definition: MElementCut.h:307
MFace
Definition: MFace.h:20
MElement::_getEdgeRep
void _getEdgeRep(MVertex *v0, MVertex *v1, double *x, double *y, double *z, SVector3 *n, int faceIndex=-1)
Definition: MElement.cpp:107
MTriangleBorder::setDomain
virtual void setDomain(MElement *d, int i)
Definition: MElementCut.h:447
MEdge::getVertex
MVertex * getVertex(std::size_t i) const
Definition: MEdge.h:39
MPolyhedron::getShapeFunctionNode
virtual MVertex * getShapeFunctionNode(int i)
Definition: MElementCut.h:165
MTriangleBorder::isInside
virtual bool isInside(double u, double v, double w) const
Definition: MElementCut.cpp:376
MPolyhedron::reverse
virtual void reverse()
Definition: MElementCut.h:113
MPolyhedron::getNumPrimaryShapeFunctions
virtual std::size_t getNumPrimaryShapeFunctions() const
Definition: MElementCut.h:157
gLevelset
Definition: gmshLevelset.h:64
MLineBorder::MLineBorder
MLineBorder(MVertex *v0, MVertex *v1, int num=0, int part=0, MElement *d1=nullptr, MElement *d2=nullptr)
Definition: MElementCut.h:501
MPolyhedron::getTypeForMSH
virtual int getTypeForMSH() const
Definition: MElementCut.h:112
MPolygon::getShapeFunctionNode
virtual MVertex * getShapeFunctionNode(int i)
Definition: MElementCut.h:338
MPolyhedron::getShapeFunctions
virtual void getShapeFunctions(double u, double v, double w, double s[], int o) const
Definition: MElementCut.h:138
MPolygon::getEdge
virtual MEdge getEdge(int num) const
Definition: MElementCut.h:253
MLineChild::_orig
MElement * _orig
Definition: MElementCut.h:365
MPolygon::getVerticesIdForMSH
virtual void getVerticesIdForMSH(std::vector< int > &verts)
Definition: MElementCut.h:348
MLineBorder::_domains
MElement * _domains[2]
Definition: MElementCut.h:497
MLineChild::setParent
virtual void setParent(MElement *p, bool owner=false)
Definition: MElementCut.h:415
MTriangleBorder::getParent
virtual MElement * getParent() const
Definition: MElementCut.h:448
MPolygon::_innerVertices
std::vector< MVertex * > _innerVertices
Definition: MElementCut.h:205
MPolyhedron::MPolyhedron
MPolyhedron(std::vector< MVertex * > v, int num=0, int part=0, bool owner=false, MElement *orig=nullptr)
Definition: MElementCut.h:34
MPolygon::getFace
virtual MFace getFace(int num) const
Definition: MElementCut.h:268
GModel
Definition: GModel.h:44
MSH_TRI_B
#define MSH_TRI_B
Definition: GmshDefines.h:147
MElement::getNumShapeFunctions
virtual std::size_t getNumShapeFunctions() const
Definition: MElement.h:387
MElement::getNumPrimaryShapeFunctions
virtual std::size_t getNumPrimaryShapeFunctions() const
Definition: MElement.h:388
MPolyhedron::getNumFaces
virtual int getNumFaces()
Definition: MElementCut.h:95
MPolygon::getParent
virtual MElement * getParent() const
Definition: MElementCut.h:293
MPolygon::getShapeFunctionNode
virtual const MVertex * getShapeFunctionNode(int i) const
Definition: MElementCut.h:334
MPolygon::reverse
virtual void reverse()
Definition: MElementCut.h:285
MLineChild::getIntegrationPoints
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts)
Definition: MElementCut.cpp:340
MPolygon::getEdgeRep
virtual void getEdgeRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n)
Definition: MElementCut.h:255
MSH_POLYG_B
#define MSH_POLYG_B
Definition: GmshDefines.h:148
MElement
Definition: MElement.h:30
MPolyhedron::getEdgeRep
virtual void getEdgeRep(bool curved, int num, double *x, double *y, double *z, SVector3 *n)
Definition: MElementCut.h:80
MPolygonBorder::getParent
virtual MElement * getParent() const
Definition: MElementCut.h:486
MPolygon::getVertex
virtual const MVertex * getVertex(int num) const
Definition: MElementCut.h:246
MPolyhedron
Definition: MElementCut.h:21
MPolygon::setParent
virtual void setParent(MElement *p, bool owner=false)
Definition: MElementCut.h:294
MSH_LIN_B
#define MSH_LIN_B
Definition: GmshDefines.h:146
MPolyhedron::_intpt
IntPt * _intpt
Definition: MElementCut.h:25
MPolyhedron::~MPolyhedron
~MPolyhedron()
Definition: MElementCut.h:53
MPolyhedron::getHessShapeFunctions
virtual void getHessShapeFunctions(double u, double v, double w, double s[][3][3], int o) const
Definition: MElementCut.h:148
MLineChild::isInside
virtual bool isInside(double u, double v, double w) const
Definition: MElementCut.cpp:321
MPolygon::isInside
virtual bool isInside(double u, double v, double w) const
Definition: MElementCut.cpp:257
MPolyhedron::isInside
virtual bool isInside(double u, double v, double w) const
Definition: MElementCut.cpp:84
MLineChild::~MLineChild
~MLineChild()
Definition: MElementCut.h:379
MTriangle
Definition: MTriangle.h:26
MPolygonBorder::~MPolygonBorder
~MPolygonBorder()
Definition: MElementCut.h:483
MPolygonBorder::setDomain
virtual void setDomain(MElement *d, int i)
Definition: MElementCut.h:485
MPolyhedron::getVertex
virtual const MVertex * getVertex(int num) const
Definition: MElementCut.h:71
MPolyhedron::getGradShapeFunctions
virtual void getGradShapeFunctions(double u, double v, double w, double s[][3], int o) const
Definition: MElementCut.h:143
MPolygon::getNumEdges
virtual int getNumEdges() const
Definition: MElementCut.h:252
MLineChild::getGradShapeFunctions
virtual void getGradShapeFunctions(double u, double v, double w, double s[][3], int o) const
Definition: MElementCut.h:400
MSH_POLYH_
#define MSH_POLYH_
Definition: GmshDefines.h:114
MElement::_getFaceRep
void _getFaceRep(MVertex *v0, MVertex *v1, MVertex *v2, double *x, double *y, double *z, SVector3 *n)
Definition: MElement.cpp:146
MPolyhedron::_orig
MElement * _orig
Definition: MElementCut.h:24
TYPE_POLYG
#define TYPE_POLYG
Definition: GmshDefines.h:72
MLineChild::getParent
virtual MElement * getParent() const
Definition: MElementCut.h:414
MPolygonBorder::getTypeForMSH
virtual int getTypeForMSH() const
Definition: MElementCut.h:492
MVertex::getIndex
long int getIndex() const
Definition: MVertex.h:93
nodalBasis
Definition: nodalBasis.h:12
IntPt
Definition: GaussIntegration.h:12
MPolygon::ownsParent
virtual bool ownsParent() const
Definition: MElementCut.h:301
MTetrahedron.h
MTriangleBorder::getIntegrationPoints
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts)
Definition: MElementCut.cpp:396
z
const double z
Definition: GaussQuadratureQuad.cpp:56
JacobianBasis
Definition: JacobianBasis.h:60
MPolyhedron::getNumFacesRep
virtual int getNumFacesRep(bool curved)
Definition: MElementCut.h:97
MLineChild::_owner
bool _owner
Definition: MElementCut.h:364
MPolygon::MPolygon
MPolygon(std::vector< MTriangle * > vT, int num=0, int part=0, bool owner=false, MElement *orig=nullptr)
Definition: MElementCut.h:218
MPolyhedron::getNumChildren
virtual int getNumChildren() const
Definition: MElementCut.h:180
MLineChild::getShapeFunctions
virtual void getShapeFunctions(double u, double v, double w, double s[], int o) const
Definition: MElementCut.h:395
MSH_POLYG_
#define MSH_POLYG_
Definition: GmshDefines.h:113
MElement.h
MPolygon::getNumEdgesRep
virtual int getNumEdgesRep(bool curved)
Definition: MElementCut.h:254
MPolygonBorder::getDomain
virtual MElement * getDomain(int i) const
Definition: MElementCut.h:484
MPolyhedron::getEdgeVertices
virtual void getEdgeVertices(const int num, std::vector< MVertex * > &v) const
Definition: MElementCut.h:89
MLineBorder::~MLineBorder
~MLineBorder()
Definition: MElementCut.h:515
MPolyhedron::getVerticesIdForMSH
virtual void getVerticesIdForMSH(std::vector< int > &verts)
Definition: MElementCut.h:184
MElement::getJacobianFuncSpace
virtual const JacobianBasis * getJacobianFuncSpace(int orderElement=-1) const
Definition: MElement.cpp:679
MPolyhedron::_parts
std::vector< MTetrahedron * > _parts
Definition: MElementCut.h:26
MElement::getShapeFunctions
virtual void getShapeFunctions(double u, double v, double w, double s[], int order=-1) const
Definition: MElement.cpp:458
MPolygon::getNumChildren
virtual int getNumChildren() const
Definition: MElementCut.h:299
MPolyhedron::getNumVolumeVertices
virtual int getNumVolumeVertices() const
Definition: MElementCut.h:64
MPolygon::_vertices
std::vector< MVertex * > _vertices
Definition: MElementCut.h:204
MPolyhedron::getNumShapeFunctions
virtual std::size_t getNumShapeFunctions() const
Definition: MElementCut.h:153
buildCutMesh
GModel * buildCutMesh(GModel *gm, gLevelset *ls, std::map< int, std::vector< MElement * > > elements[10], std::map< int, MVertex * > &vertexMap, std::map< int, std::map< int, std::string > > physicals[4], bool cutElem)
Definition: MElementCut.cpp:1462
MLineBorder::getTypeForMSH
virtual int getTypeForMSH() const
Definition: MElementCut.h:524
MPolyhedron::getVertex
virtual MVertex * getVertex(int num)
Definition: MElementCut.h:65
MPolygon
Definition: MElementCut.h:198
MPolygon::getTypeForMSH
virtual int getTypeForMSH() const
Definition: MElementCut.h:284
MTriangleBorder::_domains
MElement * _domains[2]
Definition: MElementCut.h:427
MPolygonBorder::MPolygonBorder
MPolygonBorder(const std::vector< MTriangle * > &v, int num=0, int part=0, bool own=false, MElement *p=nullptr, MElement *d1=nullptr, MElement *d2=nullptr)
Definition: MElementCut.h:467
MPolyhedron::_vertices
std::vector< MVertex * > _vertices
Definition: MElementCut.h:27
MPolygon::getNumVertices
virtual std::size_t getNumVertices() const
Definition: MElementCut.h:235
MLineChild::getJacobianFuncSpace
virtual const JacobianBasis * getJacobianFuncSpace(int order=-1) const
Definition: MElementCut.h:390
MPolyhedron::_edges
std::vector< MEdge > _edges
Definition: MElementCut.h:29
MPolyhedron::_faces
std::vector< MFace > _faces
Definition: MElementCut.h:30
MElement::getFunctionSpace
virtual const nodalBasis * getFunctionSpace(int order=-1, bool serendip=false) const
Definition: MElement.cpp:666
MPolygon::getNumVerticesForMSH
virtual std::size_t getNumVerticesForMSH()
Definition: MElementCut.h:347
MPolygon::getNumShapeFunctions
virtual std::size_t getNumShapeFunctions() const
Definition: MElementCut.h:326
MPolyhedron::getIntegrationPoints
virtual void getIntegrationPoints(int pOrder, int *npts, IntPt **pts)
Definition: MElementCut.cpp:107
TYPE_POLYH
#define TYPE_POLYH
Definition: GmshDefines.h:73
MPolygon::getDim
virtual int getDim() const
Definition: MElementCut.h:234
MPolyhedron::getNumVerticesForMSH
virtual std::size_t getNumVerticesForMSH()
Definition: MElementCut.h:183
MPolygon::_orig
MElement * _orig
Definition: MElementCut.h:201
MPolyhedron::getDim
virtual int getDim() const
Definition: MElementCut.h:59
MLineChild::getFunctionSpace
virtual const nodalBasis * getFunctionSpace(int order=-1, bool serendip=false) const
Definition: MElementCut.h:384
MPolyhedron::_innerVertices
std::vector< MVertex * > _innerVertices
Definition: MElementCut.h:28
MLineChild::MLineChild
MLineChild(const std::vector< MVertex * > &v, int num=0, int part=0, bool owner=false, MElement *orig=nullptr)
Definition: MElementCut.h:374
MElement::getGradShapeFunctions
virtual void getGradShapeFunctions(double u, double v, double w, double s[][3], int order=-1) const
Definition: MElement.cpp:468
MPolygon::_initVertices
void _initVertices()
Definition: MElementCut.cpp:152