diff --git a/patches/apply_patches.sh b/patches/apply_patches.sh index 5fa3ab5e28c162fb391e0b66ec5aec066d4b903a..9d25dfeeace347316b17f45328c75a4cdde3b368 100755 --- a/patches/apply_patches.sh +++ b/patches/apply_patches.sh @@ -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 diff --git a/patches/ufl/conditional-uflid.patch b/patches/ufl/conditional-uflid.patch deleted file mode 100644 index b469437ed6507bca7ec4ed4b56fa8578804a9809..0000000000000000000000000000000000000000 --- a/patches/ufl/conditional-uflid.patch +++ /dev/null @@ -1,34 +0,0 @@ -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): diff --git a/python/dune/perftool/pdelab/localoperator.py b/python/dune/perftool/pdelab/localoperator.py index 4a374577055ffe6f3784bb9a9293488e1ac34b71..3fb213c87e98883e4f474c4145090b40aff1eec4 100644 --- a/python/dune/perftool/pdelab/localoperator.py +++ b/python/dune/perftool/pdelab/localoperator.py @@ -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