diff options
Diffstat (limited to 'src/SetupPGV.c')
-rw-r--r-- | src/SetupPGV.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/SetupPGV.c b/src/SetupPGV.c index 3b1d334..c797afa 100644 --- a/src/SetupPGV.c +++ b/src/SetupPGV.c @@ -376,6 +376,10 @@ int pugh_GenerateNeighbours(int dim, int total_procs, int *nprocs, int **neighbo neighbours[i][idim*2] = pugh_ComposeIJK(dim, nprocs, pos); pos[idim] = temp; } + else + { + neighbours[i][idim*2] = -1; + } pos[idim]++; @@ -393,7 +397,11 @@ int pugh_GenerateNeighbours(int dim, int total_procs, int *nprocs, int **neighbo neighbours[i][idim*2+1] = pugh_ComposeIJK(dim, nprocs, pos); pos[idim] = temp; } - + else + { + neighbours[i][idim*2+1] = -1; + } + pos[idim]--; } } @@ -407,6 +415,20 @@ int pugh_GenerateNeighbours(int dim, int total_procs, int *nprocs, int **neighbo free(pos); +#ifdef DEBUG_PUGH + /* Print neighbours */ + printf("Neighbours (dim: %d)\n",dim); + for (i=0;i<total_procs;i++) + { + printf("Proc %d: ",i); + for (idim=0;idim<2*dim;idim++) + { + printf(" %d",neighbours[i][idim]); + } + printf("\n"); + } +#endif + return retval; } @@ -1274,7 +1296,7 @@ int pugh_EnablePGAStorage(pGA *GA, if(GA->storage == PUGH_NOSTORAGE) { /* Allocate memory for communication buffers */ - for(i = 0; i < GA->extras->dim; i++) + for(i = 0; i < 2*GA->extras->dim; i++) { dir = i/2; @@ -1478,7 +1500,9 @@ void pugh_GAComm(pGA *GA, int docomm) else if (docomm == PUGH_ALLCOMM) { for (idir=0;idir<2*dim;idir++) + { GA->docomm[idir] = 1; + } } else if (docomm == PUGH_PLUSFACESCOMM) { |