|
39 | 39 | from ufl.classes import Coefficient, Form, FunctionSpace, GeometricFacetQuantity |
40 | 40 | from ufl.constantvalue import Zero |
41 | 41 | 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 |
43 | 43 | from ufl.utils.sequences import max_degree |
44 | 44 |
|
45 | 45 |
|
@@ -262,7 +262,6 @@ def compute_form_data( |
262 | 262 | do_append_everywhere_integrals=True, |
263 | 263 | do_replace_functions=False, |
264 | 264 | coefficients_to_split=None, |
265 | | - do_assume_single_integral_type=True, |
266 | 265 | complex_mode=False, |
267 | 266 | do_remove_component_tensors=False, |
268 | 267 | ): |
@@ -469,22 +468,27 @@ def compute_form_data( |
469 | 468 | # Propagate restrictions to terminals |
470 | 469 | if do_apply_restrictions: |
471 | 470 | 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 |
475 | 478 | 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) |
488 | 492 | else: |
489 | 493 | default_restrictions = None |
490 | 494 | new_integrals = [] |
|
0 commit comments