9 std::cout <<
"3D Array with grid_key (without redundant dimension): " <<
"\n";
15 clock_gettime(CLOCK_REALTIME, &ts_start);
19 for (
int i = 0 ; i < GS_SIZE ; i++)
21 for (
int j = 0 ; j < GS_SIZE ; j++)
23 for (
int k = 0 ; k < GS_SIZE ; k++)
27 c3.get<P::x>(kk) = 1.1f;
28 c3.get<P::y>(kk) = 1.2f;
29 c3.get<P::z>(kk) = 1.3f;
30 c3.get<P::s>(kk) = 1.0f;
32 c3.get<P::v>(kk)[0] = 1.0f;
33 c3.get<P::v>(kk)[1] = 2.0f;
34 c3.get<P::v>(kk)[2] = 3.0f;
36 c3.get<P::t>(kk)[0][0] = 1.0f;
37 c3.get<P::t>(kk)[0][1] = 2.0f;
38 c3.get<P::t>(kk)[0][2] = 3.0f;
39 c3.get<P::t>(kk)[1][0] = 4.0f;
40 c3.get<P::t>(kk)[1][1] = 5.0f;
41 c3.get<P::t>(kk)[1][2] = 6.0f;
42 c3.get<P::t>(kk)[2][0] = 7.0f;
43 c3.get<P::t>(kk)[2][1] = 8.0f;
44 c3.get<P::t>(kk)[2][2] = 9.0f;
50 clock_gettime(CLOCK_REALTIME, &end_time);
51 float time_dif =(float)( end_time.tv_sec - ts_start.tv_sec + (
double)(end_time.tv_nsec - ts_start.tv_nsec)/1000000000.0 );
53 std::cout <<
"End : " << GS_SIZE*GS_SIZE*GS_SIZE*16*4/1024/1024 <<
" MB " <<
" Bandwidth: " << GS_SIZE*GS_SIZE*GS_SIZE*16*4/1024/1024/time_dif <<
" MB/s ";
59 for (
int i = 0 ; i < GS_SIZE ; i++)
61 for (
int j = 0 ; j < GS_SIZE ; j++)
63 for (
int k = 0 ; k < GS_SIZE ; k++)
70 c3.get<P::s>(kk) = i+j+k;
72 c3.get<P::v>(kk)[0] = i;
73 c3.get<P::v>(kk)[1] = j;
74 c3.get<P::v>(kk)[2] = k;
76 c3.get<P::t>(kk)[0][0] = i+i;
77 c3.get<P::t>(kk)[0][1] = i+j;
78 c3.get<P::t>(kk)[0][2] = i+k;
79 c3.get<P::t>(kk)[1][0] = j+i;
80 c3.get<P::t>(kk)[1][1] = j+j;
81 c3.get<P::t>(kk)[1][2] = j+k;
82 c3.get<P::t>(kk)[2][0] = k+i;
83 c3.get<P::t>(kk)[2][1] = k+j;
84 c3.get<P::t>(kk)[2][2] = k+k;
89 for (
int i = 0 ; i < GS_SIZE ; i++)
91 for (
int j = 0 ; j < GS_SIZE ; j++)
93 for (
int k = 0 ; k < GS_SIZE ; k++)
97 if (c3.get<P::x>(kk) != i) passed =
false;
98 if (c3.get<P::y>(kk) != j) passed =
false;
99 if (c3.get<P::z>(kk) != k) passed =
false;
100 if (c3.get<P::s>(kk) != i+j+k) passed =
false;
102 if (c3.get<P::v>(kk)[0] != i) passed =
false;
103 if (c3.get<P::v>(kk)[1] != j) passed =
false;
104 if (c3.get<P::v>(kk)[2] != k) passed =
false;
106 if (c3.get<P::t>(kk)[0][0] != i+i) passed =
false;
107 if (c3.get<P::t>(kk)[0][1] != i+j) passed =
false;
108 if (c3.get<P::t>(kk)[0][2] != i+k) passed =
false;
109 if (c3.get<P::t>(kk)[1][0] != j+i) passed =
false;
110 if (c3.get<P::t>(kk)[1][1] != j+j) passed =
false;
111 if (c3.get<P::t>(kk)[1][2] != j+k) passed =
false;
112 if (c3.get<P::t>(kk)[2][0] != k+i) passed =
false;
113 if (c3.get<P::t>(kk)[2][1] != k+j) passed =
false;
114 if (c3.get<P::t>(kk)[2][2] != k+k) passed =
false;
120 std::cout <<
"PASSED" <<
"\n";
122 std::cout <<
"FAILED" <<
"\n";
128 std::cout <<
"3D Array with grid_key (without redundant dimension): " <<
"\n";
134 clock_gettime(CLOCK_REALTIME, &ts_start);
138 for (
int i = 0 ; i < GS_SIZE ; i++)
140 for (
int j = 0 ; j < GS_SIZE ; j++)
142 for (
int k = 0 ; k < GS_SIZE ; k++)
147 c3.get<P::x>(kk) = 1.1f;
148 c3.get<P::y>(kk) = 1.2f;
149 c3.get<P::z>(kk) = 1.3f;
150 c3.get<P::s>(kk) = 1.0f;
152 c3.get<P::v>(kk)[0] = 1.0f;
153 c3.get<P::v>(kk)[1] = 2.0f;
154 c3.get<P::v>(kk)[2] = 3.0f;
156 c3.get<P::t>(kk)[0][0] = 1.0f;
157 c3.get<P::t>(kk)[0][1] = 2.0f;
158 c3.get<P::t>(kk)[0][2] = 3.0f;
159 c3.get<P::t>(kk)[1][0] = 4.0f;
160 c3.get<P::t>(kk)[1][1] = 5.0f;
161 c3.get<P::t>(kk)[1][2] = 6.0f;
162 c3.get<P::t>(kk)[2][0] = 7.0f;
163 c3.get<P::t>(kk)[2][1] = 8.0f;
164 c3.get<P::t>(kk)[2][2] = 9.0f;
171 clock_gettime(CLOCK_REALTIME, &end_time);
172 float time_dif =(float)( end_time.tv_sec - ts_start.tv_sec + (
double)(end_time.tv_nsec - ts_start.tv_nsec)/1000000000.0 );
174 std::cout <<
"End : " << GS_SIZE*GS_SIZE*GS_SIZE*16*4/1024/1024 <<
" MB " <<
" Bandwidth: " << GS_SIZE*GS_SIZE*GS_SIZE*16*4/1024/1024/time_dif <<
" MB/s ";
180 for (
int i = 0 ; i < GS_SIZE ; i++)
182 for (
int j = 0 ; j < GS_SIZE ; j++)
184 for (
int k = 0 ; k < GS_SIZE ; k++)
188 c3.get<P::x>(kk) = i;
189 c3.get<P::y>(kk) = j;
190 c3.get<P::z>(kk) = k;
191 c3.get<P::s>(kk) = i+j+k;
193 c3.get<P::v>(kk)[0] = i;
194 c3.get<P::v>(kk)[1] = j;
195 c3.get<P::v>(kk)[2] = k;
197 c3.get<P::t>(kk)[0][0] = i+i;
198 c3.get<P::t>(kk)[0][1] = i+j;
199 c3.get<P::t>(kk)[0][2] = i+k;
200 c3.get<P::t>(kk)[1][0] = j+i;
201 c3.get<P::t>(kk)[1][1] = j+j;
202 c3.get<P::t>(kk)[1][2] = j+k;
203 c3.get<P::t>(kk)[2][0] = k+i;
204 c3.get<P::t>(kk)[2][1] = k+j;
205 c3.get<P::t>(kk)[2][2] = k+k;
210 for (
int i = 0 ; i < GS_SIZE ; i++)
212 for (
int j = 0 ; j < GS_SIZE ; j++)
214 for (
int k = 0 ; k < GS_SIZE ; k++)
218 if (c3.get<P::x>(kk) != i) passed =
false;
219 if (c3.get<P::y>(kk) != j) passed =
false;
220 if (c3.get<P::z>(kk) != k) passed =
false;
221 if (c3.get<P::s>(kk) != i+j+k) passed =
false;
223 if (c3.get<P::v>(kk)[0] != i) passed =
false;
224 if (c3.get<P::v>(kk)[1] != j) passed =
false;
225 if (c3.get<P::v>(kk)[2] != k) passed =
false;
227 if (c3.get<P::t>(kk)[0][0] != i+i) passed =
false;
228 if (c3.get<P::t>(kk)[0][1] != i+j) passed =
false;
229 if (c3.get<P::t>(kk)[0][2] != i+k) passed =
false;
230 if (c3.get<P::t>(kk)[1][0] != j+i) passed =
false;
231 if (c3.get<P::t>(kk)[1][1] != j+j) passed =
false;
232 if (c3.get<P::t>(kk)[1][2] != j+k) passed =
false;
233 if (c3.get<P::t>(kk)[2][0] != k+i) passed =
false;
234 if (c3.get<P::t>(kk)[2][1] != k+j) passed =
false;
235 if (c3.get<P::t>(kk)[2][2] != k+k) passed =
false;
241 std::cout <<
"PASSED" <<
"\n";
243 std::cout <<
"FAILED" <<
"\n";
grid_key_dx is the key to access any element in the grid
This class implement the point shape in an N-dimensional space.
void set(a v, T...t)
set the grid key from a list of numbers
Test structure used for several test.