HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Exchange data and fill in ghost points for an n-dimensional array. More...
Go to the source code of this file.
Functions | |
int | MPIExchangeBoundariesnD (int ndims, int nvars, int *dim, int ghosts, void *m, double *var) |
Exchange data and fill in ghost points for an n-dimensional array.
Definition in file MPIExchangeBoundariesnD.c.
int MPIExchangeBoundariesnD | ( | int | ndims, |
int | nvars, | ||
int * | dim, | ||
int | ghosts, | ||
void * | m, | ||
double * | var | ||
) |
Exchange data across MPI ranks, and fill in ghost points for an n-dimensional array (where n is the total number of spatial dimensions). If any of the physical boundaries are periodic, this function also exchanges data and fills in the ghost points for these boundaries.
The n-dimensional array must be stored in the memory as a single-index array, with the following order of mapping:
For example, consider a 2D simulation (ndims = 2), of size \(7 \times 3\), with \(4\) vector components (nvars = 4). The following figure shows the layout (without the ghost points):
The bold numbers in parentheses represent the 2D indices. The numbers below them are the indices of the array that correspond to that 2D location. Thus, elements 40,41,42, and 43 in the array are the 1st, 2nd, 3rd, and 4th vector components at location (1,3).
If \({\bf i}\left[{\rm ndims}\right]\) is an integer array representing an n-dimensional index (for example, \(\left(5,4\right)\) in 2D, \(\left(3,5,2\right)\) in 3D), and the number of vector components is nvars, then:
ndims | Number of spatial dimensions |
nvars | Number of variables (vector components) at each grid location |
dim | Integer array whose elements are the local size along each spatial dimension |
ghosts | Number of ghost points |
m | MPI object of type MPIVariables |
var | The array for which to exchange data and fill in ghost points |
Definition at line 42 of file MPIExchangeBoundariesnD.c.