Class Datatype
- java.lang.Object
-
- mpi.Datatype
-
-
Field Summary
Fields Modifier and Type Field Description protected intbaseSizeprotected intbaseTypeprotected static intBOOLEANprotected static intBYTEprotected static intCHARprotected static intDOUBLEprotected static intDOUBLE_COMPLEXprotected static intDOUBLE_INTprotected static intFLOATprotected static intFLOAT_COMPLEXprotected static intFLOAT_INTprotected longhandleprotected static intINTprotected static intINT2protected static intLONGprotected static intLONG_INTprotected static intNULLprotected static intPACKEDprotected static intSHORTprotected static intSHORT_INT
-
Constructor Summary
Constructors Modifier Constructor Description protectedDatatype()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Datatypeclone()Java binding ofMPI_TYPE_DUP.voidcommit()Commits a derived datatype.static DatatypecreateContiguous(int count, Datatype oldType)Construct new datatype representing replication of old datatype into contiguous locations.static DatatypecreateHIndexed(int[] blockLengths, int[] displacements, Datatype oldType)Identical tocreateIndexedexcept that the displacements are expressed directly in terms of the buffer index, rather than the units of the old type.static DatatypecreateHVector(int count, int blockLength, int stride, Datatype oldType)Identical tocreateVectorexcept that the stride is expressed directly in terms of the buffer index, rather than the units of the old type.static DatatypecreateIndexed(int[] blockLengths, int[] displacements, Datatype oldType)Construct new datatype representing replication of old datatype into a sequence of blocks where each block can contain a different number of copies and have a different displacement.static intcreateKeyval()Create a new attribute key.static DatatypecreateResized(Datatype oldType, int lb, int extent)Create a datatype with a new lower bound and extent from an existing datatype.static DatatypecreateStruct(int[] blockLengths, int[] displacements, Datatype[] types)The most general type constructor.static DatatypecreateVector(int count, int blockLength, int stride, Datatype oldType)Construct new datatype representing replication of old datatype into locations that consist of equally spaced blocks.voiddeleteAttr(int keyval)Deletes an attribute value associated with a key.Datatypedup()Java binding ofMPI_TYPE_DUP.voidfree()Frees the datatype.static voidfreeKeyval(int keyval)Frees an attribute key.java.lang.ObjectgetAttr(int keyval)Retrieves attribute value by key.intgetExtent()Returns the extent of a datatype.intgetLb()Returns the lower bound of a datatype.java.lang.StringgetName()Return the print name from the datatype.protected intgetOffset(java.lang.Object buffer)Gets the offset of a buffer in bytes.intgetSize()Returns the total size of a datatype - the number of buffer elements it represents.intgetTrueExtent()Returns the true extent of a datatype.intgetTrueLb()Returns the true lower bound of a datatype.booleanisNull()Returnstrueif this datatype is MPI_DATATYPE_NULL.voidsetAttr(int keyval, java.lang.Object value)Stores attribute value associated with a key.protected voidsetBasic(int type)protected voidsetBasic(int type, Datatype oldType)voidsetName(java.lang.String name)Sets the print name for the datatype.
-
-
-
Field Detail
-
handle
protected long handle
-
baseType
protected int baseType
-
baseSize
protected int baseSize
-
NULL
protected static final int NULL
- See Also:
- Constant Field Values
-
BYTE
protected static final int BYTE
- See Also:
- Constant Field Values
-
CHAR
protected static final int CHAR
- See Also:
- Constant Field Values
-
SHORT
protected static final int SHORT
- See Also:
- Constant Field Values
-
BOOLEAN
protected static final int BOOLEAN
- See Also:
- Constant Field Values
-
INT
protected static final int INT
- See Also:
- Constant Field Values
-
LONG
protected static final int LONG
- See Also:
- Constant Field Values
-
FLOAT
protected static final int FLOAT
- See Also:
- Constant Field Values
-
DOUBLE
protected static final int DOUBLE
- See Also:
- Constant Field Values
-
PACKED
protected static final int PACKED
- See Also:
- Constant Field Values
-
INT2
protected static final int INT2
- See Also:
- Constant Field Values
-
SHORT_INT
protected static final int SHORT_INT
- See Also:
- Constant Field Values
-
LONG_INT
protected static final int LONG_INT
- See Also:
- Constant Field Values
-
FLOAT_INT
protected static final int FLOAT_INT
- See Also:
- Constant Field Values
-
DOUBLE_INT
protected static final int DOUBLE_INT
- See Also:
- Constant Field Values
-
FLOAT_COMPLEX
protected static final int FLOAT_COMPLEX
- See Also:
- Constant Field Values
-
DOUBLE_COMPLEX
protected static final int DOUBLE_COMPLEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
setBasic
protected void setBasic(int type)
-
setBasic
protected void setBasic(int type, Datatype oldType)
-
getLb
public int getLb() throws MPIExceptionReturns the lower bound of a datatype.Java binding of the MPI operation
MPI_TYPE_GET_EXTENT.- Returns:
- lower bound of datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
getExtent
public int getExtent() throws MPIExceptionReturns the extent of a datatype.Java binding of the MPI operation
MPI_TYPE_GET_EXTENT.- Returns:
- datatype extent
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
getTrueLb
public int getTrueLb() throws MPIExceptionReturns the true lower bound of a datatype.Java binding of the MPI operation
MPI_TYPE_GET_TRUE_EXTENT.- Returns:
- lower bound of datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
getTrueExtent
public int getTrueExtent() throws MPIExceptionReturns the true extent of a datatype.Java binding of the MPI operation
MPI_TYPE_GET_TRUE_EXTENT.- Returns:
- datatype true extent
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
getSize
public int getSize() throws MPIExceptionReturns the total size of a datatype - the number of buffer elements it represents.Java binding of the MPI operation
MPI_TYPE_SIZE.- Returns:
- datatype size
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
commit
public void commit() throws MPIExceptionCommits a derived datatype. Java binding of the MPI operationMPI_TYPE_COMMIT.- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
free
public void free() throws MPIExceptionFrees the datatype.Java binding of the MPI operation
MPI_TYPE_FREE.- Specified by:
freein interfaceFreeable- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
isNull
public boolean isNull()
Returnstrueif this datatype is MPI_DATATYPE_NULL.- Returns:
trueif this datatype is MPI_DATATYPE_NULL
-
clone
public Datatype clone()
Java binding ofMPI_TYPE_DUP.It is recommended to use
dup()instead ofclone()because the last can't throw anMPIException.- Overrides:
clonein classjava.lang.Object- Returns:
- new datatype
-
dup
public Datatype dup() throws MPIException
Java binding ofMPI_TYPE_DUP.- Returns:
- new datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
createContiguous
public static Datatype createContiguous(int count, Datatype oldType) throws MPIException
Construct new datatype representing replication of old datatype into contiguous locations.Java binding of the MPI operation
MPI_TYPE_CONTIGUOUS.The base type of the new datatype is the same as the base type of
oldType.- Parameters:
count- replication countoldType- old datatype- Returns:
- new datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
createVector
public static Datatype createVector(int count, int blockLength, int stride, Datatype oldType) throws MPIException
Construct new datatype representing replication of old datatype into locations that consist of equally spaced blocks.Java binding of the MPI operation
MPI_TYPE_VECTOR.The base type of the new datatype is the same as the base type of
oldType.- Parameters:
count- number of blocksblockLength- number of elements in each blockstride- number of elements between start of each blockoldType- old datatype- Returns:
- new datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
createHVector
public static Datatype createHVector(int count, int blockLength, int stride, Datatype oldType) throws MPIException
Identical tocreateVectorexcept that the stride is expressed directly in terms of the buffer index, rather than the units of the old type.Java binding of the MPI operation
MPI_TYPE_CREATE_HVECTOR.- Parameters:
count- number of blocksblockLength- number of elements in eachstride- number of bytes between start of each blockoldType- old datatype- Returns:
- new datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
createIndexed
public static Datatype createIndexed(int[] blockLengths, int[] displacements, Datatype oldType) throws MPIException
Construct new datatype representing replication of old datatype into a sequence of blocks where each block can contain a different number of copies and have a different displacement.Java binding of the MPI operation
MPI_TYPE_INDEXED.The number of blocks is taken to be size of the
blockLengthsargument. The second argument,displacements, should be the same size. The base type of the new datatype is the same as the base type ofoldType.- Parameters:
blockLengths- number of elements per blockdisplacements- displacement of each block in units of old typeoldType- old datatype- Returns:
- new datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
createHIndexed
public static Datatype createHIndexed(int[] blockLengths, int[] displacements, Datatype oldType) throws MPIException
Identical tocreateIndexedexcept that the displacements are expressed directly in terms of the buffer index, rather than the units of the old type.Java binding of the MPI operation
MPI_TYPE_CREATE_HINDEXED.- Parameters:
blockLengths- number of elements per blockdisplacements- byte displacement in buffer for each blockoldType- old datatype- Returns:
- new datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
createStruct
public static Datatype createStruct(int[] blockLengths, int[] displacements, Datatype[] types) throws MPIException
The most general type constructor.Java binding of the MPI operation
MPI_TYPE_CREATE_STRUCT.The number of blocks is taken to be size of the
blockLengthsargument. The second and third arguments,displacements, andtypes, should be the same size.- Parameters:
blockLengths- number of elements in each blockdisplacements- byte displacement of each blocktypes- type of elements in each block- Returns:
- new datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
createResized
public static Datatype createResized(Datatype oldType, int lb, int extent) throws MPIException
Create a datatype with a new lower bound and extent from an existing datatype.Java binding of the MPI operation
MPI_TYPE_CREATE_RESIZED.- Parameters:
oldType- input datatypelb- new lower bound of datatype (address integer)extent- new extent of datatype (address integer)- Returns:
- new datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
setName
public void setName(java.lang.String name) throws MPIExceptionSets the print name for the datatype.- Parameters:
name- name for the datatype- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
getName
public java.lang.String getName() throws MPIExceptionReturn the print name from the datatype.- Returns:
- name of the datatype
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
createKeyval
public static int createKeyval() throws MPIExceptionCreate a new attribute key.Java binding of the MPI operation
MPI_TYPE_CREATE_KEYVAL.- Returns:
- attribute key for future access
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
freeKeyval
public static void freeKeyval(int keyval) throws MPIExceptionFrees an attribute key.Java binding of the MPI operation
MPI_TYPE_FREE_KEYVAL.- Parameters:
keyval- attribute key- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
setAttr
public void setAttr(int keyval, java.lang.Object value) throws MPIExceptionStores attribute value associated with a key.Java binding of the MPI operation
MPI_TYPE_SET_ATTR.- Parameters:
keyval- attribute keyvalue- attribute value- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
getAttr
public java.lang.Object getAttr(int keyval) throws MPIExceptionRetrieves attribute value by key.Java binding of the MPI operation
MPI_TYPE_GET_ATTR.- Parameters:
keyval- attribute key- Returns:
- attribute value or null if no attribute is associated with the key.
- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
deleteAttr
public void deleteAttr(int keyval) throws MPIExceptionDeletes an attribute value associated with a key.Java binding of the MPI operation
MPI_TYPE_DELETE_ATTR.- Parameters:
keyval- attribute key- Throws:
MPIException- Signals that an MPI exception of some sort has occurred.
-
getOffset
protected int getOffset(java.lang.Object buffer)
Gets the offset of a buffer in bytes.- Parameters:
buffer- buffer- Returns:
- offset in bytes
-
-