37 #define OGDF_LQ_M2L_MIN_BOUND 8 38 #define OGDF_LQ_WSPD_BRANCH_BOUND 16 39 #define OGDF_LQ_WSPD_BOUND 25 42 namespace fast_multipole_embedder {
44 class LinearQuadtreeBuilder;
116 for (uint32_t i=0; i<numNodes; i++)
142 if (tree.
isLeaf(u))
return;
156 template<
typename Func>
168 for (
PointID i = firstPoint; i < end; i++)
174 template<
typename Func>
191 if (tree.
isLeaf(u))
return;
206 template<
typename F,
typename CondType = true_condition>
230 template<
typename F,
typename Cond>
238 template<
typename F,
typename CondType = true_condition>
262 template<
typename F,
typename Cond>
269 template<
typename WSPairFuncType,
typename DPairFuncType,
typename DNodeFuncType,
typename BranchCondType = true_condition>
279 : tree(t), WSFunction(wsf), DPairFunction(dpf), DNodeFunction(dnf) { }
282 : tree(t), WSFunction(wsf), DPairFunction(dpf), DNodeFunction(dnf), BranchCondFunction(bc) { }
286 if (BranchCondFunction(u))
328 template<
typename A,
typename B,
typename C,
typename ConditionType>
334 template<
typename A,
typename B,
typename C>
492 LinearQuadtree(uint32_t n,
float* origXPos,
float* origYPos,
float* origSize);
580 float s = 0.00000001f;
583 float d_sq = dx*dx+dy*dy;
585 return d_sq > (s * 0.5 + 1) * (s * 0.5 + 1) * 2 * size * size;
616 void init(
float min_x,
float min_y,
float max_x,
float max_y);
631 mnr = mnr >> (level * 2);
632 mnr = mnr << (level * 2);
633 mortonNumberInv<uint64_t, uint32_t>(mnr, ix, iy);
bottom_up_traversal_functor(const LinearQuadtree &t, F f, CondType c)
uint32_t m_numDirectNodes
const LinearQuadtree & tree
NodeID firstInnerNode() const
float * m_nodeXPos
node x coord
void deallocate()
helper function for releasing memory
functor for iterating over all ordered pairs of children of a node
uint32_t numberOfPoints(NodeID nodeID) const
returns the number of points contained in the subtree of node nodeID
forall_ordered_pairs_of_children_functor< F > forall_ordered_pairs_of_children(F f) const
creator
float pointSize(PointID point) const
uint32_t numberOfInnerNodes() const
void addDirect(NodeID s)
add a direct node to the array list of direct nodes
#define OGDF_LQ_WSPD_BRANCH_BOUND
LQNode * m_tree
the main tree array containing all nodes (including leaves)
void computeCoords(NodeID nodeIndex)
NodeID root() const
returns the index of the root
top_down_traversal_functor< F > top_down_traversal(F f) const
creator
Definition of utility functions for FME layout.
void operator()(NodeID u)
forall_points_functor(const LinearQuadtree &t, const Func &f)
simple functor for iterating over all children of a node
uint32_t numberOfDirectNodes() const
is_leaf_condition_functor is_leaf_condition() const
creator
double m_sideLengthGrid
the resulting side length of the grid (constant)
uint32_t m_maxNumNodes
the maximum number of nodes (2*n here instead of 2*n-1)
is_fence_condition_functor(const LinearQuadtree &t)
forall_tree_nodes_functor< F > forall_tree_nodes(F f, NodeID begin, uint32_t num) const
creator
PointID findFirstPointInCell(PointID somePointInCell) const
forall_tree_nodes_functor(const LinearQuadtree &t, F f, NodeID b, uint32_t num)
NodeID directNode(uint32_t i) const
bool LQPointComparer(const LinearQuadtree::LQPoint &a, const LinearQuadtree::LQPoint &b)
LinearQuadtree(uint32_t n, float *origXPos, float *origYPos, float *origSize)
constructor. required tree mem will be allocated
friend class LinearQuadtreeBuilderList
float * m_nodeYPos
node y coord
forall_ordered_pairs_of_children_functor(const LinearQuadtree &t, F f)
void setPoint(PointID id, float x, float y, uint32_t ref)
void operator()(NodeID u)
bool operator()(NodeID u)
uint32_t numberOfPoints() const
returns the number of points in this tree
void operator()(NodeID u)
float nodeX(NodeID nodeID) const
uint32_t numberOfLeaves() const
void setChild(NodeID nodeID, uint32_t i, NodeID c)
sets the i th child index of node nodeID
PointID firstPoint(NodeID nodeID) const
void initLeaf(NodeID leaf, PointID firstPoint, uint32_t numPoints, NodeID next)
top down traversal of the subtree of a given node
void setNodeSize(NodeID nodeID, float size)
#define OGDF_LQ_WSPD_BOUND
forall_children_functor(const LinearQuadtree &t, F f)
void operator()(NodeID a, NodeID b)
double m_scaleInv
the inverse scale to transform
bottom_up_traversal_functor< F > bottom_up_traversal(F f) const
creator
bool isWS(NodeID a, NodeID b) const
StoreWSPairFunctor(LinearQuadtree &t)
NodeID m_firstInner
first inner node in the inner node chain
NodeID child(NodeID nodeID, uint32_t i) const
returns the i th child index of node nodeID
is_fence_condition_functor is_fence_condition() const
creator
#define OGDF_LQ_M2L_MIN_BOUND
void operator()(NodeID u)
void setNextNode(NodeID nodeID, NodeID next)
forall_children_functor< F > forall_children(F f) const
creator
void allocate(uint32_t n)
helper function for allocating the array's
const LinearQuadtree & tree
float * m_pointXPos
point x coord in tree order
float m_max_y
the y coordinate of the top most point
void setNodeX(NodeID nodeID, float x)
BranchCondType BranchCondFunction
void addWSPD(NodeID s, NodeID t)
adds a well-separated pair to the wspd
float * m_origYPos
point y coord in graph order
wspd_functor(const LinearQuadtree &t, WSPairFuncType &wsf, DPairFuncType &dpf, DNodeFuncType &dnf)
LQWSPair(NodeID c, NodeID d)
void setPoint(PointID id, float x, float y, float r, uint32_t ref)
void operator()(NodeID u, NodeID v)
void setPointLeaf(PointID point, NodeID leaf)
float * m_origSize
point size in graph order
void setNodeY(NodeID nodeID, float y)
void setFirstPoint(NodeID nodeID, PointID firstPoint)
uint32_t m_numLeaves
number of leaves in the chain
float * m_pointYPos
point y coord in tree order
uint32_t numberOfDirectPairs() const
float pointY(PointID point) const
bottom_up_traversal_functor< F, Cond > bottom_up_traversal(F f, Cond cond) const
creator
float m_min_y
the y coordinate of the bottom most point
uint32_t m_numInnerNodes
number of inner nodes in the chain
NodeID pointLeaf(PointID point) const
void operator()(NodeID u)
const LQPoint & point(PointID pointID) const
uint32_t refOfPoint(PointID id) const
void setPoint(PointID id, float x, float y, float r)
double m_cellSize
the height and width of a grid cell
void addDirectPair(NodeID s, NodeID t)
add a direct pair to the array list of direct pairs
void setNumberOfChilds(NodeID nodeID, uint32_t numChilds)
sets the number of children of a node
float pointX(PointID point) const
bool operator()(NodeID u)
void leafAppendPoint(NodeID leaf, PointID point)
appends an successing point by simply increasing childcount of a leaf. Assumes isLeaf ...
float nodeY(NodeID nodeID) const
StoreDirectNodeFunctor(LinearQuadtree &t)
void init(float min_x, float min_y, float max_x, float max_y)
const LinearQuadtree & tree
double m_sideLengthPoints
the maximum of height and width
void nodeAppendChild(NodeID nodeID, NodeID child)
appends one child index. Assumes childCount < 4 and not leaf
uint32_t m_numPoints
number of points this quadtree is based on
forall_points_functor< Func > forall_points(const Func &func) const
creator
void clear()
resets the tree
void setLevel(NodeID nodeID, uint32_t level)
NodeID directNodeA(uint32_t i) const
float nodeSize(NodeID nodeID) const
const LinearQuadtree & tree
uint32_t maxNumberOfNodes() const
the upper bound for a compressed quadtree (2*numPoints)
StoreDirectNodeFunctor StoreDirectNodeFunction()
void operator()(NodeID a)
const LinearQuadtree & tree
WSPairFuncType WSFunction
wspd_functor< A, B, C > forall_well_separated_pairs(A a, B b, C c)
simple functor for iterating over all nodes
float * m_origXPos
point x coord in graph order
float * m_nodeSize
node size
void nodeFence(NodeID nodeID)
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 ...
DNodeFuncType DNodeFunction
LQPoint * m_points
the point order in tree order
float m_max_x
the x coordinate of the right most point
top_down_traversal_functor< F, Cond > top_down_traversal(F f, Cond cond) const
creator
const LinearQuadtree & tree
top_down_traversal_functor(const LinearQuadtree &t, F f)
const LinearQuadtree & tree
void setNumberOfPoints(NodeID nodeID, uint32_t numPoints)
sets the number of nodes containted in node nodeID
float m_min_x
the x coordinate of the left most point
StoreDirectPairFunctor StoreDirectPairFunction()
void updatePointPositionSize(PointID id)
~LinearQuadtree(void)
destructor. tree mem will be released
NodeID directNodeB(uint32_t i) const
static pair_call_functor< F, A > pair_call(F f, A a)
creates a pair call resulting in a call f(a, *)
StoreWSPairFunctor StoreWSPairFunction()
void initInnerNode(NodeID nodeID, NodeID leftChild, NodeID rightChild, uint32_t level, NodeID next)
bool isLeaf(NodeID nodeID) const
returns true if the given node index is a leaf
NodeID m_root
the root of the tree
is_leaf_condition_functor(const LinearQuadtree &t)
Class for the Well-Separated-Pairs-Decomposition (WSPD)
the builder for the LinearQuadtree
NodeID level(NodeID nodeID) const
NodeID m_firstLeaf
first leaf in the leaf chain
uint32_t numberOfWSP() const
The namespace for all OGDF objects.
LQPoint & point(PointID pointID)
void operator()(NodeID u)
void operator()(NodeID a, NodeID b)
Definitions of functors used in FME layout.
simple functor for iterating over all points of a node
wspd_functor< A, B, C, ConditionType > forall_well_separated_pairs(A a, B b, C c, ConditionType cond)
const LinearQuadtree & tree
NodeID nextNode(NodeID nodeID) const
WSPD * m_WSPD
the wspd of this quadtree
float * m_pointSize
point size in tree order
float * pointSize() const
bool isFence(NodeID nodeID) const
sets the fence flag for node nodeID
wspd_functor(const LinearQuadtree &t, WSPairFuncType &wsf, DPairFuncType &dpf, DNodeFuncType &dnf, BranchCondType &bc)
MortonNR mortonNr(PointID point) const
const LinearQuadtree & tree
StoreDirectPairFunctor(LinearQuadtree &t)
bottom up traversal of the subtree of a given node
bottom_up_traversal_functor(const LinearQuadtree &t, F f)
uint32_t numberOfNodes() const
returns the number of nodes in this tree
top_down_traversal_functor(const LinearQuadtree &t, F f, CondType c)
uint64_t sizeInBytes() const
NodeID nodeOfPoint(PointID id) const
DPairFuncType DPairFunction