/usr/share/netgen/libsrc/gprim/adtree.hpp is in netgen-headers 4.9.13.dfsg-8build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | #ifndef FILE_ADTREE
#define FILE_ADTREE
/* *************************************************************************/
/* File: adtree.hh */
/* Author: Joachim Schoeberl */
/* Date: 16. Feb. 98 */
/* Redesigned by Wolfram Muehlhuber, May 1998 */
/* *************************************************************************/
/**
Alternating Digital Tree
*/
#include "../include/mystdlib.h"
#include "../include/myadt.hpp"
class ADTreeNode
{
public:
ADTreeNode *left, *right, *father;
int dim;
float sep;
float *data;
float *boxmin;
float *boxmax;
int pi;
int nchilds;
ADTreeNode (int adim);
~ADTreeNode ();
friend class ADTree;
};
class ADTreeCriterion
{
public:
ADTreeCriterion() { }
virtual int Eval (const ADTreeNode * node) const = 0;
};
class ADTree
{
int dim;
ADTreeNode * root;
float *cmin, *cmax;
Array<ADTreeNode*> ela;
const ADTreeCriterion * criterion;
Array<ADTreeNode*> stack;
Array<int> stackdir;
int stackindex;
public:
ADTree (int adim, const float * acmin,
const float * acmax);
~ADTree ();
void Insert (const float * p, int pi);
// void GetIntersecting (const float * bmin, const float * bmax,
// Array<int> & pis) const;
void SetCriterion (ADTreeCriterion & acriterion);
void Reset ();
int Next ();
void GetMatch (Array<int> & matches);
void DeleteElement (int pi);
void Print (ostream & ost) const
{ PrintRec (ost, root); }
void PrintRec (ostream & ost, const ADTreeNode * node) const;
};
class ADTreeNode3
{
public:
ADTreeNode3 *left, *right, *father;
float sep;
float data[3];
int pi;
int nchilds;
ADTreeNode3 ();
void DeleteChilds ();
friend class ADTree3;
static BlockAllocator ball;
void * operator new(size_t);
void operator delete (void *);
};
class ADTree3
{
ADTreeNode3 * root;
float cmin[3], cmax[3];
Array<ADTreeNode3*> ela;
public:
ADTree3 (const float * acmin,
const float * acmax);
~ADTree3 ();
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
void DeleteElement (int pi);
void Print (ostream & ost) const
{ PrintRec (ost, root); }
void PrintRec (ostream & ost, const ADTreeNode3 * node) const;
};
/*
// divide each direction
#define ADTN_DIV 10
class ADTreeNode3Div
{
public:
ADTreeNode3Div *father;
ADTreeNode3Div *childs[ADTN_DIV];
float minx, dist;
float data[3];
int pi;
int nchilds;
ADTreeNode3Div ();
void DeleteChilds ();
friend class ADTree3Div;
static BlockAllocator ball;
void * operator new(size_t);
void operator delete (void *);
};
class ADTree3Div
{
ADTreeNode3Div * root;
float cmin[3], cmax[3];
Array<ADTreeNode3Div*> ela;
public:
ADTree3Div (const float * acmin,
const float * acmax);
~ADTree3Div ();
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
void DeleteElement (int pi);
void Print (ostream & ost) const
{ PrintRec (ost, root); }
void PrintRec (ostream & ost, const ADTreeNode3Div * node) const;
};
#define ADTN_SIZE 10
// multiple entries
class ADTreeNode3M
{
public:
ADTreeNode3M *left, *right, *father;
float sep;
float data[ADTN_SIZE][3];
int pi[ADTN_SIZE];
int nchilds;
ADTreeNode3M ();
void DeleteChilds ();
friend class ADTree3M;
static BlockAllocator ball;
void * operator new(size_t);
void operator delete (void *);
};
class ADTree3M
{
ADTreeNode3M * root;
float cmin[3], cmax[3];
Array<ADTreeNode3M*> ela;
public:
ADTree3M (const float * acmin,
const float * acmax);
~ADTree3M ();
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
void DeleteElement (int pi);
void Print (ostream & ost) const
{ PrintRec (ost, root); }
void PrintRec (ostream & ost, const ADTreeNode3M * node) const;
};
class ADTreeNode3F
{
public:
ADTreeNode3F *father;
ADTreeNode3F *childs[8];
float sep[3];
float data[3];
int pi;
int nchilds;
ADTreeNode3F ();
void DeleteChilds ();
friend class ADTree3F;
static BlockAllocator ball;
void * operator new(size_t);
void operator delete (void *);
};
// fat tree
class ADTree3F
{
ADTreeNode3F * root;
float cmin[3], cmax[3];
Array<ADTreeNode3F*> ela;
public:
ADTree3F (const float * acmin,
const float * acmax);
~ADTree3F ();
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
void DeleteElement (int pi);
void Print (ostream & ost) const
{ PrintRec (ost, root); }
void PrintRec (ostream & ost, const ADTreeNode3F * node) const;
};
class ADTreeNode3FM
{
public:
ADTreeNode3FM *father;
ADTreeNode3FM *childs[8];
float sep[3];
float data[ADTN_SIZE][3];
int pi[ADTN_SIZE];
int nchilds;
ADTreeNode3FM ();
void DeleteChilds ();
friend class ADTree3FM;
static BlockAllocator ball;
void * operator new(size_t);
void operator delete (void *);
};
// fat tree
class ADTree3FM
{
ADTreeNode3FM * root;
float cmin[3], cmax[3];
Array<ADTreeNode3FM*> ela;
public:
ADTree3FM (const float * acmin,
const float * acmax);
~ADTree3FM ();
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
void DeleteElement (int pi);
void Print (ostream & ost) const
{ PrintRec (ost, root); }
void PrintRec (ostream & ost, const ADTreeNode3FM * node) const;
};
*/
class ADTreeNode6
{
public:
ADTreeNode6 *left, *right, *father;
float sep;
float data[6];
int pi;
int nchilds;
ADTreeNode6 ();
void DeleteChilds ();
friend class ADTree6;
static BlockAllocator ball;
void * operator new(size_t);
void operator delete (void *);
};
class ADTree6
{
ADTreeNode6 * root;
float cmin[6], cmax[6];
Array<ADTreeNode6*> ela;
public:
ADTree6 (const float * acmin,
const float * acmax);
~ADTree6 ();
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
void DeleteElement (int pi);
void Print (ostream & ost) const
{ PrintRec (ost, root); }
int Depth () const
{ return DepthRec (root); }
int Elements () const
{ return ElementsRec (root); }
void PrintRec (ostream & ost, const ADTreeNode6 * node) const;
int DepthRec (const ADTreeNode6 * node) const;
int ElementsRec (const ADTreeNode6 * node) const;
void PrintMemInfo (ostream & ost) const;
};
/*
class ADTreeNode6F
{
public:
ADTreeNode6F * father;
ADTreeNode6F * childs[64];
float sep[6];
float data[6];
int pi;
int nchilds;
ADTreeNode6F ();
void DeleteChilds ();
friend class ADTree6F;
static BlockAllocator ball;
void * operator new(size_t);
void operator delete (void *);
};
class ADTree6F
{
ADTreeNode6F * root;
float cmin[6], cmax[6];
Array<ADTreeNode6F*> ela;
public:
ADTree6F (const float * acmin,
const float * acmax);
~ADTree6F ();
void Insert (const float * p, int pi);
void GetIntersecting (const float * bmin, const float * bmax,
Array<int> & pis) const;
void DeleteElement (int pi);
void Print (ostream & ost) const
{ PrintRec (ost, root); }
int Depth () const
{ return DepthRec (root); }
void PrintRec (ostream & ost, const ADTreeNode6F * node) const;
int DepthRec (const ADTreeNode6F * node) const;
};
*/
class Point3dTree
{
ADTree3 * tree;
public:
Point3dTree (const Point<3> & pmin, const Point<3> & pmax);
~Point3dTree ();
void Insert (const Point<3> & p, int pi);
void DeleteElement (int pi)
{ tree->DeleteElement(pi); }
void GetIntersecting (const Point<3> & pmin, const Point<3> & pmax,
Array<int> & pis) const;
const ADTree3 & Tree() const { return *tree; };
};
class Box3dTree
{
ADTree6 * tree;
Point<3> boxpmin, boxpmax;
public:
Box3dTree (const Point<3> & apmin, const Point<3> & apmax);
~Box3dTree ();
void Insert (const Point<3> & bmin, const Point<3> & bmax, int pi);
void Insert (const Box<3> & box, int pi)
{
Insert (box.PMin(), box.PMax(), pi);
}
void DeleteElement (int pi)
{ tree->DeleteElement(pi); }
void GetIntersecting (const Point<3> & pmin, const Point<3> & pmax,
Array<int> & pis) const;
const ADTree6 & Tree() const { return *tree; };
};
#endif
|