Skip to content

Commit e8c1f1b

Browse files
committed
compiler: Avoid specialising for factor=1
1 parent ef5d60a commit e8c1f1b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

devito/types/dimension.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ def __init_finalize__(self, name, parent=None, factor=None, condition=None,
916916
super().__init_finalize__(name, parent)
917917

918918
# Process subsampling factor
919-
if factor is None or factor == 1:
919+
if factor is None:
920920
self._factor = None
921921
elif is_number(factor):
922922
self._factor = int(factor)
@@ -937,16 +937,18 @@ def uses_symbolic_factor(self):
937937
def factor_data(self):
938938
if isinstance(self.factor, Constant):
939939
return self.factor.data
940-
else:
940+
elif self.factor is not None:
941941
return self.factor
942+
else:
943+
return 1
942944

943945
@property
944946
def spacing(self):
945947
return self.factor_data * self.parent.spacing
946948

947949
@property
948950
def factor(self):
949-
return self._factor if self.uses_symbolic_factor else 1
951+
return self._factor
950952

951953
@cached_property
952954
def symbolic_factor(self):

0 commit comments

Comments
 (0)