dump.c
#include "array.h"
#include "poisson.h"
void
dump(dmatrix a, Decomposition oned, Grid grid)
{
/* prints out the local array with global indices, */
/* using a token ring scheme for synchronisation */
int x, y;
int token = 0;
MPI_Status status;
double scale;
scale = oned.gx * oned.gy;
MPI_Recv(&token, 1, MPI_INT, grid.down, TAG_RING, grid.comm, &status);
for (x = 1; x <= oned.lx; x++)
{
for (y = 1; y <= oned.ly; y++)
{
printf("%03d %03d %10.3lf\n",
x + oned.llc_x - 1, y, INDEX(a, x, y)/scale);
}
}
MPI_Send(&token, 1, MPI_INT, grid.up, TAG_RING, grid.comm);
}

Peter Junglas 11.5.2000