next up previous contents index
Next: Translating array sections Up: Basic translation Previous: Distributed array creation without   Contents   Index


Translating element access

We only need to consider the case where the array reference is a multiarray. The general scheme is illustrated in Figure A.26. The macro OFFSET is defined as

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it OF...
...-1}\left[{a}\right], e_{R-1}\right)$\end{tabbing}\end{minipage}\end{displaymath}

There are three cases for the macro OFFSET_DIM depending on whether the subscript argument is an integer subscripts (in a sequential dimension), a distributed index, or a shifted index.

If $e_r$ is an integer expression (which implies that $a'_r$ has type SeqArrayDim), then

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it OF...
...f_stp * $${\bf T}\left[{e_r}\right]$\end{tabbing}\end{minipage}\end{displaymath}

The fields off_bas and off_stp are initialized by the constructors for SeqArrayDim. They do not exist in the superclass ArrayDim.

Otherwise, if $e_r$ is a distributed index $i$, then

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it OF...
..._r$\verb$.stride * $$\mbox{\it sub}$\end{tabbing}\end{minipage}\end{displaymath}

where $\mbox{\it sub}$ is the local subscript variable for this index (see sections A.4.6 and A.4.7).

Otherwise, if $e_r$ is a shifted index $i \pm d$, then

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it OF...
... $${\bf T}\left[{d}\right]$\verb$)$
\end{tabbing}\end{minipage}\end{displaymath}

where $\mbox{\it sub}$ is the local subscript variable and $\mbox{\it stp}$ is the shift step variable for $i$ (again, see sections A.4.6 and A.4.7).

Figure A.27: Translation of array section with no scalar subscripts.

SOURCE:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$v$\verb$ = $...
... $\mbox{\it subs}_{R-1}$\verb$]] ;$
\end{tabbing}\end{minipage}\end{displaymath}

TRANSLATION:


\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
$\mbox{\it PR...
...all bas}}\left[{a}\right]$\verb$ ;$
\end{tabbing}\end{minipage}\end{displaymath}

where:

\begin{displaymath}
\begin{array}{l}
\mbox{The expression $v$ is the assigned a...
... {\it PROCESS\_SUBSCRIPTS} is defined in the text.}
\end{array}\end{displaymath}


next up previous contents index
Next: Translating array sections Up: Basic translation Previous: Distributed array creation without   Contents   Index
Bryan Carpenter 2003-04-15