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