HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MPISum.c
Go to the documentation of this file.
1 
5 #ifndef serial
6 #include <mpi.h>
7 #endif
8 
17  int *global,
18  int *var,
19  int size,
20  void *comm
21  )
22 {
23 #ifdef serial
24  int i;
25  for (i = 0; i < size; i++) global[i] = var[i];
26 #else
27  MPI_Allreduce((var==global?MPI_IN_PLACE:var),global,size,MPI_INT,MPI_SUM,*((MPI_Comm*)comm));
28 #endif
29  return(0);
30 }
31 
40  double *global,
41  double *var,
42  int size,
43  void *comm
44  )
45 {
46 #ifdef serial
47  int i;
48  for (i = 0; i < size; i++) global[i] = var[i];
49 #else
50  MPI_Allreduce((var==global?MPI_IN_PLACE:var),global,size,MPI_DOUBLE,MPI_SUM,*((MPI_Comm*)comm));
51 #endif
52  return(0);
53 }
int MPISum_integer(int *, int *, int, void *)
Definition: MPISum.c:16
int MPISum_double(double *, double *, int, void *)
Definition: MPISum.c:39