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);
#define _ArraySetValue_(x, size, value)
int MPIPartitionArraynDwGhosts(int, void *, double *, double *, int *, int *, int, int)
#define _ArrayIncrementIndex_(N, imax, i, done)
MPI related function definitions.
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArrayCopy1D_(x, y, size)
int MPIPartitionArraynD(int, void *, double *, double *, int *, int *, int, int)
int MPILocalDomainLimits(int, int, void *, int *, int *, int *)
Some basic definitions and macros.
Contains macros and function definitions for common array operations.
Structure of MPI-related variables.