35 int is[ndims], ie[ndims], index[ndims], bounds[ndims];
38 if (mpi->
rank && xg) {
39 fprintf(stderr,
"Error in MPIPartitionArraynD(): global array exists on non-root processors (rank %d).\n",
43 if ((!mpi->
rank) && (!xg)) {
44 fprintf(stderr,
"Error in MPIPartitionArraynD(): global array is not allocated on root processor.\n");
50 for (proc = 0; proc < mpi->
nproc; proc++) {
55 for (d=0; d<ndims; d++) {
56 size *= (ie[d]-is[d]);
57 bounds[d] = ie[d] - is[d];
59 double *buffer = (
double*) calloc (size*nvars,
sizeof(
double));
69 MPI_Send(buffer,size*nvars,MPI_DOUBLE,proc,1538,mpi->
world);
88 size = 1;
for (d=0; d<ndims; d++) size *= dim_local[d];
89 double *buffer = (
double*) calloc (size*nvars,
sizeof(
double));
90 MPI_Recv(buffer,size*nvars,MPI_DOUBLE,0,1538,mpi->
world,&status);
129 int is[ndims], ie[ndims], index[ndims], bounds[ndims];
130 int dim_global_wghosts[ndims];
131 for (d = 0; d < ndims; d++) dim_global_wghosts[d] = dim_global[d] + 2*ghosts;
134 if (mpi->
rank && xg) {
135 fprintf(stderr,
"Error in MPIPartitionArraynD(): global array exists on non-root processors (rank %d).\n",
139 if ((!mpi->
rank) && (!xg)) {
140 fprintf(stderr,
"Error in MPIPartitionArraynD(): global array is not allocated on root processor.\n");
146 for (proc = 0; proc < mpi->
nproc; proc++) {
151 for (d=0; d<ndims; d++) {
152 size *= (ie[d]-is[d]+2*ghosts);
153 bounds[d] = ie[d] - is[d] + 2*ghosts;
155 double *buffer = (
double*) calloc (size*nvars,
sizeof(
double));
165 MPI_Send(buffer,size*nvars,MPI_DOUBLE,proc,1538,mpi->
world);
179 size = 1;
for (d=0; d<ndims; d++) size *= (dim_local[d]+2*ghosts);
180 double *buffer = (
double*) calloc (size*nvars,
sizeof(
double));
181 MPI_Recv(buffer,size*nvars,MPI_DOUBLE,0,1538,mpi->
world,&status);
MPI related function definitions.
Some basic definitions and macros.
int MPIPartitionArraynDwGhosts(int ndims, void *m, double *xg, double *x, int *dim_global, int *dim_local, int ghosts, int nvars)
#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)
int MPIPartitionArraynD(int ndims, void *m, double *xg, double *x, int *dim_global, int *dim_local, int ghosts, int nvars)
int MPILocalDomainLimits(int, int, void *, int *, int *, int *)
Structure of MPI-related variables.
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.