Commit 8788b468 authored by Martin Bauer's avatar Martin Bauer
Browse files

Refactored pyphasefield -> pygrandchem

parent 07a3f195
......@@ -29,7 +29,7 @@ def sympy_cse(ac: AssignmentCollection) -> AssignmentCollection:
def sympy_cse_on_assignment_list(assignments: List[Assignment]) -> List[Assignment]:
"""Extracts common subexpressions from a list of assignments."""
ec = AssignmentCollection(assignments, [])
ec = AssignmentCollection([], assignments)
return sympy_cse(ec).all_assignments
......
......@@ -13,7 +13,7 @@ from pystencils.astnodes import Node, ResolvedFieldAccess, SympyAssignment
from pystencils.data_types import create_type, PointerType, get_type_of_expression, VectorType, cast_func
from pystencils.backends.simd_instruction_sets import selectedInstructionSet
__all__ = ['generate_c', 'CustomCppCode', 'get_headers']
__all__ = ['generate_c', 'CustomCppCode', 'PrintNode', 'get_headers']
def generate_c(ast_node: Node, signature_only: bool = False, use_float_constants: Optional[bool] = None) -> str:
......
import sys
from PyQt5.QtWidgets import QWidget, QApplication, QTreeWidget, QTreeWidgetItem, QHBoxLayout
from pystencils.astnodes import Block, LoopOverCoordinate, KernelFunction
def debug_gui(ast):
app = QApplication.instance()
if app is None:
app = QApplication(sys.argv)
else:
print('QApplication instance already exists: %s' % str(app))
ex = DebugTree()
ex.insert_ast(ast)
app.exec_()
class DebugTree(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.tree = QTreeWidget(self)
self.tree.setColumnCount(1)
self.tree.setHeaderLabel('repr')
hbox = QHBoxLayout()
hbox.stretch(1)
hbox.addWidget(self.tree)
self.setWindowTitle('Debug')
self.setLayout(hbox)
self.show()
def insert_ast(self, node, parent=None):
if parent is None:
parent = self.tree
if isinstance(node, Block): # Blocks are represented with the tree structure
item = parent
else:
item = QTreeWidgetItem(parent)
item.setText(0, repr(node))
if node.func in [LoopOverCoordinate, KernelFunction]:
self.tree.expandItem(item)
for child in node.args:
self.insert_ast(child, item)
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