From 0d70a66273134551e0a8a832c58853da62c3fabd Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Fri, 13 Dec 2024 16:59:49 +0000 Subject: [PATCH] suggestion from code review --- firedrake/assemble.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/firedrake/assemble.py b/firedrake/assemble.py index 59ff6b750e..c69173daea 100644 --- a/firedrake/assemble.py +++ b/firedrake/assemble.py @@ -143,8 +143,7 @@ def get_assembler(form, *args, **kwargs): """ is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False) - bcs = kwargs.get('bcs', None) - fc_params = kwargs.get('form_compiler_parameters', None) + fc_params = kwargs.pop('form_compiler_parameters', None) if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed: mat_type = kwargs.get('mat_type', None) # Preprocess the DAG and restructure the DAG @@ -155,8 +154,8 @@ def get_assembler(form, *args, **kwargs): if len(form.arguments()) == 0: return ZeroFormAssembler(form, form_compiler_parameters=fc_params) elif len(form.arguments()) == 1 or diagonal: - return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params, needs_zeroing=kwargs.get('needs_zeroing', True), - zero_bc_nodes=kwargs.get('zero_bc_nodes', True), diagonal=diagonal) + return OneFormAssembler(form, *args, form_compiler_parameters=fc_params, + diagonal=diagonal, **kwargs) elif len(form.arguments()) == 2: return TwoFormAssembler(form, *args, **kwargs) else: @@ -1149,13 +1148,13 @@ class OneFormAssembler(ParloopFormAssembler): @classmethod def _cache_key(cls, form, bcs=None, form_compiler_parameters=None, needs_zeroing=True, - zero_bc_nodes=False, diagonal=False, weight=1.0): + zero_bc_nodes=True, diagonal=False, weight=1.0): bcs = solving._extract_bcs(bcs) - return tuple(bcs), tuplify(form_compiler_parameters), needs_zeroing, zero_bc_nodes, diagonal + return tuple(bcs), tuplify(form_compiler_parameters), needs_zeroing, zero_bc_nodes, diagonal, weight @FormAssembler._skip_if_initialised def __init__(self, form, bcs=None, form_compiler_parameters=None, needs_zeroing=True, - zero_bc_nodes=False, diagonal=False, weight=1.0): + zero_bc_nodes=True, diagonal=False, weight=1.0): super().__init__(form, bcs=bcs, form_compiler_parameters=form_compiler_parameters, needs_zeroing=needs_zeroing) self._weight = weight self._diagonal = diagonal