Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pycodegen
pystencils_autodiff
Commits
3bb90210
Commit
3bb90210
authored
Oct 30, 2020
by
Stephan Seitz
Browse files
Update
parent
98eb75fe
Pipeline
#27621
failed with stage
in 1 minute and 34 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/pystencils_autodiff/backends/python_bindings.py
View file @
3bb90210
...
...
@@ -120,7 +120,8 @@ REGISTER_KERNEL_BUILDER(Name("{{ python_name }}").Device({{ device }}), {{ pytho
render_dict
=
{
'python_name'
:
stringcase
.
pascalcase
(
function_node
.
function_name
),
# tf wants PascalCase!
'cpp_name'
:
function_node
.
function_name
,
'parameters'
:
[
p
.
symbol
.
name
for
p
in
parameters
],
'parameters'
:
[
p
.
symbol
.
name
for
p
in
parameters
if
hasattr
(
p
.
symbol
,
'dtype'
)
and
not
str
(
p
.
symbol
)
==
'meshFunctor'
],
'input_fields'
:
input_fields
,
'inputs'
:
self
.
inputs
,
'output_fields'
:
output_fields
,
...
...
src/pystencils_autodiff/lbm/adjoint_boundaryconditions.py
View file @
3bb90210
...
...
@@ -13,7 +13,7 @@ class AdjointBoundaryCondition(Boundary):
self
.
_constant_fields
=
constant_fields
self
.
_time_constant_fields
=
time_constant_fields
def
__call__
(
self
,
pdf_field
:
pystencils_autodiff
.
AdjointField
,
direction_symbol
,
lb_method
,
**
kwargs
):
def
__call__
(
self
,
pdf_field
:
pystencils_autodiff
.
AdjointField
,
direction_symbol
,
*
args
,
**
kwargs
):
# apply heuristics
if
pdf_field
.
name
.
startswith
(
'diff'
):
...
...
@@ -24,13 +24,15 @@ class AdjointBoundaryCondition(Boundary):
f
'
{
pdf_field
}
should be a pystencils_autodiff.AdjointField to use AdjointBoundaryCondition'
forward_field
=
pdf_field
.
corresponding_forward_field
forward_assignments
=
self
.
_forward_condition
(
forward_field
,
direction_symbol
,
lb_method
,
**
kwargs
)
forward_assignments
=
self
.
_forward_condition
(
forward_field
,
direction_symbol
,
*
args
,
**
kwargs
)
backward_assignments
=
pystencils_autodiff
.
create_backward_assignments
(
forward_assignments
,
diff_fields_prefix
=
pdf_field
.
name_prefix
,
time_constant_fields
=
self
.
_time_constant_fields
,
constant_fields
=
self
.
_constant_fields
)
assert
backward_assignments
.
all_assignments
,
(
"Must have a at least one read field in forward boundary "
"to have an meaningful adjoint boundary condition"
)
return
backward_assignments
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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