36 int is[ndims], ie[ndims], index[ndims], bounds[ndims];
39 if (mpi->
rank && xg) {
40 fprintf(stderr,
"Error in MPIGatherArraynD(): global array exists on non-root processors (rank %d).\n",
44 if ((!mpi->
rank) && (!xg)) {
45 fprintf(stderr,
"Error in MPIGatherArraynD(): global array is not allocated on root processor.\n");
51 for (d = 0; d < ndims; d++) size *= dim_local[d];
54 double *buffer = (
double*) calloc (size*nvars,
sizeof(
double));
59 for (proc = 0; proc < mpi->
nproc; proc++) {
64 for (d=0; d<ndims; d++) {
65 size *= (ie[d]-is[d]);
66 bounds[d] = ie[d] - is[d];
71 double *recvbuf = (
double*) calloc (size*nvars,
sizeof(
double));
72 MPI_Recv(recvbuf,size*nvars,MPI_DOUBLE,proc,1902,mpi->
world,&status);
96 MPI_Send(buffer,size*nvars,MPI_DOUBLE,0,1902,mpi->
world);
133 int is[ndims], ie[ndims], index[ndims], bounds[ndims];
134 int dim_global_wghosts[ndims];
135 for (d = 0; d < ndims; d++) dim_global_wghosts[d] = dim_global[d] + 2*ghosts;
138 if (mpi->
rank && xg) {
139 fprintf(stderr,
"Error in MPIGatherArraynD(): global array exists on non-root processors (rank %d).\n",
143 if ((!mpi->
rank) && (!xg)) {
144 fprintf(stderr,
"Error in MPIGatherArraynD(): global array is not allocated on root processor.\n");
150 for (d = 0; d < ndims; d++) size *= (dim_local[d]+2*ghosts);
153 double *buffer = (
double*) calloc (size*nvars,
sizeof(
double));
158 for (proc = 0; proc < mpi->
nproc; proc++) {
162 for (d=0; d<ndims; d++) {
163 bounds[d] = ie[d] - is[d];
168 for (d=0; d<ndims; d++) {
169 size *= (ie[d]-is[d]+2*ghosts);
170 bounds[d] = ie[d] - is[d];
173 double *recvbuf = (
double*) calloc (size*nvars,
sizeof(
double));
174 MPI_Recv(recvbuf,size*nvars,MPI_DOUBLE,proc,1902,mpi->
world,&status);
198 MPI_Send(buffer,size*nvars,MPI_DOUBLE,0,1902,mpi->
world);
#define _ArraySetValue_(x, size, value)
#define _ArrayIncrementIndex_(N, imax, i, done)
INLINE int ArrayCopynD(int, const double *, double *, int *, int, int, int *, int)
MPI related function definitions.
#define _ArrayIndex1D_(N, imax, i, ghost, index)
int MPIGatherArraynDwGhosts(int, void *, double *, double *, int *, int *, int, int)
int MPIGatherArraynD(int, void *, double *, double *, int *, int *, int, int)
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArrayCopy1D_(x, y, size)
int MPILocalDomainLimits(int, int, void *, int *, int *, int *)
Some basic definitions and macros.
Contains macros and function definitions for common array operations.
int MPIExchangeBoundariesnD(int, int, int *, int, void *, double *)
Structure of MPI-related variables.