@@ -154,64 +154,42 @@ def test_timedaccess_cached(self, fc, x, y):
154154
155155 assert ta0 is ta1
156156
157- def test_timedaccess_touched_nodomain (self ):
157+ @pytest .mark .parametrize ('autopadding' , [False , True ])
158+ def test_timedaccess_touched_nodomain (self , autopadding ):
158159 grid = Grid (shape = (17 , 17 ))
159160 x , y = grid .dimensions
160161
161- f = Function (name = 'f' , grid = grid , space_order = 8 )
162+ with switchconfig (autopadding = autopadding ):
163+ f = Function (name = 'f' , grid = grid , space_order = 8 )
162164 hx , hy = f ._size_nodomain .left
163165
164166 k = CustomDimension ('k' , parent = y , symbolic_min = 1 ,
165167 symbolic_max = 4 , symbolic_size = 4 )
166168 k0 = CustomDimension ('k0' , parent = y , symbolic_min = 0 ,
167169 symbolic_max = 4 , symbolic_size = 5 )
168170 yl = SubDimension .left ('yl' , y , thickness = 4 )
169-
170- left = TimedAccess (
171- f .indexed [x + hx , hy - k ], 'W' , 0 ,
172- IterationSpace ([Interval (x ), Interval (k )])
173- )
174- right = TimedAccess (
175- f .indexed [x + hx , hy + y .symbolic_size - 1 + k ], 'W' , 0 ,
176- IterationSpace ([Interval (x ), Interval (k )])
177- )
178-
179- depth = yl - y .symbolic_min + 1
180- left_sub = TimedAccess (
181- f .indexed [x + hx , hy + y .symbolic_min - depth ], 'W' , 0 ,
182- IterationSpace ([Interval (x ), Interval (yl )])
183- )
184- left_constant = TimedAccess (
185- f .indexed [x + hx , hy - 1 ], 'W' , 0 ,
186- IterationSpace ([Interval (x )])
187- )
188-
189- domain = TimedAccess (
190- f .indexed [x + hx , y + hy ], 'W' , 0 ,
191- IterationSpace ([Interval (x ), Interval (y )])
192- )
193- straddling = TimedAccess (
194- f .indexed [x + hx , hy - k0 ], 'W' , 0 ,
195- IterationSpace ([Interval (x ), Interval (k0 )])
196- )
197- nonlinear = TimedAccess (
198- f .indexed [x + hx , hy - k ** 2 ], 'W' , 0 ,
199- IterationSpace ([Interval (x ), Interval (k )])
200- )
201- shifted = TimedAccess (
202- f .indexed [x + hx , hy - k ], 'W' , 0 ,
203- IterationSpace ([Interval (x ), Interval (k , - 1 , 0 )])
204- )
205-
206- assert left .touched_nodomain (y ) == (True , False )
207- assert right .touched_nodomain (y ) == (False , True )
208- assert left_sub .touched_nodomain (y ) == (True , False )
209- assert left_constant .touched_nodomain (y ) == (True , False )
210-
211- assert domain .touched_nodomain (y ) == (False , False )
212- assert straddling .touched_nodomain (y ) == (False , False )
213- assert nonlinear .touched_nodomain (y ) == (False , False )
214- assert shifted .touched_nodomain (y ) == (False , False )
171+ yr = SubDimension .right ('yr' , y , thickness = 4 )
172+ a = Scalar (name = 'a' , is_const = True )
173+
174+ for index , interval , expected in [
175+ (- k , Interval (k ), (True , False )),
176+ (y .symbolic_size - 1 + k , Interval (k ), (False , True )),
177+ (2 * y .symbolic_min - yl - 1 , Interval (yl ), (True , False )),
178+ (2 * y .symbolic_max - yr + 1 , Interval (yr ), (False , True )),
179+ (S .NegativeOne , None , (True , False )),
180+ (y .symbolic_size , None , (False , True )),
181+ (y , Interval (y ), (False , False )),
182+ (- k0 , Interval (k0 ), (False , False )),
183+ (- k ** 2 , Interval (k ), (False , False )),
184+ (- k , Interval (k , - 1 , 0 ), (False , False )),
185+ (- k , None , (False , False )),
186+ (a * k , Interval (k ), (False , False )),
187+ (y .symbolic_min ** 2 - k , Interval (k ), (False , False )),
188+ ]:
189+ intervals = [Interval (x )] + ([interval ] if interval is not None else [])
190+ access = TimedAccess (f .indexed [x + hx , hy + index ], 'W' , 0 ,
191+ IterationSpace (intervals ))
192+ assert access .touched_nodomain (y ) == expected
215193
216194 def test_iteration_instance_arithmetic (self , x , y , ii_num , ii_literal ):
217195 """
0 commit comments