Package mpi

# Class Group

java.lang.Object
mpi.Group

All Implemented Interfaces:
  `Freeable`

public final class Group extends Object implements Freeable
This class represents `MPI_Group`.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected long`
`handle`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`Group(long handle)`

## Method Summary

Modifier and Type
Method
Description
`static int`
`compare(Group group1, Group group2)`
Compare two groups.
`static Group`
`difference(Group group1, Group group2)`
Set difference of two groups.
`Group`
`excl(int[] ranks)`
Create a subset group excluding specified processes.
`void`
`free()`
Java binding of the MPI operation `MPI_GROUP_FREE`.
`protected static long`
`getEmpty()`
`int`
`getRank()`
Rank of this process in the group.
`int`
`getSize()`
Java binding of the MPI operation `MPI_GROUP_SIZE`.
`Group`
`incl(int[] ranks)`
Create a subset group including specified processes.
`static Group`
`intersection(Group group1, Group group2)`
Set intersection of two groups.
`boolean`
`isNull()`
Test if group object is null.
`Group`
`rangeExcl(int[][] ranges)`
Create a subset group excluding processes specified by strided intervals of ranks.
`Group`
`rangeIncl(int[][] ranges)`
Create a subset group including processes specified by strided intervals of ranks.
`static int[]`
`translateRanks(Group group1, int[] ranks1, Group group2)`
Translate ranks within one group to ranks within another.
`static Group`
`union(Group group1, Group group2)`
Set union of two groups.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### handle

protected long handle

## Constructor Details

### Group

protected Group(long handle)

## Method Details

### getEmpty

protected static long getEmpty()

### getSize

public int getSize() throws MPIException
Java binding of the MPI operation `MPI_GROUP_SIZE`.

Returns:
  number of processes in the group
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### getRank

public int getRank() throws MPIException
Rank of this process in the group.

Java binding of the MPI operation `MPI_GROUP_RANK`.

Returns:
  rank of this process in the group, or `MPI.UNDEFINED` if this process is not a member of the group.
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### free

public void free() throws MPIException
Java binding of the MPI operation `MPI_GROUP_FREE`.

Specified by:
  `free` in interface `Freeable`
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### isNull

public boolean isNull()
Test if group object is null.

Returns:
  true if the group object is null.

### translateRanks

public static int[] translateRanks(Group group1, int[] ranks1, Group group2) throws MPIException
Translate ranks within one group to ranks within another.

Java binding of the MPI operation `MPI_GROUP_TRANSLATE_RANKS`.

Result elements are `MPI.UNDEFINED` where no correspondence exists.

Parameters:
  `group1` - a group
  `ranks1` - array of valid ranks in group1
  `group2` - another group
Returns:
  array of corresponding ranks in group2
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### compare

public static int compare(Group group1, Group group2) throws MPIException
Compare two groups.

Java binding of the MPI operation `MPI_GROUP_COMPARE`.

Parameters:
  `group1` - first group
  `group2` - second group
Returns:
  `MPI.IDENT` if the group members and group order are exactly the same in both groups, `MPI.SIMILAR` if the group members are the same but the order is different, `MPI.UNEQUAL` otherwise.
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### union

public static Group union(Group group1, Group group2) throws MPIException
Set union of two groups.

Java binding of the MPI operation `MPI_GROUP_UNION`.

Parameters:
  `group1` - first group
  `group2` - second group
Returns:
  union group
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### intersection

public static Group intersection(Group group1, Group group2) throws MPIException
Set intersection of two groups. Java binding of the MPI operation `MPI_GROUP_INTERSECTION`.

Parameters:
  `group1` - first group
  `group2` - second group
Returns:
  intersection group
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### difference

public static Group difference(Group group1, Group group2) throws MPIException
Set difference of two groups. Java binding of the MPI operation `MPI_GROUP_DIFFERENCE`.

Parameters:
  `group1` - first group
  `group2` - second group
Returns:
  difference group
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### incl

public Group incl(int[] ranks) throws MPIException
Create a subset group including specified processes.

Java binding of the MPI operation `MPI_GROUP_INCL`.

Parameters:
  `ranks` - ranks from this group to appear in new group
Returns:
  new group
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### excl

public Group excl(int[] ranks) throws MPIException
Create a subset group excluding specified processes.

Java binding of the MPI operation `MPI_GROUP_EXCL`.

Parameters:
  `ranks` - ranks from this group not to appear in new group
Returns:
  new group
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### rangeIncl

public Group rangeIncl(int[][] ranges) throws MPIException
Create a subset group including processes specified by strided intervals of ranks.

Java binding of the MPI operation `MPI_GROUP_RANGE_INCL`.

The triplets are of the form (first rank, last rank, stride) indicating ranks in this group to be included in the new group. The size of the first dimension of `ranges` is the number of triplets. The size of the second dimension is 3.

Parameters:
  `ranges` - array of integer triplets
Returns:
  new group
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.

### rangeExcl

public Group rangeExcl(int[][] ranges) throws MPIException
Create a subset group excluding processes specified by strided intervals of ranks.

Java binding of the MPI operation `MPI_GROUP_RANGE_EXCL`.

Triplet array is defined as for `rangeIncl`, the ranges indicating ranks in this group to be excluded from the new group.

Parameters:
  `ranges` - array of integer triplets
Returns:
  new group
Throws:
  `MPIException` - Signals that an MPI error of some sort has occurred.