1
1
openmpi/ompi/mpi/java/java/DistGraphNeighbors.java
Jeff Squyres e4e3e411fc Next generation of MPI Java bindings.
Includes all MPI functions supported by Open MPI, including MPI-3
functions (as of about 2 weeks ago).  Many changes compared to the
prior generation of Java bindings; not much is left from the prior
generation, actually.  The changes include (but are not limited to):

 * Add support for more than just a subset of MPI-1 functions
 * Use typical Java case for symbol names
 * Support Java Direct buffers (giving darn-near "native C"
   performance)
 * Support "type struct" better than the prior generation
 * Make more of an effort for the Java bindings to be a thin layer
   over the back-end C bindings
 * ...and more

A proper README with more information about what is supported, how to
use these bindings, etc. will be committed shortly.

This commit was SVN r29263.
2013-09-26 21:44:39 +00:00

90 строки
1.9 KiB
Java

package mpi;
/**
* Adjacency information for a distributed graph topology.
*/
public final class DistGraphNeighbors
{
private final int[] sources, sourceWeights, destinations, destWeights;
private final boolean weighted;
protected DistGraphNeighbors(
int[] sources, int[] sourceWeights,
int[] destinations, int[] destWeights, boolean weighted)
{
this.sources = sources;
this.sourceWeights = sourceWeights;
this.destinations = destinations;
this.destWeights = destWeights;
this.weighted = weighted;
}
/**
* Gets the number of edges into this process.
* @return number of edges into this process
*/
public int getInDegree()
{
return sources.length;
}
/**
* Gets the number of edges out of this process.
* @return number of edges out of this process
*/
public int getOutDegree()
{
return destinations.length;
}
/**
* Returns false if {@code MPI_UNWEIGHTED} was supplied during creation.
* @return false if {@code MPI_UNWEIGHTED} was supplied, true otherwise
*/
public boolean isWeighted()
{
return weighted;
}
/**
* Gets a process for which the calling processs is a destination.
* @param i source index
* @return process for which the calling processs is a destination
*/
public int getSource(int i)
{
return sources[i];
}
/**
* Gets the weight of an edge into the calling process.
* @param i source index
* @return weight of the edge into the calling process
*/
public int getSourceWeight(int i)
{
return sourceWeights[i];
}
/**
* Gets a process for which the calling process is a source
* @param i destination index
* @return process for which the calling process is a source
*/
public int getDestination(int i)
{
return destinations[i];
}
/**
* Gets the weight of an edge out of the calling process.
* @param i destination index
* @return weight of an edge out of the calling process
*/
public int getDestinationWeight(int i)
{
return destWeights[i];
}
} // DistGraphNeighbors