Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonas Plewinski
pystencils
Commits
8788b468
Commit
8788b468
authored
Apr 06, 2018
by
Martin Bauer
Browse files
Refactored pyphasefield -> pygrandchem
parent
07a3f195
Changes
3
Hide whitespace changes
Inline
Side-by-side
assignment_collection/simplifications.py
View file @
8788b468
...
...
@@ -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
...
...
backends/cbackend.py
View file @
8788b468
...
...
@@ -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
:
...
...
qtgui.py
deleted
100644 → 0
View file @
07a3f195
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
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment