|
9 | 9 | ConditionalDimension, switchconfig) |
10 | 10 | from devito.ir.iet.visitors import Specializer |
11 | 11 |
|
12 | | -# Test that specializer replaces symbols as expected |
13 | | - |
14 | | -# Create a couple of arbitrary operators |
15 | | -# Reference bounds, subdomains, spacings, constants, conditionaldimensions with symbolic |
16 | | -# factor |
17 | | -# Create a couple of different substitution sets |
18 | | - |
19 | | -# Check that all the instances in the kernel are replaced |
20 | | -# Check that all the instances in the parameters are removed |
21 | | - |
22 | | -# Check that sanity check catches attempts to specialize non-scalar types |
23 | | -# Check that trying to specialize symbols not in the Operator parameters results |
24 | | -# in an error being thrown |
25 | | - |
26 | | -# Check that sizes and strides get specialized when using `linearize=True` |
27 | | - |
28 | 12 |
|
29 | 13 | class TestSpecializer: |
30 | 14 | """Tests for the Specializer transformer""" |
@@ -240,3 +224,29 @@ def test_basic(self, caplog, override): |
240 | 224 | @pytest.mark.parametrize('override', [False, True]) |
241 | 225 | def test_basic_mpi(self, caplog, mode, override): |
242 | 226 | self.test_basic(caplog, override) |
| 227 | + |
| 228 | + def test_diffusion_like(self): |
| 229 | + grid = Grid(shape=(11, 11)) |
| 230 | + |
| 231 | + dt = 2.5e-5 |
| 232 | + |
| 233 | + f = TimeFunction(name='f', grid=grid, space_order=4) |
| 234 | + f.data[:, 4:-4, 4:-4] = 1 |
| 235 | + |
| 236 | + op = Operator(Eq(f.forward, f - grid.time_dim.spacing*f.laplace)) |
| 237 | + |
| 238 | + op.apply(t_M=100, dt=dt) |
| 239 | + |
| 240 | + check = np.array(f.data[0]) |
| 241 | + f.data[:] = 0 |
| 242 | + f.data[:, 4:-4, 4:-4] = 1 |
| 243 | + |
| 244 | + op.apply(t_M=100, dt=dt, specialize=tuple()) |
| 245 | + |
| 246 | + print(f.data[0]) |
| 247 | + print(check) |
| 248 | + assert False |
| 249 | + |
| 250 | + # Diffusion-like test |
| 251 | + # Acoustic-like test (with and without source injection) |
| 252 | + # Elastic-like test (with and without source injection) |
0 commit comments