Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lbmpy
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
lbmpy
Commits
de17c1e8
Commit
de17c1e8
authored
7 months ago
by
Philipp Suffa
Committed by
Markus Holzer
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Added a copy kernel, which can be used to transfer data from a source field to a destination field.
parent
5ff03a69
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!181
Added a copy kernel, which can be used to transfer data from a source field to a destination field.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lbmpy/updatekernels.py
+20
-0
20 additions, 0 deletions
src/lbmpy/updatekernels.py
with
20 additions
and
0 deletions
src/lbmpy/updatekernels.py
+
20
−
0
View file @
de17c1e8
...
...
@@ -120,6 +120,26 @@ def create_stream_pull_with_output_kernel(lb_method, src_field, dst_field=None,
simplification_hints
=
output_eq_collection
.
simplification_hints
)
def
create_copy_kernel
(
stencil
,
src_field
,
dst_field
,
accessor
=
StreamPullTwoFieldsAccessor
()):
"""
Creates a copy kernel, which can be used to transfer information from src to dst field.
Args:
stencil: lattice Boltzmann stencil which is used in the form of a tuple of tuples
src_field: field used for reading pdf values
dst_field: field used for writing pdf values
accessor: instance of PdfFieldAccessor, defining where to read and write values
to create e.g. a fused stream-collide kernel See
'
fieldaccess.PdfFieldAccessor
'
Returns:
AssignmentCollection of a copy update rule
"""
temporary_symbols
=
sp
.
symbols
(
f
'
copied:
{
stencil
.
Q
}
'
)
subexpressions
=
[
Assignment
(
tmp
,
acc
)
for
tmp
,
acc
in
zip
(
temporary_symbols
,
accessor
.
write
(
src_field
,
stencil
))]
main_assignments
=
[
Assignment
(
acc
,
tmp
)
for
acc
,
tmp
in
zip
(
accessor
.
write
(
dst_field
,
stencil
),
temporary_symbols
)]
return
AssignmentCollection
(
main_assignments
,
subexpressions
=
subexpressions
)
# ---------------------------------- Pdf array creation for various layouts --------------------------------------------
...
...
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