Skip to content

Commit

Permalink
remove deprecated method. (#3398)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
  • Loading branch information
Ig-dolci and pbrubeck authored Feb 16, 2024
1 parent 116ee9b commit 503c736
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions firedrake/adjoint_utils/blocks/assembly.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ufl
import firedrake
from ufl.domain import as_domain
from ufl.formatting.ufl2unicode import ufl2unicode
from pyadjoint import Block, AdjFloat, create_overloaded_object
from firedrake.adjoint_utils.checkpointing import maybe_disk_checkpoint
Expand All @@ -10,8 +11,10 @@ class AssembleBlock(Block):
def __init__(self, form, ad_block_tag=None):
super(AssembleBlock, self).__init__(ad_block_tag=ad_block_tag)
self.form = form
mesh = self.form.ufl_domain() if hasattr(self.form, 'ufl_domain') \
else None
try:
mesh = as_domain(form)
except AttributeError:
mesh = None

if mesh and not isinstance(self.form, ufl.Interpolate):
# Interpolation differentiation wrt spatial coordinates is currently not supported.
Expand Down Expand Up @@ -102,7 +105,7 @@ def evaluate_adj_component(self, inputs, adj_inputs, block_variable, idx,
arity_form = len(extract_arguments(form))

if isconstant(c):
mesh = self.form.ufl_domain()
mesh = as_domain(self.form)
space = c._ad_function_space(mesh)
elif isinstance(c, (firedrake.Function, firedrake.Cofunction)):
space = c.function_space()
Expand Down Expand Up @@ -161,7 +164,7 @@ def evaluate_hessian_component(self, inputs, hessian_inputs, adj_inputs,
c1_rep = block_variable.saved_output

if isconstant(c1):
mesh = form.ufl_domain()
mesh = as_domain(form)
space = c1._ad_function_space(mesh)
elif isinstance(c1, (firedrake.Function, firedrake.Cofunction)):
space = c1.function_space()
Expand Down

0 comments on commit 503c736

Please sign in to comment.