00001 /* 00002 * $Revision: 2299 $ 00003 * 00004 * last checkin: 00005 * $Author: gutwenger $ 00006 * $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 00007 ***************************************************************/ 00008 00043 #ifdef _MSC_VER 00044 #pragma once 00045 #endif 00046 00047 #ifndef OGDF_QUAD_TREE_NM_H 00048 #define OGDF_QUAD_TREE_NM_H 00049 00050 #include <ogdf/internal/energybased/QuadTreeNodeNM.h> 00051 #include "ParticleInfo.h" 00052 00053 namespace ogdf { 00054 00055 class QuadTreeNM 00056 { 00057 //Helping data structure that stores the information needed to represent 00058 //the modified quadtree in the New Multipole Merthod (NMM) 00059 00060 public: 00061 00062 QuadTreeNM(); //constructor 00063 ~QuadTreeNM(); //destructor 00064 00065 //Deletes the tree starting at node_ptr. 00066 void delete_tree(QuadTreeNodeNM* node_ptr); 00067 00068 //Deletes the tree starting at node_ptr and counts the nodes of the subtree. 00069 void delete_tree_and_count_nodes(QuadTreeNodeNM* node_ptr,int& nodecounter); 00070 00071 //Pre_order traversal of the tree rooted at node_ptr (with or without 00072 //output of the M,L-lists from 0 to precision). 00073 void cout_preorder(QuadTreeNodeNM* node_ptr); 00074 void cout_preorder(QuadTreeNodeNM* node_ptr,int precision); 00075 00076 //Creates the root node and lets act_ptr and root_ptr point to the root node. 00077 void init_tree() 00078 { 00079 root_ptr = new QuadTreeNodeNM(); 00080 act_ptr = root_ptr; 00081 } 00082 00083 //Sets act_ptr to the root_ptr. 00084 void start_at_root() 00085 { 00086 act_ptr = root_ptr; 00087 } 00088 00089 //Sets act_ptr to the father_ptr. 00090 void go_to_father() 00091 { 00092 if (act_ptr->get_father_ptr() != NULL) 00093 act_ptr = act_ptr->get_father_ptr(); 00094 else 00095 cout<<"Error QuadTreeNM: No father Node exists"; 00096 } 00097 00098 //Sets act_ptr to the left_top_child_ptr. 00099 void go_to_lt_child() 00100 { 00101 act_ptr = act_ptr->get_child_lt_ptr(); 00102 } 00103 00104 //Sets act_ptr to the right_top_child_ptr. 00105 void go_to_rt_child() 00106 { 00107 act_ptr = act_ptr->get_child_rt_ptr(); 00108 } 00109 00110 //Sets act_ptr to the left_bottom_child_ptr. 00111 void go_to_lb_child() 00112 { 00113 act_ptr = act_ptr->get_child_lb_ptr(); 00114 } 00115 00116 //Sets act_ptr to the right_bottom_child_ptr. 00117 void go_to_rb_child() 00118 { 00119 act_ptr = act_ptr->get_child_rb_ptr(); 00120 } 00121 00122 //Creates a new left_top_child of the actual node (importing L_x(y)_ptr). 00123 void create_new_lt_child(List<ParticleInfo>* L_x_ptr,List<ParticleInfo>* L_y_ptr); 00124 void create_new_lt_child(); 00125 00126 //Creates a new right_top_child of the actual node (importing L_x(y)_ptr). 00127 void create_new_rt_child(List<ParticleInfo>* L_x_ptr,List<ParticleInfo>* L_y_ptr); 00128 void create_new_rt_child(); 00129 00130 //Creates a new left_bottom_child of the actual node (importing L_x(y)_ptr). 00131 void create_new_lb_child(List<ParticleInfo>* L_x_ptr,List<ParticleInfo>* L_y_ptr); 00132 void create_new_lb_child(); 00133 00134 //Creates a new right_bottom_child of the actual node(importing L_x(y)_ptr). 00135 void create_new_rb_child(List<ParticleInfo>* L_x_ptr,List<ParticleInfo>* L_y_ptr); 00136 void create_new_rb_child(); 00137 00138 //Returns the actual/root node pointer of the tree. 00139 QuadTreeNodeNM* get_act_ptr() { return act_ptr;} 00140 QuadTreeNodeNM* get_root_ptr(){ return root_ptr;} 00141 00142 //Sets root_ptr to r_ptr. 00143 void set_root_ptr(QuadTreeNodeNM* r_ptr) {root_ptr = r_ptr;} 00144 00145 //Sets act_ptr to a_ptr. 00146 void set_act_ptr(QuadTreeNodeNM* a_ptr) {act_ptr = a_ptr;} 00147 00148 //Sets the content of *root_ptr to r. 00149 void set_root_node(QuadTreeNodeNM& r){*root_ptr = r;} 00150 00151 private: 00152 QuadTreeNodeNM* root_ptr; //points to the root node 00153 QuadTreeNodeNM* act_ptr; //points to the actual node 00154 00155 }; 00156 }//namespace ogdf 00157 #endif 00158 00159