47 CommGrid(MPI_Comm world,
int nrowproc,
int ncolproc);
51 MPI_Comm_free(&commWorld);
52 MPI_Comm_free(&rowWorld);
53 MPI_Comm_free(&colWorld);
54 if(grrows == grcols) {
55 if(diagWorld != MPI_COMM_NULL) MPI_Comm_free(&diagWorld);
59 myprocrow(rhs.myprocrow), myproccol(rhs.myproccol), myrank(rhs.myrank)
61 MPI_Comm_dup(rhs.commWorld, &commWorld);
62 MPI_Comm_dup(rhs.rowWorld, &rowWorld);
63 MPI_Comm_dup(rhs.colWorld, &colWorld);
67 if(rhs.diagWorld == MPI_COMM_NULL)
68 diagWorld = MPI_COMM_NULL;
70 MPI_Comm_dup(rhs.diagWorld,&diagWorld);
77 MPI_Comm_free(&commWorld);
78 MPI_Comm_free(&rowWorld);
79 MPI_Comm_free(&colWorld);
84 myprocrow = rhs.myprocrow;
85 myproccol = rhs.myproccol;
87 MPI_Comm_dup(rhs.commWorld, &commWorld);
88 MPI_Comm_dup(rhs.rowWorld, &rowWorld);
89 MPI_Comm_dup(rhs.colWorld, &colWorld);
91 if(rhs.diagWorld == MPI_COMM_NULL) diagWorld = MPI_COMM_NULL;
92 else MPI_Comm_dup(rhs.diagWorld,&diagWorld);
101 return (! (*
this == rhs));
106 int GetRank(
int rowrank,
int colrank) {
return rowrank * grcols + colrank; }
107 int GetRank(
int diagrank) {
return diagrank * grcols + diagrank; }
114 MPI_Comm_rank(diagWorld, &
rank);
126 return ((grcols * myproccol) + myprocrow);
144 MPI_Comm_size(diagWorld, &
size);
153 MPI_Comm commWorld, rowWorld, colWorld, diagWorld;
161 template <
class IT,
class NT,
class DER>
164 template <
class IT,
class NT>
MPI_Comm GetColWorld() const
bool operator==(const CommGrid &rhs) const
bool OnSameProcRow(int rhsrank)
void OpenDebugFile(std::string prefix, std::ofstream &output) const
MPI_Comm GetWorld() const
MPI_Comm GetRowWorld() const
MPI_Comm & GetDiagWorld()
int GetRank(int rowrank, int colrank)
friend std::shared_ptr< CommGrid > ProductGrid(CommGrid *gridA, CommGrid *gridB, int &innerdim, int &Aoffset, int &Boffset)
bool OnSameProcCol(int rhsrank)
CommGrid & operator=(const CommGrid &rhs)
MPI_Comm GetDiagWorld() const
int GetRank(int diagrank)
CommGrid(const CommGrid &rhs)
int GetRankInProcCol(int wholerank)
CommGrid(MPI_Comm world, int nrowproc, int ncolproc)
int GetRankInProcRow(int wholerank)
bool operator!=(const CommGrid &rhs) const