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
48646a0b
Commit
48646a0b
authored
Sep 24, 2019
by
Stephan Seitz
Browse files
Add spatial_coordinates
parent
0a8c16b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
pystencils/__init__.py
View file @
48646a0b
...
@@ -12,6 +12,8 @@ from .kernelcreation import create_indexed_kernel, create_kernel, create_stagger
...
@@ -12,6 +12,8 @@ from .kernelcreation import create_indexed_kernel, create_kernel, create_stagger
from
.simp
import
AssignmentCollection
from
.simp
import
AssignmentCollection
from
.slicing
import
make_slice
from
.slicing
import
make_slice
from
.sympyextensions
import
SymbolCreator
from
.sympyextensions
import
SymbolCreator
from
.spatial_coordinates
import
(
x_
,
x_staggered
,
x_staggered_vector
,
x_vector
,
y_
,
y_staggered
,
z_
,
z_staggered
)
try
:
try
:
import
pystencils_autodiff
import
pystencils_autodiff
...
@@ -30,5 +32,8 @@ __all__ = ['Field', 'FieldType', 'fields',
...
@@ -30,5 +32,8 @@ __all__ = ['Field', 'FieldType', 'fields',
'SymbolCreator'
,
'SymbolCreator'
,
'create_data_handling'
,
'create_data_handling'
,
'kernel'
,
'kernel'
,
'x_'
,
'y_'
,
'z_'
,
'x_staggered'
,
'y_staggered'
,
'z_staggered'
,
'x_vector'
,
'x_staggered_vector'
,
'fd'
,
'fd'
,
'stencil'
]
'stencil'
]
pystencils/spatial_coordinates.py
0 → 100644
View file @
48646a0b
import
sympy
import
pystencils
import
pystencils.astnodes
x_
,
y_
,
z_
=
tuple
(
pystencils
.
astnodes
.
LoopOverCoordinate
.
get_loop_counter_symbol
(
i
)
for
i
in
range
(
3
))
x_staggered
,
y_staggered
,
z_staggered
=
x_
+
0.5
,
y_
+
0.5
,
z_
+
0.5
def
x_vector
(
ndim
):
return
sympy
.
Matrix
(
tuple
(
pystencils
.
astnodes
.
LoopOverCoordinate
.
get_loop_counter_symbol
(
i
)
for
i
in
range
(
ndim
)))
def
x_staggered_vector
(
ndim
):
return
sympy
.
Matrix
(
tuple
(
pystencils
.
astnodes
.
LoopOverCoordinate
.
get_loop_counter_symbol
(
i
)
+
0.5
for
i
in
range
(
ndim
)
))
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