Skip to content

Commit

Permalink
Do not split off-diagonal blocks if we only want the diagonal
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Jan 2, 2025
1 parent d82039d commit af53302
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions firedrake/formmanipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,15 @@ def split_form(form, diagonal=False):
args = form.arguments()
shape = tuple(len(a.function_space()) for a in args)
forms = []
arity = len(shape)
if diagonal:
assert len(shape) == 2
assert arity == 2
arity = 1
for idx in numpy.ndindex(shape):
f = splitter.split(form, idx)
if diagonal:
i, j = idx
if i != j:
continue
idx = (i, )
forms.append(SplitForm(indices=idx, form=f))
f = splitter.split(form, idx)
forms.append(SplitForm(indices=idx[:arity], form=f))
return tuple(forms)

0 comments on commit af53302

Please sign in to comment.