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
Tom Harke
pystencils
Commits
bee3bfdf
Commit
bee3bfdf
authored
Jul 26, 2017
by
Martin Bauer
Browse files
pystencils: easy access to center
parent
747f1851
Changes
2
Hide whitespace changes
Inline
Side-by-side
field.py
View file @
bee3bfdf
...
...
@@ -204,6 +204,10 @@ class Field(object):
offsetList
[
coordId
]
=
offset
return
Field
.
Access
(
self
,
tuple
(
offsetList
))
def
center
(
self
):
center
=
tuple
([
0
]
*
self
.
spatialDimensions
)
return
Field
.
Access
(
self
,
center
)
def
__getitem__
(
self
,
offset
):
if
type
(
offset
)
is
np
.
ndarray
:
offset
=
tuple
(
offset
)
...
...
transformations.py
View file @
bee3bfdf
...
...
@@ -540,7 +540,8 @@ def getOptimalLoopOrdering(fields):
layouts
=
set
([
field
.
layout
for
field
in
fields
])
if
len
(
layouts
)
>
1
:
raise
ValueError
(
"Due to different layout of the fields no optimal loop ordering exists "
+
str
(
layouts
))
raise
ValueError
(
"Due to different layout of the fields no optimal loop ordering exists "
+
str
({
f
.
name
:
f
.
layout
for
f
in
fields
}))
layout
=
list
(
layouts
)[
0
]
return
list
(
layout
)
...
...
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