gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
ghostRegion.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 #ifndef GHOST_REGION_H
7 #define GHOST_REGION_H
8 
9 #include "GModel.h"
10 #include "discreteRegion.h"
11 #include "MTetrahedron.h"
12 #include "MHexahedron.h"
13 #include "MPrism.h"
14 #include "MPyramid.h"
15 #include "MTrihedron.h"
16 #include "MElementCut.h"
17 
18 class ghostRegion : public discreteRegion {
19 private:
21  std::map<MElement *, int> _ghostCells;
22  bool _saveMesh;
23  bool _haveMesh;
24 
25 public:
26  ghostRegion(GModel *model, const int num, const int partition)
27  : discreteRegion(model, num), _partition(partition), _ghostCells(),
28  _saveMesh(false), _haveMesh(false)
29  {
30  }
31  virtual ~ghostRegion()
32  {
33  if(!_haveMesh) {
34  tetrahedra.clear();
35  hexahedra.clear();
36  prisms.clear();
37  pyramids.clear();
38  trihedra.clear();
39  polyhedra.clear();
40  mesh_vertices.clear();
41  }
42  }
43  virtual GeomType geomType() const { return GhostVolume; }
44  virtual void setPartition(const int partition) { _partition = partition; }
45  virtual int getPartition() const { return _partition; }
46  bool saveMesh() const { return _saveMesh; }
47  void saveMesh(bool saveMesh) { _saveMesh = saveMesh; }
48  bool haveMesh() const { return _haveMesh; }
49  void haveMesh(bool haveMesh) { _haveMesh = haveMesh; }
50  virtual std::map<MElement *, int> &getGhostCells() { return _ghostCells; }
51 
52  void addTetrahedron(MTetrahedron *t, int onWhichPartition)
53  {
55  _ghostCells.insert(std::pair<MElement *, int>(t, onWhichPartition));
57  }
58  void addHexahedron(MHexahedron *h, int onWhichPartition)
59  {
61  _ghostCells.insert(std::pair<MElement *, int>(h, onWhichPartition));
63  }
64  void addPrism(MPrism *p, int onWhichPartition)
65  {
67  _ghostCells.insert(std::pair<MElement *, int>(p, onWhichPartition));
69  }
70  void addPyramid(MPyramid *p, int onWhichPartition)
71  {
73  _ghostCells.insert(std::pair<MElement *, int>(p, onWhichPartition));
75  }
76  void addPolyhedron(MPolyhedron *p, int onWhichPartition)
77  {
79  _ghostCells.insert(std::pair<MElement *, int>(p, onWhichPartition));
81  }
82  void addTrihedron(MTrihedron *t, int onWhichPartition)
83  {
85  _ghostCells.insert(std::pair<MElement *, int>(t, onWhichPartition));
87  }
88  void addElement(int type, MElement *e, int onWhichPartition)
89  {
90  GRegion::addElement(type, e);
91  _ghostCells.insert(std::pair<MElement *, int>(e, onWhichPartition));
93  }
94 
95  // To make the hidden function visible in ghostRegion
103 };
104 
105 #endif
ghostRegion::haveMesh
bool haveMesh() const
Definition: ghostRegion.h:48
ghostRegion::addTetrahedron
void addTetrahedron(MTetrahedron *t, int onWhichPartition)
Definition: ghostRegion.h:52
MTrihedron.h
ghostRegion::addHexahedron
void addHexahedron(MHexahedron *h, int onWhichPartition)
Definition: ghostRegion.h:58
GRegion::addPyramid
void addPyramid(MPyramid *p)
Definition: GRegion.h:173
ghostRegion
Definition: ghostRegion.h:18
MTetrahedron
Definition: MTetrahedron.h:34
ghostRegion::haveMesh
void haveMesh(bool haveMesh)
Definition: ghostRegion.h:49
GEntity::model
GModel * model() const
Definition: GEntity.h:277
ghostRegion::addPolyhedron
void addPolyhedron(MPolyhedron *p, int onWhichPartition)
Definition: ghostRegion.h:76
discreteRegion.h
ghostRegion::addTrihedron
void addTrihedron(MTrihedron *t, int onWhichPartition)
Definition: ghostRegion.h:82
ghostRegion::addPyramid
void addPyramid(MPyramid *p, int onWhichPartition)
Definition: ghostRegion.h:70
ghostRegion::getGhostCells
virtual std::map< MElement *, int > & getGhostCells()
Definition: ghostRegion.h:50
GRegion::addPolyhedron
void addPolyhedron(MPolyhedron *p)
Definition: GRegion.h:174
MPyramid
Definition: MPyramid.h:32
MPrism
Definition: MPrism.h:34
ghostRegion::getPartition
virtual int getPartition() const
Definition: ghostRegion.h:45
GModel::addGhostCells
void addGhostCells(MElement *elm, short partition)
Definition: GModel.h:619
discreteRegion
Definition: discreteRegion.h:13
GRegion::addHexahedron
void addHexahedron(MHexahedron *h)
Definition: GRegion.h:171
ghostRegion::ghostRegion
ghostRegion(GModel *model, const int num, const int partition)
Definition: ghostRegion.h:26
GRegion::polyhedra
std::vector< MPolyhedron * > polyhedra
Definition: GRegion.h:168
GRegion::hexahedra
std::vector< MHexahedron * > hexahedra
Definition: GRegion.h:164
ghostRegion::_haveMesh
bool _haveMesh
Definition: ghostRegion.h:23
MTrihedron
Definition: MTrihedron.h:31
ghostRegion::geomType
virtual GeomType geomType() const
Definition: ghostRegion.h:43
ghostRegion::setPartition
virtual void setPartition(const int partition)
Definition: ghostRegion.h:44
GEntity::mesh_vertices
std::vector< MVertex * > mesh_vertices
Definition: GEntity.h:56
MElementCut.h
MHexahedron.h
ghostRegion::saveMesh
bool saveMesh() const
Definition: ghostRegion.h:46
GModel
Definition: GModel.h:44
ghostRegion::~ghostRegion
virtual ~ghostRegion()
Definition: ghostRegion.h:31
MPyramid.h
GRegion::trihedra
std::vector< MTrihedron * > trihedra
Definition: GRegion.h:167
MHexahedron
Definition: MHexahedron.h:28
ghostRegion::addElement
void addElement(int type, MElement *e, int onWhichPartition)
Definition: ghostRegion.h:88
ghostRegion::_ghostCells
std::map< MElement *, int > _ghostCells
Definition: ghostRegion.h:21
MElement
Definition: MElement.h:30
GEntity::GhostVolume
@ GhostVolume
Definition: GEntity.h:127
MPolyhedron
Definition: MElementCut.h:21
GRegion::addTetrahedron
void addTetrahedron(MTetrahedron *t)
Definition: GRegion.h:170
GEntity::GeomType
GeomType
Definition: GEntity.h:88
GRegion::prisms
std::vector< MPrism * > prisms
Definition: GRegion.h:165
GRegion::pyramids
std::vector< MPyramid * > pyramids
Definition: GRegion.h:166
GRegion::addElement
void addElement(int type, MElement *e)
Definition: GRegion.cpp:613
MTetrahedron.h
ghostRegion::addPrism
void addPrism(MPrism *p, int onWhichPartition)
Definition: ghostRegion.h:64
ghostRegion::saveMesh
void saveMesh(bool saveMesh)
Definition: ghostRegion.h:47
MPrism.h
ghostRegion::_saveMesh
bool _saveMesh
Definition: ghostRegion.h:22
GRegion::addPrism
void addPrism(MPrism *p)
Definition: GRegion.h:172
GModel.h
ghostRegion::_partition
int _partition
Definition: ghostRegion.h:20
GRegion::addTrihedron
void addTrihedron(MTrihedron *t)
Definition: GRegion.h:175
GRegion::tetrahedra
std::vector< MTetrahedron * > tetrahedra
Definition: GRegion.h:163