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
f84e5252
Commit
f84e5252
authored
9 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Add the runtime_ufl from uflpdelab
it reserves the trial function as coefficient 0.
parent
5d9a7dd6
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
examples/laplace.ufl
+1
-2
1 addition, 2 deletions
examples/laplace.ufl
python/dune/perftool/runtime_ufl.py
+30
-0
30 additions, 0 deletions
python/dune/perftool/runtime_ufl.py
with
31 additions
and
2 deletions
examples/laplace.ufl
+
1
−
2
View file @
f84e5252
V = FiniteElement("CG", "triangle", 1)
V = FiniteElement("CG", "triangle", 1)
k = Coefficient(V)
u = TrialFunction(V)
u = Coefficient(V)
v = TestFunction(V)
v = TestFunction(V)
forms = [inner(grad(u), grad(v))*dx]
forms = [inner(grad(u), grad(v))*dx]
This diff is collapsed.
Click to expand it.
python/dune/perftool/runtime_ufl.py
0 → 100644
+
30
−
0
View file @
f84e5252
"""
This module is loaded instead of ufl when executing .ufl files.
So, this module contains all our extensions and monkey patches to
UFL.
"""
import
ufl
from
ufl
import
*
from
ufl.split_functions
import
split
class
TrialFunction
(
ufl
.
Coefficient
):
"""
A coefficient that always takes the reserved index 0
"""
def
__init__
(
self
,
element
,
count
=
None
):
if
count
and
count
is
not
0
:
raise
ValueError
(
"
The trial function must be the coefficient of index 0 in uflpdelab
"
)
ufl
.
Coefficient
.
__init__
(
self
,
element
,
count
=
0
)
class
Coefficient
(
ufl
.
Coefficient
):
"""
A coefficient that honors the reserved index 0.
"""
def
__init__
(
self
,
element
,
count
=
None
):
if
count
and
count
is
0
:
raise
ValueError
(
"
The coefficient of index 0 is reserved for the trial function in uflpdelab
"
)
if
not
count
and
ufl
.
Coefficient
.
_globalcount
is
0
:
count
=
1
ufl
.
Coefficient
.
__init__
(
self
,
element
,
count
)
def
Coefficients
(
element
):
return
split
(
Coefficient
(
element
))
def
TrialFunctions
(
element
):
return
split
(
TrialFunction
(
element
))
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