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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3668 - (show annotations)
Wed Nov 16 01:49:46 2011 UTC (7 years, 10 months ago) by jfenwick
File MIME type: text/plain
File size: 2210 byte(s)
Stage 1 rename
1 #ifndef FACECONSTS_H
2 #define FACECONSTS_H
3
4 namespace
5 {
6
7 // This is to be included in an anonymous namespace in a .cc file
8
9
10 // the direction is:
11 // +x -x +y -y +z -z
12 // 0 1 2 3 4 5
13
14 // return the opposite direction (down for up etc)
15 inline unsigned short oppdir(unsigned short d)
16 {
17 // return (d%2)?(d-1):(d+1);
18 return d ^ 1;
19 }
20
21 // lists the kids on each face(direction)
22 static unsigned faces[6][4] = { {1, 2, 6, 5}, // +x
23 {3, 0, 4, 7}, // -x
24 {3, 2, 6, 7}, // +y
25 {0, 1, 5, 4}, // -y
26 {4, 5, 6, 7}, // +z
27 {3, 2, 1, 0} };// -z
28
29
30 // Which child number touches me in the specified direction
31 unsigned short neighbour(unsigned short mypos, unsigned short dir)
32 {
33 // direction 0 1 2 3 4 5
34 static unsigned short narr[8][6]={ {1, 1, 3, 3, 4, 4 }, // me at pos 0
35 {0, 0, 2, 2, 5, 5 }, // me at pos 1
36 {3, 3, 1, 1, 6, 6 }, // me at pos 2
37 {2, 2, 0, 0, 7, 7 }, // me at pos 3
38 {5, 5, 7, 7, 0, 0 }, // me at pos 4
39 {4, 4, 6, 6, 1, 1 }, // me at pos 5,
40 {7, 7, 5, 5, 2, 2 }, // me at pos 6
41 {6, 6, 4, 4, 3, 3 }}; // me at pos 7
42 return narr[mypos][dir];
43 }
44
45
46 unsigned short facestouch[8][3] = {{1, 3, 5}, // which faces touch the specified corner
47 {0, 3, 5},
48 {0, 2, 5},
49 {1, 2, 5},
50 {1, 3, 4},
51 {0, 3, 4},
52 {0, 2, 4},
53 {1, 2, 4} };
54
55 // canhang[c][n] is true if a leaf which is the c'th child of its parent and its n'th node could hang
56 bool canhang[8][8] = {{false, true, true, true, true, true, false, true}, // 0
57 {true, false, true, true, true, true, true, false}, // 1
58 {true, true, false, true, false, true, true, true}, // 2
59 {true, true, true, false, true, false, true, true}, // 3
60 {true, true, false, true, false, true, true, true}, // 4
61 {true, true, true, false, true, false, true, true}, // 5
62 {false, true, true, true, true, true, false, true}, // 6
63 {true, false, true, true, true, true, true, false} // 7
64 };
65 } // end of namespace
66
67 // This really should be typed as unkid --- will fix that once I've untangled what goes where
68 const unsigned int HANG_NODE=1;
69
70 #endif

  ViewVC Help
Powered by ViewVC 1.1.26