@@ -58,6 +58,7 @@ class Object:
5858 :arg user_defined: user defined data dict, defaults to None
5959 :arg subphases: list of subphases, defaults to None
6060 :arg collection_id: collection id (required for migratable objects)
61+ :arg index: the n-dimensional index for an object that belongs to a collection
6162 """
6263
6364 def __init__ (
@@ -70,7 +71,8 @@ def __init__(
7071 comm : Optional [ObjectCommunicator ]= None ,
7172 user_defined : dict = None ,
7273 subphases : list = None ,
73- collection_id : Optional [int ] = None ):
74+ collection_id : Optional [int ] = None ,
75+ index : Optional [list ] = None ):
7476
7577 # Check that id is provided as defined in LBDatafile schema
7678 if packed_id is None and seq_id is None :
@@ -151,6 +153,9 @@ def __init__(
151153 else :
152154 raise TypeError (f"subphases: { subphases } is of type { type (subphases )} but must be <class 'list'>" )
153155
156+ if index is not None :
157+ self .__index = index
158+
154159 def __repr__ (self ):
155160 return f"Object id: { self .get_id ()} , load: { self .__load } "
156161
@@ -174,6 +179,14 @@ def set_collection_id(self, collection_id: Optional[int]):
174179 """ Set object collection ID (required for migratable objects)."""
175180 self .__collection_id = collection_id
176181
182+ def get_index (self ) -> Optional [list ]:
183+ """Return the object's index."""
184+ return self .__index
185+
186+ def set_index (self , index : Optional [list ]):
187+ """Set an object's index."""
188+ self .__index = index
189+
177190 def set_load (self , load : float ):
178191 """ Set object load."""
179192 self .__load = load
0 commit comments