PLUTO
cartcoord.c File Reference

Go to the source code of this file.

Functions

 GetRankCoordinates (periods, nprocs, coords)
 
void GetRankCoordinates (int periods[3], int nprocs[3], int coords[3])
 
int CoordOffRank (Grid *grid, int dir, int poff, MPI_comm *cartcomm)
 

Function Documentation

int CoordOffRank ( Grid grid,
int  dir,
int  poff,
MPI_comm *  cartcomm 
)

Definition at line 30 of file cartcoord.c.

39 {
40  int coords[3], rnk;
41 
42  coords[IDIR] = grid[IDIR].rank_coord;
43  coords[JDIR] = grid[JDIR].rank_coord;
44  coords[KDIR] = grid[KDIR].rank_coord;
45 
46  coords[dir] += poff;
47 
48  MPI_Cart_rank(cartcomm, coords, &rnk);
49  return rnk;
50 }
#define KDIR
Definition: pluto.h:195
#define IDIR
Definition: pluto.h:193
int rank_coord
Parallel coordinate in a Cartesian topology.
Definition: structs.h:121
#define JDIR
Definition: pluto.h:194
GetRankCoordinates ( periods  ,
nprocs  ,
coords   
)
void GetRankCoordinates ( int  periods[3],
int  nprocs[3],
int  coords[3] 
)

Definition at line 6 of file cartcoord.c.

11 {
12  MPI_Comm cartcomm;
13  MPI_Status status;
14  int nprocs[3], periods[3], coords[3];
15  int rank;
16 
17  MPI_Comm_rank(MPI_COMM_WORLD, &prank);
18 
19  coords[0] = coords[1] = coords[2] = 0;
20  periods[0] = periods[1] = periods[2] = 0;
21  nprocs[0] = nprocs[1] = nprocs[2] = 0;
22 
23  AL_Get_cart_comm(SZ, &cartcomm);
24  MPI_Cart_get(cartcomm, 3, nprocs, periods, coords);
25  MPI_Cart_rank(cartcomm, coords, &rank);
26 }
int prank
Processor rank.
Definition: globals.h:33
int AL_Get_cart_comm(int, MPI_Comm *)
Definition: al_sz_get.c:117
Definition: al_hidden.h:38

Here is the call graph for this function: