SISCone  2.0.6
quadtree.h
1 // -*- C++ -*-
3 // File: quadtree.h //
4 // Description: header file for quadtree management (Cquadtree class) //
5 // This file is part of the SISCone project. //
6 // For more details, see http://projects.hepforge.org/siscone //
7 // //
8 // Copyright (c) 2006 Gavin Salam and Gregory Soyez //
9 // //
10 // This program is free software; you can redistribute it and/or modify //
11 // it under the terms of the GNU General Public License as published by //
12 // the Free Software Foundation; either version 2 of the License, or //
13 // (at your option) any later version. //
14 // //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
18 // GNU General Public License for more details. //
19 // //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program; if not, write to the Free Software //
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
23 // //
24 // $Revision:: 123 $//
25 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $//
27 
28 #ifndef __QUADTREE_H__
29 #define __QUADTREE_H__
30 
31 #include "momentum.h"
32 #include <stdio.h>
33 
34 namespace siscone{
35 
43 class Cquadtree{
44  public:
46  Cquadtree();
47 
49  Cquadtree(double _x, double _y, double _half_size_x, double _half_size_y);
50 
54  ~Cquadtree();
55 
67  int init(double _x, double _y, double _half_size_x, double _half_size_y);
68 
76  int add(Cmomentum *v_add);
77 
88  Creference circle_intersect(double cx, double cy, double cR2);
89 
99  int save(FILE *flux);
100 
110  int save_leaves(FILE *flux);
111 
112  double centre_x;
113  double centre_y;
114  double half_size_x;
115  double half_size_y;
116 
118 
120  bool has_child;
121 };
122 
123 }
124 #endif
Implementation of a 2D quadtree.
Definition: quadtree.h:43
int save(FILE *flux)
output a data file for drawing the grid.
Definition: quadtree.cpp:261
int init(double _x, double _y, double _half_size_x, double _half_size_y)
init the tree.
Definition: quadtree.cpp:91
Creference circle_intersect(double cx, double cy, double cR2)
circle intersection.
Definition: quadtree.cpp:176
base class for dynamic coordinates management
Definition: momentum.h:49
int save_leaves(FILE *flux)
output a data file for drawing the tree leaves.
Definition: quadtree.cpp:287
double half_size_y
HALF size of the cell.
Definition: quadtree.h:115
Definition: area.cpp:33
double centre_y
y-position of the centre of the cell
Definition: quadtree.h:113
Cquadtree()
default ctor
Definition: quadtree.cpp:45
Cquadtree * children[2][2]
sub-cells ( 0,1->left-right; 0,1->bottom,top)
Definition: quadtree.h:119
Cmomentum * v
physical contents
Definition: quadtree.h:117
bool has_child
true if not a leaf
Definition: quadtree.h:120
int add(Cmomentum *v_add)
adding a particle to the tree.
Definition: quadtree.cpp:111
~Cquadtree()
default destructor at destruction, everything is destroyed except physical values at the leaves ...
Definition: quadtree.cpp:69
double centre_x
x-position of the centre of the cell
Definition: quadtree.h:112
double half_size_x
HALF size of the cell.
Definition: quadtree.h:114
references used for checksums.
Definition: reference.h:43
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Mon Oct 19 2015 20:25:39 for SISCone by  Doxygen 1.8.9.1