|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
51 namespace fast_multipole_embedder {
56 std::list<LinearQuadtree::NodeID>
nodes;
59 template<
typename Func>
174 uint32_t ref = p.
ref;
180 for (uint32_t i =
begin; i <=
end; i++) {
205 for (uint32_t pointIndex = firstPointOfLeaf;
206 pointIndex < (firstPointOfLeaf + numPointsInLeaf); pointIndex++) {
321 fx + offsetB,
fy + offsetB, numPointsB);
328 fx + offset,
fy + offset, numPoints);
345 ,
tree(pLocalContext->pGlobalContext->pQuadtree)
346 ,
localContexts(pLocalContext->pGlobalContext->pLocalContext) { }
350 if (numInnerNodesPerThread < 25) {
366 >= numInnerNodesPerThread) {
375 if (numLeavesPerThread < 25) {
416 l_par.push_back(nodeID);
429 while (!
l_par.empty()) {
431 uint32_t v =
l_par.front();
468 uint32_t ref = p.
ref;
473 for (uint32_t i =
begin; i <=
end; i++) {
500 for (uint32_t i =
begin; i <=
end; i++) {
534 for (uint32_t i =
begin; i <=
end; i++) {
569 for (uint32_t i =
begin; i <=
end; i++) {
610 for (uint32_t i =
begin; i <=
end; i++) {
626 template<
unsigned int FLAGS>
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;
654 float fa = f * 0.25f;
655 float fb = f * 0.25f;
658 fa = (float)(fa / ((
float)a_info.
degree));
659 fb = (float)(fb / ((
float)b_info.
degree));
673 for (uint32_t i =
begin; i <=
end; i++) {
691 template<
unsigned int FLAGS>
711 return static_cast<int>(lhs) |
static_cast<int>(rhs);
714 template<
unsigned int FLAGS>
743 sumX += localArrayX[i];
744 sumY += localArrayY[i];
746 localArrayX[i] = 0.0f;
747 localArrayY[i] = 0.0f;
764 for (uint32_t i =
begin; i <=
end; i++) {
779 template<
unsigned int FLAGS>
789 template<
unsigned int FLAGS>
796 float ftimeStep,
float* globalForceArray)
800 , forceArray(globalForceArray) {}
831 double dsq = (d_x * d_x + d_y * d_y);
832 double d = sqrt(dsq);
853 for (uint32_t i =
begin; i <=
end; i++) {
870 template<
unsigned int FLAGS>
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);
883 for (uint32_t i = 0; i < s; i++) {
void operator()(LinearQuadtree::NodeID nodeIndex)
The namespace for all OGDF objects.
FMELocalContext ** localContexts
uint32_t numberOfNodes() const
returns the number of nodes in this tree
static min_max_functor< float > min_max_y_function(FMELocalContext *pLocalContext)
creates a min max functor for the y coords of the node
float edgeForceFactor
edge force factor for the main step
FMEGlobalOptions * pOptions
pointer to the global options
uint32_t operator()(void) const
uint32_t numberOfDirectNodes() const
LinearQuadtreeExpansion * pExpansion
pointer to the coeefficients
int operator&(int lhs, FMEEdgeForce rhs)
LinearQuadtree * quadtree
LinearQuadtreeExpansion & expansions
double stopCritForce
stopping criteria
Declaration of class LinearQuadtree.
double maxForceSq
local maximum force
static p2p_functor p2p_function(FMELocalContext *pLocalContext)
creates Local-to-Point functor
void operator()(uint32_t i)
float normNodeSize
average node size when node sizes are normalized
Computes the coords and size of the i-th node in the LinearQuadtree.
NodeID directNode(uint32_t i) const
uint32_t operator()(void) const
void operator()(uint32_t i)
D2DFunctor(FMELocalContext *pLocalContext)
forall_children_functor< F > forall_children(F f) const
creator
LinearQuadtreeExpansion & expansions
void operator()(uint32_t i)
NodeID firstInnerNode() const
bool doPostProcessing
enable postprocessing
l2p_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e, float *x, float *y)
LinearQuadtree * quadtree
uint32_t operator()(void) const
Information about incident edges (16 bytes).
Class for the Well-Separated-Pairs-Decomposition (WSPD)
uint32_t numberOfInnerNodes() const
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
LinearQuadtree * quadtree
uint32_t wsNodeOfPair(uint32_t currPairIndex, NodeID a) const
Returns the other node (not a) of the pair with index currPairIndex.
uint32_t a
First node of the pair.
FMEGlobalContext * pGlobalContext
pointer to the global context
const LinearQuadtree & tree
LQPointUpdateFunctor(FMELocalContext *pLocalContext)
FMENodeChainPartition leafPartition
chain of leaf nodes assigned to the thread
uint32_t numNodes() const
Returns the number of nodes.
void for_loop(Func &func)
void computeCoords(NodeID nodeIndex)
static pair_call_functor< F, A > pair_call(F f, A a)
creates a pair call resulting in a call f(a, *)
uint32_t numberOfDirectPairs() const
static constexpr int TIME_STEP_NORMAL
void operator()(LinearQuadtree::NodeID nodeIndex)
float * nodeXPos()
Returns the x coord array for all nodes.
std::list< uint32_t > l_par
ArrayGraph * pGraph
pointer to the array graph
NodeID nextNode(NodeID nodeID) const
LinearQuadtree * quadtree
void operator()(LinearQuadtree::NodeID nodeIndex, LinearQuadtree::PointID pointIndex)
float * forceY
local force array for all nodes, points
static constexpr int TIME_STEP_PREP
void operator()(LinearQuadtree::NodeID nodeIndex)
void operator()(uint32_t begin, uint32_t end)
void operator()(uint32_t begin, uint32_t end)
Declaration of class ArrayGraph.
float max_y
global point, node max y coordinate for bounding box calculations
Declaration of class LinearQuadtreeExpansion.
uint32_t operator()(void) const
float pointSize(PointID point) const
double avgForce
local maximum force
uint32_t numberOfLeaves() const
uint32_t preProcMaxNumIterations
number of iterations the preprocessing is applied
void operator()(uint32_t i)
uint32_t nextPair(uint32_t currPairIndex, NodeID a) const
Returns the index of the next pair of currPairIndex of the node with index a.
uint32_t numInnerNodes
number of inner nodes the thread prepared
uint32_t numberOfPoints(NodeID nodeID) const
returns the number of points contained in the subtree of node nodeID
m2m_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e)
LinearQuadtree * pQuadtree
pointer to the quadtree
std::list< LinearQuadtree::NodeID > nodes
void P2M(uint32_t point, uint32_t receiver)
adds a point with the given charge to the receiver expansion
LinearQuadtree::NodeID firstInnerNode
first inner nodes the thread prepared
Definition of utility functions for FME layout.
void operator()(LinearQuadtree::NodeID parent, LinearQuadtree::NodeID child)
void partitionNodeChains()
bool doPrepProcessing
enable preprocessing
void operator()(uint32_t i)
void L2L(uint32_t source, uint32_t receiver)
shifts the source local coefficient to the center of the receiver and adds them
static NodeMoveFunctor< FLAGS > node_move_function(FMELocalContext *pLocalContext)
PointID firstPoint(NodeID nodeID) const
NodeID pointLeaf(PointID point) const
NodeID child(NodeID nodeID, uint32_t i) const
returns the i th child index of node nodeID
static m2m_functor m2m_function(FMELocalContext *pLocalContext)
creates Multipole-to-Multipole functor
uint32_t operator()(void) const
void operator()(uint32_t i)
FMETreePartition * currPartition()
the main global options for a run
float min_y
global point, node min y coordinate for bounding box calculations
float min_x
global point, node min x coordinate for bounding box calculations
void operator()(uint32_t i)
Converts the multipole expansion coefficients from all nodes which are well separated from the i-th n...
Declaration of class WSPD (well-separated pair decomposition).
float pointX(PointID point) const
static constexpr int USE_NODE_MOVE_RAD
float * nodeMoveRadius()
Returns the node movement radius array for all nodes.
void operator()(uint32_t begin, uint32_t end)
EdgeForceFunctor(FMELocalContext *pLocalContext)
NodeMoveFunctor(FMELocalContext *pLocalContext)
LQMortonFunctor(FMELocalContext *pLocalContext)
void operator()(uint32_t begin, uint32_t end)
double stopCritAvgForce
stopping criteria
static EdgeForceFunctor< FLAGS > edge_force_function(FMELocalContext *pLocalContext)
FMELocalContext ** localContexts
m2l_functor(LinearQuadtreeExpansion &e)
NodeAdjInfo & nodeInfo(uint32_t i)
Returns the adjacency information for the node at index i in m_nodeAdj.
Calculates the repulsive forces acting between all nodes inside the cell of the i-th LinearQuadtree n...
p2p_functor(const LinearQuadtree &t, float *x, float *y)
void operator()(uint32_t i)
float min_x
global point, node min x coordinate for bounding box calculations
float * globalForceY
the global node force y array
void operator()(LinearQuadtree::NodeID nodeIndexSource, LinearQuadtree::NodeID nodeIndexReceiver)
LinearQuadtree * quadtree
static min_max_functor< float > min_max_x_function(FMELocalContext *pLocalContext)
creates a min max functor for the x coords of the node
float pointY(PointID point) const
LQPoint & point(PointID pointID)
FMEGlobalContext * globalContext
uint32_t operator()(void) const
Calculates the repulsive forces acting between all nodes of the direct interacting cells of the i-th ...
void M2M(uint32_t source, uint32_t receiver)
shifts the source multipole coefficient to the center of the receiver and adds them
float * desiredEdgeLength()
Returns the edge length array for all edges.
static l2l_functor l2l_function(FMELocalContext *pLocalContext)
creates Local-to-Local functor
Point-to-Multipole functor.
Multipole-to-Multipole functor.
LinearQuadtree * quadtree
LinearQuadtreeExpansion & expansions
float max_y
global point, node max y coordinate for bounding box calculations
FMELocalContext * localContext
uint32_t maxNumIterations
maximum number of iterations in the main step
Multipole-to-Local functor.
uint32_t multipolePrecision
Datastructures for edge chains itself and the edge chains of nodes.
static CollectForceFunctor< FLAGS > collect_force_function(FMELocalContext *pLocalContext)
The partitioner which partitions the quadtree into subtrees and partitions the sequence of inner node...
float max_x
global point, node max x coordinate for bounding box calculations
static p2m_functor p2m_function(FMELocalContext *pLocalContext)
creates a Point-to-Multipole functor
LinearQuadtree::NodeID firstLeaf
first leaves the thread prepared
const LinearQuadtree & tree
LinearQuadtreeExpansion * quadtreeExp
float * nodeSize()
Returns the node size array for all nodes.
uint32_t numLeaves
number of leaves the thread prepared
CollectForceFunctor(FMELocalContext *pLocalContext)
LQCoordsFunctor(FMELocalContext *pLocalContext)
generic min max functor for an array
float timeStep
time step factor for the main step
const LinearQuadtree & tree
float normEdgeLength
average edge length when desired edge length are normalized
uint32_t operator()(void) const
M2LFunctor(FMELocalContext *pLocalContext)
uint32_t firstPairEntry(NodeID nodeID) const
Returns the index of the first pair of node nodeID.
constexpr int operator|(int lhs, FMECollect rhs)
uint32_t degree
Total count of pairs where is either the first or second node.
LinearQuadtreeExpansion * quadtreeExp
bool isLeaf(NodeID nodeID) const
returns true if the given node index is a leaf
float * nodeYPos()
Returns the y coord array for all nodes.
static l2p_functor l2p_function(FMELocalContext *pLocalContext)
creates Local-to-Point functor
Basic declarations, included by all source files.
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)
void operator()(LinearQuadtree::NodeID nodeIndexA, LinearQuadtree::NodeID nodeIndexB)
static m2l_functor m2l_function(FMELocalContext *pLocalContext)
creates Multipole-to-Local functor
LQPartitioner(FMELocalContext *pLocalContext)
float preProcEdgeForceFactor
edge force factor for the preprocessing step
p2m_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e)
Information about an edge (16 bytes).
uint32_t numEdges() const
Returns the number of edges.
void operator()(LinearQuadtree::NodeID nodeIndex)
float * desiredEdgeLength
float * forceX
local force array for all nodes, points
float max_x
global point, node max x coordinate for bounding box calculations
NodeID root() const
returns the index of the root
uint32_t refOfPoint(PointID id) const
void operator()(uint32_t begin, uint32_t end)
float repForceFactor
repulsive force factor for the main step
void operator()(uint32_t begin, uint32_t end)
NDFunctor(FMELocalContext *pLocalContext)
Definitions of functors used in FME layout.
uint32_t numThreads
number of threads, local contexts
uint32_t minNumIterations
minimum number of iterations to be done regardless of any other conditions
double stopCritConstSq
stopping criteria
FMENodeChainPartition innerNodePartition
chain of inner nodes assigned to the thread
LinearQuadtree::NodeID lastInnerNode
last inner nodes the thread prepared
float min_y
global point, node min y coordinate for bounding box calculations
void nodeFence(NodeID nodeID)
void operator()(LinearQuadtree::PointID pointIndex)
LinearQuadtreeExpansion & expansions
uint32_t numWSNodes(NodeID a) const
Returns the number of well separated nodes for node a.
void for_loop_array_set(uint32_t threadNr, uint32_t numThreads, TYP *a, uint32_t n, TYP value)
const LinearQuadtree & tree
void operator()(uint32_t begin, uint32_t end)
NodeID directNodeB(uint32_t i) const
static constexpr int ZERO_GLOBAL_ARRAY
Declaration of FME kernel.
float * currentEdgeLength
const LinearQuadtree & tree
NodeID directNodeA(uint32_t i) const
LinearQuadtreeExpansion * quadtreeExp
FMELocalContext ** pLocalContext
all local contexts
WSPD * pWSPD
pointer to the well separated pairs decomposition
LinearQuadtreeExpansion & expansions
void operator()(uint32_t begin, uint32_t end)
LinearQuadtree::NodeID lastLeaf
last leaves the thread prepared
void operator()(uint32_t i)
void setPoint(PointID id, float x, float y, uint32_t ref)
bool earlyExit
var for the main thread to notify the other threads that they are done
l2l_functor(const LinearQuadtree &t, LinearQuadtreeExpansion &e)
uint32_t operator()(void) const
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
float * globalForceX
the global node force x array
uint32_t b
Second node of the pair.
LinearQuadtreeExpansion * quadtreeExp
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 newPartition(uint32_t nodeID)
float preProcTimeStep
time step factor for the preprocessing step
struct for distributing subtrees to the threads
uint32_t numPointsPerThread
EdgeAdjInfo & edgeInfo(uint32_t i)
Returns the adjacency information for the edge at index i in m_edgeAdj.
void operator()(LinearQuadtree::NodeID parent, LinearQuadtree::NodeID child)
FMETreePartition treePartition
tree partition assigned to the thread
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 ...
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...
void operator()(uint32_t begin, uint32_t end)