00001 /* 00002 * $Revision: 2027 $ 00003 * 00004 * last checkin: 00005 * $Author: gutwenger $ 00006 * $Date: 2010-09-01 11:55:17 +0200 (Wed, 01 Sep 2010) $ 00007 ***************************************************************/ 00008 00052 #ifdef _MSC_VER 00053 #pragma once 00054 #endif 00055 00056 #ifndef OGDF_QUAD_TREE_NODE_NM_H 00057 #define OGDF_QUAD_TREE_NODE_NM_H 00058 00059 00060 #include <ogdf/basic/Graph.h> 00061 #include <ogdf/basic/List.h> 00062 #include <ogdf/basic/geometry.h> 00063 #include <ogdf/internal/energybased/ParticleInfo.h> 00064 #include <complex> 00065 00066 00067 using std::complex; 00068 00069 namespace ogdf { 00070 00071 class QuadTreeNodeNM 00072 { 00073 //Helping data structure that stores the information needed to represent 00074 //a node of the reduced quad tree in the New Multipole Method (NMM). 00075 00076 //Outputstream for QuadTreeNodeNM. 00077 friend ostream &operator<< (ostream &,const QuadTreeNodeNM &); 00078 00079 //Inputstream for QuadTreeNodeNM. 00080 friend istream &operator>> (istream &,QuadTreeNodeNM &); 00081 00082 public: 00083 00084 QuadTreeNodeNM(); //constructor 00085 ~QuadTreeNodeNM(); //destructor 00086 00087 void set_Sm_level(int l) { Sm_level = l;} 00088 void set_Sm_downleftcorner(DPoint dlc) {Sm_downleftcorner = dlc;} 00089 void set_Sm_boxlength(double l) {Sm_boxlength = l;} 00090 void set_x_List_ptr(List<ParticleInfo>* x_ptr) {L_x_ptr = x_ptr;} 00091 void set_y_List_ptr(List<ParticleInfo>* y_ptr) {L_y_ptr = y_ptr;} 00092 void set_particlenumber_in_subtree(int p){ subtreeparticlenumber = p;} 00093 void set_Sm_center(complex<double> c) {Sm_center = c;} 00094 void set_contained_nodes(List<node>& L) {contained_nodes = L;} 00095 void pushBack_contained_nodes(node v) {contained_nodes.pushBack(v);} 00096 node pop_contained_nodes() {return contained_nodes.popFrontRet();} 00097 bool contained_nodes_empty() {return contained_nodes.empty();} 00098 00099 void set_I(List<QuadTreeNodeNM*>& l) {I = l;} 00100 void set_D1(List<QuadTreeNodeNM*>& l) {D1 = l;} 00101 void set_D2(List<QuadTreeNodeNM*>& l) {D2 = l;} 00102 void set_M(List<QuadTreeNodeNM*>& l) {M = l;} 00103 00104 //LE[i] is set to local[i] for i = 0 to precision and space for LE is reserved. 00105 void set_locale_exp(Array<complex<double> > &local,int precision) 00106 { 00107 int i; 00108 LE = new complex<double> [precision+1]; 00109 for (i = 0 ; i<= precision; i++) 00110 LE[i] = local[i]; 00111 } 00112 00113 //ME[i] is set to multi[i] for i = 0 to precision and space for LE is reserved. 00114 void set_multipole_exp(Array<complex<double> > &multi,int precision) 00115 { 00116 int i; 00117 ME = new complex<double> [precision+1]; 00118 for (i = 0 ; i<= precision; i++) 00119 ME[i] = multi[i]; 00120 } 00121 00122 //ME[i] is set to multi[i] for i = 0 to precision and no space for LE is reserved. 00123 void replace_multipole_exp(Array<complex<double> > &multi,int precision) 00124 { 00125 int i; 00126 for (i = 0 ; i<= precision; i++) 00127 ME[i] = multi[i]; 00128 } 00129 00130 void set_father_ptr (QuadTreeNodeNM* f) { father_ptr = f;} 00131 void set_child_lt_ptr(QuadTreeNodeNM* c) {child_lt_ptr = c;} 00132 void set_child_rt_ptr(QuadTreeNodeNM* c) {child_rt_ptr = c;} 00133 void set_child_lb_ptr(QuadTreeNodeNM* c) {child_lb_ptr = c;} 00134 void set_child_rb_ptr(QuadTreeNodeNM* c) {child_rb_ptr = c;} 00135 00136 bool is_root() {if(father_ptr == NULL) return true; else return false;} 00137 bool is_leaf(){if ((child_lt_ptr == NULL) &&(child_rt_ptr == NULL) &&(child_lb_ptr 00138 == NULL) && (child_rb_ptr == NULL)) 00139 return true; else return false;} 00140 bool child_lt_exists() { if (child_lt_ptr != NULL) return true; else return false;} 00141 bool child_rt_exists() { if (child_rt_ptr != NULL) return true; else return false;} 00142 bool child_lb_exists() { if (child_lb_ptr != NULL) return true; else return false;} 00143 bool child_rb_exists() { if (child_rb_ptr != NULL) return true; else return false;} 00144 00145 int get_Sm_level () const {return Sm_level;} 00146 DPoint get_Sm_downleftcorner () const {return Sm_downleftcorner;} 00147 double get_Sm_boxlength () const {return Sm_boxlength; } 00148 List<ParticleInfo>* get_x_List_ptr() {return L_x_ptr;} 00149 List<ParticleInfo>* get_y_List_ptr() {return L_y_ptr;} 00150 int get_particlenumber_in_subtree()const { return subtreeparticlenumber;} 00151 complex<double> get_Sm_center() const {return Sm_center;} 00152 complex<double>* get_local_exp () const {return LE;} 00153 complex<double>* get_multipole_exp () const {return ME;} 00154 void get_contained_nodes(List<node>& L) const {L = contained_nodes;} 00155 void get_I (List <QuadTreeNodeNM*>& l){l = I;} 00156 void get_D1 (List <QuadTreeNodeNM*>& l){l = D1;} 00157 void get_D2 (List <QuadTreeNodeNM*>& l){l = D2;} 00158 void get_M (List <QuadTreeNodeNM*>& l){l = M;} 00159 00160 QuadTreeNodeNM* get_father_ptr () const {return father_ptr;} 00161 QuadTreeNodeNM* get_child_lt_ptr () const {return child_lt_ptr;} 00162 QuadTreeNodeNM* get_child_rt_ptr () const {return child_rt_ptr;} 00163 QuadTreeNodeNM* get_child_lb_ptr () const {return child_lb_ptr;} 00164 QuadTreeNodeNM* get_child_rb_ptr () const {return child_rb_ptr;} 00165 00166 private: 00167 00168 int Sm_level; //level of the small cell 00169 DPoint Sm_downleftcorner; //coords of the down left corner of the small cell 00170 double Sm_boxlength; //length of small cell 00171 List<ParticleInfo>* L_x_ptr; //points to the lists that contain each Particle 00172 //of G with its x(y)coordinate in increasing order 00173 List<ParticleInfo>* L_y_ptr; //and a cross reference to the list_item in the 00174 //list with the other coordinate 00175 int subtreeparticlenumber; //the number of particles in the subtree rooted 00176 //at this node 00177 complex<double> Sm_center; //center of the small cell 00178 complex<double>* ME; //Multipole Expansion terms 00179 complex<double>* LE; //Locale Expansion terms 00180 List <node> contained_nodes; //list of nodes of G that are contained in this 00181 //QuadTreeNode (emty if it is not a leave of 00182 //the ModQuadTree 00183 List <QuadTreeNodeNM*> I; //the list of min. ill sep. nodes in DIM2 00184 List <QuadTreeNodeNM*> D1,D2; //list of neighbouring(=D1) and not adjacent(=D2) 00185 //leaves for direct force calculation in DIM2 00186 List<QuadTreeNodeNM*> M; //list of nodes with multipole force contribution 00187 //like in DIM2 00188 QuadTreeNodeNM* father_ptr; //points to the father node 00189 QuadTreeNodeNM* child_lt_ptr; //points to left top child 00190 QuadTreeNodeNM* child_rt_ptr; //points to right bottom child 00191 QuadTreeNodeNM* child_lb_ptr; //points to left bottom child 00192 QuadTreeNodeNM* child_rb_ptr; //points to right bottom child 00193 }; 00194 }//namespace ogdf 00195 #endif 00196 00197