From 63de9997e4ac27ff4cf503b6029a3e19566cdd3b Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Thu, 15 Aug 2019 17:40:00 +0200
Subject: [PATCH] Add KernelFunction.fields_written

---
 pystencils/astnodes.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pystencils/astnodes.py b/pystencils/astnodes.py
index 38bb988..461ced2 100644
--- a/pystencils/astnodes.py
+++ b/pystencils/astnodes.py
@@ -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.
 
-- 
GitLab