Skip to content

Commit

Permalink
api: remove un-necessary extra eqs and temp for gridpoint precomputed
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Apr 15, 2024
1 parent 42cce7e commit 9074deb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions devito/operations/interpolators.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,11 @@ class PrecomputedInterpolator(WeightedInterpolator):
_name = 'precomp'

def _positions(self, implicit_dims):
if self.sfunction.gridpoints is None:
if self.sfunction.gridpoints_data is None:
return super()._positions(implicit_dims)
# No position temp as we have directly the gridpoints
return [Eq(p, floor(k), implicit_dims=implicit_dims)
for (k, p) in self.sfunction._position_map.items()]
else:
# No position temp as we have directly the gridpoints
return []

@property
def interpolation_coeffs(self):
Expand Down
7 changes: 3 additions & 4 deletions devito/types/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1154,11 +1154,10 @@ def _position_map(self):
the position. We mitigate this problem by computing the positions
individually (hence the need for a position map).
"""
if self.gridpoints is not None:
if self.gridpoints_data is not None:
ddim = self.gridpoints.dimensions[-1]
return OrderedDict((self.gridpoints._subs(ddim, di), p)
for (di, p) in zip(range(self.grid.dim),
self._pos_symbols))
return OrderedDict((d, self.gridpoints._subs(ddim, i))
for (i, d) in enumerate(self.grid.dimensions))
else:
return super()._position_map

Expand Down

0 comments on commit 9074deb

Please sign in to comment.