Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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
50namespace ogdf {
51namespace 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
95
96
98struct FMELocalContext;
99
120
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
159public:
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;
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
185private:
189 double scale;
190 float* x;
191 float* y;
192 float* s;
193};
194
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
213static inline p2m_functor p2m_function(FMELocalContext* pLocalContext) {
214 return p2m_functor(*pLocalContext->pGlobalContext->pQuadtree,
215 *pLocalContext->pGlobalContext->pExpansion);
216}
217
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
235static inline m2m_functor m2m_function(FMELocalContext* pLocalContext) {
236 return m2m_functor(*pLocalContext->pGlobalContext->pQuadtree,
237 *pLocalContext->pGlobalContext->pExpansion);
238}
239
243
245
246 inline void operator()(LinearQuadtree::NodeID nodeIndexSource,
247 LinearQuadtree::NodeID nodeIndexReceiver) {
248 expansions.M2L(nodeIndexSource, nodeIndexReceiver);
249 }
250};
251
253static inline m2l_functor m2l_function(FMELocalContext* pLocalContext) {
254 return m2l_functor(*pLocalContext->pGlobalContext->pExpansion);
255}
256
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
274static inline l2l_functor l2l_function(FMELocalContext* pLocalContext) {
275 return l2l_functor(*pLocalContext->pGlobalContext->pQuadtree,
276 *pLocalContext->pGlobalContext->pExpansion);
277}
278
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
300static inline l2p_functor l2p_function(FMELocalContext* pLocalContext) {
301 return l2p_functor(*pLocalContext->pGlobalContext->pQuadtree,
302 *pLocalContext->pGlobalContext->pExpansion, pLocalContext->forceX, pLocalContext->forceY);
303}
304
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
333static inline p2p_functor p2p_function(FMELocalContext* pLocalContext) {
334 return p2p_functor(*pLocalContext->pGlobalContext->pQuadtree, pLocalContext->forceX,
335 pLocalContext->forceY);
336}
337
340public:
341 explicit LQPartitioner(FMELocalContext* pLocalContext)
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;
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++) {
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
425 l_par.clear();
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
446private:
448 uint32_t numThreads;
449 uint32_t currThread;
450 std::list<uint32_t> l_par;
453};
454
456public:
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
478private:
480 float* x;
481 float* y;
482 float* s;
483};
484
489public:
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
505private:
508};
509
515public:
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
539private:
543};
544
549public:
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
574private:
579};
580
585public:
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
615private:
620};
621
622enum class FMEEdgeForce { SubRep = 0x2, DivDegree = 0x8 };
623
624inline int operator&(int lhs, FMEEdgeForce rhs) { return lhs & static_cast<int>(rhs); }
625
626template<unsigned int FLAGS>
628public:
629 inline explicit EdgeForceFunctor(FMELocalContext* pLocalContext) {
630 pGraph = pLocalContext->pGlobalContext->pGraph;
631 x = pGraph->nodeXPos();
632 y = pGraph->nodeYPos();
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
678private:
679 float* x;
680 float* y;
683
686 float* nodeSize;
689};
690
691template<unsigned int FLAGS>
693 return EdgeForceFunctor<FLAGS>(pLocalContext);
694}
695
696
697enum class FMECollect {
698 NoFactor = 0x00,
699 EdgeFactor = 0x01,
700 RepulsiveFactor = 0x02,
701 EdgeFactorRep = 0x04,
702 Tree2GraphOrder = 0x08,
703 ZeroThreadArray = 0x10
704};
705
706inline int operator&(int lhs, FMECollect rhs) { return lhs & static_cast<int>(rhs); }
707
708inline constexpr int operator|(int lhs, FMECollect rhs) { return lhs | static_cast<int>(rhs); }
709
710inline constexpr int operator|(FMECollect lhs, FMECollect rhs) {
711 return static_cast<int>(lhs) | static_cast<int>(rhs);
712}
713
714template<unsigned int FLAGS>
716public:
717 inline explicit CollectForceFunctor(FMELocalContext* pLocalContext) {
718 numContexts = pLocalContext->pGlobalContext->numThreads;
719 globalContext = pLocalContext->pGlobalContext;
723 pGraph = pLocalContext->pGlobalContext->pGraph;
724 if (FLAGS & FMECollect::EdgeFactor) {
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
769private:
775 uint32_t numContexts;
776 float factor;
777};
778
779template<unsigned int FLAGS>
781 return CollectForceFunctor<FLAGS>(pLocalContext);
782}
783
784static constexpr int TIME_STEP_NORMAL = 0x1;
785static constexpr int TIME_STEP_PREP = 0x2;
786static constexpr int ZERO_GLOBAL_ARRAY = 0x4;
787static constexpr int USE_NODE_MOVE_RAD = 0x8;
788
789template<unsigned int FLAGS>
791public:
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) {
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);
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
858private:
859 float timeStep;
860 float* x;
861 float* y;
868};
869
870template<unsigned int FLAGS>
872 return NodeMoveFunctor<FLAGS>(pLocalContext);
873}
874
875template<typename TYP>
876inline 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}
Declaration of class ArrayGraph.
Datastructures for edge chains itself and the edge chains of nodes.
Definitions of functors used in FME layout.
Declaration of FME kernel.
Definition of utility functions for FME layout.
Declaration of class LinearQuadtree.
Declaration of class LinearQuadtreeExpansion.
Declaration of class WSPD (well-separated pair decomposition).
Basic declarations, included by all source files.
float * nodeMoveRadius()
Returns the node movement radius array for all nodes.
Definition ArrayGraph.h:186
float * nodeXPos()
Returns the x coord array for all nodes.
Definition ArrayGraph.h:168
uint32_t numEdges() const
Returns the number of edges.
Definition ArrayGraph.h:65
EdgeAdjInfo & edgeInfo(uint32_t i)
Returns the adjacency information for the edge at index i in m_edgeAdj.
Definition ArrayGraph.h:150
float * nodeYPos()
Returns the y coord array for all nodes.
Definition ArrayGraph.h:174
NodeAdjInfo & nodeInfo(uint32_t i)
Returns the adjacency information for the node at index i in m_nodeAdj.
Definition ArrayGraph.h:144
float * nodeSize()
Returns the node size array for all nodes.
Definition ArrayGraph.h:180
uint32_t numNodes() const
Returns the number of nodes.
Definition ArrayGraph.h:62
float * desiredEdgeLength()
Returns the edge length array for all edges.
Definition ArrayGraph.h:189
CollectForceFunctor(FMELocalContext *pLocalContext)
Definition FMEFunc.h:717
void operator()(uint32_t begin, uint32_t end)
Definition FMEFunc.h:763
Calculates the repulsive forces acting between all nodes of the direct interacting cells of the i-th ...
Definition FMEFunc.h:584
D2DFunctor(FMELocalContext *pLocalContext)
Definition FMEFunc.h:586
void operator()(uint32_t begin, uint32_t end)
Definition FMEFunc.h:609
LinearQuadtreeExpansion * quadtreeExp
Definition FMEFunc.h:617
Information about an edge (16 bytes).
Definition EdgeChain.h:53
uint32_t b
Second node of the pair.
Definition EdgeChain.h:56
uint32_t a
First node of the pair.
Definition EdgeChain.h:55
void operator()(uint32_t begin, uint32_t end)
Definition FMEFunc.h:672
EdgeForceFunctor(FMELocalContext *pLocalContext)
Definition FMEFunc.h:629
Computes the coords and size of the i-th node in the LinearQuadtree.
Definition FMEFunc.h:488
LQCoordsFunctor(FMELocalContext *pLocalContext)
Definition FMEFunc.h:490
void operator()(uint32_t begin, uint32_t end)
Definition FMEFunc.h:499
LinearQuadtreeExpansion * quadtreeExp
Definition FMEFunc.h:507
LQMortonFunctor(FMELocalContext *pLocalContext)
Definition FMEFunc.h:160
void operator()(uint32_t begin, uint32_t end)
Definition FMEFunc.h:179
The partitioner which partitions the quadtree into subtrees and partitions the sequence of inner node...
Definition FMEFunc.h:339
LQPartitioner(FMELocalContext *pLocalContext)
Definition FMEFunc.h:341
void operator()(uint32_t begin, uint32_t end)
Definition FMEFunc.h:472
LQPointUpdateFunctor(FMELocalContext *pLocalContext)
Definition FMEFunc.h:457
void P2M(uint32_t point, uint32_t receiver)
adds a point with the given charge to the receiver expansion
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...
void M2M(uint32_t source, uint32_t receiver)
shifts the source multipole coefficient to the center of the receiver and adds them
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
void L2L(uint32_t source, uint32_t receiver)
shifts the source local coefficient to the center of the receiver and adds them
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 ...
forall_children_functor< F > forall_children(F f) const
creator
void setPoint(PointID id, float x, float y, uint32_t ref)
NodeID child(NodeID nodeID, uint32_t i) const
returns the i th child index of node nodeID
NodeID root() const
returns the index of the root
bool isLeaf(NodeID nodeID) const
returns true if the given node index is a leaf
uint32_t numberOfPoints(NodeID nodeID) const
returns the number of points contained in the subtree of node nodeID
uint32_t numberOfNodes() const
returns the number of nodes in this tree
Converts the multipole expansion coefficients from all nodes which are well separated from the i-th n...
Definition FMEFunc.h:514
M2LFunctor(FMELocalContext *pLocalContext)
Definition FMEFunc.h:516
void operator()(uint32_t begin, uint32_t end)
Definition FMEFunc.h:533
LinearQuadtreeExpansion * quadtreeExp
Definition FMEFunc.h:541
Calculates the repulsive forces acting between all nodes inside the cell of the i-th LinearQuadtree n...
Definition FMEFunc.h:548
void operator()(uint32_t begin, uint32_t end)
Definition FMEFunc.h:568
LinearQuadtreeExpansion * quadtreeExp
Definition FMEFunc.h:576
NDFunctor(FMELocalContext *pLocalContext)
Definition FMEFunc.h:550
Information about incident edges (16 bytes).
Definition EdgeChain.h:44
uint32_t degree
Total count of pairs where is either the first or second node.
Definition EdgeChain.h:46
void operator()(uint32_t begin, uint32_t end)
Definition FMEFunc.h:852
NodeMoveFunctor(FMELocalContext *pLocalContext)
Definition FMEFunc.h:793
Class for the Well-Separated-Pairs-Decomposition (WSPD)
Definition WSPD.h:43
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
uint32_t firstPairEntry(NodeID nodeID) const
Returns the index of the first pair of node nodeID.
Definition WSPD.h:88
uint32_t numWSNodes(NodeID a) const
Returns the number of well separated nodes for node a.
Definition WSPD.h:57
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
static m2l_functor m2l_function(FMELocalContext *pLocalContext)
creates Multipole-to-Local functor
Definition FMEFunc.h:253
static pair_call_functor< F, A > pair_call(F f, A a)
creates a pair call resulting in a call f(a, *)
static CollectForceFunctor< FLAGS > collect_force_function(FMELocalContext *pLocalContext)
Definition FMEFunc.h:780
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
static constexpr int USE_NODE_MOVE_RAD
Definition FMEFunc.h:787
static m2m_functor m2m_function(FMELocalContext *pLocalContext)
creates Multipole-to-Multipole functor
Definition FMEFunc.h:235
static NodeMoveFunctor< FLAGS > node_move_function(FMELocalContext *pLocalContext)
Definition FMEFunc.h:871
static p2p_functor p2p_function(FMELocalContext *pLocalContext)
creates Local-to-Point functor
Definition FMEFunc.h:333
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
int operator&(int lhs, FMEEdgeForce rhs)
Definition FMEFunc.h:624
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
static l2p_functor l2p_function(FMELocalContext *pLocalContext)
creates Local-to-Point functor
Definition FMEFunc.h:300
static l2l_functor l2l_function(FMELocalContext *pLocalContext)
creates Local-to-Local functor
Definition FMEFunc.h:274
static p2m_functor p2m_function(FMELocalContext *pLocalContext)
creates a Point-to-Multipole functor
Definition FMEFunc.h:213
static constexpr int ZERO_GLOBAL_ARRAY
Definition FMEFunc.h:786
static constexpr int TIME_STEP_NORMAL
Definition FMEFunc.h:784
static EdgeForceFunctor< FLAGS > edge_force_function(FMELocalContext *pLocalContext)
Definition FMEFunc.h:692
constexpr int operator|(int lhs, FMECollect rhs)
Definition FMEFunc.h:708
static constexpr int TIME_STEP_PREP
Definition FMEFunc.h:785
void for_loop_array_set(uint32_t threadNr, uint32_t numThreads, TYP *a, uint32_t n, TYP value)
Definition FMEFunc.h:876
The namespace for all OGDF objects.
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)
uint32_t numThreads
number of threads, local contexts
Definition FMEFunc.h:103
bool earlyExit
var for the main thread to notify the other threads that they are done
Definition FMEFunc.h:111
FMELocalContext ** pLocalContext
all local contexts
Definition FMEFunc.h:102
float * globalForceX
the global node force x array
Definition FMEFunc.h:108
float max_y
global point, node max y coordinate for bounding box calculations
Definition FMEFunc.h:117
float min_y
global point, node min y coordinate for bounding box calculations
Definition FMEFunc.h:116
float max_x
global point, node max x coordinate for bounding box calculations
Definition FMEFunc.h:115
ArrayGraph * pGraph
pointer to the array graph
Definition FMEFunc.h:104
FMEGlobalOptions * pOptions
pointer to the global options
Definition FMEFunc.h:110
float * globalForceY
the global node force y array
Definition FMEFunc.h:109
LinearQuadtreeExpansion * pExpansion
pointer to the coeefficients
Definition FMEFunc.h:106
float min_x
global point, node min x coordinate for bounding box calculations
Definition FMEFunc.h:114
WSPD * pWSPD
pointer to the well separated pairs decomposition
Definition FMEFunc.h:107
LinearQuadtree * pQuadtree
pointer to the quadtree
Definition FMEFunc.h:105
the main global options for a run
Definition FMEFunc.h:73
float repForceFactor
repulsive force factor for the main step
Definition FMEFunc.h:80
float preProcTimeStep
time step factor for the preprocessing step
Definition FMEFunc.h:74
float normEdgeLength
average edge length when desired edge length are normalized
Definition FMEFunc.h:81
uint32_t minNumIterations
minimum number of iterations to be done regardless of any other conditions
Definition FMEFunc.h:84
float preProcEdgeForceFactor
edge force factor for the preprocessing step
Definition FMEFunc.h:75
bool doPrepProcessing
enable preprocessing
Definition FMEFunc.h:86
float timeStep
time step factor for the main step
Definition FMEFunc.h:78
uint32_t preProcMaxNumIterations
number of iterations the preprocessing is applied
Definition FMEFunc.h:76
bool doPostProcessing
enable postprocessing
Definition FMEFunc.h:87
float normNodeSize
average node size when node sizes are normalized
Definition FMEFunc.h:82
uint32_t maxNumIterations
maximum number of iterations in the main step
Definition FMEFunc.h:83
float edgeForceFactor
edge force factor for the main step
Definition FMEFunc.h:79
uint32_t numInnerNodes
number of inner nodes the thread prepared
Definition FMEFunc.h:139
LinearQuadtree::NodeID firstLeaf
first leaves the thread prepared
Definition FMEFunc.h:141
LinearQuadtree::NodeID lastLeaf
last leaves the thread prepared
Definition FMEFunc.h:142
float * forceY
local force array for all nodes, points
Definition FMEFunc.h:125
float * forceX
local force array for all nodes, points
Definition FMEFunc.h:124
FMETreePartition treePartition
tree partition assigned to the thread
Definition FMEFunc.h:133
float max_x
global point, node max x coordinate for bounding box calculations
Definition FMEFunc.h:129
float max_y
global point, node max y coordinate for bounding box calculations
Definition FMEFunc.h:131
FMENodeChainPartition innerNodePartition
chain of inner nodes assigned to the thread
Definition FMEFunc.h:134
FMENodeChainPartition leafPartition
chain of leaf nodes assigned to the thread
Definition FMEFunc.h:135
uint32_t numLeaves
number of leaves the thread prepared
Definition FMEFunc.h:143
FMEGlobalContext * pGlobalContext
pointer to the global context
Definition FMEFunc.h:123
LinearQuadtree::NodeID firstInnerNode
first inner nodes the thread prepared
Definition FMEFunc.h:137
float min_x
global point, node min x coordinate for bounding box calculations
Definition FMEFunc.h:128
LinearQuadtree::NodeID lastInnerNode
last inner nodes the thread prepared
Definition FMEFunc.h:138
float min_y
global point, node min y coordinate for bounding box calculations
Definition FMEFunc.h:130
struct for distributing subtrees to the threads
Definition FMEFunc.h:55
std::list< LinearQuadtree::NodeID > nodes
Definition FMEFunc.h:56
void operator()(LinearQuadtree::NodeID nodeIndex)
Definition FMEFunc.h:268
void operator()(LinearQuadtree::NodeID parent, LinearQuadtree::NodeID child)
Definition FMEFunc.h:264
LinearQuadtreeExpansion & expansions
Definition FMEFunc.h:260
l2l_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e)
Definition FMEFunc.h:262
l2p_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e, float *x, float *y)
Definition FMEFunc.h:286
void operator()(LinearQuadtree::NodeID nodeIndex, LinearQuadtree::PointID pointIndex)
Definition FMEFunc.h:289
void operator()(LinearQuadtree::PointID pointIndex)
Definition FMEFunc.h:293
LinearQuadtreeExpansion & expansions
Definition FMEFunc.h:282
Multipole-to-Local functor.
Definition FMEFunc.h:241
LinearQuadtreeExpansion & expansions
Definition FMEFunc.h:242
m2l_functor(LinearQuadtreeExpansion &e)
Definition FMEFunc.h:244
void operator()(LinearQuadtree::NodeID nodeIndexSource, LinearQuadtree::NodeID nodeIndexReceiver)
Definition FMEFunc.h:246
Multipole-to-Multipole functor.
Definition FMEFunc.h:219
LinearQuadtreeExpansion & expansions
Definition FMEFunc.h:221
m2m_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e)
Definition FMEFunc.h:223
void operator()(LinearQuadtree::NodeID nodeIndex)
Definition FMEFunc.h:229
void operator()(LinearQuadtree::NodeID parent, LinearQuadtree::NodeID child)
Definition FMEFunc.h:225
generic min max functor for an array
Point-to-Multipole functor.
Definition FMEFunc.h:196
p2m_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e)
Definition FMEFunc.h:200
void operator()(LinearQuadtree::NodeID nodeIndex)
Definition FMEFunc.h:202
LinearQuadtreeExpansion & expansions
Definition FMEFunc.h:198
void operator()(LinearQuadtree::NodeID nodeIndexA, LinearQuadtree::NodeID nodeIndexB)
Definition FMEFunc.h:313
p2p_functor(const LinearQuadtree &t, float *x, float *y)
Definition FMEFunc.h:311
void operator()(LinearQuadtree::NodeID nodeIndex)
Definition FMEFunc.h:324