Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

FMEFunc.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/basic.h>
43 
44 #include <algorithm>
45 #include <cfloat>
46 #include <cmath>
47 #include <cstdint>
48 #include <list>
49 
50 namespace ogdf {
51 namespace fast_multipole_embedder {
52 
53 
56  std::list<LinearQuadtree::NodeID> nodes;
57  uint32_t pointCount;
58 
59  template<typename Func>
60  void for_loop(Func& func) {
61  for (LinearQuadtree::NodeID id : nodes) {
62  func(id);
63  }
64  }
65 };
66 
68  uint32_t begin;
69  uint32_t numNodes;
70 };
71 
77 
78  float timeStep;
82  float normNodeSize;
83  uint32_t maxNumIterations;
84  uint32_t minNumIterations;
85 
88 
89  double stopCritForce;
91  double stopCritConstSq;
92 
94 };
95 
96 
98 struct FMELocalContext;
99 
103  uint32_t numThreads;
108  float* globalForceX;
109  float* globalForceY;
111  bool earlyExit;
112  float scaleFactor;
113  float coolDown;
114  float min_x;
115  float max_x;
116  float min_y;
117  float max_y;
119 };
120 
124  float* forceX;
125  float* forceY;
126  double maxForceSq;
127  double avgForce;
128  float min_x;
129  float max_x;
130  float min_y;
131  float max_y;
136 
139  uint32_t numInnerNodes;
140 
143  uint32_t numLeaves;
144 };
145 
148  return min_max_functor<float>(pLocalContext->pGlobalContext->pGraph->nodeXPos(),
149  pLocalContext->min_x, pLocalContext->max_x);
150 }
151 
154  return min_max_functor<float>(pLocalContext->pGlobalContext->pGraph->nodeYPos(),
155  pLocalContext->min_y, pLocalContext->max_y);
156 }
157 
159 public:
160  inline LQMortonFunctor(FMELocalContext* pLocalContext) {
161  x = pLocalContext->pGlobalContext->pGraph->nodeXPos();
162  y = pLocalContext->pGlobalContext->pGraph->nodeYPos();
163  s = pLocalContext->pGlobalContext->pGraph->nodeSize();
164  quadtree = pLocalContext->pGlobalContext->pQuadtree;
165  translate_x = -quadtree->minX();
166  translate_y = -quadtree->minY();
167  scale = quadtree->scaleInv();
168  }
169 
170  inline uint32_t operator()(void) const { return quadtree->numberOfPoints(); }
171 
172  inline void operator()(uint32_t i) {
174  uint32_t ref = p.ref;
175  p.mortonNr = mortonNumber<uint64_t, uint32_t>((uint32_t)((x[ref] + translate_x) * scale),
176  (uint32_t)((y[ref] + translate_y) * scale));
177  }
178 
179  inline void operator()(uint32_t begin, uint32_t end) {
180  for (uint32_t i = begin; i <= end; i++) {
181  this->operator()(i);
182  }
183  }
184 
185 private:
187  float translate_x;
188  float translate_y;
189  double scale;
190  float* x;
191  float* y;
192  float* s;
193 };
194 
196 struct p2m_functor {
199 
201 
202  inline void operator()(LinearQuadtree::NodeID nodeIndex) {
203  uint32_t numPointsInLeaf = tree.numberOfPoints(nodeIndex);
204  uint32_t firstPointOfLeaf = tree.firstPoint(nodeIndex);
205  for (uint32_t pointIndex = firstPointOfLeaf;
206  pointIndex < (firstPointOfLeaf + numPointsInLeaf); pointIndex++) {
207  expansions.P2M(pointIndex, nodeIndex);
208  }
209  }
210 };
211 
213 static inline p2m_functor p2m_function(FMELocalContext* pLocalContext) {
214  return p2m_functor(*pLocalContext->pGlobalContext->pQuadtree,
215  *pLocalContext->pGlobalContext->pExpansion);
216 }
217 
219 struct m2m_functor {
222 
224 
226  expansions.M2M(child, parent);
227  }
228 
229  inline void operator()(LinearQuadtree::NodeID nodeIndex) {
230  tree.forall_children(pair_call(*this, nodeIndex))(nodeIndex);
231  }
232 };
233 
235 static inline m2m_functor m2m_function(FMELocalContext* pLocalContext) {
236  return m2m_functor(*pLocalContext->pGlobalContext->pQuadtree,
237  *pLocalContext->pGlobalContext->pExpansion);
238 }
239 
241 struct m2l_functor {
243 
245 
246  inline void operator()(LinearQuadtree::NodeID nodeIndexSource,
247  LinearQuadtree::NodeID nodeIndexReceiver) {
248  expansions.M2L(nodeIndexSource, nodeIndexReceiver);
249  }
250 };
251 
253 static inline m2l_functor m2l_function(FMELocalContext* pLocalContext) {
254  return m2l_functor(*pLocalContext->pGlobalContext->pExpansion);
255 }
256 
258 struct l2l_functor {
261 
263 
265  expansions.L2L(parent, child);
266  }
267 
268  inline void operator()(LinearQuadtree::NodeID nodeIndex) {
269  tree.forall_children(pair_call(*this, nodeIndex))(nodeIndex);
270  }
271 };
272 
274 static inline l2l_functor l2l_function(FMELocalContext* pLocalContext) {
275  return l2l_functor(*pLocalContext->pGlobalContext->pQuadtree,
276  *pLocalContext->pGlobalContext->pExpansion);
277 }
278 
280 struct l2p_functor {
283  float* fx;
284  float* fy;
285 
286  l2p_functor(const LinearQuadtree& t, LinearQuadtreeExpansion& e, float* x, float* y)
287  : tree(t), expansions(e), fx(x), fy(y) { }
288 
289  inline void operator()(LinearQuadtree::NodeID nodeIndex, LinearQuadtree::PointID pointIndex) {
290  expansions.L2P(nodeIndex, pointIndex, fx[pointIndex], fy[pointIndex]);
291  }
292 
293  inline void operator()(LinearQuadtree::PointID pointIndex) {
294  LinearQuadtree::NodeID nodeIndex = tree.pointLeaf(pointIndex);
295  this->operator()(nodeIndex, pointIndex);
296  }
297 };
298 
300 static inline l2p_functor l2p_function(FMELocalContext* pLocalContext) {
301  return l2p_functor(*pLocalContext->pGlobalContext->pQuadtree,
302  *pLocalContext->pGlobalContext->pExpansion, pLocalContext->forceX, pLocalContext->forceY);
303 }
304 
306 struct p2p_functor {
308  float* fx;
309  float* fy;
310 
311  p2p_functor(const LinearQuadtree& t, float* x, float* y) : tree(t), fx(x), fy(y) { }
312 
313  inline void operator()(LinearQuadtree::NodeID nodeIndexA, LinearQuadtree::NodeID nodeIndexB) {
314  uint32_t offsetA = tree.firstPoint(nodeIndexA);
315  uint32_t offsetB = tree.firstPoint(nodeIndexB);
316  uint32_t numPointsA = tree.numberOfPoints(nodeIndexA);
317  uint32_t numPointsB = tree.numberOfPoints(nodeIndexB);
318  eval_direct_fast(tree.pointX() + offsetA, tree.pointY() + offsetA,
319  tree.pointSize() + offsetA, fx + offsetA, fy + offsetA, numPointsA,
320  tree.pointX() + offsetB, tree.pointY() + offsetB, tree.pointSize() + offsetB,
321  fx + offsetB, fy + offsetB, numPointsB);
322  }
323 
324  inline void operator()(LinearQuadtree::NodeID nodeIndex) {
325  uint32_t offset = tree.firstPoint(nodeIndex);
326  uint32_t numPoints = tree.numberOfPoints(nodeIndex);
327  eval_direct_fast(tree.pointX() + offset, tree.pointY() + offset, tree.pointSize() + offset,
328  fx + offset, fy + offset, numPoints);
329  }
330 };
331 
333 static inline p2p_functor p2p_function(FMELocalContext* pLocalContext) {
334  return p2p_functor(*pLocalContext->pGlobalContext->pQuadtree, pLocalContext->forceX,
335  pLocalContext->forceY);
336 }
337 
340 public:
341  explicit LQPartitioner(FMELocalContext* pLocalContext)
342  : numPointsPerThread(0)
343  , numThreads(pLocalContext->pGlobalContext->numThreads)
344  , currThread(0)
345  , tree(pLocalContext->pGlobalContext->pQuadtree)
346  , localContexts(pLocalContext->pGlobalContext->pLocalContext) { }
347 
349  uint32_t numInnerNodesPerThread = tree->numberOfInnerNodes() / numThreads;
350  if (numInnerNodesPerThread < 25) {
353  for (uint32_t i = 1; i < numThreads; i++) {
355  }
356  } else {
358  currThread = 0;
361  for (uint32_t i = 0; i < tree->numberOfInnerNodes(); i++) {
363  curr = tree->nextNode(curr);
364  if (currThread < numThreads - 1
365  && localContexts[currThread]->innerNodePartition.numNodes
366  >= numInnerNodesPerThread) {
367  currThread++;
370  }
371  }
372  }
373 
374  uint32_t numLeavesPerThread = tree->numberOfLeaves() / numThreads;
375  if (numLeavesPerThread < 25) {
378  for (uint32_t i = 1; i < numThreads; i++) {
380  }
381  } else {
383  currThread = 0;
384  localContexts[0]->leafPartition.begin = curr;
386  for (uint32_t i = 0; i < tree->numberOfLeaves(); i++) {
388  curr = tree->nextNode(curr);
389  if (currThread < numThreads - 1
390  && localContexts[currThread]->leafPartition.numNodes >= numLeavesPerThread) {
391  currThread++;
394  }
395  }
396  }
397  }
398 
399  void partition() {
401  currThread = 0;
403  for (uint32_t i = 0; i < numThreads; i++) {
404  localContexts[i]->treePartition.nodes.clear();
406  }
407  if (numThreads > 1) {
408  newPartition();
409  }
410  }
411 
412  void newPartition(uint32_t nodeID) {
413  uint32_t bound = tree->numberOfPoints() / (numThreads * numThreads);
414 
415  if (tree->isLeaf(nodeID) || tree->numberOfPoints(nodeID) < bound) {
416  l_par.push_back(nodeID);
417  } else {
418  for (uint32_t i = 0; i < tree->numberOfChilds(nodeID); i++) {
419  newPartition(tree->child(nodeID, i));
420  }
421  }
422  }
423 
424  void newPartition() {
425  l_par.clear();
426  newPartition(tree->root());
427  uint32_t bound = (tree->numberOfPoints() / (numThreads))
428  + (tree->numberOfPoints() / (numThreads * numThreads * 2));
429  while (!l_par.empty()) {
431  uint32_t v = l_par.front();
432  if (((partition->pointCount + tree->numberOfPoints(v)) <= bound)
433  || (currThread == numThreads - 1)) {
434  partition->pointCount += tree->numberOfPoints(v);
435  partition->nodes.push_back(v);
436  tree->nodeFence(v);
437  l_par.pop_front();
438  } else {
439  currThread++;
440  }
441  }
442  }
443 
445 
446 private:
448  uint32_t numThreads;
449  uint32_t currThread;
450  std::list<uint32_t> l_par;
453 };
454 
456 public:
457  inline explicit LQPointUpdateFunctor(FMELocalContext* pLocalContext) {
458  x = pLocalContext->pGlobalContext->pGraph->nodeXPos();
459  y = pLocalContext->pGlobalContext->pGraph->nodeYPos();
460  s = pLocalContext->pGlobalContext->pGraph->nodeSize();
461  quadtree = pLocalContext->pGlobalContext->pQuadtree;
462  }
463 
464  inline uint32_t operator()(void) const { return quadtree->numberOfPoints(); }
465 
466  inline void operator()(uint32_t i) {
468  uint32_t ref = p.ref;
469  quadtree->setPoint(i, x[ref], y[ref], s[ref]);
470  }
471 
472  inline void operator()(uint32_t begin, uint32_t end) {
473  for (uint32_t i = begin; i <= end; i++) {
474  this->operator()(i);
475  }
476  }
477 
478 private:
480  float* x;
481  float* y;
482  float* s;
483 };
484 
489 public:
490  inline explicit LQCoordsFunctor(FMELocalContext* pLocalContext) {
491  quadtree = pLocalContext->pGlobalContext->pQuadtree;
492  quadtreeExp = pLocalContext->pGlobalContext->pExpansion;
493  }
494 
495  inline uint32_t operator()(void) const { return quadtree->numberOfNodes(); }
496 
497  inline void operator()(uint32_t i) { quadtree->computeCoords(i); }
498 
499  inline void operator()(uint32_t begin, uint32_t end) {
500  for (uint32_t i = begin; i <= end; i++) {
501  this->operator()(i);
502  }
503  }
504 
505 private:
508 };
509 
514 class M2LFunctor {
515 public:
516  inline explicit M2LFunctor(FMELocalContext* pLocalContext) {
517  quadtree = pLocalContext->pGlobalContext->pQuadtree;
518  quadtreeExp = pLocalContext->pGlobalContext->pExpansion;
519  wspd = pLocalContext->pGlobalContext->pWSPD;
520  }
521 
522  inline uint32_t operator()(void) const { return quadtree->numberOfNodes(); }
523 
524  inline void operator()(uint32_t i) {
525  uint32_t currEntryIndex = wspd->firstPairEntry(i);
526  for (uint32_t k = 0; k < wspd->numWSNodes(i); k++) {
527  uint32_t j = wspd->wsNodeOfPair(currEntryIndex, i);
528  quadtreeExp->M2L(j, i);
529  currEntryIndex = wspd->nextPair(currEntryIndex, i);
530  }
531  }
532 
533  inline void operator()(uint32_t begin, uint32_t end) {
534  for (uint32_t i = begin; i <= end; i++) {
535  this->operator()(i);
536  }
537  }
538 
539 private:
543 };
544 
548 class NDFunctor {
549 public:
550  inline explicit NDFunctor(FMELocalContext* pLocalContext) {
551  quadtree = pLocalContext->pGlobalContext->pQuadtree;
552  quadtreeExp = pLocalContext->pGlobalContext->pExpansion;
553  forceArrayX = pLocalContext->forceX;
554  forceArrayY = pLocalContext->forceY;
555  }
556 
557  inline uint32_t operator()(void) const { return quadtree->numberOfDirectNodes(); }
558 
559  inline void operator()(uint32_t i) {
560  uint32_t nodeI = quadtree->directNode(i);
561  uint32_t offset = quadtree->firstPoint(nodeI);
562  uint32_t numPoints = quadtree->numberOfPoints(nodeI);
563  eval_direct_fast(quadtree->pointX() + offset, quadtree->pointY() + offset,
564  quadtree->pointSize() + offset, forceArrayX + offset, forceArrayY + offset,
565  numPoints);
566  }
567 
568  inline void operator()(uint32_t begin, uint32_t end) {
569  for (uint32_t i = begin; i <= end; i++) {
570  this->operator()(i);
571  }
572  }
573 
574 private:
577  float* forceArrayX;
578  float* forceArrayY;
579 };
580 
584 class D2DFunctor {
585 public:
586  inline explicit D2DFunctor(FMELocalContext* pLocalContext) {
587  quadtree = pLocalContext->pGlobalContext->pQuadtree;
588  quadtreeExp = pLocalContext->pGlobalContext->pExpansion;
589  forceArrayX = pLocalContext->forceX;
590  forceArrayY = pLocalContext->forceY;
591  }
592 
593  inline uint32_t operator()(void) const { return quadtree->numberOfDirectPairs(); }
594 
595  inline void operator()(uint32_t i) {
596  uint32_t nodeA = quadtree->directNodeA(i);
597  uint32_t nodeB = quadtree->directNodeB(i);
598  uint32_t offsetA = quadtree->firstPoint(nodeA);
599  uint32_t offsetB = quadtree->firstPoint(nodeB);
600  uint32_t numPointsA = quadtree->numberOfPoints(nodeA);
601  uint32_t numPointsB = quadtree->numberOfPoints(nodeB);
602  eval_direct_fast(quadtree->pointX() + offsetA, quadtree->pointY() + offsetA,
603  quadtree->pointSize() + offsetA, forceArrayX + offsetA, forceArrayY + offsetA,
604  numPointsA, quadtree->pointX() + offsetB, quadtree->pointY() + offsetB,
605  quadtree->pointSize() + offsetB, forceArrayX + offsetB, forceArrayY + offsetB,
606  numPointsB);
607  }
608 
609  inline void operator()(uint32_t begin, uint32_t end) {
610  for (uint32_t i = begin; i <= end; i++) {
611  this->operator()(i);
612  }
613  }
614 
615 private:
618  float* forceArrayX;
619  float* forceArrayY;
620 };
621 
622 enum class FMEEdgeForce { SubRep = 0x2, DivDegree = 0x8 };
623 
624 inline int operator&(int lhs, FMEEdgeForce rhs) { return lhs & static_cast<int>(rhs); }
625 
626 template<unsigned int FLAGS>
628 public:
629  inline explicit EdgeForceFunctor(FMELocalContext* pLocalContext) {
630  pGraph = pLocalContext->pGlobalContext->pGraph;
631  x = pGraph->nodeXPos();
632  y = pGraph->nodeYPos();
633  edgeInfo = pGraph->edgeInfo();
634  nodeInfo = pGraph->nodeInfo();
636  nodeSize = pGraph->nodeSize();
637  forceArrayX = pLocalContext->forceX;
638  forceArrayY = pLocalContext->forceY;
639  }
640 
641  inline uint32_t operator()(void) const { return pGraph->numEdges(); }
642 
643  inline void operator()(uint32_t i) {
644  const EdgeAdjInfo& e_info = edgeInfo[i];
645  const NodeAdjInfo& a_info = nodeInfo[e_info.a];
646  const NodeAdjInfo& b_info = nodeInfo[e_info.b];
647 
648  float d_x = x[e_info.a] - x[e_info.b];
649  float d_y = y[e_info.a] - y[e_info.b];
650  float d_sq = d_x * d_x + d_y * d_y;
651 
652  float f = (float)(logf(d_sq) * 0.5f - logf(desiredEdgeLength[i]));
653 
654  float fa = f * 0.25f;
655  float fb = f * 0.25f;
656 
657  if (FLAGS & FMEEdgeForce::DivDegree) {
658  fa = (float)(fa / ((float)a_info.degree));
659  fb = (float)(fb / ((float)b_info.degree));
660  }
661 
662  if (FLAGS & FMEEdgeForce::SubRep) {
663  fa += (nodeSize[e_info.b] / d_sq);
664  fb += (nodeSize[e_info.a] / d_sq);
665  }
666  forceArrayX[e_info.a] -= fa * d_x;
667  forceArrayY[e_info.a] -= fa * d_y;
668  forceArrayX[e_info.b] += fb * d_x;
669  forceArrayY[e_info.b] += fb * d_y;
670  }
671 
672  inline void operator()(uint32_t begin, uint32_t end) {
673  for (uint32_t i = begin; i <= end; i++) {
674  this->operator()(i);
675  }
676  }
677 
678 private:
679  float* x;
680  float* y;
683 
686  float* nodeSize;
687  float* forceArrayX;
688  float* forceArrayY;
689 };
690 
691 template<unsigned int FLAGS>
693  return EdgeForceFunctor<FLAGS>(pLocalContext);
694 }
695 
696 
697 enum class FMECollect {
698  NoFactor = 0x00,
699  EdgeFactor = 0x01,
700  RepulsiveFactor = 0x02,
701  EdgeFactorRep = 0x04,
702  Tree2GraphOrder = 0x08,
703  ZeroThreadArray = 0x10
704 };
705 
706 inline int operator&(int lhs, FMECollect rhs) { return lhs & static_cast<int>(rhs); }
707 
708 inline constexpr int operator|(int lhs, FMECollect rhs) { return lhs | static_cast<int>(rhs); }
709 
710 inline constexpr int operator|(FMECollect lhs, FMECollect rhs) {
711  return static_cast<int>(lhs) | static_cast<int>(rhs);
712 }
713 
714 template<unsigned int FLAGS>
716 public:
717  inline explicit CollectForceFunctor(FMELocalContext* pLocalContext) {
718  numContexts = pLocalContext->pGlobalContext->numThreads;
719  globalContext = pLocalContext->pGlobalContext;
720  localContexts = pLocalContext->pGlobalContext->pLocalContext;
723  pGraph = pLocalContext->pGlobalContext->pGraph;
724  if (FLAGS & FMECollect::EdgeFactor) {
725  factor = pLocalContext->pGlobalContext->pOptions->edgeForceFactor;
726  } else if (FLAGS & FMECollect::RepulsiveFactor) {
727  factor = pLocalContext->pGlobalContext->pOptions->repForceFactor;
728  } else if (FLAGS & FMECollect::EdgeFactorRep) {
730  } else {
731  factor = 1.0;
732  }
733  }
734 
735  inline uint32_t operator()(void) const { return pGraph->numNodes(); }
736 
737  inline void operator()(uint32_t i) {
738  float sumX = 0.0f;
739  float sumY = 0.0f;
740  for (uint32_t j = 0; j < numContexts; j++) {
741  float* localArrayX = localContexts[j]->forceX;
742  float* localArrayY = localContexts[j]->forceY;
743  sumX += localArrayX[i];
744  sumY += localArrayY[i];
745  if (FLAGS & FMECollect::ZeroThreadArray) {
746  localArrayX[i] = 0.0f;
747  localArrayY[i] = 0.0f;
748  }
749  }
750 
751  if (FLAGS & FMECollect::Tree2GraphOrder) {
753  }
754  if (FLAGS & FMECollect::RepulsiveFactor && pGraph->nodeInfo(i).degree > 100) {
755  // prevent some evil effects
756  sumX /= (float)pGraph->nodeInfo(i).degree;
757  sumY /= (float)pGraph->nodeInfo(i).degree;
758  }
759  globalArrayX[i] += sumX * factor;
760  globalArrayY[i] += sumY * factor;
761  }
762 
763  inline void operator()(uint32_t begin, uint32_t end) {
764  for (uint32_t i = begin; i <= end; i++) {
765  this->operator()(i);
766  }
767  }
768 
769 private:
773  float* globalArrayX;
774  float* globalArrayY;
775  uint32_t numContexts;
776  float factor;
777 };
778 
779 template<unsigned int FLAGS>
781  return CollectForceFunctor<FLAGS>(pLocalContext);
782 }
783 
784 static constexpr int TIME_STEP_NORMAL = 0x1;
785 static constexpr int TIME_STEP_PREP = 0x2;
786 static constexpr int ZERO_GLOBAL_ARRAY = 0x4;
787 static constexpr int USE_NODE_MOVE_RAD = 0x8;
788 
789 template<unsigned int FLAGS>
791 public:
792 #if 1
793  inline explicit NodeMoveFunctor(FMELocalContext* pLocalContext)
794 #else
795  inline NodeMoveFunctor(FMELocalContext* pLocalContext, float* xCoords, float* yCoords,
796  float ftimeStep, float* globalForceArray)
797  : x(xCoords)
798  , y(yCoords)
799  , timeStep(ftimeStep)
800  , forceArray(globalForceArray) {}
801 #endif
802  {
803  if (FLAGS & TIME_STEP_NORMAL) {
804  timeStep = pLocalContext->pGlobalContext->pOptions->timeStep
805  * pLocalContext->pGlobalContext->coolDown;
806  } else if (FLAGS & TIME_STEP_PREP) {
807  timeStep = pLocalContext->pGlobalContext->pOptions->preProcTimeStep;
808  } else {
809  timeStep = 1.0;
810  }
811  pGraph = pLocalContext->pGlobalContext->pGraph;
812  x = pGraph->nodeXPos();
813  y = pGraph->nodeYPos();
815  forceArrayX = pLocalContext->pGlobalContext->globalForceX;
816  forceArrayY = pLocalContext->pGlobalContext->globalForceY;
817  localContext = pLocalContext;
819  }
820 
821 #if 0
822  inline void operator()(void) const
823  {
824  return pGraph->numNodes();
825  };
826 #endif
827 
828  inline void operator()(uint32_t i) {
829  float d_x = forceArrayX[i] * timeStep;
830  float d_y = forceArrayY[i] * timeStep;
831  double dsq = (d_x * d_x + d_y * d_y);
832  double d = sqrt(dsq);
833 
834  localContext->maxForceSq = max<double>(localContext->maxForceSq, (double)dsq);
835  localContext->avgForce += d;
836  if (d < FLT_MAX) {
837  x[i] += d_x;
838  y[i] += d_y;
839  if (FLAGS & ZERO_GLOBAL_ARRAY) {
840  forceArrayX[i] = 0.0;
841  forceArrayY[i] = 0.0;
842  } else {
843  forceArrayX[i] = d_x;
844  forceArrayY[i] = d_y;
845  }
846  } else {
847  forceArrayX[i] = 0.0;
848  forceArrayY[i] = 0.0;
849  }
850  }
851 
852  inline void operator()(uint32_t begin, uint32_t end) {
853  for (uint32_t i = begin; i <= end; i++) {
854  this->operator()(i);
855  }
856  }
857 
858 private:
859  float timeStep;
860  float* x;
861  float* y;
862  float* forceArrayX;
863  float* forceArrayY;
868 };
869 
870 template<unsigned int FLAGS>
872  return NodeMoveFunctor<FLAGS>(pLocalContext);
873 }
874 
875 template<typename TYP>
876 inline void for_loop_array_set(uint32_t threadNr, uint32_t numThreads, TYP* a, uint32_t n, TYP value) {
877  uint32_t s = n / numThreads;
878  uint32_t o = s * threadNr;
879  if (threadNr == numThreads - 1) {
880  s = s + (n % numThreads);
881  }
882 
883  for (uint32_t i = 0; i < s; i++) {
884  a[o + i] = value;
885  }
886 }
887 
888 }
889 }
ogdf::fast_multipole_embedder::p2p_functor::fx
float * fx
Definition: FMEFunc.h:308
ogdf::fast_multipole_embedder::LinearQuadtree::minX
float minX() const
Definition: LinearQuadtree.h:545
ogdf::fast_multipole_embedder::l2l_functor::operator()
void operator()(LinearQuadtree::NodeID nodeIndex)
Definition: FMEFunc.h:268
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::fast_multipole_embedder::CollectForceFunctor::localContexts
FMELocalContext ** localContexts
Definition: FMEFunc.h:772
ogdf::fast_multipole_embedder::LinearQuadtree::numberOfNodes
uint32_t numberOfNodes() const
returns the number of nodes in this tree
Definition: LinearQuadtree.h:432
ogdf::fast_multipole_embedder::FMENodeChainPartition::numNodes
uint32_t numNodes
Definition: FMEFunc.h:69
ogdf::fast_multipole_embedder::min_max_y_function
static min_max_functor< float > min_max_y_function(FMELocalContext *pLocalContext)
creates a min max functor for the y coords of the node
Definition: FMEFunc.h:153
ogdf::fast_multipole_embedder::l2p_functor::fy
float * fy
Definition: FMEFunc.h:284
ogdf::fast_multipole_embedder::LQPartitioner::newPartition
void newPartition()
Definition: FMEFunc.h:424
ogdf::fast_multipole_embedder::LinearQuadtree::NodeID
unsigned int NodeID
Definition: LinearQuadtree.h:55
ogdf::fast_multipole_embedder::EdgeForceFunctor::nodeInfo
NodeAdjInfo * nodeInfo
Definition: FMEFunc.h:682
ogdf::fast_multipole_embedder::LQMortonFunctor::s
float * s
Definition: FMEFunc.h:192
ogdf::fast_multipole_embedder::FMEGlobalOptions::edgeForceFactor
float edgeForceFactor
edge force factor for the main step
Definition: FMEFunc.h:79
ogdf::fast_multipole_embedder::FMEGlobalContext::pOptions
FMEGlobalOptions * pOptions
pointer to the global options
Definition: FMEFunc.h:110
ogdf::fast_multipole_embedder::EdgeForceFunctor::operator()
uint32_t operator()(void) const
Definition: FMEFunc.h:641
ogdf::fast_multipole_embedder::LinearQuadtree::numberOfDirectNodes
uint32_t numberOfDirectNodes() const
Definition: LinearQuadtree.h:533
ogdf::fast_multipole_embedder::FMEGlobalContext::pExpansion
LinearQuadtreeExpansion * pExpansion
pointer to the coeefficients
Definition: FMEFunc.h:106
ogdf::fast_multipole_embedder::operator&
int operator&(int lhs, FMEEdgeForce rhs)
Definition: FMEFunc.h:624
ogdf::fast_multipole_embedder::D2DFunctor::quadtree
LinearQuadtree * quadtree
Definition: FMEFunc.h:616
ogdf::fast_multipole_embedder::m2l_functor::expansions
LinearQuadtreeExpansion & expansions
Definition: FMEFunc.h:242
ogdf::fast_multipole_embedder::FMEGlobalOptions::stopCritForce
double stopCritForce
stopping criteria
Definition: FMEFunc.h:89
LinearQuadtree.h
Declaration of class LinearQuadtree.
ogdf::fast_multipole_embedder::FMELocalContext::maxForceSq
double maxForceSq
local maximum force
Definition: FMEFunc.h:126
ogdf::fast_multipole_embedder::p2p_function
static p2p_functor p2p_function(FMELocalContext *pLocalContext)
creates Local-to-Point functor
Definition: FMEFunc.h:333
ogdf::fast_multipole_embedder::NDFunctor::operator()
void operator()(uint32_t i)
Definition: FMEFunc.h:559
ogdf::fast_multipole_embedder::EdgeForceFunctor::forceArrayY
float * forceArrayY
Definition: FMEFunc.h:688
ogdf::fast_multipole_embedder::FMEGlobalOptions::normNodeSize
float normNodeSize
average node size when node sizes are normalized
Definition: FMEFunc.h:82
ogdf::fast_multipole_embedder::LQCoordsFunctor
Computes the coords and size of the i-th node in the LinearQuadtree.
Definition: FMEFunc.h:488
ogdf::fast_multipole_embedder::LinearQuadtree::directNode
NodeID directNode(uint32_t i) const
Definition: LinearQuadtree.h:535
ogdf::fast_multipole_embedder::CollectForceFunctor::operator()
uint32_t operator()(void) const
Definition: FMEFunc.h:735
ogdf::fast_multipole_embedder::ArrayGraph
Definition: ArrayGraph.h:46
ogdf::fast_multipole_embedder::LQCoordsFunctor::operator()
void operator()(uint32_t i)
Definition: FMEFunc.h:497
ogdf::fast_multipole_embedder::D2DFunctor::D2DFunctor
D2DFunctor(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:586
ogdf::fast_multipole_embedder::LinearQuadtree::forall_children
forall_children_functor< F > forall_children(F f) const
creator
Definition: LinearQuadtree.h:154
ogdf::fast_multipole_embedder::l2l_functor::expansions
LinearQuadtreeExpansion & expansions
Definition: FMEFunc.h:260
ogdf::fast_multipole_embedder::LQMortonFunctor::translate_y
float translate_y
Definition: FMEFunc.h:188
ogdf::fast_multipole_embedder::D2DFunctor::operator()
void operator()(uint32_t i)
Definition: FMEFunc.h:595
ogdf::fast_multipole_embedder::LinearQuadtree::firstInnerNode
NodeID firstInnerNode() const
Definition: LinearQuadtree.h:521
ogdf::fast_multipole_embedder::FMEGlobalOptions::doPostProcessing
bool doPostProcessing
enable postprocessing
Definition: FMEFunc.h:87
ogdf::fast_multipole_embedder::D2DFunctor::forceArrayX
float * forceArrayX
Definition: FMEFunc.h:618
ogdf::fast_multipole_embedder::l2p_functor::l2p_functor
l2p_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e, float *x, float *y)
Definition: FMEFunc.h:286
ogdf::fast_multipole_embedder::LQCoordsFunctor::quadtree
LinearQuadtree * quadtree
Definition: FMEFunc.h:506
ogdf::fast_multipole_embedder::NDFunctor::operator()
uint32_t operator()(void) const
Definition: FMEFunc.h:557
ogdf::fast_multipole_embedder::NodeAdjInfo
Information about incident edges (16 bytes).
Definition: EdgeChain.h:44
ogdf::fast_multipole_embedder::FMETreePartition::pointCount
uint32_t pointCount
Definition: FMEFunc.h:57
ogdf::fast_multipole_embedder::WSPD
Class for the Well-Separated-Pairs-Decomposition (WSPD)
Definition: WSPD.h:43
ogdf::fast_multipole_embedder::LinearQuadtree::numberOfInnerNodes
uint32_t numberOfInnerNodes() const
Definition: LinearQuadtree.h:523
ogdf::fast_multipole_embedder::LQPointUpdateFunctor::y
float * y
Definition: FMEFunc.h:481
ogdf::begin
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
ogdf::fast_multipole_embedder::l2p_functor::fx
float * fx
Definition: FMEFunc.h:283
ogdf::fast_multipole_embedder::LQPointUpdateFunctor::quadtree
LinearQuadtree * quadtree
Definition: FMEFunc.h:479
ogdf::fast_multipole_embedder::FMENodeChainPartition
Definition: FMEFunc.h:67
ogdf::fast_multipole_embedder::WSPD::wsNodeOfPair
uint32_t wsNodeOfPair(uint32_t currPairIndex, NodeID a) const
Returns the other node (not a) of the pair with index currPairIndex.
Definition: WSPD.h:83
ogdf::fast_multipole_embedder::EdgeAdjInfo::a
uint32_t a
First node of the pair.
Definition: EdgeChain.h:55
ogdf::fast_multipole_embedder::FMELocalContext::pGlobalContext
FMEGlobalContext * pGlobalContext
pointer to the global context
Definition: FMEFunc.h:123
ogdf::fast_multipole_embedder::l2l_functor::tree
const LinearQuadtree & tree
Definition: FMEFunc.h:259
ogdf::fast_multipole_embedder::LinearQuadtree::scaleInv
double scaleInv() const
Definition: LinearQuadtree.h:553
ogdf::fast_multipole_embedder::LQPointUpdateFunctor::LQPointUpdateFunctor
LQPointUpdateFunctor(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:457
ogdf::fast_multipole_embedder::FMELocalContext::leafPartition
FMENodeChainPartition leafPartition
chain of leaf nodes assigned to the thread
Definition: FMEFunc.h:135
ogdf::fast_multipole_embedder::ArrayGraph::numNodes
uint32_t numNodes() const
Returns the number of nodes.
Definition: ArrayGraph.h:62
ogdf::fast_multipole_embedder::FMETreePartition::for_loop
void for_loop(Func &func)
Definition: FMEFunc.h:60
ogdf::fast_multipole_embedder::EdgeForceFunctor
Definition: FMEFunc.h:627
ogdf::fast_multipole_embedder::LinearQuadtree::computeCoords
void computeCoords(NodeID nodeIndex)
Definition: LinearQuadtree.h:555
ogdf::fast_multipole_embedder::FMECollect::NoFactor
@ NoFactor
ogdf::fast_multipole_embedder::FMECollect::ZeroThreadArray
@ ZeroThreadArray
ogdf::fast_multipole_embedder::pair_call
static pair_call_functor< F, A > pair_call(F f, A a)
creates a pair call resulting in a call f(a, *)
Definition: FMEFunctional.h:153
ogdf::fast_multipole_embedder::FMECollect::EdgeFactor
@ EdgeFactor
ogdf::fast_multipole_embedder::LinearQuadtree::numberOfDirectPairs
uint32_t numberOfDirectPairs() const
Definition: LinearQuadtree.h:531
ogdf::fast_multipole_embedder::TIME_STEP_NORMAL
static constexpr int TIME_STEP_NORMAL
Definition: FMEFunc.h:784
ogdf::fast_multipole_embedder::FMENodeChainPartition::begin
uint32_t begin
Definition: FMEFunc.h:68
ogdf::fast_multipole_embedder::p2m_functor::operator()
void operator()(LinearQuadtree::NodeID nodeIndex)
Definition: FMEFunc.h:202
ogdf::fast_multipole_embedder::ArrayGraph::nodeXPos
float * nodeXPos()
Returns the x coord array for all nodes.
Definition: ArrayGraph.h:168
ogdf::fast_multipole_embedder::LQPartitioner::l_par
std::list< uint32_t > l_par
Definition: FMEFunc.h:450
ogdf::fast_multipole_embedder::FMEGlobalContext::pGraph
ArrayGraph * pGraph
pointer to the array graph
Definition: FMEFunc.h:104
ogdf::fast_multipole_embedder::FMECollect::RepulsiveFactor
@ RepulsiveFactor
ogdf::fast_multipole_embedder::LinearQuadtree::nextNode
NodeID nextNode(NodeID nodeID) const
Definition: LinearQuadtree.h:377
ogdf::fast_multipole_embedder::LQMortonFunctor::quadtree
LinearQuadtree * quadtree
Definition: FMEFunc.h:186
ogdf::fast_multipole_embedder::l2p_functor::operator()
void operator()(LinearQuadtree::NodeID nodeIndex, LinearQuadtree::PointID pointIndex)
Definition: FMEFunc.h:289
ogdf::fast_multipole_embedder::FMELocalContext::forceY
float * forceY
local force array for all nodes, points
Definition: FMEFunc.h:125
ogdf::fast_multipole_embedder::TIME_STEP_PREP
static constexpr int TIME_STEP_PREP
Definition: FMEFunc.h:785
ogdf::fast_multipole_embedder::p2p_functor::operator()
void operator()(LinearQuadtree::NodeID nodeIndex)
Definition: FMEFunc.h:324
ogdf::fast_multipole_embedder::LQMortonFunctor::operator()
void operator()(uint32_t begin, uint32_t end)
Definition: FMEFunc.h:179
ogdf::fast_multipole_embedder::CollectForceFunctor::globalArrayX
float * globalArrayX
Definition: FMEFunc.h:773
ogdf::fast_multipole_embedder::FMEGlobalContext::coolDown
float coolDown
Definition: FMEFunc.h:113
ogdf::fast_multipole_embedder::NodeMoveFunctor::operator()
void operator()(uint32_t begin, uint32_t end)
Definition: FMEFunc.h:852
ArrayGraph.h
Declaration of class ArrayGraph.
ogdf::fast_multipole_embedder::FMELocalContext::max_y
float max_y
global point, node max y coordinate for bounding box calculations
Definition: FMEFunc.h:131
ogdf::fast_multipole_embedder::NodeMoveFunctor::nodeMoveRadius
float * nodeMoveRadius
Definition: FMEFunc.h:864
LinearQuadtreeExpansion.h
Declaration of class LinearQuadtreeExpansion.
ogdf::fast_multipole_embedder::LQPointUpdateFunctor::operator()
uint32_t operator()(void) const
Definition: FMEFunc.h:464
ogdf::fast_multipole_embedder::LinearQuadtree::pointSize
float pointSize(PointID point) const
Definition: LinearQuadtree.h:456
ogdf::fast_multipole_embedder::FMELocalContext::avgForce
double avgForce
local maximum force
Definition: FMEFunc.h:127
ogdf::fast_multipole_embedder::LQPartitioner::numThreads
uint32_t numThreads
Definition: FMEFunc.h:448
ogdf::fast_multipole_embedder::LinearQuadtree::numberOfLeaves
uint32_t numberOfLeaves() const
Definition: LinearQuadtree.h:527
ogdf::fast_multipole_embedder::FMEGlobalOptions::preProcMaxNumIterations
uint32_t preProcMaxNumIterations
number of iterations the preprocessing is applied
Definition: FMEFunc.h:76
ogdf::fast_multipole_embedder::EdgeForceFunctor::operator()
void operator()(uint32_t i)
Definition: FMEFunc.h:643
ogdf::fast_multipole_embedder::WSPD::nextPair
uint32_t nextPair(uint32_t currPairIndex, NodeID a) const
Returns the index of the next pair of currPairIndex of the node with index a.
Definition: WSPD.h:78
ogdf::fast_multipole_embedder::FMELocalContext::numInnerNodes
uint32_t numInnerNodes
number of inner nodes the thread prepared
Definition: FMEFunc.h:139
ogdf::fast_multipole_embedder::LinearQuadtree::numberOfPoints
uint32_t numberOfPoints(NodeID nodeID) const
returns the number of points contained in the subtree of node nodeID
Definition: LinearQuadtree.h:418
ogdf::fast_multipole_embedder::m2m_functor::m2m_functor
m2m_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e)
Definition: FMEFunc.h:223
ogdf::fast_multipole_embedder::FMEGlobalContext::pQuadtree
LinearQuadtree * pQuadtree
pointer to the quadtree
Definition: FMEFunc.h:105
ogdf::fast_multipole_embedder::FMETreePartition::nodes
std::list< LinearQuadtree::NodeID > nodes
Definition: FMEFunc.h:56
ogdf::fast_multipole_embedder::FMEGlobalContext::currAvgEdgeLength
double currAvgEdgeLength
Definition: FMEFunc.h:118
ogdf::fast_multipole_embedder::LinearQuadtreeExpansion
Definition: LinearQuadtreeExpansion.h:45
ogdf::fast_multipole_embedder::LinearQuadtreeExpansion::P2M
void P2M(uint32_t point, uint32_t receiver)
adds a point with the given charge to the receiver expansion
ogdf::fast_multipole_embedder::FMELocalContext::firstInnerNode
LinearQuadtree::NodeID firstInnerNode
first inner nodes the thread prepared
Definition: FMEFunc.h:137
ogdf::fast_multipole_embedder::LinearQuadtree::LQPoint::mortonNr
MortonNR mortonNr
Definition: LinearQuadtree.h:60
ogdf::fast_multipole_embedder::NodeMoveFunctor::y
float * y
Definition: FMEFunc.h:861
FastUtils.h
Definition of utility functions for FME layout.
ogdf::fast_multipole_embedder::m2m_functor::operator()
void operator()(LinearQuadtree::NodeID parent, LinearQuadtree::NodeID child)
Definition: FMEFunc.h:225
ogdf::fast_multipole_embedder::LQPartitioner::partitionNodeChains
void partitionNodeChains()
Definition: FMEFunc.h:348
ogdf::fast_multipole_embedder::FMEGlobalOptions::doPrepProcessing
bool doPrepProcessing
enable preprocessing
Definition: FMEFunc.h:86
ogdf::fast_multipole_embedder::NodeMoveFunctor::operator()
void operator()(uint32_t i)
Definition: FMEFunc.h:828
ogdf::fast_multipole_embedder::LinearQuadtreeExpansion::L2L
void L2L(uint32_t source, uint32_t receiver)
shifts the source local coefficient to the center of the receiver and adds them
ogdf::fast_multipole_embedder::EdgeForceFunctor::edgeInfo
EdgeAdjInfo * edgeInfo
Definition: FMEFunc.h:681
ogdf::fast_multipole_embedder::node_move_function
static NodeMoveFunctor< FLAGS > node_move_function(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:871
ogdf::fast_multipole_embedder::CollectForceFunctor::pGraph
ArrayGraph * pGraph
Definition: FMEFunc.h:770
ogdf::fast_multipole_embedder::LinearQuadtree::firstPoint
PointID firstPoint(NodeID nodeID) const
Definition: LinearQuadtree.h:383
ogdf::fast_multipole_embedder::LinearQuadtree::pointLeaf
NodeID pointLeaf(PointID point) const
Definition: LinearQuadtree.h:448
ogdf::fast_multipole_embedder::l2l_functor
Local-to-Local functor.
Definition: FMEFunc.h:258
ogdf::fast_multipole_embedder::LinearQuadtree::child
NodeID child(NodeID nodeID, uint32_t i) const
returns the i th child index of node nodeID
Definition: LinearQuadtree.h:406
ogdf::fast_multipole_embedder::m2m_function
static m2m_functor m2m_function(FMELocalContext *pLocalContext)
creates Multipole-to-Multipole functor
Definition: FMEFunc.h:235
ogdf::fast_multipole_embedder::M2LFunctor::operator()
uint32_t operator()(void) const
Definition: FMEFunc.h:522
ogdf::fast_multipole_embedder::LQPointUpdateFunctor::operator()
void operator()(uint32_t i)
Definition: FMEFunc.h:466
ogdf::fast_multipole_embedder::LQPartitioner::currPartition
FMETreePartition * currPartition()
Definition: FMEFunc.h:444
ogdf::fast_multipole_embedder::CollectForceFunctor::numContexts
uint32_t numContexts
Definition: FMEFunc.h:775
ogdf::fast_multipole_embedder::FMEGlobalOptions
the main global options for a run
Definition: FMEFunc.h:73
ogdf::fast_multipole_embedder::FMEGlobalContext::min_y
float min_y
global point, node min y coordinate for bounding box calculations
Definition: FMEFunc.h:116
ogdf::fast_multipole_embedder::FMELocalContext::min_x
float min_x
global point, node min x coordinate for bounding box calculations
Definition: FMEFunc.h:128
ogdf::fast_multipole_embedder::FMEEdgeForce::SubRep
@ SubRep
ogdf::fast_multipole_embedder::LQPartitioner::tree
LinearQuadtree * tree
Definition: FMEFunc.h:451
ogdf::fast_multipole_embedder::LinearQuadtree::LQPoint::ref
uint32_t ref
Definition: LinearQuadtree.h:62
ogdf::fast_multipole_embedder::LQMortonFunctor::operator()
void operator()(uint32_t i)
Definition: FMEFunc.h:172
ogdf::fast_multipole_embedder::M2LFunctor
Converts the multipole expansion coefficients from all nodes which are well separated from the i-th n...
Definition: FMEFunc.h:514
WSPD.h
Declaration of class WSPD (well-separated pair decomposition).
ogdf::fast_multipole_embedder::LinearQuadtree::pointX
float pointX(PointID point) const
Definition: LinearQuadtree.h:452
ogdf::fast_multipole_embedder::FMEGlobalContext
Global Context.
Definition: FMEFunc.h:101
ogdf::fast_multipole_embedder::USE_NODE_MOVE_RAD
static constexpr int USE_NODE_MOVE_RAD
Definition: FMEFunc.h:787
ogdf::fast_multipole_embedder::p2p_functor::fy
float * fy
Definition: FMEFunc.h:309
ogdf::fast_multipole_embedder::ArrayGraph::nodeMoveRadius
float * nodeMoveRadius()
Returns the node movement radius array for all nodes.
Definition: ArrayGraph.h:186
ogdf::fast_multipole_embedder::LQCoordsFunctor::operator()
void operator()(uint32_t begin, uint32_t end)
Definition: FMEFunc.h:499
ogdf::fast_multipole_embedder::EdgeForceFunctor::EdgeForceFunctor
EdgeForceFunctor(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:629
ogdf::fast_multipole_embedder::NodeMoveFunctor::NodeMoveFunctor
NodeMoveFunctor(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:793
ogdf::fast_multipole_embedder::LQMortonFunctor::LQMortonFunctor
LQMortonFunctor(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:160
ogdf::fast_multipole_embedder::D2DFunctor::operator()
void operator()(uint32_t begin, uint32_t end)
Definition: FMEFunc.h:609
ogdf::fast_multipole_embedder::FMEGlobalOptions::stopCritAvgForce
double stopCritAvgForce
stopping criteria
Definition: FMEFunc.h:90
ogdf::fast_multipole_embedder::FMECollect
FMECollect
Definition: FMEFunc.h:697
ogdf::fast_multipole_embedder::LinearQuadtree::firstLeaf
NodeID firstLeaf() const
Definition: LinearQuadtree.h:525
ogdf::fast_multipole_embedder::edge_force_function
static EdgeForceFunctor< FLAGS > edge_force_function(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:692
ogdf::fast_multipole_embedder::LQPartitioner::localContexts
FMELocalContext ** localContexts
Definition: FMEFunc.h:452
ogdf::fast_multipole_embedder::m2l_functor::m2l_functor
m2l_functor(LinearQuadtreeExpansion &e)
Definition: FMEFunc.h:244
ogdf::fast_multipole_embedder::ArrayGraph::nodeInfo
NodeAdjInfo & nodeInfo(uint32_t i)
Returns the adjacency information for the node at index i in m_nodeAdj.
Definition: ArrayGraph.h:144
ogdf::fast_multipole_embedder::NDFunctor
Calculates the repulsive forces acting between all nodes inside the cell of the i-th LinearQuadtree n...
Definition: FMEFunc.h:548
ogdf::fast_multipole_embedder::p2p_functor::p2p_functor
p2p_functor(const LinearQuadtree &t, float *x, float *y)
Definition: FMEFunc.h:311
ogdf::fast_multipole_embedder::l2p_functor
Local-to-Point functor.
Definition: FMEFunc.h:280
ogdf::fast_multipole_embedder::M2LFunctor::operator()
void operator()(uint32_t i)
Definition: FMEFunc.h:524
ogdf::fast_multipole_embedder::FMEGlobalContext::min_x
float min_x
global point, node min x coordinate for bounding box calculations
Definition: FMEFunc.h:114
ogdf::fast_multipole_embedder::FMEGlobalContext::globalForceY
float * globalForceY
the global node force y array
Definition: FMEFunc.h:109
ogdf::fast_multipole_embedder::m2l_functor::operator()
void operator()(LinearQuadtree::NodeID nodeIndexSource, LinearQuadtree::NodeID nodeIndexReceiver)
Definition: FMEFunc.h:246
ogdf::fast_multipole_embedder::M2LFunctor::quadtree
LinearQuadtree * quadtree
Definition: FMEFunc.h:540
ogdf::fast_multipole_embedder::min_max_x_function
static min_max_functor< float > min_max_x_function(FMELocalContext *pLocalContext)
creates a min max functor for the x coords of the node
Definition: FMEFunc.h:147
ogdf::fast_multipole_embedder::LinearQuadtree::LQPoint
Definition: LinearQuadtree.h:58
ogdf::fast_multipole_embedder::LinearQuadtree::pointY
float pointY(PointID point) const
Definition: LinearQuadtree.h:454
ogdf::fast_multipole_embedder::LinearQuadtree::point
LQPoint & point(PointID pointID)
Definition: LinearQuadtree.h:389
ogdf::fast_multipole_embedder::FMELocalContext
Local thread Context.
Definition: FMEFunc.h:122
ogdf::fast_multipole_embedder::CollectForceFunctor::globalContext
FMEGlobalContext * globalContext
Definition: FMEFunc.h:771
ogdf::fast_multipole_embedder::LQCoordsFunctor::operator()
uint32_t operator()(void) const
Definition: FMEFunc.h:495
ogdf::fast_multipole_embedder::LinearQuadtree::minY
float minY() const
Definition: LinearQuadtree.h:547
ogdf::fast_multipole_embedder::D2DFunctor
Calculates the repulsive forces acting between all nodes of the direct interacting cells of the i-th ...
Definition: FMEFunc.h:584
ogdf::fast_multipole_embedder::LinearQuadtreeExpansion::M2M
void M2M(uint32_t source, uint32_t receiver)
shifts the source multipole coefficient to the center of the receiver and adds them
ogdf::fast_multipole_embedder::ArrayGraph::desiredEdgeLength
float * desiredEdgeLength()
Returns the edge length array for all edges.
Definition: ArrayGraph.h:189
ogdf::fast_multipole_embedder::l2l_function
static l2l_functor l2l_function(FMELocalContext *pLocalContext)
creates Local-to-Local functor
Definition: FMEFunc.h:274
ogdf::fast_multipole_embedder::FMECollect::EdgeFactorRep
@ EdgeFactorRep
ogdf::fast_multipole_embedder::LQMortonFunctor::x
float * x
Definition: FMEFunc.h:190
ogdf::fast_multipole_embedder::p2m_functor
Point-to-Multipole functor.
Definition: FMEFunc.h:196
ogdf::fast_multipole_embedder::m2m_functor
Multipole-to-Multipole functor.
Definition: FMEFunc.h:219
ogdf::fast_multipole_embedder::NodeMoveFunctor::x
float * x
Definition: FMEFunc.h:860
ogdf::fast_multipole_embedder::NDFunctor::quadtree
LinearQuadtree * quadtree
Definition: FMEFunc.h:575
ogdf::fast_multipole_embedder::m2m_functor::expansions
LinearQuadtreeExpansion & expansions
Definition: FMEFunc.h:221
ogdf::fast_multipole_embedder::FMEGlobalContext::max_y
float max_y
global point, node max y coordinate for bounding box calculations
Definition: FMEFunc.h:117
ogdf::fast_multipole_embedder::NodeMoveFunctor::localContext
FMELocalContext * localContext
Definition: FMEFunc.h:867
ogdf::fast_multipole_embedder::FMEGlobalOptions::maxNumIterations
uint32_t maxNumIterations
maximum number of iterations in the main step
Definition: FMEFunc.h:83
ogdf::fast_multipole_embedder::FMECollect::Tree2GraphOrder
@ Tree2GraphOrder
ogdf::fast_multipole_embedder::m2l_functor
Multipole-to-Local functor.
Definition: FMEFunc.h:241
ogdf::fast_multipole_embedder::FMEGlobalOptions::multipolePrecision
uint32_t multipolePrecision
Definition: FMEFunc.h:93
EdgeChain.h
Datastructures for edge chains itself and the edge chains of nodes.
ogdf::fast_multipole_embedder::collect_force_function
static CollectForceFunctor< FLAGS > collect_force_function(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:780
ogdf::fast_multipole_embedder::LQPartitioner
The partitioner which partitions the quadtree into subtrees and partitions the sequence of inner node...
Definition: FMEFunc.h:339
ogdf::fast_multipole_embedder::FMEGlobalContext::max_x
float max_x
global point, node max x coordinate for bounding box calculations
Definition: FMEFunc.h:115
ogdf::fast_multipole_embedder::M2LFunctor::wspd
WSPD * wspd
Definition: FMEFunc.h:542
ogdf::fast_multipole_embedder::p2m_function
static p2m_functor p2m_function(FMELocalContext *pLocalContext)
creates a Point-to-Multipole functor
Definition: FMEFunc.h:213
ogdf::fast_multipole_embedder::LQMortonFunctor::y
float * y
Definition: FMEFunc.h:191
ogdf::fast_multipole_embedder::FMELocalContext::firstLeaf
LinearQuadtree::NodeID firstLeaf
first leaves the thread prepared
Definition: FMEFunc.h:141
ogdf::fast_multipole_embedder::l2p_functor::tree
const LinearQuadtree & tree
Definition: FMEFunc.h:281
ogdf::fast_multipole_embedder::NDFunctor::quadtreeExp
LinearQuadtreeExpansion * quadtreeExp
Definition: FMEFunc.h:576
ogdf::fast_multipole_embedder::LQMortonFunctor::translate_x
float translate_x
Definition: FMEFunc.h:187
ogdf::fast_multipole_embedder::LQMortonFunctor::scale
double scale
Definition: FMEFunc.h:189
ogdf::fast_multipole_embedder::ArrayGraph::nodeSize
float * nodeSize()
Returns the node size array for all nodes.
Definition: ArrayGraph.h:180
ogdf::fast_multipole_embedder::FMEEdgeForce
FMEEdgeForce
Definition: FMEFunc.h:622
ogdf::fast_multipole_embedder::FMELocalContext::numLeaves
uint32_t numLeaves
number of leaves the thread prepared
Definition: FMEFunc.h:143
ogdf::fast_multipole_embedder::EdgeForceFunctor::x
float * x
Definition: FMEFunc.h:679
ogdf::fast_multipole_embedder::CollectForceFunctor::CollectForceFunctor
CollectForceFunctor(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:717
ogdf::fast_multipole_embedder::LinearQuadtree
Definition: LinearQuadtree.h:50
ogdf::fast_multipole_embedder::LinearQuadtree::PointID
unsigned int PointID
Definition: LinearQuadtree.h:56
ogdf::fast_multipole_embedder::LQCoordsFunctor::LQCoordsFunctor
LQCoordsFunctor(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:490
ogdf::fast_multipole_embedder::CollectForceFunctor
Definition: FMEFunc.h:715
ogdf::fast_multipole_embedder::min_max_functor
generic min max functor for an array
Definition: FMEFunctional.h:208
ogdf::fast_multipole_embedder::LQMortonFunctor
Definition: FMEFunc.h:158
ogdf::fast_multipole_embedder::FMEGlobalOptions::timeStep
float timeStep
time step factor for the main step
Definition: FMEFunc.h:78
ogdf::fast_multipole_embedder::NodeMoveFunctor
Definition: FMEFunc.h:790
ogdf::fast_multipole_embedder::p2m_functor::tree
const LinearQuadtree & tree
Definition: FMEFunc.h:197
ogdf::fast_multipole_embedder::FMEGlobalOptions::normEdgeLength
float normEdgeLength
average edge length when desired edge length are normalized
Definition: FMEFunc.h:81
ogdf::fast_multipole_embedder::LQPartitioner::currThread
uint32_t currThread
Definition: FMEFunc.h:449
ogdf::fast_multipole_embedder::LQMortonFunctor::operator()
uint32_t operator()(void) const
Definition: FMEFunc.h:170
ogdf::fast_multipole_embedder::M2LFunctor::M2LFunctor
M2LFunctor(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:516
ogdf::fast_multipole_embedder::WSPD::firstPairEntry
uint32_t firstPairEntry(NodeID nodeID) const
Returns the index of the first pair of node nodeID.
Definition: WSPD.h:88
ogdf::fast_multipole_embedder::operator|
constexpr int operator|(int lhs, FMECollect rhs)
Definition: FMEFunc.h:708
ogdf::fast_multipole_embedder::p2p_functor
Local-to-Point functor.
Definition: FMEFunc.h:306
ogdf::fast_multipole_embedder::LQPointUpdateFunctor::s
float * s
Definition: FMEFunc.h:482
ogdf::fast_multipole_embedder::NodeAdjInfo::degree
uint32_t degree
Total count of pairs where is either the first or second node.
Definition: EdgeChain.h:46
ogdf::fast_multipole_embedder::D2DFunctor::quadtreeExp
LinearQuadtreeExpansion * quadtreeExp
Definition: FMEFunc.h:617
ogdf::fast_multipole_embedder::LinearQuadtree::isLeaf
bool isLeaf(NodeID nodeID) const
returns true if the given node index is a leaf
Definition: LinearQuadtree.h:412
ogdf::fast_multipole_embedder::CollectForceFunctor::factor
float factor
Definition: FMEFunc.h:776
ogdf::fast_multipole_embedder::ArrayGraph::nodeYPos
float * nodeYPos()
Returns the y coord array for all nodes.
Definition: ArrayGraph.h:174
ogdf::fast_multipole_embedder::l2p_function
static l2p_functor l2p_function(FMELocalContext *pLocalContext)
creates Local-to-Point functor
Definition: FMEFunc.h:300
basic.h
Basic declarations, included by all source files.
ogdf::fast_multipole_embedder::NDFunctor::forceArrayY
float * forceArrayY
Definition: FMEFunc.h:578
ogdf::fast_multipole_embedder::EdgeForceFunctor::pGraph
ArrayGraph * pGraph
Definition: FMEFunc.h:684
ogdf::end
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)
ogdf::fast_multipole_embedder::p2p_functor::operator()
void operator()(LinearQuadtree::NodeID nodeIndexA, LinearQuadtree::NodeID nodeIndexB)
Definition: FMEFunc.h:313
ogdf::fast_multipole_embedder::m2l_function
static m2l_functor m2l_function(FMELocalContext *pLocalContext)
creates Multipole-to-Local functor
Definition: FMEFunc.h:253
ogdf::fast_multipole_embedder::LQPartitioner::LQPartitioner
LQPartitioner(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:341
ogdf::fast_multipole_embedder::FMEGlobalOptions::preProcEdgeForceFactor
float preProcEdgeForceFactor
edge force factor for the preprocessing step
Definition: FMEFunc.h:75
ogdf::fast_multipole_embedder::LQPartitioner::partition
void partition()
Definition: FMEFunc.h:399
ogdf::fast_multipole_embedder::p2m_functor::p2m_functor
p2m_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e)
Definition: FMEFunc.h:200
ogdf::fast_multipole_embedder::EdgeAdjInfo
Information about an edge (16 bytes).
Definition: EdgeChain.h:53
ogdf::fast_multipole_embedder::ArrayGraph::numEdges
uint32_t numEdges() const
Returns the number of edges.
Definition: ArrayGraph.h:65
ogdf::fast_multipole_embedder::m2m_functor::operator()
void operator()(LinearQuadtree::NodeID nodeIndex)
Definition: FMEFunc.h:229
ogdf::fast_multipole_embedder::EdgeForceFunctor::desiredEdgeLength
float * desiredEdgeLength
Definition: FMEFunc.h:685
ogdf::fast_multipole_embedder::FMELocalContext::forceX
float * forceX
local force array for all nodes, points
Definition: FMEFunc.h:124
ogdf::fast_multipole_embedder::FMELocalContext::max_x
float max_x
global point, node max x coordinate for bounding box calculations
Definition: FMEFunc.h:129
ogdf::fast_multipole_embedder::LinearQuadtree::root
NodeID root() const
returns the index of the root
Definition: LinearQuadtree.h:426
ogdf::fast_multipole_embedder::LinearQuadtree::refOfPoint
uint32_t refOfPoint(PointID id) const
Definition: LinearQuadtree.h:502
ogdf::fast_multipole_embedder::CollectForceFunctor::operator()
void operator()(uint32_t begin, uint32_t end)
Definition: FMEFunc.h:763
ogdf::fast_multipole_embedder::FMEGlobalOptions::repForceFactor
float repForceFactor
repulsive force factor for the main step
Definition: FMEFunc.h:80
ogdf::fast_multipole_embedder::M2LFunctor::operator()
void operator()(uint32_t begin, uint32_t end)
Definition: FMEFunc.h:533
ogdf::fast_multipole_embedder::NDFunctor::NDFunctor
NDFunctor(FMELocalContext *pLocalContext)
Definition: FMEFunc.h:550
FMEFunctional.h
Definitions of functors used in FME layout.
ogdf::fast_multipole_embedder::FMEGlobalContext::numThreads
uint32_t numThreads
number of threads, local contexts
Definition: FMEFunc.h:103
ogdf::fast_multipole_embedder::CollectForceFunctor::globalArrayY
float * globalArrayY
Definition: FMEFunc.h:774
ogdf::fast_multipole_embedder::NodeMoveFunctor::timeStep
float timeStep
Definition: FMEFunc.h:859
ogdf::fast_multipole_embedder::FMEGlobalContext::scaleFactor
float scaleFactor
var
Definition: FMEFunc.h:112
ogdf::fast_multipole_embedder::EdgeForceFunctor::forceArrayX
float * forceArrayX
Definition: FMEFunc.h:687
ogdf::fast_multipole_embedder::FMEGlobalOptions::minNumIterations
uint32_t minNumIterations
minimum number of iterations to be done regardless of any other conditions
Definition: FMEFunc.h:84
ogdf::fast_multipole_embedder::FMEGlobalOptions::stopCritConstSq
double stopCritConstSq
stopping criteria
Definition: FMEFunc.h:91
ogdf::fast_multipole_embedder::FMELocalContext::innerNodePartition
FMENodeChainPartition innerNodePartition
chain of inner nodes assigned to the thread
Definition: FMEFunc.h:134
ogdf::fast_multipole_embedder::FMELocalContext::lastInnerNode
LinearQuadtree::NodeID lastInnerNode
last inner nodes the thread prepared
Definition: FMEFunc.h:138
ogdf::fast_multipole_embedder::FMELocalContext::min_y
float min_y
global point, node min y coordinate for bounding box calculations
Definition: FMEFunc.h:130
ogdf::fast_multipole_embedder::LinearQuadtree::nodeFence
void nodeFence(NodeID nodeID)
Definition: LinearQuadtree.h:506
ogdf::fast_multipole_embedder::l2p_functor::operator()
void operator()(LinearQuadtree::PointID pointIndex)
Definition: FMEFunc.h:293
ogdf::fast_multipole_embedder::p2m_functor::expansions
LinearQuadtreeExpansion & expansions
Definition: FMEFunc.h:198
ogdf::fast_multipole_embedder::WSPD::numWSNodes
uint32_t numWSNodes(NodeID a) const
Returns the number of well separated nodes for node a.
Definition: WSPD.h:57
ogdf::fast_multipole_embedder::for_loop_array_set
void for_loop_array_set(uint32_t threadNr, uint32_t numThreads, TYP *a, uint32_t n, TYP value)
Definition: FMEFunc.h:876
ogdf::fast_multipole_embedder::NodeMoveFunctor::forceArrayX
float * forceArrayX
Definition: FMEFunc.h:862
ogdf::fast_multipole_embedder::p2p_functor::tree
const LinearQuadtree & tree
Definition: FMEFunc.h:307
ogdf::fast_multipole_embedder::NDFunctor::operator()
void operator()(uint32_t begin, uint32_t end)
Definition: FMEFunc.h:568
ogdf::fast_multipole_embedder::LinearQuadtree::directNodeB
NodeID directNodeB(uint32_t i) const
Definition: LinearQuadtree.h:539
ogdf::fast_multipole_embedder::EdgeForceFunctor::nodeSize
float * nodeSize
Definition: FMEFunc.h:686
ogdf::fast_multipole_embedder::ZERO_GLOBAL_ARRAY
static constexpr int ZERO_GLOBAL_ARRAY
Definition: FMEFunc.h:786
ogdf::fast_multipole_embedder::LQPointUpdateFunctor
Definition: FMEFunc.h:455
ogdf::fast_multipole_embedder::LQPointUpdateFunctor::x
float * x
Definition: FMEFunc.h:480
ogdf::fast_multipole_embedder::FMELocalContext::currAvgEdgeLength
double currAvgEdgeLength
Definition: FMEFunc.h:132
FMEKernel.h
Declaration of FME kernel.
ogdf::fast_multipole_embedder::NodeMoveFunctor::currentEdgeLength
float * currentEdgeLength
Definition: FMEFunc.h:865
ogdf::fast_multipole_embedder::m2m_functor::tree
const LinearQuadtree & tree
Definition: FMEFunc.h:220
ogdf::fast_multipole_embedder::LinearQuadtree::directNodeA
NodeID directNodeA(uint32_t i) const
Definition: LinearQuadtree.h:537
ogdf::fast_multipole_embedder::LQCoordsFunctor::quadtreeExp
LinearQuadtreeExpansion * quadtreeExp
Definition: FMEFunc.h:507
ogdf::fast_multipole_embedder::FMEGlobalContext::pLocalContext
FMELocalContext ** pLocalContext
all local contexts
Definition: FMEFunc.h:102
ogdf::fast_multipole_embedder::FMEGlobalContext::pWSPD
WSPD * pWSPD
pointer to the well separated pairs decomposition
Definition: FMEFunc.h:107
ogdf::fast_multipole_embedder::l2p_functor::expansions
LinearQuadtreeExpansion & expansions
Definition: FMEFunc.h:282
ogdf::fast_multipole_embedder::LQPointUpdateFunctor::operator()
void operator()(uint32_t begin, uint32_t end)
Definition: FMEFunc.h:472
ogdf::fast_multipole_embedder::FMELocalContext::lastLeaf
LinearQuadtree::NodeID lastLeaf
last leaves the thread prepared
Definition: FMEFunc.h:142
ogdf::fast_multipole_embedder::CollectForceFunctor::operator()
void operator()(uint32_t i)
Definition: FMEFunc.h:737
ogdf::fast_multipole_embedder::LinearQuadtree::setPoint
void setPoint(PointID id, float x, float y, uint32_t ref)
Definition: LinearQuadtree.h:476
ogdf::fast_multipole_embedder::FMEGlobalContext::earlyExit
bool earlyExit
var for the main thread to notify the other threads that they are done
Definition: FMEFunc.h:111
ogdf::fast_multipole_embedder::l2l_functor::l2l_functor
l2l_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e)
Definition: FMEFunc.h:262
ogdf::fast_multipole_embedder::D2DFunctor::operator()
uint32_t operator()(void) const
Definition: FMEFunc.h:593
ogdf::fast_multipole_embedder::NodeMoveFunctor::pGraph
ArrayGraph * pGraph
Definition: FMEFunc.h:866
ogdf::fast_multipole_embedder::LinearQuadtreeExpansion::L2P
void L2P(uint32_t source, uint32_t point, float &fx, float &fy)
evaluates the derivate of the local expansion at the point and adds the forces to fx fy
ogdf::fast_multipole_embedder::FMEGlobalContext::globalForceX
float * globalForceX
the global node force x array
Definition: FMEFunc.h:108
ogdf::fast_multipole_embedder::NodeMoveFunctor::forceArrayY
float * forceArrayY
Definition: FMEFunc.h:863
ogdf::fast_multipole_embedder::EdgeAdjInfo::b
uint32_t b
Second node of the pair.
Definition: EdgeChain.h:56
ogdf::fast_multipole_embedder::M2LFunctor::quadtreeExp
LinearQuadtreeExpansion * quadtreeExp
Definition: FMEFunc.h:541
ogdf::fast_multipole_embedder::LinearQuadtreeExpansion::M2L
void M2L(uint32_t source, uint32_t receiver)
converts the source multipole coefficient in to a local coefficients at the center of the receiver an...
ogdf::fast_multipole_embedder::NDFunctor::forceArrayX
float * forceArrayX
Definition: FMEFunc.h:577
ogdf::fast_multipole_embedder::LQPartitioner::newPartition
void newPartition(uint32_t nodeID)
Definition: FMEFunc.h:412
ogdf::fast_multipole_embedder::FMEGlobalOptions::preProcTimeStep
float preProcTimeStep
time step factor for the preprocessing step
Definition: FMEFunc.h:74
ogdf::fast_multipole_embedder::FMETreePartition
struct for distributing subtrees to the threads
Definition: FMEFunc.h:55
ogdf::fast_multipole_embedder::LQPartitioner::numPointsPerThread
uint32_t numPointsPerThread
Definition: FMEFunc.h:447
ogdf::fast_multipole_embedder::ArrayGraph::edgeInfo
EdgeAdjInfo & edgeInfo(uint32_t i)
Returns the adjacency information for the edge at index i in m_edgeAdj.
Definition: ArrayGraph.h:150
ogdf::fast_multipole_embedder::l2l_functor::operator()
void operator()(LinearQuadtree::NodeID parent, LinearQuadtree::NodeID child)
Definition: FMEFunc.h:264
ogdf::fast_multipole_embedder::FMELocalContext::treePartition
FMETreePartition treePartition
tree partition assigned to the thread
Definition: FMEFunc.h:133
ogdf::fast_multipole_embedder::EdgeForceFunctor::y
float * y
Definition: FMEFunc.h:680
ogdf::fast_multipole_embedder::LinearQuadtree::numberOfChilds
uint32_t numberOfChilds(NodeID nodeID) const
returns the number of children of node nodeID. for an inner node this is 1..4 and can be accessed by ...
Definition: LinearQuadtree.h:398
ogdf::fast_multipole_embedder::eval_direct_fast
void eval_direct_fast(float *x, float *y, float *s, float *fx, float *fy, size_t n)
kernel function to evaluate forces between n points with coords x, y directly. result is stored in fx...
Definition: FMEKernel.h:163
ogdf::fast_multipole_embedder::EdgeForceFunctor::operator()
void operator()(uint32_t begin, uint32_t end)
Definition: FMEFunc.h:672
ogdf::fast_multipole_embedder::D2DFunctor::forceArrayY
float * forceArrayY
Definition: FMEFunc.h:619
ogdf::fast_multipole_embedder::FMEEdgeForce::DivDegree
@ DivDegree