Skip to content

Commit

Permalink
compiler: Polish code
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioLuporini committed Jul 3, 2024
1 parent afe0719 commit efa27df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion devito/symbolics/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def pow_to_mul(expr):
# E.g., a Symbol, or possibly a generic expression
return expr
if exp > 10 or exp < -10 or exp == 0:
# Large and non-integer powers remain untouched
# Large powers remain untouched
return expr
elif exp == -1 or int(exp) != exp:
# Reciprocals and fractional powers also remain untouched,
Expand Down
5 changes: 2 additions & 3 deletions devito/types/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,10 +1017,9 @@ def __padding_setup_smart__(self, **kwargs):
return nopadding

# The padded Dimension
candidates = self.space_dimensions
if not candidates:
if not self.space_dimensions:
return nopadding
d = candidates[-1]
d = self.space_dimensions[-1]

mmts = configuration['platform'].max_mem_trans_size(self.__padding_dtype__)
remainder = self._size_nopad[d] % mmts
Expand Down
4 changes: 4 additions & 0 deletions tests/test_dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ def test_modulo_dims_generation_v2(self):
assert np.all(f.data[4] == 4)

def test_degenerate_to_zero(self):
"""
Check that if `save=Buffer(1)` is used, then the TimeFunction doesn't
need any ModuloDimension for indexing.
"""
grid = Grid(shape=(10, 10))

u = TimeFunction(name='u', grid=grid, save=Buffer(1))
Expand Down

0 comments on commit efa27df

Please sign in to comment.