Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-codegen
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Christian Heinigk
dune-codegen
Commits
4eb8b362
Commit
4eb8b362
authored
5 years ago
by
Marcel Koch
Browse files
Options
Downloads
Patches
Plain Diff
initialize cache only for cell evaluation, do nothing otherwise
parent
e7122e78
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/dune/codegen/blockstructured/basis.py
+24
-18
24 additions, 18 deletions
python/dune/codegen/blockstructured/basis.py
with
24 additions
and
18 deletions
python/dune/codegen/blockstructured/basis.py
+
24
−
18
View file @
4eb8b362
...
@@ -38,21 +38,24 @@ class BlockStructuredBasisMixin(GenericBasisMixin):
...
@@ -38,21 +38,24 @@ class BlockStructuredBasisMixin(GenericBasisMixin):
assert
not
isinstance
(
element
,
MixedElement
)
assert
not
isinstance
(
element
,
MixedElement
)
name
=
"
phi_{}
"
.
format
(
FEM_name_mangling
(
element
))
name
=
"
phi_{}
"
.
format
(
FEM_name_mangling
(
element
))
name
=
restricted_name
(
name
,
restriction
)
name
=
restricted_name
(
name
,
restriction
)
self
.
init_basis_cache
(
element
)
self
.
init_basis_cache
(
element
,
restriction
)
self
.
evaluate_basis
(
element
,
name
,
restriction
)
self
.
evaluate_basis
(
element
,
name
,
restriction
)
inames
=
self
.
lfs_inames
(
element
,
restriction
,
number
,
context
=
context
)
inames
=
self
.
lfs_inames
(
element
,
restriction
,
number
,
context
=
context
)
return
prim
.
Subscript
(
prim
.
Variable
(
name
),
(
tensor_index_to_sequential_index
(
inames
,
element
.
degree
()
+
1
),
0
))
return
prim
.
Subscript
(
prim
.
Variable
(
name
),
(
tensor_index_to_sequential_index
(
inames
,
element
.
degree
()
+
1
),
0
))
@preamble
(
kernel
=
'
operator
'
)
@preamble
(
kernel
=
'
operator
'
)
def
init_basis_cache
(
self
,
element
):
def
init_basis_cache
(
self
,
element
,
restriction
):
cache
=
name_localbasis_cache
(
element
)
if
not
restriction
:
localbasis
=
name_localbasis
(
element
)
cache
=
name_localbasis_cache
(
element
)
qp_name
=
get_pymbolic_basename
(
self
.
quadrature_position_in_micro
())
localbasis
=
name_localbasis
(
element
)
return
[
"
for (int i=0; i < {}.size(); ++i)
"
.
format
(
qp_name
),
qp_name
=
get_pymbolic_basename
(
self
.
quadrature_position_in_micro
())
"
{
"
,
return
[
"
for (int i=0; i < {}.size(); ++i)
"
.
format
(
qp_name
),
"
{}.evaluateFunction({}[i], {});
"
.
format
(
cache
,
qp_name
,
localbasis
),
"
{
"
,
"
}
"
]
"
{}.evaluateFunction({}[i], {});
"
.
format
(
cache
,
qp_name
,
localbasis
),
"
}
"
]
else
:
return
[]
@kernel_cached
@kernel_cached
def
evaluate_basis
(
self
,
element
,
name
,
restriction
):
def
evaluate_basis
(
self
,
element
,
name
,
restriction
):
...
@@ -71,21 +74,24 @@ class BlockStructuredBasisMixin(GenericBasisMixin):
...
@@ -71,21 +74,24 @@ class BlockStructuredBasisMixin(GenericBasisMixin):
assert
not
isinstance
(
element
,
MixedElement
)
assert
not
isinstance
(
element
,
MixedElement
)
name
=
"
js_{}
"
.
format
(
FEM_name_mangling
(
element
))
name
=
"
js_{}
"
.
format
(
FEM_name_mangling
(
element
))
name
=
restricted_name
(
name
,
restriction
)
name
=
restricted_name
(
name
,
restriction
)
self
.
init_gradient_cache
(
element
)
self
.
init_gradient_cache
(
element
,
restriction
)
self
.
evaluate_reference_gradient
(
element
,
name
,
restriction
)
self
.
evaluate_reference_gradient
(
element
,
name
,
restriction
)
inames
=
self
.
lfs_inames
(
element
,
restriction
,
number
,
context
=
context
)
inames
=
self
.
lfs_inames
(
element
,
restriction
,
number
,
context
=
context
)
return
prim
.
Subscript
(
prim
.
Variable
(
name
),
(
tensor_index_to_sequential_index
(
inames
,
element
.
degree
()
+
1
),
0
))
return
prim
.
Subscript
(
prim
.
Variable
(
name
),
(
tensor_index_to_sequential_index
(
inames
,
element
.
degree
()
+
1
),
0
))
@preamble
(
kernel
=
'
operator
'
)
@preamble
(
kernel
=
'
operator
'
)
def
init_gradient_cache
(
self
,
element
):
def
init_gradient_cache
(
self
,
element
,
restriction
):
cache
=
name_localbasis_cache
(
element
)
if
not
restriction
:
localbasis
=
name_localbasis
(
element
)
cache
=
name_localbasis_cache
(
element
)
qp_name
=
get_pymbolic_basename
(
self
.
quadrature_position_in_micro
())
localbasis
=
name_localbasis
(
element
)
return
[
"
for (int i=0; i < {}.size(); ++i)
"
.
format
(
qp_name
),
qp_name
=
get_pymbolic_basename
(
self
.
quadrature_position_in_micro
())
"
{
"
,
return
[
"
for (int i=0; i < {}.size(); ++i)
"
.
format
(
qp_name
),
"
{}.evaluateJacobian({}[i], {});
"
.
format
(
cache
,
qp_name
,
localbasis
),
"
{
"
,
"
}
"
]
"
{}.evaluateJacobian({}[i], {});
"
.
format
(
cache
,
qp_name
,
localbasis
),
"
}
"
]
else
:
return
[]
@kernel_cached
@kernel_cached
def
evaluate_reference_gradient
(
self
,
element
,
name
,
restriction
):
def
evaluate_reference_gradient
(
self
,
element
,
name
,
restriction
):
...
...
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