HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
MPILocalDomainLimits.c
Go to the documentation of this file.
1 
6 #include <stdlib.h>
7 #include <basic.h>
8 #include <mpivars.h>
9 
19  int ndims,
20  int p,
21  void *m,
22  int *dim_global,
23  int *is,
24  int *ie
25  )
26 {
27  MPIVariables *mpi = (MPIVariables*) m;
28  int i;
30 
31  int ip[ndims];
32  IERR MPIRanknD(ndims,p,mpi->iproc,ip); CHECKERR(ierr);
33 
34  for (i=0; i<ndims; i++) {
35  int imax_local, isize, root = 0;
36  imax_local = MPIPartition1D(dim_global[i],mpi->iproc[i],root );
37  isize = MPIPartition1D(dim_global[i],mpi->iproc[i],ip[i]);
38  if (is) is[i] = ip[i]*imax_local;
39  if (ie) ie[i] = ip[i]*imax_local + isize;
40  }
41  return(0);
42 }
#define IERR
Definition: basic.h:16
MPI related function definitions.
#define CHECKERR(ierr)
Definition: basic.h:18
Some basic definitions and macros.
int MPIPartition1D(int, int, int)
Structure of MPI-related variables.
int MPIRanknD(int, int, int *, int *)
Definition: MPIRanknD.c:27
#define _DECLARE_IERR_
Definition: basic.h:17
int MPILocalDomainLimits(int ndims, int p, void *m, int *dim_global, int *is, int *ie)