The Vector type constructor assumes that the stride
between successive blocks is a multiple of the oldtype extent. This
avoids, most of the time, the need for computing stride in bytes.
Sometimes it is useful to relax this assumption and allow a stride which
consists of an arbitrary number of bytes.
The Hvector type constructor below achieves this purpose. The usage of both
Vector and Hvector is illustrated in
Examples -
.
MPI_TYPE_HVECTOR(count, blocklength, stride, oldtype, newtype) IN count number of blocks IN blocklength number of elements in each block IN stride spacing between start of each block, measured as number of elements IN oldtype old datatype OUT newtype new datatype
MPI_Type_hvector(int count, int blocklength, MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype *newtype)
MPI_TYPE_HVECTOR(COUNT, BLOCKLENGTH, STRIDE, OLDTYPE, NEWTYPE, IERROR)INTEGER COUNT, BLOCKLENGTH, STRIDE, OLDTYPE, NEWTYPE, IERROR
MPI_TYPE_HVECTOR is identical to
MPI_TYPE_VECTOR, except that stride is given in bytes,
rather than in elements.
(H stands for ``heterogeneous'').
The action of the Hvector
constructor is represented schematically in
Figure .
Figure: Memory layout of 2D array section for
Example . The shaded blocks are sent.