Skip to content

Commit c9794be

Browse files
committed
In-place assignment
1 parent 369db0b commit c9794be

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

firedrake/adjoint_utils/constant.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ def _ad_assign_numpy(dst, src, offset):
104104
def _ad_to_list(m):
105105
return m.dat.data_ro.reshape(-1).tolist()
106106

107+
def _ad_assign(self, other):
108+
self.assign(other)
109+
107110
def _ad_copy(self):
108111
return self._constant_from_values()
109112

firedrake/adjoint_utils/function.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ def _ad_to_list(m):
352352

353353
return m_a.tolist()
354354

355+
def _ad_assign(self, other):
356+
self.assign(other)
357+
355358
def _ad_copy(self):
356359
from firedrake import Function
357360

0 commit comments

Comments
 (0)