
\documentstyle{csart}

\begin{document}

\sloppy

\section{The array frame}

\begin{verbatim}
  class Frame {
    int typeLen ;

    ProcessGroup* procGrp ;

    int rank ;
    Range**  rngs ;
    Stride** strs ;

    char* data ;

    // ...
  } ;
\end{verbatim}
\begin{itemize}
\item
\verb$typeLen$ is the length of the array element datum, in bytes.
\item
\verb$procGrp$ is a structure describing the process group over which
the array is distributed---it defines the process array, and any
embeddings in dimensions of that array.
\item
\verb$rank$ is the rank of the array.
\item
\verb$rngs$ is a vector of \verb$rank$ ``range'' structures, describing 
the extent and mapping of the dimensions of the array.
\item
\verb$strs$ is a vector of \verb$rank$ ``stride'' structures, defining
local memory offsets produced by subscripting the dimensions of the array.
\item
\verb$data$ is a base address for (locally held) array data.
\end{itemize}

\section{The range}

\begin{verbatim}
  class Range {

    // Process dimension
    Dimension* dim ;

    // Primitive range characteristics
    int blockSize ;

    // Range parameters
    int base ;
    int stride ;
    int extent ;

    // ...
  } ;
\end{verbatim}
[In practise some of the fields listed above are inheritted from base
classes].
\begin{itemize}
\item
\verb$dim$ describes the process array dimension over which the range
is distributed.  This is \verb$NULL$ for a collapsed range.
\item
\verb$blockSize$ is the block size of the primitive range (template
dimension) to which the range is aligned.
\item
\verb$base$, \verb$stride$ are the parameters
defining the alignment of the range to the primitive range.
\item
\verb$extent$ is the extent of the range.
\end{itemize}

\section{Subscripts and strides}

\begin{verbatim}
  class Subscript {
    int s_v, s_h ;

    //...
  } ;
\end{verbatim}
\verb$s_v$ and \verb$s_h$ are ``template coordinates'', defining which
element of a range is selected.  This element is the one aligned to
locally held block number \verb$s_v$, at position \verb$s_h$ in that
block---the blocks concerned being blocks of the primitive range (or
template dimension).
\begin{verbatim}
  class Stride {
    int norm_h   ;
    int stride_h ;
    int base_v   ;
    int stride_v ;
  public :
    // ...
    int offset(Subscript*) ;
  } ;
\end{verbatim}
[In reality this is the implementation of a subclass of
\verb$Stride$ used to describe ordinary array dimensions; other
sibling classes deal with some special cases].
The implemenation of \verb$offset$ is
\begin{verbatim}
  int Stride :: offset(Subscript* i) {

    // Offset generated by subscript `i'.

    return stride_v * (i->s_v - base_v) + stride_h * (i->s_h / norm_h) ;
  }
\end{verbatim}
A stride is a characterstic of an initial data array.  A general array
is a section of such an array.  Sections acquire stride structures
(unchanged) from corresponding dimensions of their ultimate parent
array (although the section may have a new range structure for that
dimension).

\section{Subscripting operations}

If \verb$i_1$, \verb$i_2$, \ldots are subscripts defining a location on
the local processor, the address of a correponding array element 
in array \verb$a$ is
\begin{verbatim}
  a.data + (a.strs [0])->offset(i_1) +
           (a.strs [1])->offset(i_2) +
           ...
\end{verbatim}

\end{document}

