Skip to content

Commit

Permalink
assemble: introduce BaseFormAssembler
Browse files Browse the repository at this point in the history
assemble_base_form -> BaseFormAssembler().assemble
  • Loading branch information
ksagiyam committed Feb 28, 2024
1 parent a498a62 commit 353ca0f
Show file tree
Hide file tree
Showing 3 changed files with 498 additions and 506 deletions.
4 changes: 2 additions & 2 deletions firedrake/adjoint_utils/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def wrapper(form, *args, **kwargs):
ad_block_tag = kwargs.pop("ad_block_tag", None)
annotate = annotate_tape(kwargs)
with stop_annotating():
from firedrake.assemble import preprocess_base_form
from firedrake.assemble import BaseFormAssembler
from firedrake.slate import slate
if not isinstance(form, slate.TensorBase):
# Preprocess the form at the annotation stage so that the `AssembleBlock`
Expand All @@ -25,7 +25,7 @@ def wrapper(form, *args, **kwargs):
# -> `interp = Action(Interpolate(v1, v0), f)` with `v1` and `v0` being respectively `Argument`
# and `Coargument`. Differentiating `interp` is not currently supported as the action's left slot
# is a 2-form. However, after preprocessing, we obtain `Interpolate(f, v0)`, which can be differentiated.
form = preprocess_base_form(form)
form = BaseFormAssembler.preprocess_base_form(form)
kwargs['is_base_form_preprocessed'] = True
output = assemble(form, *args, **kwargs)

Expand Down
Loading

0 comments on commit 353ca0f

Please sign in to comment.