|
1 | 1 | from itertools import product |
| 2 | +from copy import deepcopy |
2 | 3 |
|
3 | 4 | import numpy as np |
4 | 5 | from sympy import And, Or |
@@ -1896,6 +1897,24 @@ def test_cond_notime(self): |
1896 | 1897 | op(time_m=1, time_M=nt-1, dt=1) |
1897 | 1898 | assert norm(g, order=1) == norm(sum(usaved, dims=time_under), order=1) |
1898 | 1899 |
|
| 1900 | + def test_cond_copy(self): |
| 1901 | + grid = Grid((11, 11, 11)) |
| 1902 | + time = grid.time_dim |
| 1903 | + |
| 1904 | + cd = ConditionalDimension(name='tsub', parent=time, factor=5) |
| 1905 | + u = TimeFunction(name='u', grid=grid, space_order=4, time_order=2, save=Buffer(2)) |
| 1906 | + u1 = TimeFunction(name='u1', grid=grid, space_order=0, |
| 1907 | + time_order=0, save=5, time_dim=cd) |
| 1908 | + u2 = TimeFunction(name='u2', grid=grid, space_order=0, |
| 1909 | + time_order=0, save=5, time_dim=cd) |
| 1910 | + |
| 1911 | + # Mimic what happens when an operator is copied |
| 1912 | + u12 = deepcopy(u1) |
| 1913 | + u22 = deepcopy(u2) |
| 1914 | + |
| 1915 | + op = Operator([Eq(u.forward, u.laplace), Eq(u12, u), Eq(u22, u)]) |
| 1916 | + assert len([p for p in op.parameters if p.name == 'tsubf']) == 1 |
| 1917 | + |
1899 | 1918 |
|
1900 | 1919 | class TestCustomDimension: |
1901 | 1920 |
|
|
0 commit comments