|
6 | 6 |
|
7 | 7 | from conftest import assert_structure, opts_tiling |
8 | 8 | from devito import ( |
9 | | - Border, ConditionalDimension, Constant, Eq, Function, Grid, Lt, Operator, |
| 9 | + Border, Buffer, ConditionalDimension, Constant, Eq, Function, Grid, Lt, Operator, |
10 | 10 | SparseFunction, SparseTimeFunction, SubDomain, SubDomainSet, TensorFunction, |
11 | 11 | TimeFunction, VectorFunction, solve |
12 | 12 | ) |
@@ -228,6 +228,40 @@ def define(self, dimensions): |
228 | 228 | sregistry=SymbolRegistry())[0] |
229 | 229 | assert str(expr.rhs) == 'ix*f[ix + 1, iy + 1] + iy' |
230 | 230 |
|
| 231 | + @pytest.mark.parallel(mode=2) |
| 232 | + def test_halo_subdomain(self, mode): |
| 233 | + """ |
| 234 | + Test halo lowering with temporary dimensions and shifted subdomain access. |
| 235 | + """ |
| 236 | + space_order = 8 |
| 237 | + |
| 238 | + class Interface(SubDomain): |
| 239 | + name = 'interface' |
| 240 | + |
| 241 | + def define(self, dimensions): |
| 242 | + x, y, z = dimensions |
| 243 | + return { |
| 244 | + x: ('middle', 0, 0), |
| 245 | + y: ('middle', 0, 0), |
| 246 | + z: ('middle', space_order//2, 0) |
| 247 | + } |
| 248 | + |
| 249 | + grid = Grid(shape=(9, 9, 9), subdomains=(Interface(),)) |
| 250 | + x, y, z = grid.dimensions |
| 251 | + time = grid.stepping_dim |
| 252 | + u = TimeFunction(name='u', grid=grid, time_order=1, |
| 253 | + space_order=space_order, save=Buffer(1), |
| 254 | + is_transient=False) |
| 255 | + |
| 256 | + equation = Eq(u[time + 1, x, y, z - space_order//2], |
| 257 | + u.dxdy + u.dydz + |
| 258 | + u[time + 1, x, y, z - space_order//2], |
| 259 | + subdomain=grid.subdomains['interface']) |
| 260 | + |
| 261 | + op = Operator([equation]) |
| 262 | + |
| 263 | + assert_structure(op, ['t', 'txyz', 'txyz'], 'txyzyz') |
| 264 | + |
231 | 265 |
|
232 | 266 | class TestMultiSubDomain: |
233 | 267 |
|
|
0 commit comments