#include "array.h" #include "poisson.h" void exchange(dmatrix a, Decomposition oned, Grid grid) { /* exchange of boundary values (ghost points) using non-blocking routines */ int lx, ly; MPI_Status status[4]; MPI_Request req[4]; lx = oned.lx; ly = oned.ly; /* extra boundary points in y are not exchanged, they are constant anyway */ MPI_Irecv(&INDEX(a, lx+1, 1), ly, MPI_DOUBLE, grid.up, 0, grid.comm, &req[0]); MPI_Irecv(&INDEX(a, 0, 1), ly, MPI_DOUBLE, grid.down, 1, grid.comm, &req[1]); MPI_Isend(&INDEX(a, 1, 1), ly, MPI_DOUBLE, grid.down, 0, grid.comm, &req[2]); MPI_Isend(&INDEX(a, lx, 1), ly, MPI_DOUBLE, grid.up, 1, grid.comm, &req[3]); MPI_Waitall(4, req, status); }