So I am currently working on a project that involves a parallel grid structure. The problem I am having is related to the communication scheme. The amount of information I have for each element in this matrix is what processor rank it is. This lets me calculate where, in the global scheme, it is.
I'll try to give a visual example:
This matrix represents a global picture of the node numbering.
| 0| 1| 2| 3|
| 4| 5| 6| 7|
| 8| 9|10|11|
|12|13|14|15|
Locally, I can find any (i,j) given its' processor rank and total number of processors in the comm.
The problem I am trying to solve is how to find, for an arbitrarily sized square mesh, how do I know which element is on the diagonal or ant diagonal.
A better picture of what I am looking at is posted below. The differing black/white scheme has been taken care of, I just need to know how to find the diagonal and anti diagonal given its' processor rank and node coordinates.