Skip to content

Commit 0b1f4eb

Browse files
committed
compiler: Fix petscsection constrain bcs in 1d
1 parent 27e0d87 commit 0b1f4eb

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

devito/petsc/iet/passes.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,33 @@ def linear_indices(iet, **kwargs):
148148
dtype = np.int64
149149

150150
tracker = Tracker('basic', dtype, kwargs['sregistry'])
151-
candidates = {
152-
i.name for i in FindSymbols('indexeds').visit(iet)
151+
152+
indexeds = [
153+
i for i in FindSymbols('indexeds').visit(iet)
153154
if not isinstance(i.function, LocalType)
154-
}
155+
]
156+
candidates = {i.function.name for i in indexeds}
155157
key = lambda f: f.name in candidates
158+
156159
iet = linearize_accesses(iet, key0=key, tracker=tracker)
157160

158-
findexeds = [i for i in FindSymbols('indexeds').visit(iet) if isinstance(i, FIndexed)]
159-
mapper_findexeds = {i: i.linear_index for i in findexeds}
161+
indexeds = [
162+
i for i in FindSymbols('indexeds').visit(iet)
163+
if i.function.name in candidates
164+
]
165+
mapper_findexeds = {i: linear_index(i) for i in indexeds}
160166

161167
return Uxreplace(mapper_findexeds).visit(iet), {}
162168

163169

170+
def linear_index(i):
171+
if isinstance(i, FIndexed):
172+
return i.linear_index
173+
# 1D case
174+
assert len(i.indices) == 1
175+
return i.indices[0]
176+
177+
164178
@iet_pass
165179
def rebuild_child_user_struct(iet, mapper, **kwargs):
166180
"""

0 commit comments

Comments
 (0)