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
d59f8644
Commit
d59f8644
authored
Feb 05, 2020
by
Stephan Seitz
Browse files
Implement __hash__ for SympyAssignment
parent
2b6ae723
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils/astnodes.py
View file @
d59f8644
...
...
@@ -538,7 +538,7 @@ class LoopOverCoordinate(Node):
class
SympyAssignment
(
Node
):
def
__init__
(
self
,
lhs_symbol
,
rhs_expr
,
is_const
=
True
,
use_auto
=
False
):
super
(
SympyAssignment
,
self
).
__init__
(
parent
=
None
)
self
.
_lhs_symbol
=
lhs_symbol
self
.
_lhs_symbol
=
sp
.
sympify
(
lhs_symbol
)
self
.
rhs
=
sp
.
sympify
(
rhs_expr
)
self
.
_is_const
=
is_const
self
.
_is_declaration
=
self
.
__is_declaration
()
...
...
@@ -621,6 +621,12 @@ class SympyAssignment(Node):
printed_rhs
=
sp
.
latex
(
self
.
rhs
)
return
"${printed_lhs}
\\
leftarrow {printed_rhs}$"
.
format
(
printed_lhs
=
printed_lhs
,
printed_rhs
=
printed_rhs
)
def
__hash__
(
self
):
return
hash
((
self
.
lhs
,
self
.
rhs
))
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
and
(
self
.
lhs
,
self
.
rhs
)
==
(
other
.
lhs
,
other
.
rhs
)
class
ResolvedFieldAccess
(
sp
.
Indexed
):
def
__new__
(
cls
,
base
,
linearized_index
,
field
,
offsets
,
idx_coordinate_values
):
...
...
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