Skip to content

Commit

Permalink
compiler: Add increment boll to inject method in SparseTimeFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
fffarias committed May 24, 2022
1 parent fb22b58 commit 77aec6c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions devito/types/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ def interpolate(self, expr, offset=0, u_t=None, p_t=None, increment=False):
increment=increment,
self_subs=subs)

def inject(self, field, expr, offset=0, u_t=None, p_t=None):
def inject(self, field, expr, offset=0, u_t=None, p_t=None, increment=True):
"""
Generate equations injecting an arbitrary expression into a field.
Expand All @@ -864,14 +864,16 @@ def inject(self, field, expr, offset=0, u_t=None, p_t=None):
Time index at which the interpolation is performed.
p_t : expr-like, optional
Time index at which the result of the interpolation is stored.
increment: bool, optional
If True, generate increments (Inc) rather than assignments (Eq).
"""
# Apply optional time symbol substitutions to field and expr
if u_t is not None:
field = field.subs({field.time_dim: u_t})
if p_t is not None:
expr = expr.subs({self.time_dim: p_t})

return super(SparseTimeFunction, self).inject(field, expr, offset=offset)
return super(SparseTimeFunction, self).inject(field, expr, offset=offset, increment=increment)

# Pickling support
_pickle_kwargs = AbstractSparseTimeFunction._pickle_kwargs +\
Expand Down

0 comments on commit 77aec6c

Please sign in to comment.