Commit 440866e2 authored by Martin Bauer's avatar Martin Bauer
Browse files

Merge branch 'KernelFunction.fields_written' into 'master'

Add KernelFunction.fields_written

See merge request pycodegen/pystencils!33
parents 69f779ea 63de9997
......@@ -212,6 +212,10 @@ class KernelFunction(Node):
"""Set of Field instances: fields which are accessed inside this kernel function"""
return set(o.field for o in self.atoms(ResolvedFieldAccess))
def fields_written(self):
assigments = self.atoms(SympyAssignment)
return {a.lhs.field for a in assigments if isinstance(a.lhs, ResolvedFieldAccess)}
def get_parameters(self) -> Sequence['KernelFunction.Parameter']:
"""Returns list of parameters for this function.
......
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