-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathInternal.cpp
More file actions
46 lines (44 loc) · 966 Bytes
/
Internal.cpp
File metadata and controls
46 lines (44 loc) · 966 Bytes
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
#include "Internal.hpp"
namespace oa {
namespace internal {
template<>
void set_buffer_rand(int *buffer, int size) {
srand(SEED);
for (int i = 0; i < size; i++) {
int r = rand() % 10000;
buffer[i] = r;
}
}
/*
int calc_id(int i, int j, int k, int3 S) {
int M = S[0];
int N = S[1];
int P = S[2];
return k * M * N + j * M + i;
}
*/
int3 calc_step(Box box, int d, int sw) {
int xs, xe, ys, ye, zs, ze;
int st, ed, step;
box.get_corners(xs, xe, ys, ye, zs, ze);
switch (d) {
case 0:
st = sw;
ed = xe - xs + sw;
break;
case 1:
st = sw;
ed = ye - ys + sw;
break;
case 2:
st = sw;
ed = ze - zs + sw;
break;
}
step = (st + 1 == ed) ? 0 : 1;
int3 loop;
loop[0] = st; loop[1] = step; loop[2] = ed;
return loop;
}
}
}