Open
Graph Drawing
Framework

 v.2012.07
 

QuadTreeNodeNM.h
Go to the documentation of this file.
1 /*
2  * $Revision: 2564 $
3  *
4  * last checkin:
5  * $Author: gutwenger $
6  * $Date: 2012-07-07 00:03:48 +0200 (Sa, 07. Jul 2012) $
7  ***************************************************************/
8 
43 #ifdef _MSC_VER
44 #pragma once
45 #endif
46 
47 #ifndef OGDF_QUAD_TREE_NODE_NM_H
48 #define OGDF_QUAD_TREE_NODE_NM_H
49 
50 
51 #include <ogdf/basic/Graph.h>
52 #include <ogdf/basic/List.h>
53 #include <ogdf/basic/geometry.h>
55 #include <complex>
56 
57 
58 using std::complex;
59 
60 namespace ogdf {
61 
63 {
64  //Helping data structure that stores the information needed to represent
65  //a node of the reduced quad tree in the New Multipole Method (NMM).
66 
67  //Outputstream for QuadTreeNodeNM.
68  friend ostream &operator<< (ostream &,const QuadTreeNodeNM &);
69 
70  //Inputstream for QuadTreeNodeNM.
71  friend istream &operator>> (istream &,QuadTreeNodeNM &);
72 
73 public:
74 
75  QuadTreeNodeNM(); //constructor
76  ~QuadTreeNodeNM(); //destructor
77 
78  void set_Sm_level(int l) { Sm_level = l;}
80  void set_Sm_boxlength(double l) {Sm_boxlength = l;}
81  void set_x_List_ptr(List<ParticleInfo>* x_ptr) {L_x_ptr = x_ptr;}
82  void set_y_List_ptr(List<ParticleInfo>* y_ptr) {L_y_ptr = y_ptr;}
84  void set_Sm_center(complex<double> c) {Sm_center = c;}
89 
90  void set_I(List<QuadTreeNodeNM*>& l) {I = l;}
93  void set_M(List<QuadTreeNodeNM*>& l) {M = l;}
94 
95  //LE[i] is set to local[i] for i = 0 to precision and space for LE is reserved.
96  void set_locale_exp(Array<complex<double> > &local,int precision)
97  {
98  int i;
99  LE = new complex<double> [precision+1];
100  for (i = 0 ; i<= precision; i++)
101  LE[i] = local[i];
102  }
103 
104  //ME[i] is set to multi[i] for i = 0 to precision and space for LE is reserved.
105  void set_multipole_exp(Array<complex<double> > &multi,int precision)
106  {
107  int i;
108  ME = new complex<double> [precision+1];
109  for (i = 0 ; i<= precision; i++)
110  ME[i] = multi[i];
111  }
112 
113  //ME[i] is set to multi[i] for i = 0 to precision and no space for LE is reserved.
114  void replace_multipole_exp(Array<complex<double> > &multi,int precision)
115  {
116  int i;
117  for (i = 0 ; i<= precision; i++)
118  ME[i] = multi[i];
119  }
120 
126 
127  bool is_root() {if(father_ptr == NULL) return true; else return false;}
128  bool is_leaf(){if ((child_lt_ptr == NULL) &&(child_rt_ptr == NULL) &&(child_lb_ptr
129  == NULL) && (child_rb_ptr == NULL))
130  return true; else return false;}
131  bool child_lt_exists() { if (child_lt_ptr != NULL) return true; else return false;}
132  bool child_rt_exists() { if (child_rt_ptr != NULL) return true; else return false;}
133  bool child_lb_exists() { if (child_lb_ptr != NULL) return true; else return false;}
134  bool child_rb_exists() { if (child_rb_ptr != NULL) return true; else return false;}
135 
136  int get_Sm_level () const {return Sm_level;}
138  double get_Sm_boxlength () const {return Sm_boxlength; }
142  complex<double> get_Sm_center() const {return Sm_center;}
143  complex<double>* get_local_exp () const {return LE;}
144  complex<double>* get_multipole_exp () const {return ME;}
150 
156 
157 private:
158 
159  int Sm_level; //level of the small cell
160  DPoint Sm_downleftcorner; //coords of the down left corner of the small cell
161  double Sm_boxlength; //length of small cell
162  List<ParticleInfo>* L_x_ptr; //points to the lists that contain each Particle
163  //of G with its x(y)coordinate in increasing order
164  List<ParticleInfo>* L_y_ptr; //and a cross reference to the list_item in the
165  //list with the other coordinate
166  int subtreeparticlenumber; //the number of particles in the subtree rooted
167  //at this node
168  complex<double> Sm_center; //center of the small cell
169  complex<double>* ME; //Multipole Expansion terms
170  complex<double>* LE; //Locale Expansion terms
171  List <node> contained_nodes; //list of nodes of G that are contained in this
172  //QuadTreeNode (emty if it is not a leave of
173  //the ModQuadTree
174  List <QuadTreeNodeNM*> I; //the list of min. ill sep. nodes in DIM2
175  List <QuadTreeNodeNM*> D1,D2; //list of neighbouring(=D1) and not adjacent(=D2)
176  //leaves for direct force calculation in DIM2
177  List<QuadTreeNodeNM*> M; //list of nodes with multipole force contribution
178  //like in DIM2
179  QuadTreeNodeNM* father_ptr; //points to the father node
180  QuadTreeNodeNM* child_lt_ptr; //points to left top child
181  QuadTreeNodeNM* child_rt_ptr; //points to right bottom child
182  QuadTreeNodeNM* child_lb_ptr; //points to left bottom child
183  QuadTreeNodeNM* child_rb_ptr; //points to right bottom child
184 };
185 
186 }//namespace ogdf
187 
188 #endif