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
81e909eb
Commit
81e909eb
authored
9 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Split kernel generation from file generation
... to later insert analysis/feedback loop
parent
bca56732
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
python/dune/perftool/compile.py
+6
-1
6 additions, 1 deletion
python/dune/perftool/compile.py
python/dune/perftool/pdelab/localoperator.py
+22
-13
22 additions, 13 deletions
python/dune/perftool/pdelab/localoperator.py
with
28 additions
and
14 deletions
python/dune/perftool/compile.py
+
6
−
1
View file @
81e909eb
...
...
@@ -79,4 +79,9 @@ def compile_form():
if
get_option
(
"
operator_file
"
):
from
dune.perftool.pdelab.localoperator
import
generate_localoperator
generate_localoperator
(
form
,
get_option
(
"
operator_file
"
))
kernels
=
generate_localoperator
(
form
)
# TODO insert sophisticated analysis/feedback loops here
from
dune.perftool.pdelab.localoperator
import
generate_localoperator_file
generate_localoperator_file
(
kernels
)
This diff is collapsed.
Click to expand it.
python/dune/perftool/pdelab/localoperator.py
+
22
−
13
View file @
81e909eb
...
...
@@ -129,7 +129,7 @@ def cgen_class_from_cache(name, tag, members=[]):
return
Class
(
name
,
base_classes
=
base_classes
,
members
=
members
)
def
generate_localoperator
(
form
,
operatorfile
):
def
generate_localoperator
(
form
):
# For the moment, I do assume that there is but one integral of each type. This might differ
# if you use different quadrature orders for different terms.
assert
len
(
form
.
integrals
())
==
len
(
set
(
i
.
integral_type
()
for
i
in
form
.
integrals
()))
...
...
@@ -138,14 +138,22 @@ def generate_localoperator(form, operatorfile):
from
dune.perftool.generation
import
delete_cache
delete_cache
()
# Manage includes and base classes that we always need
operator_include
(
'
dune/pdelab/gridfunctionspace/gridfunctionspaceutilities.hh
'
)
operator_include
(
'
dune/pdelab/localoperator/idefault.hh
'
)
operator_include
(
'
dune/pdelab/localoperator/flags.hh
'
)
operator_include
(
'
dune/pdelab/localoperator/pattern.hh
'
)
operator_include
(
'
dune/geometry/quadraturerules.hh
'
)
public_base_class
(
'
Dune::PDELab::LocalOperatorDefaultFlags
'
)
# Have a data structure collect the generated kernels
operator_
method
s
=
[]
operator_
kernel
s
=
{}
# Generate the necessary residual methods
for
integral
in
form
.
integrals
():
kernel
=
generate_term
(
integrand
=
integral
.
integrand
(),
measure
=
integral
.
integral_type
())
signature
=
measure_specific_details
(
integral
.
integral_type
())[
"
residual_signature
"
]
operator_methods
.
append
(
AssemblyMethod
(
signature
,
kernel
))
operator_kernels
[(
integral
.
integral_type
(),
'
residual
'
)]
=
kernel
# Generate the necessary jacobian methods
from
dune.perftool.options
import
get_option
...
...
@@ -158,19 +166,20 @@ def generate_localoperator(form, operatorfile):
for
integral
in
jacform
.
integrals
():
kernel
=
generate_term
(
integrand
=
integral
.
integrand
(),
measure
=
integral
.
integral_type
())
signature
=
measure_specific_details
(
integral
.
integral_type
())[
"
jacobian_signature
"
]
operator_methods
.
append
(
AssemblyMethod
(
signature
,
kernel
))
operator_kernels
[(
integral
.
integral_type
(),
'
jacobian
'
)]
=
kernel
# TODO: JacobianApply for matrix-free computations.
# Manage includes and base classes that we always need
operator_include
(
'
dune/pdelab/gridfunctionspace/gridfunctionspaceutilities.hh
'
)
operator_include
(
'
dune/pdelab/localoperator/idefault.hh
'
)
operator_include
(
'
dune/pdelab/localoperator/flags.hh
'
)
operator_include
(
'
dune/pdelab/localoperator/pattern.hh
'
)
operator_include
(
'
dune/geometry/quadraturerules.hh
'
)
# Return the set of generated kernels
return
operator_kernels
public_base_class
(
'
Dune::PDELab::LocalOperatorDefaultFlags
'
)
def
generate_localoperator_file
(
kernels
):
operator_methods
=
[]
# Make generables from the given kernels
for
method
,
kernel
in
kernels
.
items
():
signature
=
measure_specific_details
(
method
[
0
])[
"
{}_signature
"
.
format
(
method
[
1
])]
operator_methods
.
append
(
AssemblyMethod
(
signature
,
kernel
))
# Write the file!
from
dune.perftool.file
import
generate_file
...
...
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