Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonas Plewinski
pystencils
Commits
fe94402a
Commit
fe94402a
authored
Sep 27, 2019
by
Stephan Seitz
Browse files
Bugfix: count field as accessed even if through InterpolatorAccess instead of ResolvedFieldAccess
parent
0ff425f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils/astnodes.py
View file @
fe94402a
...
...
@@ -211,17 +211,18 @@ class KernelFunction(Node):
return
self
.
_body
,
@
property
def
fields_accessed
(
self
)
->
Set
[
'ResolvedFieldAccess'
]:
def
fields_accessed
(
self
)
->
Set
[
Field
]:
"""Set of Field instances: fields which are accessed inside this kernel function"""
return
set
(
o
.
field
for
o
in
self
.
atoms
(
ResolvedFieldAccess
))
from
pystencils.interpolation_astnodes
import
InterpolatorAccess
return
set
(
o
.
field
for
o
in
itertools
.
chain
(
self
.
atoms
(
ResolvedFieldAccess
),
self
.
atoms
(
InterpolatorAccess
)))
@
property
def
fields_written
(
self
)
->
Set
[
'ResolvedFieldAccess'
]:
def
fields_written
(
self
)
->
Set
[
Field
]:
assignments
=
self
.
atoms
(
SympyAssignment
)
return
{
a
.
lhs
.
field
for
a
in
assignments
if
isinstance
(
a
.
lhs
,
ResolvedFieldAccess
)}
@
property
def
fields_read
(
self
)
->
Set
[
'ResolvedFieldAccess'
]:
def
fields_read
(
self
)
->
Set
[
Field
]:
assignments
=
self
.
atoms
(
SympyAssignment
)
return
set
().
union
(
itertools
.
chain
.
from_iterable
([
f
.
field
for
f
in
a
.
rhs
.
free_symbols
if
hasattr
(
f
,
'field'
)]
for
a
in
assignments
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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