gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GEdgeLoop.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 GEDGE_LOOP_H
7 #define GEDGE_LOOP_H
8 
9 #include "GEdge.h"
10 #include "GmshMessage.h"
11 
12 class GEdgeSigned {
13 private:
14  int _sign;
16 public:
17  GEdgeSigned(int sign, GEdge *ge) : _sign(sign), _ge(ge)
18  {
19  if(_sign != 1 && _sign != -1)
20  Msg::Error("Edge sign should be 1 or -1");
21  }
23  {
24  return (_sign == 1) ? _ge->getBeginVertex() : _ge->getEndVertex();
25  }
27  {
28  return (_sign == 1) ? _ge->getEndVertex() : _ge->getBeginVertex();
29  }
30  void print() const;
31  int getSign() const { return _sign; }
32  GEdge *getEdge() const { return _ge; }
33  void changeSign() { _sign *= -1; }
34 };
35 
36 class GEdgeLoop {
37 private:
38  std::list<GEdgeSigned> loop;
39 
40 public:
41  typedef std::list<GEdgeSigned>::iterator iter;
42  typedef std::list<GEdgeSigned>::const_iterator citer;
43  GEdgeLoop() {}
44  GEdgeLoop(const std::vector<GEdge *> &wire);
45  bool check();
46  void add(int ori, GEdge *ge) { loop.push_back(GEdgeSigned(ori, ge)); }
47  void recompute(const std::vector<GEdge *> &wire);
48  inline iter begin() { return loop.begin(); }
49  inline iter end() { return loop.end(); }
50  inline citer begin() const { return loop.begin(); }
51  inline citer end() const { return loop.end(); }
52  inline void erase(iter it) { loop.erase(it); }
53  int count(GEdge *) const;
54  int count() const { return (int)loop.size(); }
55  void print() const;
56  void getEdges(std::vector<GEdge *> &edges) const;
57  void getSigns(std::vector<int> &signs) const;
58  void reverse();
59 };
60 
61 #endif
GEdgeLoop::begin
citer begin() const
Definition: GEdgeLoop.h:50
GEdgeSigned::getSign
int getSign() const
Definition: GEdgeLoop.h:31
GEdgeLoop::GEdgeLoop
GEdgeLoop()
Definition: GEdgeLoop.h:43
GEdgeSigned::getBeginVertex
GVertex * getBeginVertex() const
Definition: GEdgeLoop.h:22
GEdgeSigned::getEndVertex
GVertex * getEndVertex() const
Definition: GEdgeLoop.h:26
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
GEdgeLoop::iter
std::list< GEdgeSigned >::iterator iter
Definition: GEdgeLoop.h:41
GEdgeLoop::getEdges
void getEdges(std::vector< GEdge * > &edges) const
Definition: GEdgeLoop.cpp:100
GEdgeLoop::begin
iter begin()
Definition: GEdgeLoop.h:48
GEdgeLoop::loop
std::list< GEdgeSigned > loop
Definition: GEdgeLoop.h:38
GEdgeLoop::citer
std::list< GEdgeSigned >::const_iterator citer
Definition: GEdgeLoop.h:42
GmshMessage.h
edges
static int edges[6][2]
Definition: meshGRegionLocalMeshMod.cpp:23
GEdgeLoop::recompute
void recompute(const std::vector< GEdge * > &wire)
Definition: GEdgeLoop.cpp:137
GEdgeLoop::print
void print() const
Definition: GEdgeLoop.cpp:95
GEdge.h
GEdgeLoop
Definition: GEdgeLoop.h:36
GEdgeSigned::changeSign
void changeSign()
Definition: GEdgeLoop.h:33
GVertex
Definition: GVertex.h:23
GEdgeLoop::reverse
void reverse()
Definition: GEdgeLoop.cpp:189
GEdgeSigned::getEdge
GEdge * getEdge() const
Definition: GEdgeLoop.h:32
GEdge::getBeginVertex
virtual GVertex * getBeginVertex() const
Definition: GEdge.h:63
GEdgeSigned
Definition: GEdgeLoop.h:12
GEdgeSigned::GEdgeSigned
GEdgeSigned(int sign, GEdge *ge)
Definition: GEdgeLoop.h:17
GEdgeSigned::_sign
int _sign
Definition: GEdgeLoop.h:14
GEdgeLoop::count
int count() const
Definition: GEdgeLoop.h:54
GEdge
Definition: GEdge.h:26
GEdgeSigned::print
void print() const
Definition: GEdgeLoop.cpp:11
GEdgeLoop::erase
void erase(iter it)
Definition: GEdgeLoop.h:52
GEdge::getEndVertex
virtual GVertex * getEndVertex() const
Definition: GEdge.h:64
GEdgeLoop::end
citer end() const
Definition: GEdgeLoop.h:51
GEdgeSigned::_ge
GEdge * _ge
Definition: GEdgeLoop.h:15
GEdgeLoop::end
iter end()
Definition: GEdgeLoop.h:49
GEdgeLoop::check
bool check()
Definition: GEdgeLoop.cpp:176
GEdgeLoop::add
void add(int ori, GEdge *ge)
Definition: GEdgeLoop.h:46
GEdgeLoop::getSigns
void getSigns(std::vector< int > &signs) const
Definition: GEdgeLoop.cpp:106