/* comm.c: Communication routines * * Madhu Nayakkankuppam, 10/09/2002 * * Exchange of ghost cells for the Poisson problem and 1-D Jacobi sweep. * */ #ifndef _MPI_H #include "mpi.h" #endif #ifndef _COMM_H #include "comm.h" #endif /*--------------------------------------------------------------------------*/ void jacobi(double **a, /* current solution matrix */ double **b, /* updated solution matrix */ double **f, /* right hand side */ double h, /* mesh spacing */ int my_rank, /* process rank */ int p, /* number of processes */ int nx, /* # grid points along x */ int local_nx, /* # grid points along y */ int ptop, /* process rank for next (above) row */ int pbot, /* process rank for preceding (below) row */ int mode, /* mode of communication */ MPI_Comm *grid, /* communicator */ MPI_Request *a_req, /* array of 4 requests */ MPI_Request *b_req, /* array of 4 requests */ MPI_Status *status /* array of 8 statuses */ ) { /* Actual data is in a[1:local_nx][0:nx-1]. Boundary conditions apply to a[1][0:nx-1], a[local_nx][0:nx-1] for procs 0 and p-1, so 2 <= i <= local_nx-1 below. Likewise, boundary conditions apply to a[1:local_nx][0] and a[1:local_nx][nx-1], so 1 <= j <= nx-2 below for all procs. */ }