diff --git a/ufl/algorithms/compute_form_data.py b/ufl/algorithms/compute_form_data.py index ca033b560..fb8766324 100644 --- a/ufl/algorithms/compute_form_data.py +++ b/ufl/algorithms/compute_form_data.py @@ -205,7 +205,6 @@ def attach_estimated_degrees(form): A new Form with estimate degrees attached. """ integrals = form.integrals() - new_integrals = [] for integral in integrals: md = {} @@ -278,6 +277,12 @@ def compute_form_data( form = preprocess_form(form, complex_mode) + # Estimate polynomial degree of integrands now, before applying + # any pullbacks and geometric lowering. Otherwise quad degrees + # blow up horrifically. + if do_estimate_degrees: + form = attach_estimated_degrees(form) + # --- Group form integrals # TODO: Refactor this, it's rather opaque what this does # TODO: Is self.original_form.ufl_domains() right here? @@ -288,12 +293,6 @@ def compute_form_data( do_append_everywhere_integrals=do_append_everywhere_integrals, ) - # Estimate polynomial degree of integrands now, before applying - # any pullbacks and geometric lowering. Otherwise quad degrees - # blow up horrifically. - if do_estimate_degrees: - form = attach_estimated_degrees(form) - if do_apply_function_pullbacks: # Rewrite coefficients and arguments in terms of their # reference cell values with Piola transforms and symmetry diff --git a/ufl/algorithms/domain_analysis.py b/ufl/algorithms/domain_analysis.py index 3a1aed9d0..70c52e306 100644 --- a/ufl/algorithms/domain_analysis.py +++ b/ufl/algorithms/domain_analysis.py @@ -369,7 +369,11 @@ def calc_hash(cd): for integral in integrals: integral_type = integral.integral_type() ufl_domain = integral.ufl_domain() - metadata = integral.metadata() + metadata = dict(integral.metadata()) + # Group integrals only by quadrature_degree if it is available. + # Otherwise, group them by estimated_quadrature_degree. + if "quadrature_degree" in metadata: + metadata.pop("estimated_quadrature_degree", None) meta_hash = hash(canonicalize_metadata(metadata)) subdomain_id = integral.subdomain_id() subdomain_data = id_or_none(integral.subdomain_data())