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
Jonas Plewinski
pystencils
Commits
703d4048
Commit
703d4048
authored
7 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Coverage tests for pystencils.Field
parent
1534a936
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
boundaries/boundaryhandling.py
+19
-16
19 additions, 16 deletions
boundaries/boundaryhandling.py
field.py
+1
-8
1 addition, 8 deletions
field.py
with
20 additions
and
24 deletions
boundaries/boundaryhandling.py
+
19
−
16
View file @
703d4048
...
...
@@ -69,7 +69,7 @@ class BoundaryHandling:
@property
def
boundary_objects
(
self
):
return
tuple
(
self
.
_boundary_object
ToName
.
keys
())
return
tuple
(
self
.
_boundary_object
_to_boundary_info
.
keys
())
@property
def
flag_array_name
(
self
):
...
...
@@ -97,21 +97,24 @@ class BoundaryHandling:
def
set_boundary
(
self
,
boundary_obj
,
slice_obj
=
None
,
mask_callback
=
None
,
ghost_layers
=
True
,
inner_ghost_layers
=
True
,
replace
=
True
):
"""
Sets boundary using either a rectangular slice, a boolean mask or a combination of both
:param boundary_obj: instance of a boundary object that should be set
:param slice_obj: a slice object (can be created with make_slice[]) that selects a part of the domain where
the boundary should be set. If none, the complete domain is selected which makes only sense
if a mask_callback is passed. The slice can have
'
:
'
placeholders, which are interpreted
depending on the
'
inner_ghost_layers
'
parameter i.e. if it is True, the slice extends
into the ghost layers
:param mask_callback: callback function getting x,y (z) parameters of the cell midpoints and returning a
boolean mask with True entries where boundary cells should be set.
The x, y, z arrays have 2D/3D shape such that they can be used directly
to create the boolean return array. i.e return x < 10 sets boundaries in cells with
midpoint x coordinate smaller than 10.
:param ghost_layers see DataHandling.iterate()
"""
Sets boundary using either a rectangular slice, a boolean mask or a combination of both.
Args:
boundary_obj: instance of a boundary object that should be set
slice_obj: a slice object (can be created with make_slice[]) that selects a part of the domain where
the boundary should be set. If none, the complete domain is selected which makes only sense
if a mask_callback is passed. The slice can have
'
:
'
placeholders, which are interpreted
depending on the
'
inner_ghost_layers
'
parameter i.e. if it is True, the slice extends
into the ghost layers
mask_callback: callback function getting x,y (z) parameters of the cell midpoints and returning a
boolean mask with True entries where boundary cells should be set.
The x, y, z arrays have 2D/3D shape such that they can be used directly
to create the boolean return array. i.e return x < 10 sets boundaries in cells with
midpoint x coordinate smaller than 10.
ghost_layers: see DataHandling.iterate()
inner_ghost_layers: see DataHandling.iterate()
replace: by default all other flags are erased in the cells where the boundary is set. To add a
boundary condition, set this replace flag to False
"""
if
isinstance
(
boundary_obj
,
str
)
and
boundary_obj
.
lower
()
==
'
domain
'
:
flag
=
self
.
flag_interface
.
domain_flag
...
...
This diff is collapsed.
Click to expand it.
field.py
+
1
−
8
View file @
703d4048
...
...
@@ -393,11 +393,7 @@ class Field(object):
@property
def
offsets
(
self
):
return
self
.
_offsets
@offsets.setter
def
offsets
(
self
,
value
):
self
.
_offsets
=
value
return
tuple
(
self
.
_offsets
)
@property
def
required_ghost_layers
(
self
):
...
...
@@ -415,9 +411,6 @@ class Field(object):
def
index
(
self
):
return
self
.
_index
def
get_neighbor
(
self
,
*
offsets
)
->
'
Field.Access
'
:
return
Field
.
Access
(
self
.
field
,
offsets
,
self
.
index
)
def
neighbor
(
self
,
coord_id
:
int
,
offset
:
Sequence
[
int
])
->
'
Field.Access
'
:
offset_list
=
list
(
self
.
offsets
)
offset_list
[
coord_id
]
+=
offset
...
...
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