SISCone
2.0.5
|
Implementation of a 2D quadtree. More...
#include <quadtree.h>
Public Member Functions | |
Cquadtree () | |
default ctor | |
Cquadtree (double _x, double _y, double _half_size_x, double _half_size_y) | |
ctor with initialisation (see init for details) | |
~Cquadtree () | |
default destructor at destruction, everything is destroyed except physical values at the leaves | |
int | init (double _x, double _y, double _half_size_x, double _half_size_y) |
init the tree. | |
int | add (Cmomentum *v_add) |
adding a particle to the tree. | |
Creference | circle_intersect (double cx, double cy, double cR2) |
circle intersection. | |
int | save (FILE *flux) |
output a data file for drawing the grid. | |
int | save_leaves (FILE *flux) |
output a data file for drawing the tree leaves. |
Public Attributes | |
double | centre_x |
x-position of the centre of the cell | |
double | centre_y |
y-position of the centre of the cell | |
double | half_size_x |
HALF size of the cell. | |
double | half_size_y |
HALF size of the cell. | |
Cmomentum * | v |
physical contents | |
Cquadtree * | children [2][2] |
sub-cells ( 0,1->left-right; 0,1->bottom,top) | |
bool | has_child |
true if not a leaf |
Implementation of a 2D quadtree.
This class implements the traditional two-dimensional quadtree. The elements at each node are of 'Cmomentum' type.
Definition at line 43 of file quadtree.h.
int siscone::Cquadtree::add | ( | Cmomentum * | v_add | ) |
adding a particle to the tree.
This method adds one vector to the quadtree structure which is updated consequently.
v_add | vector to add |
Definition at line 111 of file quadtree.cpp.
References siscone::Cmomentum::eta, and siscone::Cmomentum::phi.
Creference siscone::Cquadtree::circle_intersect | ( | double | cx, |
double | cy, | ||
double | cR2 | ||
) |
circle intersection.
computes the intersection with a circle of given centre and radius. The output takes the form of a quadtree with all squares included in the circle.
cx | circle centre x coordinate |
cy | circle centre y coordinate |
cR2 | circle radius SQUARED |
Definition at line 176 of file quadtree.cpp.
int siscone::Cquadtree::init | ( | double | _x, |
double | _y, | ||
double | _half_size_x, | ||
double | _half_size_y | ||
) |
init the tree.
By initializing the tree, we mean setting the cell parameters and preparing the object to act as a seed for a new tree.
_x | x-position of the center |
_y | y-position of the center |
_half_size_x | x-size of the cell |
_half_size_y | y-size of the cell |
Definition at line 91 of file quadtree.cpp.
int siscone::Cquadtree::save | ( | FILE * | flux | ) |
output a data file for drawing the grid.
This can be used to output a data file containing all the grid subdivisions. The file contents is as follows: first and second columns give center of the cell, the third gives the size.
flux | opened stream to write to |
Definition at line 261 of file quadtree.cpp.
int siscone::Cquadtree::save_leaves | ( | FILE * | flux | ) |
output a data file for drawing the tree leaves.
This can be used to output a data file containing all the tree leaves. The file contents is as follows: first and second columns give center of the cell, the third gives the size.
flux | opened stream to write to |
Definition at line 287 of file quadtree.cpp.