enthought/distarray — pull request #83 by bgrant (2013-12-17 18:19:40+00:00)
Title: Generalize Maps

At long last, add support for the rest of the Distributed Array Protocol map types. This required some significant surgery.

1) Significantly alter `maps.py`. Maps now consist only of a `global_index` list and a `local_index` dict. From the docstring:
```python
"""
Attributes
----------
global_index : list of int or range object
Given a local index as a key, return the corresponding global index.
local_index : dict of int -> int
Given a global index as a key, return the corresponding local index.
"""
```

2) Local maps can no longer be expected to know the owner of every possible global index, only the global indices they own. This required removing much of the `owner_*` infrastructure. We may add this back in as an efficiency enhancement on the client.

3) `__getitem__` and `__setitem__` are a bit hacky on the client, but they work. They currently broadcast to all `LocalArray`s. This could be improved by cacheing on the client (or knowledge of specific map types whose global indices are predictably distributed).

4) Lots of tests required fixing, and more should probably be added for the newly supported disttypes. (Some have been added, but not at the client level).

5) Some work was required to have this new scheme work with the simple `__init__` method for `LocalArray`s. This required initializing the underlying dimdata data structure in stages, which is not as architecturally clean as I would like.

Hopefully this clears the way for implementing slicing. Also, due to the renaming in the Distributed Array Protocol, some significant renaming to match is warranted. I haven't done this yet though; I thought I would wait until the names in the protocol stabilized.