1 public class PSFADemo {
11 public int m_numGrids;
12 public int m_numCells;
13 public int m_numParticles;
15 public HashMap m_borderCells; // shared border cells
17 public int m_nx; // number of grid cells in each dimension
20 public float m_viscosityCoeff;
21 public Vec3 m_delta; // cell dimensions
22 public Vec3 m_domainMin;
23 public Vec3 m_domainMax;
27 public PSFADemo(int _numgrids, int _numcells, int _numparticles,
28 int _nx, int _ny, int _nz, float _viscosityCoeff, Vec3 _delta) {
29 this.m_numGrids = _numgrids;
30 this.m_numCells = _numcells;
31 this.m_numParticles = _numparticles;
32 this.m_borderCells = new HashMap();
36 this.m_viscosityCoeff = _viscosityCoeff;
37 this.m_delta = _delta;
38 this.m_domainMin = new Vec3(-0.065f, -0.08f, -0.065f);
39 this.m_domainMax = new Vec3(0.065f, 0.1f, 0.065f);
43 public void addBorderCells(int index) {
44 Integer in = new Integer(index);
45 if(!this.m_borderCells.containsKey(in)) {
46 this.m_borderCells.put(in, new Cell(index));
50 public boolean isFinish() {
52 return (this.m_counter == this.m_numGrids);
55 public void resetCounter() {
59 public void resetBorderCells() {
60 HashMapIterator it_values = this.m_borderCells.iterator(1);
61 while(it_values.hasNext()) {
62 Cell cell= (Cell)it_values.next();
67 public void resetBorderCellsHV() {
68 HashMapIterator it_values = this.m_borderCells.iterator(1);
69 while(it_values.hasNext()) {
70 Cell cell= (Cell)it_values.next();
71 for(int i = 0; i <cell.m_numPars; i++) {
79 public void sum(Grid g) {
81 HashMap visited = new HashMap();
82 HashMapIterator it_keys = g.m_neighCells.iterator(0);
83 while(it_keys.hasNext()) {
84 Integer key = (Integer)it_keys.next();
85 if(!visited.containsKey(key)) {
86 Cell cell = (Cell)(this.m_borderCells.get(key));
87 int np = cell.m_numPars;
88 Cell toadd = (Cell)(g.m_neighCells.get(key));
89 int toaddnp = toadd.m_numPars;
90 for(int j = 0; j < toaddnp; ++j) {
91 cell.m_p[np].m_x = toadd.m_p[j].m_x;
92 cell.m_p[np].m_y = toadd.m_p[j].m_y;
93 cell.m_p[np].m_z = toadd.m_p[j].m_z;
94 cell.m_hv[np].m_x = toadd.m_hv[j].m_x;
95 cell.m_hv[np].m_y = toadd.m_hv[j].m_y;
96 cell.m_hv[np].m_z = toadd.m_hv[j].m_z;
97 cell.m_v[np].m_x = toadd.m_v[j].m_x;
98 cell.m_v[np].m_y = toadd.m_v[j].m_y;
99 cell.m_v[np].m_z = toadd.m_v[j].m_z;
100 cell.m_a[np].m_x = toadd.m_a[j].m_x;
101 cell.m_a[np].m_y = toadd.m_a[j].m_y;
102 cell.m_a[np].m_z = toadd.m_a[j].m_z;
103 cell.m_density[np] = toadd.m_density[j];
106 cell.m_numPars += toaddnp;
107 visited.put(key, key);
111 for(int iz = 0; iz < g.m_ez - g.m_sz; iz += g.m_ez - g.m_sz - 1) {
112 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
113 for(int ix = 0; ix < g.m_ex - g.m_sx; ix++) {
114 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
115 + g.m_sy))*this.m_nx + (ix + g.m_sx));
116 if((this.m_borderCells.containsKey(index)) &&
117 !visited.containsKey(index)){
118 Cell cell = (Cell)(this.m_borderCells.get(index));
119 int np = cell.m_numPars;
120 Cell toadd = g.m_cells[ix][iy][iz];
121 int toaddnp = toadd.m_numPars;
122 for(int j = 0; j < toaddnp; ++j) {
123 cell.m_p[np].m_x = toadd.m_p[j].m_x;
124 cell.m_p[np].m_y = toadd.m_p[j].m_y;
125 cell.m_p[np].m_z = toadd.m_p[j].m_z;
126 cell.m_hv[np].m_x = toadd.m_hv[j].m_x;
127 cell.m_hv[np].m_y = toadd.m_hv[j].m_y;
128 cell.m_hv[np].m_z = toadd.m_hv[j].m_z;
129 cell.m_v[np].m_x = toadd.m_v[j].m_x;
130 cell.m_v[np].m_y = toadd.m_v[j].m_y;
131 cell.m_v[np].m_z = toadd.m_v[j].m_z;
132 cell.m_a[np].m_x = toadd.m_a[j].m_x;
133 cell.m_a[np].m_y = toadd.m_a[j].m_y;
134 cell.m_a[np].m_z = toadd.m_a[j].m_z;
135 cell.m_density[np] = toadd.m_density[j];
138 cell.m_numPars += toaddnp;
139 visited.put(index, index);
145 for(int ix = 0; ix < g.m_ex - g.m_sx; ix += g.m_ex - g.m_sx - 1) {
146 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
147 for(int iz = 0; iz < g.m_ez - g.m_sz; iz++) {
148 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
149 + g.m_sy))*this.m_nx + (ix + g.m_sx));
150 if((this.m_borderCells.containsKey(index))
151 && !visited.containsKey(index)){
152 Cell cell = (Cell)(this.m_borderCells.get(index));
153 int np = cell.m_numPars;
154 Cell toadd = g.m_cells[ix][iy][iz];
155 int toaddnp = toadd.m_numPars;
156 for(int j = 0; j < toaddnp; ++j) {
157 cell.m_p[np].m_x = toadd.m_p[j].m_x;
158 cell.m_p[np].m_y = toadd.m_p[j].m_y;
159 cell.m_p[np].m_z = toadd.m_p[j].m_z;
160 cell.m_hv[np].m_x = toadd.m_hv[j].m_x;
161 cell.m_hv[np].m_y = toadd.m_hv[j].m_y;
162 cell.m_hv[np].m_z = toadd.m_hv[j].m_z;
163 cell.m_v[np].m_x = toadd.m_v[j].m_x;
164 cell.m_v[np].m_y = toadd.m_v[j].m_y;
165 cell.m_v[np].m_z = toadd.m_v[j].m_z;
166 cell.m_a[np].m_x = toadd.m_a[j].m_x;
167 cell.m_a[np].m_y = toadd.m_a[j].m_y;
168 cell.m_a[np].m_z = toadd.m_a[j].m_z;
169 cell.m_density[np] = toadd.m_density[j];
172 cell.m_numPars += toaddnp;
173 visited.put(index, index);
180 public void flush(Grid g) {
181 HashMap visited = new HashMap();
183 HashMapIterator it_keys = g.m_neighCells.iterator(0);
184 while(it_keys.hasNext()) {
185 Integer key = (Integer)it_keys.next();
186 if(!visited.containsKey(key)) {
187 Cell toflush = (Cell)(this.m_borderCells.get(key));
188 int toflushnp = toflush.m_numPars;
189 Cell cell = (Cell)(g.m_neighCells.get(key));
192 for(int j = 0; j < toflushnp; ++j) {
193 cell.m_p[np].m_x = toflush.m_p[j].m_x;
194 cell.m_p[np].m_y = toflush.m_p[j].m_y;
195 cell.m_p[np].m_z = toflush.m_p[j].m_z;
196 cell.m_hv[np].m_x = toflush.m_hv[j].m_x;
197 cell.m_hv[np].m_y = toflush.m_hv[j].m_y;
198 cell.m_hv[np].m_z = toflush.m_hv[j].m_z;
199 cell.m_v[np].m_x = toflush.m_v[j].m_x;
200 cell.m_v[np].m_y = toflush.m_v[j].m_y;
201 cell.m_v[np].m_z = toflush.m_v[j].m_z;
202 cell.m_a[np].m_x = toflush.m_a[j].m_x;
203 cell.m_a[np].m_y = toflush.m_a[j].m_y;
204 cell.m_a[np].m_z = toflush.m_a[j].m_z;
205 cell.m_density[np] = toflush.m_density[j];
208 cell.m_numPars += toflushnp;
209 visited.put(key, key);
214 for(int iz = 0; iz < g.m_ez - g.m_sz; iz += g.m_ez - g.m_sz - 1) {
215 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
216 for(int ix = 0; ix < g.m_ex - g.m_sx; ix++) {
217 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
218 + g.m_sy))*this.m_nx + (ix + g.m_sx));
219 if((this.m_borderCells.containsKey(index))
220 && !visited.containsKey(index)) {
221 Cell toflush = (Cell)(this.m_borderCells.get(index));
222 int toflushnp = toflush.m_numPars;
223 Cell cell = g.m_cells[ix][iy][iz];
226 for(int j = 0; j < toflushnp; ++j) {
227 cell.m_p[np].m_x = toflush.m_p[j].m_x;
228 cell.m_p[np].m_y = toflush.m_p[j].m_y;
229 cell.m_p[np].m_z = toflush.m_p[j].m_z;
230 cell.m_hv[np].m_x = toflush.m_hv[j].m_x;
231 cell.m_hv[np].m_y = toflush.m_hv[j].m_y;
232 cell.m_hv[np].m_z = toflush.m_hv[j].m_z;
233 cell.m_v[np].m_x = toflush.m_v[j].m_x;
234 cell.m_v[np].m_y = toflush.m_v[j].m_y;
235 cell.m_v[np].m_z = toflush.m_v[j].m_z;
236 cell.m_a[np].m_x = toflush.m_a[j].m_x;
237 cell.m_a[np].m_y = toflush.m_a[j].m_y;
238 cell.m_a[np].m_z = toflush.m_a[j].m_z;
239 cell.m_density[np] = toflush.m_density[j];
242 cell.m_numPars += toflushnp;
243 visited.put(index, index);
249 for(int ix = 0; ix < g.m_ex - g.m_sx; ix += g.m_ex - g.m_sx - 1) {
250 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
251 for(int iz = 0; iz < g.m_ez - g.m_sz; iz++) {
252 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
253 + g.m_sy))*this.m_nx + (ix + g.m_sx));
254 if((this.m_borderCells.containsKey(index))
255 && !visited.containsKey(index)) {
256 Cell toflush = (Cell)(this.m_borderCells.get(index));
257 int toflushnp = toflush.m_numPars;
258 Cell cell = g.m_cells[ix][iy][iz];
261 for(int j = 0; j < toflushnp; ++j) {
262 cell.m_p[np].m_x = toflush.m_p[j].m_x;
263 cell.m_p[np].m_y = toflush.m_p[j].m_y;
264 cell.m_p[np].m_z = toflush.m_p[j].m_z;
265 cell.m_hv[np].m_x = toflush.m_hv[j].m_x;
266 cell.m_hv[np].m_y = toflush.m_hv[j].m_y;
267 cell.m_hv[np].m_z = toflush.m_hv[j].m_z;
268 cell.m_v[np].m_x = toflush.m_v[j].m_x;
269 cell.m_v[np].m_y = toflush.m_v[j].m_y;
270 cell.m_v[np].m_z = toflush.m_v[j].m_z;
271 cell.m_a[np].m_x = toflush.m_a[j].m_x;
272 cell.m_a[np].m_y = toflush.m_a[j].m_y;
273 cell.m_a[np].m_z = toflush.m_a[j].m_z;
274 cell.m_density[np] = toflush.m_density[j];
277 cell.m_numPars += toflushnp;
278 visited.put(index, index);
285 public void sum2(Grid g) {
286 HashMap visited = new HashMap();
288 HashMapIterator it_keys = g.m_neighCells.iterator(0);
289 while(it_keys.hasNext()) {
290 Integer key = (Integer)it_keys.next();
291 if(!visited.containsKey(key)) {
292 Cell cell = (Cell)(this.m_borderCells.get(key));
293 int np = cell.m_numPars;
294 Cell toadd = (Cell)(g.m_neighCells.get(key));
295 for(int j = 0; j < np; ++j) {
296 cell.m_density[j] += toadd.m_density[j];
298 visited.put(key, key);
303 for(int iz = 0; iz < g.m_ez - g.m_sz; iz += g.m_ez - g.m_sz - 1) {
304 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
305 for(int ix = 0; ix < g.m_ex - g.m_sx; ix++) {
306 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
307 + g.m_sy))*this.m_nx + (ix + g.m_sx));
308 if((this.m_borderCells.containsKey(index))
309 && !visited.containsKey(index)) {
310 Cell cell = (Cell)(this.m_borderCells.get(index));
311 int np = cell.m_numPars;
312 Cell toadd = g.m_cells[ix][iy][iz];
313 for(int j = 0; j < np; ++j) {
314 cell.m_density[j] += toadd.m_density[j];
316 visited.put(index, index);
322 for(int ix = 0; ix < g.m_ex - g.m_sx; ix += g.m_ex - g.m_sx - 1) {
323 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
324 for(int iz = 0; iz < g.m_ez - g.m_sz; iz++) {
325 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
326 + g.m_sy))*this.m_nx + (ix + g.m_sx));
327 if((this.m_borderCells.containsKey(index))
328 && !visited.containsKey(index)) {
329 Cell cell = (Cell)(this.m_borderCells.get(index));
330 int np = cell.m_numPars;
331 Cell toadd = g.m_cells[ix][iy][iz];
332 for(int j = 0; j < np; ++j) {
333 cell.m_density[j] += toadd.m_density[j];
335 visited.put(index, index);
342 public void flush2(Grid g) {
343 HashMap visited = new HashMap();
345 HashMapIterator it_keys = g.m_neighCells.iterator(0);
346 while(it_keys.hasNext()) {
347 Integer key = (Integer)it_keys.next();
348 if(!visited.containsKey(key)) {
349 Cell toflush = (Cell)(this.m_borderCells.get(key));
350 Cell cell = (Cell)(g.m_neighCells.get(key));
351 int np = cell.m_numPars;
352 for(int j = 0; j < np; ++j) {
353 cell.m_density[j] = toflush.m_density[j];
359 for(int iz = 0; iz < g.m_ez - g.m_sz; iz += g.m_ez - g.m_sz - 1) {
360 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
361 for(int ix = 0; ix < g.m_ex - g.m_sx; ix++) {
362 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
363 + g.m_sy))*this.m_nx + (ix + g.m_sx));
364 if((this.m_borderCells.containsKey(index))
365 && !visited.containsKey(index)) {
366 Cell toflush = (Cell)(this.m_borderCells.get(index));
367 Cell cell = g.m_cells[ix][iy][iz];
368 int np = cell.m_numPars;
369 for(int j = 0; j < np; ++j) {
370 cell.m_density[j] = toflush.m_density[j];
372 visited.put(index, index);
378 for(int ix = 0; ix < g.m_ex - g.m_sx; ix += g.m_ex - g.m_sx - 1) {
379 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
380 for(int iz = 0; iz < g.m_ez - g.m_sz; iz++) {
381 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
382 + g.m_sy))*this.m_nx + (ix + g.m_sx));
383 if((this.m_borderCells.containsKey(index))
384 && !visited.containsKey(index)) {
385 Cell toflush = (Cell)(this.m_borderCells.get(index));
386 Cell cell = g.m_cells[ix][iy][iz];
387 int np = cell.m_numPars;
388 for(int j = 0; j < np; ++j) {
389 cell.m_density[j] = toflush.m_density[j];
391 visited.put(index, index);
398 public void sum3(Grid g) {
399 HashMap visited = new HashMap();
401 for(int iz = 0; iz < g.m_ez - g.m_sz; iz += g.m_ez - g.m_sz - 1) {
402 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
403 for(int ix = 0; ix < g.m_ex - g.m_sx; ix++) {
404 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
405 + g.m_sy))*this.m_nx + (ix + g.m_sx));
406 if((this.m_borderCells.containsKey(index))
407 && !visited.containsKey(index)) {
408 Cell cell = (Cell)(this.m_borderCells.get(index));
409 int np = cell.m_numPars;
410 Cell toadd = g.m_cells[ix][iy][iz];
411 for(int j = 0; j < np; ++j) {
412 cell.m_density[j] = toadd.m_density[j];
414 visited.put(index, index);
420 for(int ix = 0; ix < g.m_ex - g.m_sx; ix += g.m_ex - g.m_sx - 1) {
421 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
422 for(int iz = 0; iz < g.m_ez - g.m_sz; iz++) {
423 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
424 + g.m_sy))*this.m_nx + (ix + g.m_sx));
425 if((this.m_borderCells.containsKey(index))
426 && !visited.containsKey(index)) {
427 Cell cell = (Cell)(this.m_borderCells.get(index));
428 int np = cell.m_numPars;
429 Cell toadd = g.m_cells[ix][iy][iz];
430 for(int j = 0; j < np; ++j) {
431 cell.m_density[j] = toadd.m_density[j];
433 visited.put(index, index);
440 public void flush3(Grid g) {
442 HashMapIterator it_keys = g.m_neighCells.iterator(0);
443 while(it_keys.hasNext()) {
444 Integer key = (Integer)it_keys.next();
445 Cell toflush = (Cell)(this.m_borderCells.get(key));
446 Cell cell = (Cell)(g.m_neighCells.get(key));
447 int np = cell.m_numPars;
448 for(int j = 0; j < np; ++j) {
449 cell.m_density[j] = toflush.m_density[j];
454 public void sum4(Grid g) {
455 HashMap visited = new HashMap();
457 HashMapIterator it_keys = g.m_neighCells.iterator(0);
458 while(it_keys.hasNext()) {
459 Integer key = (Integer)it_keys.next();
460 if(!visited.containsKey(key)) {
461 Cell cell = (Cell)(this.m_borderCells.get(key));
462 int np = cell.m_numPars;
463 Cell toadd = (Cell)(g.m_neighCells.get(key));
464 for(int j = 0; j < np; ++j) {
465 cell.m_v[j].m_x += toadd.m_v[j].m_x - cell.m_a[j].m_x;
466 cell.m_v[j].m_y += toadd.m_v[j].m_y - cell.m_a[j].m_y;
467 cell.m_v[j].m_z += toadd.m_v[j].m_z - cell.m_a[j].m_z;
473 for(int iz = 0; iz < g.m_ez - g.m_sz; iz += g.m_ez - g.m_sz - 1) {
474 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
475 for(int ix = 0; ix < g.m_ex - g.m_sx; ix++) {
476 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
477 + g.m_sy))*this.m_nx + (ix + g.m_sx));
478 if((this.m_borderCells.containsKey(index))
479 && !visited.containsKey(index)) {
480 Cell cell = (Cell)(this.m_borderCells.get(index));
481 int np = cell.m_numPars;
482 Cell toadd = g.m_cells[ix][iy][iz];
483 for(int j = 0; j < np; ++j) {
484 cell.m_v[j].m_x = toadd.m_v[j].m_x -
486 cell.m_v[j].m_y = toadd.m_v[j].m_y -
488 cell.m_v[j].m_z = toadd.m_v[j].m_z -
491 visited.put(index, index);
497 for(int ix = 0; ix < g.m_ex - g.m_sx; ix += g.m_ex - g.m_sx - 1) {
498 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
499 for(int iz = 0; iz < g.m_ez - g.m_sz; iz++) {
500 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
501 + g.m_sy))*this.m_nx + (ix + g.m_sx));
502 if((this.m_borderCells.containsKey(index))
503 && !visited.containsKey(index)) {
504 Cell cell = (Cell)(this.m_borderCells.get(index));
505 int np = cell.m_numPars;
506 Cell toadd = g.m_cells[ix][iy][iz];
507 for(int j = 0; j < np; ++j) {
508 cell.m_v[j].m_x = toadd.m_v[j].m_x -
510 cell.m_v[j].m_y = toadd.m_v[j].m_y -
512 cell.m_v[j].m_z = toadd.m_v[j].m_z -
515 visited.put(index, index);
521 if(this.m_counter == this.m_numGrids - 1) {
522 HashMapIterator it_values = this.m_borderCells.iterator(1);
523 while(it_values.hasNext()) {
524 Cell cell = (Cell)it_values.next();
525 int np = cell.m_numPars;
526 for(int j = 0; j < np; ++j) {
527 cell.m_a[j].m_x += cell.m_v[j].m_x;
528 cell.m_a[j].m_y += cell.m_v[j].m_y;
529 cell.m_a[j].m_z += cell.m_v[j].m_z;
535 public void flush4(Grid g) {
536 HashMap visited = new HashMap();
538 HashMapIterator it_keys = g.m_neighCells.iterator(0);
539 while(it_keys.hasNext()) {
540 Integer key = (Integer)it_keys.next();
541 if(!visited.containsKey(key)) {
542 Cell toflush = (Cell)(this.m_borderCells.get(key));
543 Cell cell = (Cell)(g.m_neighCells.get(key));
544 int np = cell.m_numPars;
545 for(int j = 0; j < np; ++j) {
546 cell.m_a[j].m_x = toflush.m_a[j].m_x;
547 cell.m_a[j].m_y = toflush.m_a[j].m_y;
548 cell.m_a[j].m_z = toflush.m_a[j].m_z;
550 visited.put(key, key);
555 for(int iz = 0; iz < g.m_ez - g.m_sz; iz += g.m_ez - g.m_sz - 1) {
556 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
557 for(int ix = 0; ix < g.m_ex - g.m_sx; ix++) {
558 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
559 + g.m_sy))*this.m_nx + (ix + g.m_sx));
560 if((this.m_borderCells.containsKey(index))
561 && !visited.containsKey(index)) {
562 Cell toflush = (Cell)(this.m_borderCells.get(index));
563 Cell cell = g.m_cells[ix][iy][iz];
564 int np = cell.m_numPars;
565 for(int j = 0; j < np; ++j) {
566 cell.m_a[j].m_x = toflush.m_a[j].m_x;
567 cell.m_a[j].m_y = toflush.m_a[j].m_y;
568 cell.m_a[j].m_z = toflush.m_a[j].m_z;
570 visited.put(index, index);
576 for(int ix = 0; ix < g.m_ex - g.m_sx; ix += g.m_ex - g.m_sx - 1) {
577 for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) {
578 for(int iz = 0; iz < g.m_ez - g.m_sz; iz++) {
579 Integer index = new Integer(((iz + g.m_sz)*this.m_ny + (iy
580 + g.m_sy))*this.m_nx + (ix + g.m_sx));
581 if((this.m_borderCells.containsKey(index))
582 && !visited.containsKey(index)) {
583 Cell toflush = (Cell)(this.m_borderCells.get(index));
584 Cell cell = g.m_cells[ix][iy][iz];
585 int np = cell.m_numPars;
586 for(int j = 0; j < np; ++j) {
587 cell.m_a[j].m_x = toflush.m_a[j].m_x;
588 cell.m_a[j].m_y = toflush.m_a[j].m_y;
589 cell.m_a[j].m_z = toflush.m_a[j].m_z;
591 visited.put(index, index);