41 int is[ndims], ie[ndims], index[ndims], bounds[ndims], size;
43 for (d=0; d<ndims; d++) {
45 ie[d] = limits[2*d+1];
46 size *= (ie[d] - is[d]);
50 if (source_rank == dest_rank) {
61 fprintf(stderr,
"Error in MPIGetArrayDatanD(): This is a serial run. Source and ");
62 fprintf(stderr,
"destination ranks must be equal. Instead they are %d and %d.\n",
63 source_rank,dest_rank);
66 if (mpi->
rank == source_rank) {
67 double *buf = (
double*) calloc (size*nvars,
sizeof(
double));
75 MPI_Send(buf,size*nvars,MPI_DOUBLE,dest_rank,2211,mpi->
world);
77 }
else if (mpi->
rank == dest_rank) {
79 MPI_Recv(xbuf,size*nvars,MPI_DOUBLE,source_rank,2211,mpi->
world,&status);
81 fprintf(stderr,
"Error in MPIGetArrayData3D(): Process %d shouldn't have entered this function.\n",
MPI related function definitions.
Some basic definitions and macros.
#define _ArraySubtract1D_(x, a, b, size)
int MPIRank1D(int, int *, int *)
int MPIGetArrayDatanD(double *xbuf, double *x, int *source, int *dest, int *limits, int *dim, int ghosts, int ndims, int nvars, void *m)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArraySetValue_(x, size, value)
#define _ArrayIncrementIndex_(N, imax, i, done)
Structure of MPI-related variables.
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.