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
Sebastian Bindgen
pystencils
Commits
c4096908
Commit
c4096908
authored
Aug 13, 2019
by
Stephan Seitz
Browse files
Print str in CBackend as str
parent
3814a508
Changes
2
Hide whitespace changes
Inline
Side-by-side
pystencils/astnodes.py
View file @
c4096908
...
...
@@ -703,8 +703,7 @@ class DestructuringBindingsForFieldClass(Node):
corresponding_field_names
=
{
s
.
field_name
for
s
in
undefined_field_symbols
if
hasattr
(
s
,
'field_name'
)}
corresponding_field_names
|=
{
s
.
field_names
[
0
]
for
s
in
undefined_field_symbols
if
hasattr
(
s
,
'field_names'
)}
return
{
TypedSymbol
(
f
,
self
.
CLASS_NAME_TEMPLATE
.
format
(
dtype
=
field_map
[
f
].
dtype
,
ndim
=
field_map
[
f
].
ndim
)
+
'&'
)
for
f
in
corresponding_field_names
}
|
\
(
self
.
body
.
undefined_symbols
-
undefined_field_symbols
)
for
f
in
corresponding_field_names
}
|
(
self
.
body
.
undefined_symbols
-
undefined_field_symbols
)
def
subs
(
self
,
subs_dict
)
->
None
:
"""Inplace! substitute, similar to sympy's but modifies the AST inplace."""
...
...
pystencils/backends/cbackend.py
View file @
c4096908
...
...
@@ -168,6 +168,8 @@ class CBackend:
return
result
def
_print
(
self
,
node
):
if
isinstance
(
node
,
str
):
return
node
for
cls
in
type
(
node
).
__mro__
:
method_name
=
"_print_"
+
cls
.
__name__
if
hasattr
(
self
,
method_name
):
...
...
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