Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
cc52a9f3
Commit
cc52a9f3
authored
7 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Documentation refactoring [WIP]
parent
30af410a
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
__init__.py
+3
-1
3 additions, 1 deletion
__init__.py
cpu/kernelcreation.py
+1
-2
1 addition, 2 deletions
cpu/kernelcreation.py
jupytersetup.py
+1
-24
1 addition, 24 deletions
jupytersetup.py
plot2d.py
+22
-0
22 additions, 0 deletions
plot2d.py
with
27 additions
and
27 deletions
__init__.py
+
3
−
1
View file @
cc52a9f3
...
@@ -10,6 +10,7 @@ from .assignment import Assignment
...
@@ -10,6 +10,7 @@ from .assignment import Assignment
from
.sympyextensions
import
SymbolCreator
from
.sympyextensions
import
SymbolCreator
from
.datahandling
import
create_data_handling
from
.datahandling
import
create_data_handling
from
.kernel_decorator
import
kernel
from
.kernel_decorator
import
kernel
from
.
import
fd
__all__
=
[
'
Field
'
,
'
FieldType
'
,
'
fields
'
,
__all__
=
[
'
Field
'
,
'
FieldType
'
,
'
fields
'
,
'
TypedSymbol
'
,
'
TypedSymbol
'
,
...
@@ -20,5 +21,6 @@ __all__ = ['Field', 'FieldType', 'fields',
...
@@ -20,5 +21,6 @@ __all__ = ['Field', 'FieldType', 'fields',
'
Assignment
'
,
'
Assignment
'
,
'
SymbolCreator
'
,
'
SymbolCreator
'
,
'
create_data_handling
'
,
'
create_data_handling
'
,
'
kernel
'
]
'
kernel
'
,
'
fd
'
]
This diff is collapsed.
Click to expand it.
cpu/kernelcreation.py
+
1
−
2
View file @
cc52a9f3
...
@@ -17,8 +17,7 @@ AssignmentOrAstNodeList = List[Union[Assignment, ast.Node]]
...
@@ -17,8 +17,7 @@ AssignmentOrAstNodeList = List[Union[Assignment, ast.Node]]
def
create_kernel
(
assignments
:
AssignmentOrAstNodeList
,
function_name
:
str
=
"
kernel
"
,
type_info
=
'
double
'
,
def
create_kernel
(
assignments
:
AssignmentOrAstNodeList
,
function_name
:
str
=
"
kernel
"
,
type_info
=
'
double
'
,
split_groups
=
(),
iteration_slice
=
None
,
ghost_layers
=
None
,
split_groups
=
(),
iteration_slice
=
None
,
ghost_layers
=
None
,
skip_independence_check
=
False
)
->
KernelFunction
:
skip_independence_check
=
False
)
->
KernelFunction
:
"""
"""
Creates an abstract syntax tree for a kernel function, by taking a list of update rules.
Creates an abstract syntax tree for a kernel function, by taking a list of update rules.
Loops are created according to the field accesses in the equations.
Loops are created according to the field accesses in the equations.
...
...
This diff is collapsed.
Click to expand it.
jupytersetup.py
+
1
−
24
View file @
cc52a9f3
...
@@ -5,8 +5,7 @@ from tempfile import NamedTemporaryFile
...
@@ -5,8 +5,7 @@ from tempfile import NamedTemporaryFile
import
base64
import
base64
import
sympy
as
sp
import
sympy
as
sp
__all__
=
[
'
log_progress
'
,
'
make_imshow_animation
'
,
'
make_surface_plot_animation
'
,
__all__
=
[
'
log_progress
'
,
'
make_imshow_animation
'
,
'
display_animation
'
,
'
set_display_mode
'
]
'
display_animation
'
,
'
set_display_mode
'
]
def
log_progress
(
sequence
,
every
=
None
,
size
=
None
,
name
=
'
Items
'
):
def
log_progress
(
sequence
,
every
=
None
,
size
=
None
,
name
=
'
Items
'
):
...
@@ -98,28 +97,6 @@ def make_imshow_animation(grid, grid_update_function, frames=90, **_):
...
@@ -98,28 +97,6 @@ def make_imshow_animation(grid, grid_update_function, frames=90, **_):
return
animation
.
FuncAnimation
(
fig
,
partial
(
update_figure
,
image
=
grid
),
frames
=
frames
)
return
animation
.
FuncAnimation
(
fig
,
partial
(
update_figure
,
image
=
grid
),
frames
=
frames
)
def
make_surface_plot_animation
(
run_function
,
frames
=
90
,
interval
=
30
):
from
mpl_toolkits.mplot3d
import
Axes3D
import
matplotlib.animation
as
animation
import
matplotlib.pyplot
as
plt
from
matplotlib
import
cm
fig
=
plt
.
figure
()
ax
=
fig
.
add_subplot
(
111
,
projection
=
'
3d
'
)
x
,
y
,
data
=
run_function
(
1
)
ax
.
plot_surface
(
x
,
y
,
data
,
rstride
=
2
,
cstride
=
2
,
color
=
'
b
'
,
cmap
=
cm
.
coolwarm
,)
ax
.
set_zlim
(
-
1.0
,
1.0
)
def
update_figure
(
*
_
):
x_grid
,
y_grid
,
d
=
run_function
(
1
)
ax
.
clear
()
plot
=
ax
.
plot_surface
(
x_grid
,
y_grid
,
d
,
rstride
=
2
,
cstride
=
2
,
color
=
'
b
'
,
cmap
=
cm
.
coolwarm
,)
ax
.
set_zlim
(
-
1.0
,
1.0
)
return
plot
,
return
animation
.
FuncAnimation
(
fig
,
update_figure
,
interval
=
interval
,
frames
=
frames
,
blit
=
False
)
# ------- Version 1: Embed the animation as HTML5 video --------- ----------------------------------
# ------- Version 1: Embed the animation as HTML5 video --------- ----------------------------------
def
display_as_html_video
(
animation
,
fps
=
30
,
show
=
True
,
**
_
):
def
display_as_html_video
(
animation
,
fps
=
30
,
show
=
True
,
**
_
):
...
...
This diff is collapsed.
Click to expand it.
plot2d.py
+
22
−
0
View file @
cc52a9f3
...
@@ -251,3 +251,25 @@ def vector_field_magnitude_animation(run_function, plot_setup_function=lambda *_
...
@@ -251,3 +251,25 @@ def vector_field_magnitude_animation(run_function, plot_setup_function=lambda *_
return
im
,
return
im
,
return
animation
.
FuncAnimation
(
fig
,
update_figure
,
interval
=
interval
,
frames
=
frames
)
return
animation
.
FuncAnimation
(
fig
,
update_figure
,
interval
=
interval
,
frames
=
frames
)
def
surface_plot_animation
(
run_function
,
frames
=
90
,
interval
=
30
):
from
mpl_toolkits.mplot3d
import
Axes3D
import
matplotlib.animation
as
animation
import
matplotlib.pyplot
as
plt
from
matplotlib
import
cm
fig
=
plt
.
figure
()
ax
=
fig
.
add_subplot
(
111
,
projection
=
'
3d
'
)
x
,
y
,
data
=
run_function
(
1
)
ax
.
plot_surface
(
x
,
y
,
data
,
rstride
=
2
,
cstride
=
2
,
color
=
'
b
'
,
cmap
=
cm
.
coolwarm
,)
ax
.
set_zlim
(
-
1.0
,
1.0
)
def
update_figure
(
*
_
):
x_grid
,
y_grid
,
d
=
run_function
(
1
)
ax
.
clear
()
plot
=
ax
.
plot_surface
(
x_grid
,
y_grid
,
d
,
rstride
=
2
,
cstride
=
2
,
color
=
'
b
'
,
cmap
=
cm
.
coolwarm
,)
ax
.
set_zlim
(
-
1.0
,
1.0
)
return
plot
,
return
animation
.
FuncAnimation
(
fig
,
update_figure
,
interval
=
interval
,
frames
=
frames
,
blit
=
False
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment