Skip to content

Commit 1a9951a

Browse files
committed
api: prevent evaluated derivatives to be re-evaluted
1 parent c31bee8 commit 1a9951a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

devito/finite_differences/differentiable.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,11 @@ def _evaluate(self, **kwargs):
952952
class DiffDerivative(IndexDerivative, DifferentiableOp):
953953
pass
954954

955+
def _eval_at(self, func):
956+
# Like EvalDerivative, a DiffDerivative must have already been evaluated
957+
# at a valid x0 and should not be re-evaluated at a different location
958+
return self
959+
955960

956961
# SymPy args ordering is the same for Derivatives and IndexDerivatives
957962
for i in ('DiffDerivative', 'IndexDerivative'):
@@ -998,6 +1003,11 @@ def _new_rawargs(self, *args, **kwargs):
9981003
kwargs.pop('is_commutative', None)
9991004
return self.func(*args, **kwargs)
10001005

1006+
def _eval_at(self, func):
1007+
# An EvalDerivative must have already been evaluated at a valid x0
1008+
# and should not be re-evaluated at a different location
1009+
return self
1010+
10011011

10021012
class diffify:
10031013

0 commit comments

Comments
 (0)