2004-03-07 01:40:26 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mca/topo/base/base.h"
|
2004-04-17 00:54:48 +04:00
|
|
|
#include "communicator/communicator.h"
|
|
|
|
#include "mca/topo/topo.h"
|
2004-03-07 01:40:26 +03:00
|
|
|
|
2004-03-08 09:48:24 +03:00
|
|
|
/*
|
|
|
|
* function - retrieves Cartesian topology information associated with a
|
|
|
|
* communicator
|
|
|
|
*
|
|
|
|
* @param comm communicator with cartesian structure (handle)
|
|
|
|
* @param maxdims length of vectors 'dims', 'periods', and 'coords'
|
|
|
|
* in the calling program (integer)
|
|
|
|
* @param dims number of processes for each cartesian dimension (array of integer)
|
|
|
|
* @param periods periodicity (true/false) for each cartesian dimension
|
|
|
|
* (array of logical)
|
|
|
|
* @param coords coordinates of calling process in cartesian structure
|
|
|
|
* (array of integer)
|
|
|
|
*
|
|
|
|
* @retval MPI_SUCCESS
|
|
|
|
*/
|
2004-04-17 00:54:48 +04:00
|
|
|
int topo_base_cart_get (MPI_Comm comm,
|
2004-03-08 09:48:24 +03:00
|
|
|
int maxdims,
|
|
|
|
int *dims,
|
|
|
|
int *periods,
|
|
|
|
int *coords){
|
|
|
|
int i;
|
|
|
|
int *d;
|
|
|
|
int *c;
|
|
|
|
|
2004-04-17 00:54:48 +04:00
|
|
|
d = comm->c_topo_comm->mtc_dims;
|
|
|
|
c = comm->c_topo_comm->mtc_coords;
|
|
|
|
for (i = 0; (i < comm->c_topo_comm->mtc_ndims) && (i < maxdims); ++i) {
|
2004-03-08 09:48:24 +03:00
|
|
|
if (*d > 0) {
|
|
|
|
*dims++ = *d++;
|
|
|
|
*periods++ = 0;
|
|
|
|
} else {
|
|
|
|
*dims++ = -(*d++);
|
|
|
|
*periods++ = 1;
|
|
|
|
}
|
|
|
|
*coords++ = *c++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|