00001 // -*- C++ -*- 00003 // File: quadtree.h // 00004 // Description: header file for quadtree management (Cquadtree class) // 00005 // This file is part of the SISCone project. // 00006 // For more details, see http://projects.hepforge.org/siscone // 00007 // // 00008 // Copyright (c) 2006 Gavin Salam and Gregory Soyez // 00009 // // 00010 // This program is free software; you can redistribute it and/or modify // 00011 // it under the terms of the GNU General Public License as published by // 00012 // the Free Software Foundation; either version 2 of the License, or // 00013 // (at your option) any later version. // 00014 // // 00015 // This program is distributed in the hope that it will be useful, // 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 00018 // GNU General Public License for more details. // 00019 // // 00020 // You should have received a copy of the GNU General Public License // 00021 // along with this program; if not, write to the Free Software // 00022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 00023 // // 00024 // $Revision:: 123 $// 00025 // $Date:: 2007-02-28 20:52:16 -0500 (Wed, 28 Feb 2007) $// 00027 00028 #ifndef __QUADTREE_H__ 00029 #define __QUADTREE_H__ 00030 00031 #include "momentum.h" 00032 #include <stdio.h> 00033 00034 namespace siscone{ 00035 00043 class Cquadtree{ 00044 public: 00046 Cquadtree(); 00047 00049 Cquadtree(double _x, double _y, double _half_size_x, double _half_size_y); 00050 00054 ~Cquadtree(); 00055 00067 int init(double _x, double _y, double _half_size_x, double _half_size_y); 00068 00076 int add(Cmomentum *v_add); 00077 00088 Creference circle_intersect(double cx, double cy, double cR2); 00089 00099 int save(FILE *flux); 00100 00110 int save_leaves(FILE *flux); 00111 00112 double centre_x; 00113 double centre_y; 00114 double half_size_x; 00115 double half_size_y; 00116 00117 Cmomentum *v; 00118 00119 Cquadtree* children[2][2]; 00120 bool has_child; 00121 }; 00122 00123 } 00124 #endif