/[escript]/branches/refine/buckley/src/OctCell.h
ViewVC logotype

Contents of /branches/refine/buckley/src/OctCell.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3680 - (show annotations)
Fri Nov 18 04:48:53 2011 UTC (7 years, 10 months ago) by jfenwick
File MIME type: text/plain
File size: 1940 byte(s)
It has memory errors during a getX.

1
2 #ifndef OCTCELL_H_2011
3 #define OCTCELL_H_2011
4
5 #include <cstddef> // to get size_t
6
7 namespace buckley
8 {
9
10 class OctCell;
11 class LeafInfo;
12
13 typedef void (*const_cellfn)(const OctCell&, void*);
14
15 typedef void (*cellfn)(OctCell&, void*);
16 typedef void (*cellfn2)(const OctCell&, int k, void*);
17 typedef void (*const_cellfn2)(const OctCell&, int k, void*);
18
19 typedef unsigned int unkid; // Type representing the id of an unknown/point
20
21 class OctCell
22 {
23 public:
24 OctCell(double x1, double y1, double z1, double x2, double y2, double z2, OctCell* par);
25 ~OctCell();
26 void split(size_t* leafc); // split this cell into 8 children
27 void collapse(size_t* leafc); // remove all kids and make this a leaf
28 void collapseAll(unsigned desdepth, size_t* leafc);
29 void collapsePoint(double x, double y, double z, unsigned desdepth, size_t* leafc);
30 void allSplit(unsigned int depth, size_t* leafc);
31 void splitPoint(double x, double y, double z, unsigned desdepth, size_t* leafc);
32 void doLeafWalk_const(const_cellfn c, void* v) const;
33 void doLeafWalk(cellfn c, void* v);
34 void doLeafWalkWithKids_const(const_cellfn2 c, int k, void* v) const;
35 OctCell* findLeaf(double x, double y, double z);
36
37
38 void linkCheck(bool fromroot);
39
40
41 void debug(bool fromroot);
42 bool whohas(LeafInfo* li, bool fromroot=true);
43
44 void gmshDump();
45 //private:
46 void upSplitPoint(double x, double y, double z, unsigned d);
47 void upCollPoint(double x, double y, double z, unsigned d);
48 void outwardRefine(unsigned desireddepth);
49 void outwardCollapse(unsigned desireddepth);
50
51 bool leaf;
52 double centre[3];
53 double sides[3]; // dimensions in x,y,z
54 OctCell* kids[8];
55 unsigned int depth;
56 OctCell* parent;
57 mutable unsigned int id;
58 LeafInfo* leafinfo;
59 };
60
61 }
62
63 #include "LeafInfo.h"
64
65 #endif

  ViewVC Help
Powered by ViewVC 1.1.26