The Datatype class listed partly as following.
Datatype.java
package MPI ;
public class Datatype {
public Datatype() { handle = type = 0;}
public Datatype(byte[] data) { SetupByte(data);}
public Datatype(char[] data) { SetupChar(data);}
...
private native void SetupByte(byte[] data);
private native void SetupChar(char[] data);
...
private long handle, type;
private int size;
}
There are constructors for each java datatype array. In each
constructor, it will invoke a native method with different identifier
that store the memory address into 64 bits handle variable, store the
corresponding MPI_Datatype object (eg. MPI_CHAR,
MPI_SHORT, ...) into 64 bits type variable, and the
buffer size into size variable.
The original MPI call in C/C++
MPI_Send(void*, int size, MPI_Datatype, int dest, int tag, MPI_Comm);would become much simpler in Java
MPI.Comm.Send(MPI.Datatype, int dest, int tag);