forked from NoseKnowsAll/Local-DG
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMPIUtil.h
More file actions
61 lines (43 loc) · 1.39 KB
/
MPIUtil.h
File metadata and controls
61 lines (43 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef MPI_UTIL_H__
#define MPI_UTIL_H__
#include <mpi.h>
#include <iostream>
#include <sstream>
#include <string>
#include "array.h"
class MPIUtil {
public:
/** Default/Main constructor */
MPIUtil();
/** Initialize MPI_FACE for use in further MPI sends/recvs */
void initDatatype(int nodesPerFace);
/* Map MPI faces to the first MPIUtil::N_FACES faces in 3D */
void initFaces(int meshDim);
/** MPI helper function to print out a string */
void printString(const std::string& toPrint) const;
/** This MPI rank's number */
int rank;
/** Total number of MPI tasks */
int np;
/** Number of MPI tasks in each dimension */
iarray nps;
/** Array of MPI ranks describing neighbors in -x,+x,-y,+y,-z,+z directions */
iarray neighbors;
/** DIM array defining this rank's coordinate in cartComm */
iarray coords;
/** Tag array for each face when on receiving side of communication */
iarray tags;
/** Cartesian MPI Communicator */
MPI_Comm cartComm;
/** Mapping a given MPI face to the corresponding mesh face */
iarray faceMap;
/** Derived datatype describing the nodes on a single element face */
MPI_Datatype MPI_FACE;
/** Dimension of MPI topology we are modeling */
const static int DIM = 3;
/** Number of faces per MPI rank */
const static int N_FACES = 2*DIM;
/** Root node rank */
const static int ROOT = 0;
};
#endif