Skip to content

Commit c65c28a

Browse files
committed
compiler: Patch premature evaluation of saved TimeFunctions
1 parent c189f61 commit c65c28a

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

devito/types/dense.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,15 +1593,6 @@ def _time_buffering(self):
15931593
def _time_buffering_default(self):
15941594
return self._time_buffering and not isinstance(self.save, Buffer)
15951595

1596-
def _evaluate(self, **kwargs):
1597-
retval = super()._evaluate(**kwargs)
1598-
if not self._time_buffering and not retval.is_Function:
1599-
# Saved TimeFunction might need streaming, expand interpolations
1600-
# for easier processing
1601-
return retval.evaluate
1602-
else:
1603-
return retval
1604-
16051596
def _arg_check(self, args, intervals, **kwargs):
16061597
super()._arg_check(args, intervals, **kwargs)
16071598

tests/test_derivatives.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
import pytest
33
from sympy import Float, Symbol, diff, simplify, sympify
44

5+
from conftest import assert_structure
56
from devito import (
67
NODE, ConditionalDimension, Eq, Function, Grid, Operator, TensorFunction,
7-
TimeFunction, VectorFunction, centered, cos, curl, div, grad, laplace, left, right,
8-
sin
8+
TensorTimeFunction, TimeFunction, VectorFunction, centered, cos, curl, div,
9+
grad, laplace, left, right, sin
910
)
1011
from devito.finite_differences import Derivative, Differentiable, diffify
1112
from devito.finite_differences.differentiable import (
@@ -927,6 +928,17 @@ def test_param_stagg_add(self):
927928
# Addition should apply the same logic as above for each term
928929
assert simplify(eq2.evaluate.rhs - (expect1 + expect0)) == 0
929930

931+
def test_unexpand_space_interp_w_saved_timefunc(self):
932+
grid = Grid(shape=(3, 3, 3))
933+
934+
tau = TensorTimeFunction(name="tau", grid=grid, save=10)
935+
936+
eq = Eq(tau[0,1], tau[2,2])
937+
938+
op = Operator(eq, opt=('advanced', {'expand': False}))
939+
940+
assert_structure(op, ['t,x,y,z', 't,x,y,z,i1', 't,x,y,z,i1,i0'])
941+
930942

931943
class TestTwoStageEvaluation:
932944

0 commit comments

Comments
 (0)