35 double tci[8][3] = { {-1, -1, -1}, {-1, 1, -1}, {1, -1, -1}, {1, 1, -1},
36 {-1, -1, 1}, {-1, 1, 1}, {1, -1, 1}, {1, 1, 1},
42 static inline int cellInNode(
int c,
struct bht_node *node)
45 double xmin, xmax, ymin, ymax, zmin, zmax;
54 xmin = node->
center[0] - l;
55 ymin = node->
center[1] - l;
57 zmin = node->
center[2] - l;
60 xmax = node->
center[0] + l;
61 ymax = node->
center[1] + l;
63 zmax = node->
center[2] + l;
67 if (x <= xmax && x > xmin && y <= ymax && y > ymin
68 && (
sdim == 2 || (z <= zmax && z > zmin)))
78 static inline int whichChildNode(
int p,
struct bht_node *node)
83 double x_min, x_max, y_min, y_max, z_min, z_max;
89 shift = node->
len * 0.25;
93 for (i = 0; i <
tnc; i++) {
113 if (x > x_min && x <= x_max && y > y_min && y <= y_max && z > z_min
116 }
else if (x > x_min && x <= x_max && y > y_min && y <= y_max)
121 if (node->
child[num] == NULL) {
135 for (j = 0; j <
tnc; j++)
151 shift = node->
len * 0.25;
152 for (j = 0; j <
tnc; j++) {
165 for (k = 0; k <
tnc; k++)
185 int pow2, idepth, pparts, k, l;
189 int nnodes_per_thread = 0;
195 printf(
" Tree build...");
228 stopRun(106,
"iroots", __FILE__, __LINE__);
236 stopRun(106,
"leafs", __FILE__, __LINE__);
238 maxTreeSize =
lnc * 16;
243 stopRun(106,
"tree", __FILE__, __LINE__);
257 for (i = 0; i <
lnc; i++) {
286 for (i = 0; i <
tnc; i++)
299 #pragma omp parallel num_threads(k) private(node,i,j) firstprivate(pparts) shared(ni)
303 OMPid = omp_get_thread_num();
308 for (i = 0; i <
lnc; i++) {
316 for (j = 0; j < pparts; j++) {
317 mycell = cellInNode(i, iroots[OMPid * pparts + j]);
319 no = iroots[OMPid * pparts + j];
331 c = whichChildNode(i, no);
335 for (s = 0; s <
tnc; s++)
338 c = whichChildNode(no->
partnum, no);
342 c = whichChildNode(i, no);
contains various Timothy inline functions
contains the most important global variables, arrays and defines
struct bht_node * child[8]
struct bht_node * bht_root
void stopRun(int ierr, char *name, char *file, int line)
void treeBuildInitial(int depth, struct bht_node **iroots, struct bht_node *node)