Skip to content
Snippets Groups Projects
Commit 6ad2127e authored by Podhorszki, Norbert's avatar Podhorszki, Norbert
Browse files

fix the left-right/up-down direction in code to make communication correct

parent ef1a1408
No related branches found
No related tags found
1 merge request!203fix the left-right/up-down direction in code to make communication co…
...@@ -64,22 +64,22 @@ Settings::Settings(int argc, char *argv[], int rank, int nproc) : rank{rank} ...@@ -64,22 +64,22 @@ Settings::Settings(int argc, char *argv[], int rank, int nproc) : rank{rank}
// determine neighbors // determine neighbors
if (posx == 0) if (posx == 0)
rank_left = -1; rank_up = -1;
else else
rank_left = rank - 1; rank_up = rank - 1;
if (posx == npx - 1) if (posx == npx - 1)
rank_right = -1; rank_down = -1;
else else
rank_right = rank + 1; rank_down = rank + 1;
if (posy == 0) if (posy == 0)
rank_up = -1; rank_left = -1;
else else
rank_up = rank - npx; rank_left = rank - npx;
if (posy == npy - 1) if (posy == npy - 1)
rank_down = -1; rank_right = -1;
else else
rank_down = rank + npx; rank_right = rank + npx;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment