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
ff780e09
Commit
ff780e09
authored
6 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Handle subdomain_data in a maybe less hacky way
parent
25781f9c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
patches/apply_patches.sh
+0
-1
0 additions, 1 deletion
patches/apply_patches.sh
patches/ufl/conditional-uflid.patch
+0
-34
0 additions, 34 deletions
patches/ufl/conditional-uflid.patch
python/dune/perftool/pdelab/localoperator.py
+7
-20
7 additions, 20 deletions
python/dune/perftool/pdelab/localoperator.py
with
7 additions
and
55 deletions
patches/apply_patches.sh
+
0
−
1
View file @
ff780e09
...
...
@@ -10,6 +10,5 @@ git apply ../../../patches/vectorclass/0001-Better-implementation-of-horizontal_
popd
pushd
python/ufl
git apply ../../patches/ufl/conditional-uflid.patch
git apply ../../patches/ufl/0001-Remove-special-case-for-variable-in-ufl2dot.patch
popd
This diff is collapsed.
Click to expand it.
patches/ufl/conditional-uflid.patch
deleted
100644 → 0
+
0
−
34
View file @
25781f9c
diff --git a/ufl/conditional.py b/ufl/conditional.py
index 352624c..ebd647f 100644
--- a/ufl/conditional.py
+++ b/ufl/conditional.py
@@ -27,6 +27,7 @@
from ufl.constantvalue import as_ufl
from ufl.precedence import parstr
from ufl.exprequals import expr_equals
from ufl.checks import is_true_ufl_scalar
+from ufl.core.ufl_id import attach_ufl_id
# --- Condition classes ---
@@ -221,10 +222,11 @@
class NotCondition(Condition):
@ufl_type(num_ops=3, inherit_shape_from_operand=1,
inherit_indices_from_operand=1)
+@attach_ufl_id
class Conditional(Operator):
- __slots__ = ()
+ __slots__ = ("_ufl_id")
- def __init__(self, condition, true_value, false_value):
+ def __init__(self, condition, true_value, false_value, ufl_id=None):
if not isinstance(condition, Condition):
error("Expectiong condition as first argument.")
true_value = as_ufl(true_value)
@@ -244,6 +246,7 @@
class Conditional(Operator):
condition.ufl_operands[1].ufl_free_indices == ())):
error("Non-scalar == or != is not allowed.")
+ self._ufl_id = self._init_ufl_id(ufl_id)
Operator.__init__(self, (condition, true_value, false_value))
def evaluate(self, x, mapping, component, index_values):
This diff is collapsed.
Click to expand it.
python/dune/perftool/pdelab/localoperator.py
+
7
−
20
View file @
ff780e09
...
...
@@ -284,37 +284,24 @@ def boundary_predicates(expr, measure, subdomain_id):
predicates
=
frozenset
([])
if
subdomain_id
not
in
[
'
everywhere
'
,
'
otherwise
'
]:
# We need to reconstruct the subdomain_data parameter of the measure
# I am *totally* confused as to why this information is not at hand anyway,
# but conversation with Martin pointed me to dolfin.fem.assembly where this
# is done in preprocessing with the limitation of only one possible type of
# modified measure per integral type.
# Get the original form and inspect the present measures
from
dune.perftool.generation
import
get_global_context_value
data
=
get_global_context_value
(
"
data
"
)
original_form
=
data
.
object_by_name
[
get_form_option
(
"
form
"
)]
sd
=
original_form
.
subdomain_data
()
assert
len
(
sd
)
==
1
subdomains
,
=
list
(
sd
.
values
())
domain
,
=
list
(
sd
.
keys
())
for
k
in
list
(
subdomains
.
keys
()):
if
subdomains
[
k
]
is
None
:
del
subdomains
[
k
]
subdomains
=
[]
for
integral
in
original_form
.
integrals
():
if
integral
.
integral_type
()
==
measure
:
subdomains
.
append
(
integral
.
subdomain_data
())
# Finally extract the original subdomain_data (which needs to be present!)
assert
measure
in
subdomains
subdomain_data
=
subdomains
[
measure
]
subdomain_data
,
=
set
(
subdomains
)
from
ufl.classes
import
Expr
if
isinstance
(
subdomain_data
,
Expr
):
visitor
=
get_visitor
(
measure
,
subdomain_id
)
cond
=
visitor
(
subdomain_data
,
do_predicates
=
True
)
else
:
raise
NotImplementedError
(
"
Only UFL expressions allowed in subdomain_data right now.
"
)
subdomain_data
=
visitor
(
subdomain_data
,
do_predicates
=
True
)
predicates
=
predicates
.
union
([
prim
.
Comparison
(
cond
,
'
==
'
,
subdomain_id
)])
predicates
=
predicates
.
union
([
prim
.
Comparison
(
subdomain_data
,
'
==
'
,
subdomain_id
)])
return
predicates
...
...
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