siscone is hosted by Hepforge, IPPP Durham

The SISCone Jet Algorithm

Version 3.0.6



SISCone 3.0.6
siscone::Cquadtree Class Reference

Implementation of a 2D quadtree. More...

#include <quadtree.h>

Collaboration diagram for siscone::Cquadtree:

Public Member Functions

 Cquadtree ()
 default ctor More...
 
 Cquadtree (double _x, double _y, double _half_size_x, double _half_size_y)
 ctor with initialisation (see init for details) More...
 
 ~Cquadtree ()
 default destructor at destruction, everything is destroyed except physical values at the leaves More...
 
int init (double _x, double _y, double _half_size_x, double _half_size_y)
 init the tree. More...
 
int add (Cmomentum *v_add)
 adding a particle to the tree. More...
 
Creference circle_intersect (double cx, double cy, double cR2)
 circle intersection. More...
 
int save (FILE *flux)
 output a data file for drawing the grid. More...
 
int save_leaves (FILE *flux)
 output a data file for drawing the tree leaves. More...
 

Public Attributes

double centre_x
 x-position of the centre of the cell More...
 
double centre_y
 y-position of the centre of the cell More...
 
double half_size_x
 HALF size of the cell. More...
 
double half_size_y
 HALF size of the cell. More...
 
Cmomentumv
 physical contents More...
 
Cquadtreechildren [2][2]
 sub-cells ( 0,1->left-right; 0,1->bottom,top) More...
 
bool has_child
 true if not a leaf More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Cquadtree() [1/2]

siscone::Cquadtree::Cquadtree ( )

default ctor

Definition at line 45 of file quadtree.cpp.

References children, has_child, and v.

Referenced by add().

◆ Cquadtree() [2/2]

siscone::Cquadtree::Cquadtree ( double  _x,
double  _y,
double  _half_size_x,
double  _half_size_y 
)

ctor with initialisation (see init for details)

Definition at line 55 of file quadtree.cpp.

References children, has_child, init(), and v.

◆ ~Cquadtree()

siscone::Cquadtree::~Cquadtree ( )

default destructor at destruction, everything is destroyed except physical values at the leaves

Definition at line 69 of file quadtree.cpp.

References children, has_child, and v.

Member Function Documentation

◆ add()

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.

Parameters
v_addvector to add
Returns
0 on success 1 on error

Definition at line 111 of file quadtree.cpp.

References add(), centre_x, centre_y, children, Cquadtree(), siscone::Cmomentum::eta, half_size_x, half_size_y, has_child, siscone::Cmomentum::phi, and v.

Referenced by add().

◆ circle_intersect()

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.

Parameters
cxcircle centre x coordinate
cycircle centre y coordinate
cR2circle radius SQUARED
Returns
the checksum for that intersection

Definition at line 176 of file quadtree.cpp.

References centre_x, centre_y, children, circle_intersect(), siscone::Cmomentum::eta, half_size_x, half_size_y, has_child, siscone::Cmomentum::phi, siscone::Cmomentum::ref, and v.

Referenced by circle_intersect().

◆ init()

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.

Parameters
_xx-position of the center
_yy-position of the center
_half_size_xx-size of the cell
_half_size_yy-size of the cell
Returns
0 on success, 1 on error. Note that if the cell or its parent is already filled, we return an error.

Definition at line 91 of file quadtree.cpp.

References centre_x, centre_y, half_size_x, half_size_y, and v.

Referenced by Cquadtree().

◆ save()

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.

Parameters
fluxopened stream to write to
Returns
0 on success, 1 on error

Definition at line 261 of file quadtree.cpp.

References centre_x, centre_y, children, half_size_x, half_size_y, has_child, and save().

Referenced by save().

◆ save_leaves()

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.

Parameters
fluxopened stream to write to
Returns
0 on success, 1 on error

Definition at line 287 of file quadtree.cpp.

References centre_x, centre_y, children, half_size_x, half_size_y, has_child, and save_leaves().

Referenced by save_leaves().

Member Data Documentation

◆ centre_x

double siscone::Cquadtree::centre_x

x-position of the centre of the cell

Definition at line 112 of file quadtree.h.

Referenced by add(), circle_intersect(), init(), save(), and save_leaves().

◆ centre_y

double siscone::Cquadtree::centre_y

y-position of the centre of the cell

Definition at line 113 of file quadtree.h.

Referenced by add(), circle_intersect(), init(), save(), and save_leaves().

◆ children

Cquadtree* siscone::Cquadtree::children[2][2]

sub-cells ( 0,1->left-right; 0,1->bottom,top)

Definition at line 119 of file quadtree.h.

Referenced by add(), circle_intersect(), Cquadtree(), save(), save_leaves(), and ~Cquadtree().

◆ half_size_x

double siscone::Cquadtree::half_size_x

HALF size of the cell.

Definition at line 114 of file quadtree.h.

Referenced by add(), circle_intersect(), init(), save(), and save_leaves().

◆ half_size_y

double siscone::Cquadtree::half_size_y

HALF size of the cell.

Definition at line 115 of file quadtree.h.

Referenced by add(), circle_intersect(), init(), save(), and save_leaves().

◆ has_child

bool siscone::Cquadtree::has_child

true if not a leaf

Definition at line 120 of file quadtree.h.

Referenced by add(), circle_intersect(), Cquadtree(), save(), save_leaves(), and ~Cquadtree().

◆ v

Cmomentum* siscone::Cquadtree::v

physical contents

Definition at line 117 of file quadtree.h.

Referenced by add(), circle_intersect(), Cquadtree(), init(), and ~Cquadtree().


The documentation for this class was generated from the following files:

The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Tue Jun 20 2023 18:08:37 for SISCone by  Doxygen 1.9.4