Skip to content

Commit 6d311a2

Browse files
committed
compute_form_data: remove do_assume_single_integral_type
1 parent 0364a52 commit 6d311a2

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

test/test_mixed_function_space_with_mesh_sequence.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def test_mixed_function_space_with_mesh_sequence_cell():
6868
do_estimate_degrees=True,
6969
do_replace_functions=True,
7070
coefficients_to_split=(f, g),
71-
do_assume_single_integral_type=False,
7271
complex_mode=False,
7372
)
7473
(id0,) = fd.integral_data
@@ -137,7 +136,6 @@ def test_mixed_function_space_with_mesh_sequence_facet():
137136
do_estimate_degrees=True,
138137
do_replace_functions=True,
139138
coefficients_to_split=(f, g),
140-
do_assume_single_integral_type=False,
141139
complex_mode=False,
142140
)
143141
(
@@ -237,7 +235,6 @@ def test_mixed_function_space_with_mesh_sequence_raise():
237235
do_estimate_degrees=True,
238236
do_replace_functions=True,
239237
coefficients_to_split=(f,),
240-
do_assume_single_integral_type=False,
241238
complex_mode=False,
242239
)
243240
assert e_info.match("Found multiple domains, cannot return just one.")
@@ -254,7 +251,6 @@ def test_mixed_function_space_with_mesh_sequence_raise():
254251
do_estimate_degrees=True,
255252
do_replace_functions=True,
256253
coefficients_to_split=(f, g),
257-
do_assume_single_integral_type=False,
258254
complex_mode=False,
259255
)
260256
assert e_info.match("Discontinuous type Coefficient must be restricted.")

ufl/algorithms/compute_form_data.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from ufl.classes import Coefficient, Form, FunctionSpace, GeometricFacetQuantity
4040
from ufl.constantvalue import Zero
4141
from ufl.corealg.traversal import traverse_unique_terminals
42-
from ufl.domain import extract_unique_domain
42+
from ufl.domain import extract_domains, extract_unique_domain
4343
from ufl.utils.sequences import max_degree
4444

4545

@@ -262,7 +262,6 @@ def compute_form_data(
262262
do_append_everywhere_integrals=True,
263263
do_replace_functions=False,
264264
coefficients_to_split=None,
265-
do_assume_single_integral_type=True,
266265
complex_mode=False,
267266
do_remove_component_tensors=False,
268267
):
@@ -469,22 +468,27 @@ def compute_form_data(
469468
# Propagate restrictions to terminals
470469
if do_apply_restrictions:
471470
for itg_data in self.integral_data:
472-
if do_assume_single_integral_type: # Conventional case
473-
if not itg_data.integral_type.startswith("interior_facet"):
474-
continue
471+
# Need the following if block in case not all participating domains
472+
# have been included in the Measure (backwards compat).
473+
if all(
474+
not integral_type.startswith("interior_facet")
475+
for _, integral_type in itg_data.domain_integral_type_map.items()
476+
):
477+
continue
475478
if do_apply_default_restrictions:
476-
if do_assume_single_integral_type: # Conventional case
477-
domains = set(
478-
domain
479-
for integral in itg_data.integrals
480-
for domain in extract_domains(integral)
481-
)
482-
default_restrictions = {domain: "+" for domain in domains}
483-
else:
484-
default_restrictions = {
485-
domain: default_restriction_map[integral_type]
486-
for domain, integral_type in itg_data.domain_integral_type_map.items()
487-
}
479+
default_restrictions = {
480+
domain: default_restriction_map[integral_type]
481+
for domain, integral_type in itg_data.domain_integral_type_map.items()
482+
}
483+
# Need the following dict update in case not all participating domains
484+
# have been included in the Measure (backwards compat).
485+
extra = {
486+
domain: default_restriction_map[itg_data.integral_type]
487+
for integral in itg_data.integrals
488+
for domain in extract_domains(integral)
489+
if domain not in default_restrictions
490+
}
491+
default_restrictions.update(extra)
488492
else:
489493
default_restrictions = None
490494
new_integrals = []

0 commit comments

Comments
 (0)