Skip to content

Commit 1abb29f

Browse files
committed
dsl: Tweaks to Border
1 parent 6a68d61 commit 1abb29f

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

devito/types/grid.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,21 @@ class Border(SubDomainSet):
985985
[1, 1, 0, 0, 0, 1, 1],
986986
[1, 1, 0, 0, 0, 1, 1]], dtype=int32)
987987
988+
which is equivalent to:
989+
990+
>>> border4 = Border(grid, 2, dims={y: y})
991+
>>> i = Function(name='i', grid=grid, dtype=np.int32)
992+
>>> eq4 = Eq(i, i+1, subdomain=border4)
993+
>>> summary = Operator(eq4)()
994+
>>> i.data
995+
Data([[1, 1, 0, 0, 0, 1, 1],
996+
[1, 1, 0, 0, 0, 1, 1],
997+
[1, 1, 0, 0, 0, 1, 1],
998+
[1, 1, 0, 0, 0, 1, 1],
999+
[1, 1, 0, 0, 0, 1, 1],
1000+
[1, 1, 0, 0, 0, 1, 1],
1001+
[1, 1, 0, 0, 0, 1, 1]], dtype=int32)
1002+
9881003
"""
9891004

9901005
DimSpec = None | dict[Dimension, Dimension | str]

tests/test_subdomains.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -737,11 +737,8 @@ def test_border_3d(self):
737737

738738
Operator(Eq(f, f+1, subdomain=border))()
739739

740-
check = np.array([
741-
[[1, 1, 1], [1, 1, 1], [1, 1, 1]],
742-
[[1, 1, 1], [1, 0, 1], [1, 1, 1]],
743-
[[1, 1, 1], [1, 1, 1], [1, 1, 1]]
744-
])
740+
check = np.ones((3, 3, 3))
741+
check[1, 1, 1] = 0
745742

746743
assert np.all(f.data == check)
747744

0 commit comments

Comments
 (0)