From 2a0c03b244ef9f641fe959d026225d49dd007a14 Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Mon, 6 Jan 2025 17:35:03 -0600 Subject: [PATCH] style --- firedrake/bcs.py | 2 +- firedrake/formmanipulation.py | 2 +- tests/firedrake/equation_bcs/test_equation_bcs.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/firedrake/bcs.py b/firedrake/bcs.py index 7c6821b3e3..5884907feb 100644 --- a/firedrake/bcs.py +++ b/firedrake/bcs.py @@ -635,7 +635,7 @@ def reconstruct(self, field=None, V=None, subu=None, u=None, row_field=None, col rank = len(self.f.arguments()) splitter = ExtractSubBlock() form = splitter.split(self.f, argument_indices=(row_field, col_field)[:rank]) - if form == 0: + if isinstance(form, ufl.ZeroBaseForm) or form.empty(): # form is empty, do nothing return if u is not None: diff --git a/firedrake/formmanipulation.py b/firedrake/formmanipulation.py index 5e92bd8e8a..97f2b3c43e 100644 --- a/firedrake/formmanipulation.py +++ b/firedrake/formmanipulation.py @@ -73,8 +73,8 @@ def split(self, form, argument_indices): assert (len(idx) == 1 for idx in self.blocks.values()) assert (idx[0] == 0 for idx in self.blocks.values()) return form - f = map_integrand_dags(self, form) # TODO find a way to distinguish empty Forms avoiding expand_derivatives + f = map_integrand_dags(self, form) if expand_derivatives(f).empty(): # Get ZeroBaseForm with the right shape f = ZeroBaseForm(tuple(Argument(subspace(arg.function_space(), diff --git a/tests/firedrake/equation_bcs/test_equation_bcs.py b/tests/firedrake/equation_bcs/test_equation_bcs.py index 3929eeaddb..fdd05b7f2e 100644 --- a/tests/firedrake/equation_bcs/test_equation_bcs.py +++ b/tests/firedrake/equation_bcs/test_equation_bcs.py @@ -190,7 +190,6 @@ def linear_poisson_mixed(solver_parameters, mesh_num, porder): solve(a == L, w, bcs=[bc2, bc3, bc4], solver_parameters=solver_parameters) - f = cos(2 * pi * x + pi / 3) * cos(2 * pi * y) g = as_vector([-2 * pi * sin(2 * pi * x + pi / 3) * cos(2 * pi * y), -2 * pi * cos(2 * pi * x + pi / 3) * sin(2 * pi * y)])