Contiguous

The simplest datatype constructor is MPI_TYPE_CONTIGUOUS which allows replication of a datatype into contiguous locations.



MPI_TYPE_CONTIGUOUS(count, oldtype, newtype)

IN
count replication count (nonnegative integer)
IN
oldtype old datatype (handle)
OUT
newtype new datatype (handle)

int MPI_Type_contiguous(int count, MPI_Datatype oldtype, MPI_Datatype *newtype)



MPI_TYPE_CONTIGUOUS(COUNT, OLDTYPE, NEWTYPE, IERROR)
INTEGER COUNT, OLDTYPE, NEWTYPE, IERROR



newtype is the datatype obtained by concatenating count copies of oldtype. Concatenation is defined using extent as the size of the concatenated copies.

Example 3..20   Let oldtype have type map \(
\{ ({\sf double}, 0), ({\sf char}, 8) \} ,
\) with extent 16, and let ${\sf count} = 3$. The type map of the datatype returned by newtype is

\begin{displaymath}
\{ ({\sf double}, 0), ({\sf char}, 8), ({\sf double}, 16), ({\sf
char}, 24), ({\sf double}, 32), ({\sf char}, 40) \} ;
\end{displaymath}

i.e., alternating double and char elements, with displacements $0, 8, 16, 24, 32, 40$.




In general, assume that the type map of oldtype is

\begin{displaymath}
\{ (type_0,disp_0), ..., (type_{n-1}, disp_{n-1}) \} ,
\end{displaymath}

with extent $ex$. Then newtype has a type map with $\sf count \cdot n$ entries defined by:

\begin{displaymath}
\{ (type_0, disp_0), ..., (type_{n-1}, disp_{n-1}), (type_0, disp_0
+ex), ... ,(type_{n-1}, disp_{n-1} + ex) ,
\end{displaymath}


\begin{displaymath}
...,(type_0, disp_0 +ex \cdot({\sf count}-1) ), ... ,
(type_{n-1} , disp_{n-1} + ex \cdot ({\sf count}-1)) \} .
\end{displaymath}




MPI-Standard for MARMOT