The Indexed constructor allows one to specify a noncontiguous data layout where displacements between successive blocks need not be equal. This allows one to gather arbitrary entries from an array and send them in one message, or receive one message and scatter the received entries into arbitrary locations in an array.
MPI_TYPE_INDEXED(count, array_of_blocklengths, array_of_displacements, oldtype, newtype) IN count number of blocks IN array_of_blocklengths number of elements per block IN array_of_displacements displacement for each block, measured as number of elements IN oldtype old datatype OUT newtype new datatypeMPI_Type_indexed(int count, int *array_of_blocklengths, int *array_of_displacements, MPI_Datatype oldtype, MPI_Datatype *newtype)
MPI_TYPE_INDEXED(COUNT, ARRAY_OF_BLOCKLENGTHS, ARRAY_OF_DISPLACEMENTS, OLDTYPE, NEWTYPE, IERROR)INTEGER COUNT, ARRAY_OF_BLOCKLENGTHS(*), ARRAY_OF_DISPLACEMENTS(*), OLDTYPE, NEWTYPE, IERROR
MPI_TYPE_INDEXED allows
replication of an old datatype into a sequence of blocks (each block is
a concatenation of the old datatype), where
each block can contain a different number of copies of oldtype
and have a different
displacement. All block displacements are measured in units of the
oldtype extent.
The action of the Indexed
constructor is represented schematically in
Figure .
Figure: Datatype constructor MPI_TYPE_INDEXED.
and
B[j] = blocklength, j = 0,.......,count - 1 The use of the MPI_TYPE_INDEXED function was illustrated in Example 3.1 on page 102; the function was used to transfer the upper triangular pert of a square matrix.The use of the MPI_TYPE_INDEXED function was illustrated in Example