Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

ogdf::energybased::dtree::DTree< IntType, Dim > Class Template Reference

Implentation of the reduced quadtree for Dim dimensions. More...

#include <ogdf/energybased/dtree/DTree.h>

Classes

struct  MortonEntry
 The entry in the sorted order for a point. More...
 
struct  Node
 The node class. More...
 
struct  Point
 The point class with integer coords. More...
 

Public Member Functions

 DTree (int numPoints)
 constructor More...
 
 ~DTree ()
 destructor More...
 
void adjustPointInfo (int curr)
 used to update the first and numPoints of inner nodes by linkNodes More...
 
void build ()
 Does all required steps except the allocate, deallocate, randomPoints. More...
 
int child (int i, int j) const
 returns the index of the j th child of node i More...
 
int countPoints (int curr) const
 Just for fun: traverse the tree and count the points in the leaves. More...
 
int countPoints () const
 Just for fun: traverse the tree and count the points in the leaves. More...
 
int linkNodes (int curr, int maxLevel)
 The Recursive Bottom-Up Construction. More...
 
void linkNodes ()
 The Recursive Bottom-Up Construction (recursion start) More...
 
int maxNumNodes () const
 returns the maximum number of nodes (and the max index of a node) More...
 
void mergeWithNext (int curr)
 Merges curr with next node in the chain (used by linkNodes) More...
 
const Node & node (int i) const
 Just to access the nodes a little bit easier. More...
 
Node & node (int i)
 Just to access the nodes a little bit easier. More...
 
int numChilds (int i) const
 returns the number of children of node i More...
 
int numPoints (int i) const
 returns the number of points covered by this subtree More...
 
int numPoints () const
 returns the number of points the quadtree contains More...
 
int point (int i, int j) const
 returns the index of the jth point covered by i's subtree. More...
 
const Point & point (int i) const
 returns the ith point in the input sequence More...
 
void prepareMortonOrder ()
 Prepares the morton numbers for sorting. More...
 
void prepareNodeLayer ()
 Prepares both the leaf and inner node layer. More...
 
int rootIndex () const
 returns the index of the root node More...
 
void setPoint (int i, int d, IntType value)
 sets the point to the given grid coords More...
 
void sortMortonNumbers ()
 Sorts the points by morton number. More...
 

Static Public Attributes

static constexpr int MaxNumChildrenPerNode = (1 << Dim)
 the maximum number of children per node = 2^d More...
 

Private Member Functions

void allocate (int n)
 Allocates memory for n points. More...
 
void deallocate ()
 Releases memory. More...
 

Private Attributes

int m_maxLevel
 
MortonEntry * m_mortonOrder
 The order to be sorted. More...
 
Node * m_nodes
 Memory for all nodes. More...
 
int m_numPoints
 Total number of points. More...
 
Point * m_points
 The input set. More...
 
int m_rootIndex
 The index of the root node. More...
 

Detailed Description

template<typename IntType, int Dim>
class ogdf::energybased::dtree::DTree< IntType, Dim >

Implentation of the reduced quadtree for Dim dimensions.

Definition at line 40 of file DTree.h.

Constructor & Destructor Documentation

◆ DTree()

template<typename IntType , int Dim>
ogdf::energybased::dtree::DTree< IntType, Dim >::DTree ( int  numPoints)
inlineexplicit

constructor

Definition at line 48 of file DTree.h.

◆ ~DTree()

template<typename IntType , int Dim>
ogdf::energybased::dtree::DTree< IntType, Dim >::~DTree ( )
inline

destructor

Definition at line 55 of file DTree.h.

Member Function Documentation

◆ adjustPointInfo()

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::adjustPointInfo ( int  curr)
inline

used to update the first and numPoints of inner nodes by linkNodes

Definition at line 299 of file DTree.h.

◆ allocate()

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::allocate ( int  n)
private

Allocates memory for n points.

allocates memory for n points

Definition at line 178 of file DTree.h.

◆ build()

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::build ( )

Does all required steps except the allocate, deallocate, randomPoints.

link the inner nodes using the recursive bottom-up method

Definition at line 371 of file DTree.h.

◆ child()

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::child ( int  i,
int  j 
) const
inline

returns the index of the j th child of node i

Definition at line 107 of file DTree.h.

◆ countPoints() [1/2]

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::countPoints ( int  curr) const

Just for fun: traverse the tree and count the points in the leaves.

Definition at line 355 of file DTree.h.

◆ countPoints() [2/2]

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::countPoints ( ) const
inline

Just for fun: traverse the tree and count the points in the leaves.

Definition at line 155 of file DTree.h.

◆ deallocate()

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::deallocate ( )
private

Releases memory.

releases memory

Definition at line 189 of file DTree.h.

◆ linkNodes() [1/2]

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::linkNodes ( int  curr,
int  maxLevel 
)

The Recursive Bottom-Up Construction.

Definition at line 313 of file DTree.h.

◆ linkNodes() [2/2]

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::linkNodes ( )

The Recursive Bottom-Up Construction (recursion start)

Definition at line 348 of file DTree.h.

◆ maxNumNodes()

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::maxNumNodes ( ) const
inline

returns the maximum number of nodes (and the max index of a node)

Definition at line 122 of file DTree.h.

◆ mergeWithNext()

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::mergeWithNext ( int  curr)
inline

Merges curr with next node in the chain (used by linkNodes)

Definition at line 285 of file DTree.h.

◆ node() [1/2]

template<typename IntType , int Dim>
const Node& ogdf::energybased::dtree::DTree< IntType, Dim >::node ( int  i) const
inline

Just to access the nodes a little bit easier.

Definition at line 98 of file DTree.h.

◆ node() [2/2]

template<typename IntType , int Dim>
Node& ogdf::energybased::dtree::DTree< IntType, Dim >::node ( int  i)
inline

Just to access the nodes a little bit easier.

Definition at line 101 of file DTree.h.

◆ numChilds()

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::numChilds ( int  i) const
inline

returns the number of children of node i

Definition at line 104 of file DTree.h.

◆ numPoints() [1/2]

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::numPoints ( int  i) const
inline

returns the number of points covered by this subtree

Definition at line 110 of file DTree.h.

◆ numPoints() [2/2]

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::numPoints ( ) const
inline

returns the number of points the quadtree contains

Definition at line 119 of file DTree.h.

◆ point() [1/2]

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::point ( int  i,
int  j 
) const
inline

returns the index of the jth point covered by i's subtree.

Definition at line 113 of file DTree.h.

◆ point() [2/2]

template<typename IntType , int Dim>
const Point& ogdf::energybased::dtree::DTree< IntType, Dim >::point ( int  i) const
inline

returns the ith point in the input sequence

Definition at line 125 of file DTree.h.

◆ prepareMortonOrder()

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::prepareMortonOrder ( )

Prepares the morton numbers for sorting.

Definition at line 205 of file DTree.h.

◆ prepareNodeLayer()

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::prepareNodeLayer ( )

Prepares both the leaf and inner node layer.

Definition at line 228 of file DTree.h.

◆ rootIndex()

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::rootIndex ( ) const
inline

returns the index of the root node

Definition at line 158 of file DTree.h.

◆ setPoint()

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::setPoint ( int  i,
int  d,
IntType  value 
)

sets the point to the given grid coords

Definition at line 197 of file DTree.h.

◆ sortMortonNumbers()

template<typename IntType , int Dim>
void ogdf::energybased::dtree::DTree< IntType, Dim >::sortMortonNumbers ( )

Sorts the points by morton number.

Definition at line 219 of file DTree.h.

Member Data Documentation

◆ m_maxLevel

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::m_maxLevel
private

Definition at line 168 of file DTree.h.

◆ m_mortonOrder

template<typename IntType , int Dim>
MortonEntry* ogdf::energybased::dtree::DTree< IntType, Dim >::m_mortonOrder
private

The order to be sorted.

Definition at line 171 of file DTree.h.

◆ m_nodes

template<typename IntType , int Dim>
Node* ogdf::energybased::dtree::DTree< IntType, Dim >::m_nodes
private

Memory for all nodes.

Definition at line 172 of file DTree.h.

◆ m_numPoints

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::m_numPoints
private

Total number of points.

Definition at line 170 of file DTree.h.

◆ m_points

template<typename IntType , int Dim>
Point* ogdf::energybased::dtree::DTree< IntType, Dim >::m_points
private

The input set.

Definition at line 169 of file DTree.h.

◆ m_rootIndex

template<typename IntType , int Dim>
int ogdf::energybased::dtree::DTree< IntType, Dim >::m_rootIndex
private

The index of the root node.

Definition at line 173 of file DTree.h.

◆ MaxNumChildrenPerNode

template<typename IntType , int Dim>
constexpr int ogdf::energybased::dtree::DTree< IntType, Dim >::MaxNumChildrenPerNode = (1 << Dim)
static

the maximum number of children per node = 2^d

Definition at line 45 of file DTree.h.


The documentation for this class was generated from the following file: