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
843ea751
Commit
843ea751
authored
6 years ago
by
Markus Holzer
Committed by
Martin Bauer
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Dirichlet Boundary Condition for pystencils
parent
940915cf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
boundaries/__init__.py
+2
-2
2 additions, 2 deletions
boundaries/__init__.py
boundaries/boundaryconditions.py
+26
-1
26 additions, 1 deletion
boundaries/boundaryconditions.py
with
28 additions
and
3 deletions
boundaries/__init__.py
+
2
−
2
View file @
843ea751
from
pystencils.boundaries.boundaryhandling
import
BoundaryHandling
from
pystencils.boundaries.boundaryconditions
import
Neumann
from
pystencils.boundaries.boundaryconditions
import
Neumann
,
Dirichlet
from
pystencils.boundaries.inkernel
import
add_neumann_boundary
__all__
=
[
'
BoundaryHandling
'
,
'
Neumann
'
,
'
add_neumann_boundary
'
]
__all__
=
[
'
BoundaryHandling
'
,
'
Neumann
'
,
'
Dirichlet
'
,
'
add_neumann_boundary
'
]
This diff is collapsed.
Click to expand it.
boundaries/boundaryconditions.py
+
26
−
1
View file @
843ea751
from
typing
import
List
,
Tuple
,
Any
from
pystencils
import
Assignment
from
pystencils.boundaries.boundaryhandling
import
BoundaryOffsetInfo
from
typing
import
List
,
Tuple
,
Any
from
pystencils.data_types
import
create_type
class
Boundary
:
...
...
@@ -68,3 +69,27 @@ class Neumann(Boundary):
def
__eq__
(
self
,
other
):
return
type
(
other
)
==
Neumann
class
Dirichlet
(
Boundary
):
def
__init__
(
self
,
value
,
name
=
"
Dirchlet
"
):
super
().
__init__
(
name
)
self
.
_value
=
value
@property
def
additional_data
(
self
):
if
callable
(
self
.
_value
):
return
[(
'
value
'
,
create_type
(
"
double
"
))]
else
:
return
[]
@property
def
additional_data_init_callback
(
self
):
if
callable
(
self
.
_value
):
return
self
.
_value
def
__call__
(
self
,
field
,
direction_symbol
,
index_field
,
**
kwargs
):
if
self
.
additional_data
:
return
[
Assignment
(
field
.
center
,
index_field
(
"
value
"
))]
if
field
.
index_dimensions
==
0
:
return
[
Assignment
(
field
.
center
,
self
.
_value
)]
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