Class for all the global variables and functions related to parallelization.
More...
#include "lib/parallel.h"
|
| parallel (const parser &iDat) |
| Constructor of the parallel class. More...
|
|
int | findRank (int xR, int yR) |
| Function to calculate the global rank of a sub-domain using its xRank and yRank. More...
|
|
|
static int | pmod (int a, int b) |
| Function to calculate the positive modulus of two numbers. More...
|
|
|
int | rank |
| The MPI rank of each sub-domain.
|
|
int | nProc |
| The total number of cores available for computation.
|
|
const int | npX |
| npX and npY indicates the number of sub-domain divisions along the X and Y directions respectively
|
|
const int | npY |
|
MPI_Comm | MPI_ROW_COMM |
| Row and column communicators.
|
|
MPI_Comm | MPI_COL_COMM |
|
int | xRank |
| xRank and yRank indicates the rank in terms of sub-domain divisions along the X and Y directions respectively. More...
|
|
int | yRank |
|
blitz::Array< int, 1 > | faceRanks |
| Array of ranks of the 4 neighbouring sub-domains across faces - Left, Right, Front, Back.
|
|
blitz::Array< int, 1 > | edgeRanks |
| Array of ranks of the 4 neighbouring sub-domains across edges - Left-Front, Left-Back, Right-Front, Right-Back.
|
|
Class for all the global variables and functions related to parallelization.
After MPI_Init, every process has its own rank. Moreover, after performing domain decomposition, each process has its own xRank and yRank to identify its position within the global computational domain. These data, along with the data to identify the neighbouring processes for inter-domain communication are stored in the parallel class. This class is initialized only once at the start of the solver.
◆ parallel()
parallel::parallel |
( |
const parser & |
iDat | ) |
|
Constructor of the parallel class.
The initializing functions of MPI are called in order to get the total number of processes spawned, and
the rank of each process.
The xRank and yRank of each process are calculated and assigned.
Finally, the ranks of neighbouring processes are found and stored in an array for use in MPI communications
- Parameters
-
iDat | is a const reference to the global data contained in the parser class |
◆ findRank()
int parallel::findRank |
( |
int |
xR, |
|
|
int |
yR |
|
) |
| |
|
inline |
Function to calculate the global rank of a sub-domain using its xRank and yRank.
The inline function computes the global rank of the processor using xRank and yRank.
In doing so, a periodic domain is assumed. Non-periodic problems must have ranks set specifically.
- Parameters
-
xR | is the integer value of the sub-domain's xRank |
yR | is the integer value of the sub-domain's yRank |
- Returns
- The integer value of the rank of the sub-domain
◆ pmod()
static int parallel::pmod |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
inlinestatic |
Function to calculate the positive modulus of two numbers.
The inline function return the positive modulus of 2 numbers, with negative values
wrapping around to the upper limit.
- Parameters
-
a | is the integer first operand as in ordinary mod function |
b | is the integer second operand as in ordinary mod function |
- Returns
- The integer value of the positive modulus of the two input numbers
◆ xRank
xRank and yRank indicates the rank in terms of sub-domain divisions along the X and Y directions respectively.
Like the global rank variable, these values also start from 0 to npX - 1 and npY - 1 respectively.
The documentation for this class was generated from the following files: