Object id handler for data matrix.
Initialize an id handler.
>>> from simo.matrix.ind2id import Ind2Id
>>> ii = Ind2Id()
>>> ii.ids
defaultdict(<type 'dict'>, {})
Add id for a new object:
>>> ii.add_id(0, 0, 0, 0, ('SIMULATION', 'SIMULATION'))
>>> dict(ii.ids)
{(0, 0): {(0, 0): ('SIMULATION', 'SIMULATION')}}
>>> dict(ii.inds)
{(0, 0): {(0, 'SIMULATION'): 0}}
>>> ii.add_id(0, 0, 1, 0, ('UID000', 'UID000'))
>>> ii.ids[(0, 0)][(1, 0)]
('UID000', 'UID000')
>>> ii.add_id(0, 0, 1, 1, ('UID001', 'UID001'))
>>> ii.ids[(0, 0)][(1, 1)]
('UID001', 'UID001')
>>> ii.add_id(0, 0, 1, 2, ('UID002', 'UID002'))
>>> ii.ids[(0, 0)][(1, 2)]
('UID002', 'UID002')
>>> ii.add_id(0, 0, 2, 0, (None, None), 1, 0)
>>> ii.ids[(0, 0)][(2, 0)]
('UID000-0', 'UID000-0')
>>> ii.add_id(0, 0, 2, 1, (None, None), 1, 1)
>>> ii.ids[(0, 0)][(2, 1)]
('UID001-0', 'UID001-0')
>>> ii.add_id(0, 0, 2, 2, (None, None), 1, 1)
>>> ii.add_id(0, 0, 3, 0, (None, None), 2, 2)
>>> ii.ids[(0, 0)][(3, 0)]
('UID001-1-0', 'UID001-1-0')
>>> ii.inds[(0, 0)][(3, 'UID001-1-0')]
0
>>> ii.inds[(0, 0)][(2, 'UID001-1')]
2
Get object id:
>>> ii.get_id(0, 0, 1, 0)
('UID000', 'UID000')
>>> ii.get_id(0, 0, 1, 1)
('UID001', 'UID001')
>>> ii.get_id(0, 0, 2, 1)
('UID001-0', 'UID001-0')
Get object index:
>>> ii.get_ind(0, 0, 1, 'UID000')
0
>>> ii.remove_id(0, 0, 1, 0)
>>> ii.get_id(0, 0, 1, 0)
>>> ii.get_ind(0, 0, 1, 0)