The scheme for distributed array creation with an on clause is given in Figure A.24.
If the expression is a range
the macro DEFINE_DIMENSION is defined as follows:
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 (see section A.4.21).