Commit fe94402a authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Bugfix: count field as accessed even if through InterpolatorAccess instead of ResolvedFieldAccess

parent 0ff425f3
......@@ -211,17 +211,18 @@ class KernelFunction(Node):
return self._body,
def fields_accessed(self) -> Set['ResolvedFieldAccess']:
def fields_accessed(self) -> Set[Field]:
"""Set of Field instances: fields which are accessed inside this kernel function"""
return set(o.field for o in self.atoms(ResolvedFieldAccess))
from pystencils.interpolation_astnodes import InterpolatorAccess
return set(o.field for o in itertools.chain(self.atoms(ResolvedFieldAccess), self.atoms(InterpolatorAccess)))
def fields_written(self) -> Set['ResolvedFieldAccess']:
def fields_written(self) -> Set[Field]:
assignments = self.atoms(SympyAssignment)
return {a.lhs.field for a in assignments if isinstance(a.lhs, ResolvedFieldAccess)}
def fields_read(self) -> Set['ResolvedFieldAccess']:
def fields_read(self) -> Set[Field]:
assignments = self.atoms(SympyAssignment)
return set().union(itertools.chain.from_iterable([f.field for f in a.rhs.free_symbols if hasattr(f, 'field')]
for a in assignments))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment