Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

SubgraphPlanarizerUML.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Array.h>
35 #include <ogdf/basic/Graph.h>
36 #include <ogdf/basic/Logger.h>
37 #include <ogdf/basic/basic.h>
41 
42 #include <memory>
43 #include <random>
44 
45 namespace ogdf {
46 class PlanRepLight;
47 class PlanRepUML;
48 
50 
110  class ThreadMaster;
111  class Worker;
112 
113 protected:
115  virtual ReturnType doCall(PlanRepUML& pr, int cc, const EdgeArray<int>* pCostOrig,
116  int& crossingNumber) override;
117 
118 public:
121 
123  SubgraphPlanarizerUML(const SubgraphPlanarizerUML& planarizer);
124 
126  virtual UMLCrossingMinimizationModule* clone() const override;
127 
129  SubgraphPlanarizerUML& operator=(const SubgraphPlanarizerUML& planarizer);
130 
132  void setSubgraph(PlanarSubgraphModule<int>* pSubgraph) { m_subgraph.reset(pSubgraph); }
133 
135  void setInserter(UMLEdgeInsertionModule* pInserter) { m_inserter.reset(pInserter); }
136 
138  int permutations() { return m_permutations; }
139 
141  void permutations(int p) { m_permutations = p; }
142 
144  bool setTimeout() { return m_setTimeout; }
145 
147  void setTimeout(bool b) { m_setTimeout = b; }
148 
150  unsigned int maxThreads() const { return m_maxThreads; }
151 
153  void maxThreads(unsigned int n) {
154 #ifndef OGDF_MEMORY_POOL_NTS
155  m_maxThreads = n;
156 #endif
157  }
158 
159 private:
160  static void doWorkHelper(ThreadMaster& master, UMLEdgeInsertionModule& inserter,
161  std::minstd_rand& rng);
162 
163  static bool doSinglePermutation(PlanRepLight& prl, int cc, const EdgeArray<int>* pCost,
164  Array<edge>& deletedEdges, UMLEdgeInsertionModule& inserter, std::minstd_rand& rng,
165  int& crossingNumber);
166 
167  std::unique_ptr<PlanarSubgraphModule<int>> m_subgraph;
168  std::unique_ptr<UMLEdgeInsertionModule> m_inserter;
169 
172  unsigned int m_maxThreads;
173 };
174 
175 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::PlanarSubgraphModule< int >
Graph.h
Includes declaration of graph class.
ogdf::SubgraphPlanarizerUML::permutations
void permutations(int p)
Sets the number of permutations to p.
Definition: SubgraphPlanarizerUML.h:141
ogdf::PlanRepUML
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition: PlanRepUML.h:55
ogdf::SubgraphPlanarizerUML::setSubgraph
void setSubgraph(PlanarSubgraphModule< int > *pSubgraph)
Sets the module option for the computation of the planar subgraph.
Definition: SubgraphPlanarizerUML.h:132
ogdf::SubgraphPlanarizerUML::permutations
int permutations()
Returns the number of permutations.
Definition: SubgraphPlanarizerUML.h:138
ogdf::PlanRepLight
Light-weight version of a planarized representation, associated with a PlanRep.
Definition: PlanRepLight.h:45
ogdf::UMLEdgeInsertionModule
Interface for UML edge insertion algorithms.
Definition: UMLEdgeInsertionModule.h:53
ogdf::SubgraphPlanarizerUML::m_permutations
int m_permutations
The number of permutations.
Definition: SubgraphPlanarizerUML.h:170
ogdf::SubgraphPlanarizerUML::maxThreads
void maxThreads(unsigned int n)
Sets the maximal number of used threads to n.
Definition: SubgraphPlanarizerUML.h:153
ogdf::SubgraphPlanarizerUML::setTimeout
void setTimeout(bool b)
Sets the option setTimeout to b.
Definition: SubgraphPlanarizerUML.h:147
Logger.h
Contains logging functionality.
UMLEdgeInsertionModule.h
Declaration of interface for edge insertion algorithms.
ogdf::UMLCrossingMinimizationModule
Base class for UML crossing minimization algorithms.
Definition: UMLCrossingMinimizationModule.h:44
ogdf::SubgraphPlanarizerUML::m_setTimeout
bool m_setTimeout
The option for setting timeouts in submodules.
Definition: SubgraphPlanarizerUML.h:171
ogdf::SubgraphPlanarizerUML::m_maxThreads
unsigned int m_maxThreads
The maximal number of used threads.
Definition: SubgraphPlanarizerUML.h:172
PlanarSubgraphModule.h
Declaration of interface for planar subgraph algorithms.
ogdf::SubgraphPlanarizerUML::m_inserter
std::unique_ptr< UMLEdgeInsertionModule > m_inserter
The edge insertion module.
Definition: SubgraphPlanarizerUML.h:168
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
ogdf::SubgraphPlanarizerUML
The planarization approach for UML crossing minimization.
Definition: SubgraphPlanarizerUML.h:109
ogdf::SubgraphPlanarizerUML::setTimeout
bool setTimeout()
Returns the current setting of options setTimeout.
Definition: SubgraphPlanarizerUML.h:144
UMLCrossingMinimizationModule.h
Declaration of CrossingMinimization Module, an interface for crossing minimization algorithms.
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::Logger
Centralized global and local logging facility working on streams like std::cout.
Definition: Logger.h:102
ogdf::Module::ReturnType
ReturnType
The return type of a module.
Definition: Module.h:52
ogdf::SubgraphPlanarizerUML::maxThreads
unsigned int maxThreads() const
Returns the maximal number of used threads.
Definition: SubgraphPlanarizerUML.h:150
ogdf::SubgraphPlanarizerUML::m_subgraph
std::unique_ptr< PlanarSubgraphModule< int > > m_subgraph
The planar subgraph algorithm.
Definition: SubgraphPlanarizerUML.h:167
ogdf::SubgraphPlanarizerUML::setInserter
void setInserter(UMLEdgeInsertionModule *pInserter)
Sets the module option for the edge insertion module.
Definition: SubgraphPlanarizerUML.h:135
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716