14 FindProcessor::FindProcessor()
16 negXL=negYL=negZL=posXL=posYL=posZL=0;
26 FindProcessor::FindProcessor(
int a[])
28 negXL=negYL=negZL=posXL=posYL=posZL=0;
36 negXL=negYL=negZL=posXL=posYL=posZL=0;
60 void FindProcessor::findNext(
int a[])
62 if(a[0]==0 && a[1]==0 && a[2]==0)
65 cout<<
"-------------------------\n";
66 cout<<
"Distance "<<next[2]<<
" starting\n";
67 cout<<
"-------------------------\n";
72 if(a[0]<=0 && a[1]<=0 && a[2]<=0)
98 cout<<
"-------------------------\n";
99 cout<<
"Distance "<<next[2]<<
" starting\n";
100 cout<<
"-------------------------\n";
101 printing(next[0], next[1], next[2]);
112 printing(next[0], next[1], next[2]);
121 printing(next[0], next[1], next[2]);
128 printing(next[0], next[1], next[2]);
137 if(a[0]==0 && a[1]==0 && a[2]==0)
152 if(next[0]>=nopZ || next[1]>=nopY || next[2]>=nopX)
167 if(next[0]>=nopZ || next[1]>=nopY || next[2]>=nopX)
180 if(next[0]>=nopZ || next[1]>=nopY || next[2]>=nopX)
198 int FindProcessor::findNextInMesh(
int a[])
201 if(count == nopX*nopY*nopZ)
203 cout<<
"-------------------------\n";
204 cout<<
"No more processors left\n";
205 cout<<
"-------------------------\n";
206 CkAbort(
"inconsistent no. of chares and processors\n");
226 if(count==nopX*nopY*nopZ)
228 cout<<
"-------------------------\n";
229 cout<<
"No more processors left\n";
230 cout<<
"-------------------------\n";
231 CkAbort(
"inconsistent no. of chares and processors\n");
235 if(a[0]==0 && a[1]==0 && a[2]==0)
259 if(a[0]<=0 && a[1]<=0 && a[2]<=0)
261 for(
int i=0; i<3;i++)
269 if(abs(next[0])>=posZL || abs(next[1])>=posYL || abs(next[2])>=posXL)
282 next[2]=next[2]+nopX;
284 next[1]=next[1]+nopY;
286 next[0]=next[0]+nopZ;
296 if(abs(next[0])>=posZL || abs(next[1])>=posYL || abs(next[2])>=posXL)
309 next[2]=next[2]+nopX;
311 next[1]=next[1]+nopY;
313 next[0]=next[0]+nopZ;
321 if(abs(next[0])>=posZL || abs(next[1])>=posYL || abs(next[2])>=posXL)
338 next[2]=next[2]+nopX;
340 next[1]=next[1]+nopY;
342 next[0]=next[0]+nopZ;
354 if(compare(next[0], posZL, negZL) || compare(next[1], posYL, negYL) || compare(next[2], posXL, negXL))
367 next[2]=next[2]+nopX;
369 next[1]=next[1]+nopY;
371 next[0]=next[0]+nopZ;
381 if(compare(next[0], posZL, negZL) || compare(next[1], posYL, negYL) || compare(next[2], posXL, negXL))
394 next[2]=next[2]+nopX;
396 next[1]=next[1]+nopY;
398 next[0]=next[0]+nopZ;
406 if(compare(next[0], posZL, negZL) || compare(next[1], posYL, negYL) || compare(next[2], posXL, negXL))
419 next[2]=next[2]+nopX;
421 next[1]=next[1]+nopY;
423 next[0]=next[0]+nopZ;
434 int FindProcessor::findNextInTorus(
int a[])
444 int FindProcessor::findNextInTorusV(
int t,
int a[])
456 if(count==nopX*nopY*nopZ) {
457 cout<<
"-------------------------\n";
458 cout<<
"No more processors left\n";
459 cout<<
"-------------------------\n";
460 CkAbort(
"inconsistent no. of chares and processors\n");
473 int FindProcessor::compare(
int n,
int a,
int b)
501 findNextInMesh(start);
506 array[2]=start[2]-nopX;
510 array[1]=start[1]-nopY;
514 array[0]=start[0]-nopZ;
519 val=findNextInTorus(array);
524 array[2]=start[2]-nopX;
528 array[1]=start[1]-nopY;
532 array[0]=start[0]-nopZ;
537 val=findNextInTorusV(w, array);
546 findNextInMesh(start);
552 array[2]=start[2]-nopX;
556 array[1]=start[1]-nopY;
560 array[0]=start[0]-nopZ;
565 val=findNextInTorus(array);
575 array[2]=start[2]-nopX;
579 array[1]=start[1]-nopY;
583 array[0]=start[0]-nopZ;
588 val=findNextInTorusV(w, array);
598 cout<<
" "<<count<<
". ";
600 cout<<
" "<<count<<
". ";
618 void FindProcessor::printing_sp(
int a,
int b,
int c)
637 cout<<
" "<<count<<
". ";
639 cout<<
" "<<count<<
". ";
Author: Abhinav S Bhatele Date Created: November 30th, 2005 Finds the nearest processor from a given ...
void printing(int a, int b, int c)
int findNextInMIter(int a[])
int findNextIter(int a[])