From ab68008f0fa172670466e1baebf988fa24a0b8a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20H=C3=B6nig?= <jan.hoenig@fau.de>
Date: Fri, 12 Jan 2018 13:55:30 +0100
Subject: [PATCH] Updated pystencils demo and tutorial notebooks.

Fixed toDot.

Remove unnecessary comments.
---
 backends/dot.py        |  9 +++++----
 llvm/kernelcreation.py | 40 ++--------------------------------------
 2 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/backends/dot.py b/backends/dot.py
index 85d684d0c..4ed76f511 100644
--- a/backends/dot.py
+++ b/backends/dot.py
@@ -14,10 +14,10 @@ class DotPrinter(Printer):
         self.dot = Digraph(**kwargs)
         self.dot.quote_edge = lang.quote
 
-    def _print_KernelFunction(self, function):
-        self.dot.node(self._nodeToStrFunction(function), style='filled', fillcolor='#a056db', label="Function")
-        self._print(function.body)
-        self.dot.edge(self._nodeToStrFunction(function), self._nodeToStrFunction(function.body))
+    def _print_KernelFunction(self, func):
+        self.dot.node(repr(func), style='filled', fillcolor='#a056db', label=self._nodeToStrFunction(func))
+        self._print(func.body)
+        self.dot.edge(repr(func), self._nodeToStrFunction(func.body))
 
     def _print_LoopOverCoordinate(self, loop):
         self.dot.node(self._nodeToStrFunction(loop), style='filled', fillcolor='#3498db')
@@ -62,6 +62,7 @@ def __shortened(node):
     elif isinstance(node, KernelFunction):
         params = [f.name for f in node.fieldsAccessed]
         params += [p.name for p in node.parameters if not p.isFieldArgument]
+        print(params)
         return "Func: %s (%s)" % (node.functionName, ",".join(params))
     elif isinstance(node, SympyAssignment):
         return repr(node.lhs)
diff --git a/llvm/kernelcreation.py b/llvm/kernelcreation.py
index c90d63cc1..78cd1166a 100644
--- a/llvm/kernelcreation.py
+++ b/llvm/kernelcreation.py
@@ -1,11 +1,7 @@
-import sympy as sp
 from pystencils.astnodes import SympyAssignment, Block, LoopOverCoordinate, KernelFunction
-from pystencils.transformations import resolveFieldAccesses, makeLoopOverDomain, typingFromSympyInspection, \
-    typeAllEquations, getOptimalLoopOrdering, parseBasePointerInfo, moveConstantsBeforeLoop, splitInnerLoop, insertCasts#, \
-    #desympy_ast, insert_casts
+from pystencils.transformations import resolveFieldAccesses, \
+    typeAllEquations, moveConstantsBeforeLoop, insertCasts
 from pystencils.data_types import TypedSymbol, BasicType, StructType
-from pystencils.field import Field
-import pystencils.astnodes as ast
 from functools import partial
 from pystencils.llvm.llvmjit import makePythonFunction
 
@@ -32,38 +28,6 @@ def createKernel(listOfEquations, functionName="kernel", typeForSymbol=None, spl
 
     :return: :class:`pystencils.ast.KernelFunction` node
     """
-    #if not typeForSymbol:
-    #    typeForSymbol = typingFromSympyInspection(listOfEquations, "double")
-    #
-    #def typeSymbol(term):
-    #    if isinstance(term, Field.Access) or isinstance(term, TypedSymbol):
-    #        return term
-    #    elif isinstance(term, sp.Symbol):
-    #        return TypedSymbol(term.name, typeForSymbol[term.name])
-    #    else:
-    #        raise ValueError("Term has to be field access or symbol")
-    #
-    #fieldsRead, fieldsWritten, assignments = typeAllEquations(listOfEquations, typeForSymbol)
-    #allFields = fieldsRead.union(fieldsWritten)
-    #
-    #readOnlyFields = set([f.name for f in fieldsRead - fieldsWritten])
-    #
-    #body = ast.Block(assignments)
-    #loopOrder = getOptimalLoopOrdering(allFields)
-    #code = makeLoopOverDomain(body, functionName, iterationSlice=iterationSlice,
-    #                          ghostLayers=ghostLayers, loopOrder=loopOrder)
-    #
-    #if splitGroups:
-    #    typedSplitGroups = [[typeSymbol(s) for s in splitGroup] for splitGroup in splitGroups]
-    #    splitInnerLoop(code, typedSplitGroups)
-    #
-    #basePointerInfo = []
-    #for i in range(len(loopOrder)):
-    #    basePointerInfo.append(['spatialInner%d' % i])
-    #basePointerInfos = {field.name: parseBasePointerInfo(basePointerInfo, loopOrder, field) for field in allFields}
-    #
-    #resolveFieldAccesses(code, readOnlyFields, fieldToBasePointerInfo=basePointerInfos)
-    #moveConstantsBeforeLoop(code)
     from pystencils.cpu import createKernel
     code = createKernel(listOfEquations, functionName, typeForSymbol, splitGroups, iterationSlice, ghostLayers)
     code = insertCasts(code)
-- 
GitLab