The general scheme for translating declaration of a field or local variable holding a multiarray reference is illustrated in Figure A.13. The single variable in the source program is converted to variables in the output program, where is the rank of the array.
The macro TRANS_ID transforms the identifier of the field in a way that encodes the dimension signature of the result. This encoding is necessary in order that the HPJava type signature of a field can be reconstructed from the class file of a translated (and compiled) class. Note that the element type of the multiarray field is known from the type of Java array in translated field--this information is automatically encoded in the Java class file.
The values returned by the TRANS_ID macro and the macros TRANS_ID_BAS and TRANS_ID_DIM all start with the the original string, followed by the suffix separator ``__$''. This is followed by a string characteristic of the individual macro, described next.
The characteristic string for TRANS_ID() is a
string of letters, each of which is ``
D'' (for a distributed
dimension) or ``
S'' (for a sequential dimension).
The characteristic string for TRANS_ID_BAS()
The characteristic string for TRANS_ID_DIM(, )
is the decimal representation of the constant integer value .
will hold a reference to the
Java array containing the locally held elements of the multiarray.
This is the value that would be returned by the inquiry
in the source program.
will hold an
instance of the class ArrayBase.
Instances of this class
contain a group object (the value that would be returned by
.grp() in the source program)
and an offset from the start of the Java array, where the first locally held
element of the multiarray is stored (the value that would
be returned by the inquiry
.bas() in the source program).
will hold descriptors for the dimensions of the arrays.
The macro DIMENSION_TYPE is defined as
), respectively, in the source program. These values are stored in the fields range and stride of ArrayDim. The class SeqArrayDim is a subclass of ArrayDim that contains extra information that can be used to simplify the computations associated with subscripting a sequential array dimension.
If, for example, a class in the source program has a field:
The first translation applies for non-HPspmd methods, the second for HPspmd methods.