gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
ghostEdge.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 // Contributed by Anthony Royer
7 
8 #ifndef GHOST_EDGE_H
9 #define GHOST_EDGE_H
10 
11 #include "GModel.h"
12 #include "discreteEdge.h"
13 #include "MLine.h"
14 
15 class ghostEdge : public discreteEdge {
16 private:
18  std::map<MElement *, int> _ghostCells;
19  bool _saveMesh;
20  bool _haveMesh;
21 
22 public:
23  ghostEdge(GModel *model, const int num, const int partition)
24  : discreteEdge(model, num, nullptr, nullptr), _partition(partition),
25  _ghostCells(), _saveMesh(false), _haveMesh(false)
26  {
27  }
28  virtual ~ghostEdge()
29  {
30  if(!_haveMesh) {
31  lines.clear();
32  mesh_vertices.clear();
33  }
34  }
35  virtual GeomType geomType() const { return GhostCurve; }
36  virtual void setPartition(const int partition) { _partition = partition; }
37  virtual int getPartition() const { return _partition; }
38  bool saveMesh() const { return _saveMesh; }
39  void saveMesh(bool saveMesh) { _saveMesh = saveMesh; }
40  bool haveMesh() const { return _haveMesh; }
41  void haveMesh(bool haveMesh) { _haveMesh = haveMesh; }
42  virtual std::map<MElement *, int> &getGhostCells() { return _ghostCells; }
43 
44  void addLine(MLine *l, int onWhichPartition)
45  {
46  GEdge::addLine(l);
47  _ghostCells.insert(std::pair<MElement *, int>(l, onWhichPartition));
49  }
50  void addElement(int type, MElement *e, int onWhichPartition)
51  {
52  GEdge::addElement(type, e);
53  _ghostCells.insert(std::pair<MElement *, int>(e, onWhichPartition));
55  }
56 
57  // To make the hidden function visible in ghostEdge
60 };
61 
62 #endif
ghostEdge::getGhostCells
virtual std::map< MElement *, int > & getGhostCells()
Definition: ghostEdge.h:42
ghostEdge::getPartition
virtual int getPartition() const
Definition: ghostEdge.h:37
GEntity::GhostCurve
@ GhostCurve
Definition: GEntity.h:125
GEdge::lines
std::vector< MLine * > lines
Definition: GEdge.h:42
GEntity::model
GModel * model() const
Definition: GEntity.h:277
discreteEdge
Definition: discreteEdge.h:12
ghostEdge::_haveMesh
bool _haveMesh
Definition: ghostEdge.h:20
ghostEdge::_ghostCells
std::map< MElement *, int > _ghostCells
Definition: ghostEdge.h:18
GEdge::addLine
void addLine(MLine *line)
Definition: GEdge.h:266
MLine.h
ghostEdge::~ghostEdge
virtual ~ghostEdge()
Definition: ghostEdge.h:28
GModel::addGhostCells
void addGhostCells(MElement *elm, short partition)
Definition: GModel.h:619
MLine
Definition: MLine.h:21
GEntity::mesh_vertices
std::vector< MVertex * > mesh_vertices
Definition: GEntity.h:56
ghostEdge::addElement
void addElement(int type, MElement *e, int onWhichPartition)
Definition: ghostEdge.h:50
GModel
Definition: GModel.h:44
ghostEdge::haveMesh
void haveMesh(bool haveMesh)
Definition: ghostEdge.h:41
ghostEdge::addLine
void addLine(MLine *l, int onWhichPartition)
Definition: ghostEdge.h:44
MElement
Definition: MElement.h:30
ghostEdge::saveMesh
void saveMesh(bool saveMesh)
Definition: ghostEdge.h:39
GEntity::GeomType
GeomType
Definition: GEntity.h:88
ghostEdge::ghostEdge
ghostEdge(GModel *model, const int num, const int partition)
Definition: ghostEdge.h:23
discreteEdge.h
ghostEdge::_saveMesh
bool _saveMesh
Definition: ghostEdge.h:19
ghostEdge::geomType
virtual GeomType geomType() const
Definition: ghostEdge.h:35
ghostEdge::haveMesh
bool haveMesh() const
Definition: ghostEdge.h:40
ghostEdge::setPartition
virtual void setPartition(const int partition)
Definition: ghostEdge.h:36
GModel.h
ghostEdge::_partition
int _partition
Definition: ghostEdge.h:17
GEdge::addElement
void addElement(int type, MElement *e)
Definition: GEdge.cpp:775
ghostEdge
Definition: ghostEdge.h:15
ghostEdge::saveMesh
bool saveMesh() const
Definition: ghostEdge.h:38