HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
MPIPartition1D.c
Go to the documentation of this file.
1 
6 #include <stdio.h>
7 #include <mpivars.h>
8 
15  int nglobal,
16  int nproc,
17  int rank
18  )
19 {
20  int nlocal;
21  if (nglobal%nproc == 0) nlocal = nglobal/nproc;
22  else {
23  if (rank == nproc-1) nlocal = nglobal/nproc + nglobal%nproc;
24  else nlocal = nglobal/nproc;
25  }
26  return(nlocal);
27 }
MPI related function definitions.
int MPIPartition1D(int nglobal, int nproc, int rank)