Tulip  5.4.0
Large graphs analysis and drawing
Ordering.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef ORDERING_H
22 #define ORDERING_H
23 #include <tulip/Face.h>
24 #include <tulip/Node.h>
25 #include <tulip/Edge.h>
26 
27 #include <tulip/MutableContainer.h>
28 
29 namespace tlp {
30 class PluginProgress;
31 class PlanarConMap;
32 
33 class TLP_SCOPE Ordering {
34 public:
35  typedef struct FaceAndPos_ {
36  Face face;
37  node n_first;
38  node n_last;
39  } FaceAndPos;
40 
41  std::vector<edge> getDummyEdges() {
42  return dummy_edge;
43  }
44 
45  Ordering(PlanarConMap *G, PluginProgress *pluginProgress = nullptr, int minProgress = 0,
46  int deltaProgress = 0, int maxProgress = 0);
47  ~Ordering();
48  // inline void push_back(std::vector<node> nodeVector) {
49  inline size_t size() {
50  return _data.size();
51  }
52  inline std::vector<node> operator[](const unsigned int i) const {
53  return _data[i];
54  }
55  inline std::vector<node> &operator[](const unsigned int i) {
56  return _data[i];
57  }
58 
59 private:
60  std::vector<std::vector<node>> _data;
61  PlanarConMap *Gp;
62  MutableContainer<int> oute;
63  MutableContainer<int> outv;
64  MutableContainer<bool> visitedNodes;
65  MutableContainer<bool> visitedFaces;
66  MutableContainer<bool> markedFaces;
67  MutableContainer<int> seqP;
68  MutableContainer<bool> isOuterFace;
69  MutableContainer<bool> contour;
70  MutableContainer<bool> is_selectable;
71  MutableContainer<bool> is_selectable_visited;
72  MutableContainer<bool> is_selectable_face;
73  MutableContainer<bool> is_selectable_visited_face;
74  MutableContainer<node> left;
75  MutableContainer<node> right;
76  bool existMarkedF;
77  FaceAndPos minMarkedFace;
78  Face ext;
79  std::vector<node> v1;
80  std::vector<edge> dummy_edge;
81 
82  node getLastOfQ(Face f, node prec, node n, edge e);
83  node getLastOfP(Face f, node prec, node n, edge e);
84  std::vector<node> getPathFrom(std::vector<node> fn, int from);
85  int infFaceSize();
86 
87  void updateOutAndVisitedFaces(Face f);
88  void updateContourLeftRight(node prec, node n, edge e, node last);
89  void updateNewSelectableNodes(node node_f, node no_tmp2, edge ed_tmp, node node_last,
90  std::vector<Face> v_faces, bool one_face = false,
91  bool was_visited = false, bool selection_face = false);
92  void updateSelectableFaces(std::vector<Face> v_faces);
93 
94  int seqp(Face f);
95  void minMarkedf();
96  void setMinMarkedFace(Face f);
97 
98  struct augmentableAndNodes_ getAugAndNodes(Face f);
99  void augment(Face f, node prec, node n, node prec_last, node last, int nbNewFace, bool pair);
100  void selectAndUpdate(Face f);
101  void selectAndUpdate(node n);
102  bool isSelectable(node n);
103 
104  void init();
105  void init_v1(std::vector<node> fn);
106  void init_selectableNodes();
107  void init_selectableFaces();
108  void init_outv_oute();
109  void init_seqP();
110  void init_outerface();
111 };
112 } // namespace tlp
113 #endif
114 
115 ///@endcond