The run-time technology introduced in this chapter for translation of distributed loops is used extensively in the implementation of the collective communication library. In that context, blocks of ranges are usually more important than individual elements, so use of the LocBlocksIndex iterator is common.
Besides enumeration of locally held blocks, it is sometimes necessary to enumerate all blocks of a range--local and non-local. For example, a data remapping operation defines a map between the elements of two ranges with different distribution formats. A local block in one range maps to a specific subrange of the other. But in general this subrange does not correspond to a single block of the target range--it may be distributed over several processes, divided into a number of blocks. If the original block of data is to be moved to the target array, it must be split into a corresponding number of data blocks, each sent to the appropriate destination.
All blocks enumeration resembles the local blocks enumeration given in section 7.2, but the loop is started using the beginAllBlk() member of AllBlocksIndex.
AllBlocksIndex i(x) ; ... for(i.beginAllBlk() ; i.test() ; i.nextAllBlk()) { ... }
In each iteration, the crd field inherited from the Location component of i gives the process coordinate of the remote block, while the fields of the Block component define the subscript range. If it is necessary to compute memory offsets in the remote process, this can be done using offset and related members of Map in exactly the same way as for a local block.
There is no guarantee that enumeration of the blocks occurs in an obvious sequential order. It is guaranteed that the subsequence of blocks associated with a single process is enumerated in the same order as for local blocks enumeration using LocBlocksIndex--this guarantee is often exploited to ensure message blocks are sent and received in the same order [need clarification on this point of ordering].