Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
MasterBase.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Barrier.h>
38
39namespace ogdf {
40namespace spring_embedder {
41
43template<typename NodeInfo, typename ForceModelBase>
45protected:
50
55
56 ForceModelBase* m_forceModel;
57 ForceModelBase* m_forceModelImprove;
58
60
62
63 double m_tNull;
64 double m_cF;
65 double m_t;
67
71
72public:
74 DPoint& boundingBox)
76 , m_gc(gc)
77 , m_ga(ga)
78 , m_boundingBox(boundingBox)
79 , m_index(gc)
82 , m_adjLists(2 * gc.numberOfEdges())
88
90 delete m_barrier;
91 delete m_forceModel;
93 }
94
95 int numberOfNodes() const { return m_vInfo.size(); }
96
97 int numberOfIterations() const { return m_spring.iterations(); }
98
100
102 // cool down
104 m_cF = 2.0;
106
107 // convergence
108 m_avgDisplacement = std::numeric_limits<double>::max();
109 m_maxDisplacement = std::numeric_limits<double>::max();
110 }
111
113 // cool down
114 m_t = m_tNull;
115 m_cF = 2.0;
117
118 // convergence
119 m_avgDisplacement = std::numeric_limits<double>::max();
120 m_maxDisplacement = std::numeric_limits<double>::max();
121 }
122
123 void coolDown() {
125 m_t = m_tNull / std::log2(m_cF);
126
128 }
129
130 double maxForceLength() const { return m_t; }
131
132 double coolingFactor() const { return m_coolingFactor; }
133
134 double idealEdgeLength() const { return m_idealEdgeLength; }
135
136 bool noise() const { return m_spring.noise(); }
137
138 const GraphCopy& getGraph() const { return m_gc; }
139
141
142 const NodeArray<int>& index() const { return m_index; }
143
145
146 Array<DPoint>& disp() { return m_disp; }
147
149
150 const ForceModelBase& forceModel() const { return *m_forceModel; }
151
152 const ForceModelBase& forceModelImprove() const { return *m_forceModelImprove; }
153
154 void syncThreads() {
155 if (m_barrier) {
157 }
158 }
159
160 double scaleFactor() const { return m_scaleFactor; }
161
166
167 double avgDisplacement() const { return m_avgDisplacement; }
168
169 double maxDisplacement() const { return m_maxDisplacement; }
170};
171
172}
173}
Implementation of a thread barrier.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Declaration of graph copy classes.
Declaration and definition of ogdf::SpringEmbedderBase.
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
INDEX size() const
Returns the size (number of elements) of the array.
Definition Array.h:297
Representation of a barrier.
Definition Barrier.h:49
void threadSync()
Synchronizes the threads in the group.
Definition Barrier.h:69
Stores additional attributes of a graph (like layout information).
Copies of graphs supporting edge splitting.
Definition GraphCopy.h:254
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Base class for ogdf::SpringEmbedderGridVariant::Master.
Definition MasterBase.h:44
const ForceModelBase & forceModelImprove() const
Definition MasterBase.h:152
GraphAttributes & getAttributes()
Definition MasterBase.h:140
const ForceModelBase & forceModel() const
Definition MasterBase.h:150
const GraphCopy & getGraph() const
Definition MasterBase.h:138
const SpringEmbedderBase & m_spring
Definition MasterBase.h:46
ForceModelBase * m_forceModelImprove
Definition MasterBase.h:57
const NodeArray< int > & index() const
Definition MasterBase.h:142
MasterBase(const SpringEmbedderBase &spring, const GraphCopy &gc, GraphAttributes &ga, DPoint &boundingBox)
Definition MasterBase.h:73
Array< NodeInfo > & vInfo()
Definition MasterBase.h:144
Common base class for ogdf::SpringEmbedderBase and ogdf::SpringEmbedderGridVariant.
double maxConvergenceFactor() const
Returns the currently used maximum convergence factor.
bool noise() const
Returns the current setting of noise.
int iterationsImprove() const
Returns the current setting of iterations for the improvement phase.
int iterations() const
Returns the current setting of iterations.
double avgConvergenceFactor() const
Returns the currently used average convergence factor.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
Definition GML.h:110