File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,18 +153,21 @@ def bind(self, pname):
153153 @property
154154 def linear_index (self ):
155155 """
156- TODO: Add tests
156+ TODO: add tests and documentation, explain why needed etc
157157 """
158158 f = self .function
159159 strides_map = self .strides_map
160- indices = self .indices
161-
162- items = [
163- idx * strides_map [d ]
164- for idx , d in zip (indices , f .dimensions [1 :])
165- ]
166- items .append (indices [- 1 ])
167-
160+ # Filter out time dimensions to get (dim, index) pairs
161+ spatial = [(d , idx ) for d , idx in zip (f .dimensions , self .indices )
162+ if not d .is_Time ]
163+ items = [idx * strides_map [spatial [i + 1 ][0 ]]
164+ for i , (d , idx ) in enumerate (spatial [:- 1 ])]
165+ items .append (spatial [- 1 ][1 ])
166+ # items = [
167+ # idx * strides_map[d]
168+ # for idx, d in zip(indices, f.dimensions[1:])
169+ # ]
170+ # items.append(indices[-1])
168171 return sympy .Add (* items , evaluate = False )
169172
170173 func = Pickable ._rebuild
You can’t perform that action at this time.
0 commit comments