| 57 |
|
|
| 58 |
|
#ifdef IS_MPI |
| 59 |
|
|
| 60 |
< |
enum direction { |
| 61 |
< |
Row = 0, |
| 62 |
< |
Column = 1 |
| 60 |
> |
enum communicatorType { |
| 61 |
> |
Global = 0, |
| 62 |
> |
Row = 1, |
| 63 |
> |
Column = 2 |
| 64 |
|
}; |
| 65 |
|
|
| 66 |
|
template<typename T> |
| 79 |
|
template<> const MPI::Datatype MPITraits<Mat3x3d>::datatype = MPI_REALTYPE; |
| 80 |
|
template<> const int MPITraits<Mat3x3d>::dim = 9; |
| 81 |
|
|
| 82 |
< |
template<direction D, typename T> |
| 82 |
> |
template<communicatorType D, typename T> |
| 83 |
|
class Communicator { |
| 84 |
|
public: |
| 85 |
|
|
| 99 |
|
rowIndex_ = myRank / nColumns; |
| 100 |
|
columnIndex_ = myRank % nColumns; |
| 101 |
|
|
| 102 |
< |
if (D == Row) { |
| 102 |
> |
switch(D) { |
| 103 |
> |
case Row : |
| 104 |
|
myComm = MPI::COMM_WORLD.Split(rowIndex_, 0); |
| 105 |
< |
} else { |
| 105 |
> |
break; |
| 106 |
> |
case Column: |
| 107 |
|
myComm = MPI::COMM_WORLD.Split(columnIndex_, 0); |
| 108 |
+ |
break; |
| 109 |
+ |
case Global: |
| 110 |
+ |
myComm = MPI::COMM_WORLD.Split(myRank, 0); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
int nCommProcs = myComm.Get_size(); |