1
1
This commit was SVN r1042.
Этот коммит содержится в:
Prabhanjan Kambadur 2004-04-16 19:49:39 +00:00
родитель 757d829971
Коммит 8947835c35

Просмотреть файл

@ -0,0 +1,47 @@
/*
* $HEADER$
*/
#include "mca/topo/base/base.h"
#include "communicator/communicator.h"
#include "mca/topo/topo.h"
/*
* function - returns the neighbors of a node associated
* with a graph topology
*
* @param comm communicator with graph topology (handle)
* @param rank rank of process in group of comm (integer)
* @param maxneighbors size of array neighbors (integer)
* @param neighbors ranks of processes that are neighbors to specified process
* (array of integer)
*
* @retval MPI_SUCCESS
*/
int topo_base_graph_neighbors (MPI_Comm comm,
int rank,
int maxneighbors,
int *neighbors){
int nnbrs;
int i;
int *p;
/*
* Fill the neighbours.
*/
nnbrs = comm->c_topo_comm->mtc_index[rank];
p = comm->c_topo_comm->mtc_edges;
if (rank > 0) {
i = comm->c_topo_comm->mtc_index[rank - 1];
nnbrs -= i;
p += i;
}
for (i = 0; (i < maxneighbors) && (i < nnbrs); ++i, ++p) {
*neighbors++ = *p;
}
return MPI_SUCCESS;
}