Helper for enumerating over a given axis.
axis : integer
Which access to enumerate over.
iterator : (local_index, global_index)
An enumerator which returns the local index into the array and the global index it corresponds to.