Figure 4.10 represents a schema for translating
the most general form of distributed array creation with an on
clause. The pre-translator makes sure that multiarray creation only
appears on the right-hand-side of a top-level assignment.
If the expression is a range
the macro DEFINE_DIMENSION is defined as follows:
As each dimension is processed,
the memory stride for the next dimension is computed by multiplying the
variable by the number of locally held range elements in the current
dimension. The variable is incremented to allow space for lower
ghost regions, below the base of the physical array, if this is required
for the ranges involved.
If the expression is an integer then
is evaluated the same as
in the previous
subsection.
The call to checkContained() throws a
GroupNotContainedException
runtime exception if is not contained in the current APG.
The variable is also introduced for run-time checking of correct usage.
The calls to remove() will throw a DimensionNotInGroupException
runtime exception if any range specified for the array is not distributed
over a dimension in , or if any two specified ranges are distributed
over the same dimension.
The method arrayDim() on the Range class creates an instance
of ArrayDim, with the memory stride specified in its argument. It is
used in place of a call to the ArrayDim constructor because
arrayDim() has the property that if the range is actually a collapsed
range, the returned object will be an instance of the
SeqArrayDim subclass. This allows a new array created with a collapsed
range to be cast to an array with a sequential dimension, should it
prove necessary at a later stage.