Skip to content

Commit

Permalink
FunctionMixin _ad_mul and _ad_add use Function operations not Vector …
Browse files Browse the repository at this point in the history
…operations
  • Loading branch information
JHopeCollins committed Oct 25, 2024
1 parent 6ca034f commit 4fd0d63
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions firedrake/adjoint_utils/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,12 @@ def _ad_dim(self):
return self.function_space().dim()

def _ad_imul(self, other):
vec = self.vector()
vec *= other
self *= other
return self

def _ad_iadd(self, other):
vec = self.vector()
ovec = other.vector()
if ovec.dat == vec.dat:
vec *= 2
else:
vec += ovec
self += other
return self

def _ad_function_space(self, mesh):
return self.ufl_function_space()
Expand Down

0 comments on commit 4fd0d63

Please sign in to comment.