Skip to content

Commit d194b04

Browse files
committed
misc: Tidy up properties
1 parent 2461ef1 commit d194b04

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

devito/operator/operator.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,11 @@ def _op_symbols(self):
13441344
"""Symbols in the Operator which may or may not carry data"""
13451345
return FindSymbols().visit(self.op)
13461346

1347+
@cached_property
1348+
def _op_functions(self):
1349+
"""Function symbols in the Operator"""
1350+
return [i for i in self._op_symbols if i.is_DiscreteFunction and not i.alias]
1351+
13471352
def _apply_override(self, i):
13481353
try:
13491354
return self.get(i.name, i)._obj
@@ -1431,10 +1436,7 @@ def nbytes_consumed_functions(self):
14311436
host = 0
14321437
device = 0
14331438
# Filter out arrays, aliases and non-AbstractFunction objects
1434-
op_symbols = [i for i in self._op_symbols if i.is_AbstractFunction
1435-
and not i.is_ArrayBasic and not i.alias]
1436-
1437-
for i in op_symbols:
1439+
for i in self._op_functions:
14381440
v = self._get_nbytes(i)
14391441
if i._mem_host or i._mem_mapped:
14401442
# No need to add to device , as it will be counted
@@ -1510,13 +1512,10 @@ def nbytes_consumed_memmapped(self):
15101512
@cached_property
15111513
def nbytes_snapshots(self):
15121514
# Filter to streamed functions
1513-
op_symbols = [i for i in self._op_symbols if i.is_AbstractFunction
1514-
and not i.is_ArrayBasic and not i.alias]
1515-
15161515
disk = 0
1517-
for i in op_symbols:
1516+
for i in self._op_functions:
15181517
try:
1519-
if i._child not in op_symbols:
1518+
if i._child not in self._op_functions:
15201519
# Use only the "innermost" layer to avoid counting snapshots
15211520
# twice
15221521
v = self._apply_override(i)

0 commit comments

Comments
 (0)