Skip to content

Commit cf4ad31

Browse files
committed
Move error deeper into codegen
1 parent 2734f16 commit cf4ad31

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

tsfc/driver.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,12 @@ def compile_integral(integral_data, form_data, prefix, parameters, *, diagonal=F
143143
raise NotImplementedError("Assembly of forms over unrelated meshes is not supported. "
144144
"Try using Submeshes or cross-mesh interpolation.")
145145

146-
coefficient_meshes = set(chain.from_iterable(map(extract_domains, coefficients)))
147-
if any(d not in integral_data.domain_integral_type_map for d in coefficient_meshes):
148-
raise ValueError("Coefficient domain not found in integral. Possibly, the form contains coefficients "
149-
"on different meshes and requires measure intersection, for example: "
150-
'Measure("dx", argument_mesh, intersect_measures=[Measure("dx", coefficient_mesh)]).')
151-
152146
integral_data_info = TSFCIntegralDataInfo(
153147
domain=integral_data.domain,
154148
integral_type=integral_data.integral_type,
155149
subdomain_id=integral_data.subdomain_id,
156150
domain_number=domain_number,
157-
domain_integral_type_map={mesh: integral_data.domain_integral_type_map[mesh] if mesh in integral_data.domain_integral_type_map else None for mesh in all_meshes},
151+
domain_integral_type_map={mesh: integral_data.domain_integral_type_map.get(mesh, None) for mesh in all_meshes},
158152
arguments=arguments,
159153
coefficients=coefficients,
160154
coefficient_split=coefficient_split,

tsfc/kernel_interface/common.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ def coefficient(self, ufl_coefficient, restriction):
5959
domain = extract_unique_domain(ufl_coefficient)
6060
if ufl_coefficient.ufl_element().family() == 'Real':
6161
return kernel_arg
62+
elif self._domain_integral_type_map[domain] is None:
63+
raise ValueError("Coefficient domain not found in integral. Possibly, the form contains coefficients "
64+
"on different meshes and requires measure intersection, for example: "
65+
'Measure("dx", argument_mesh, intersect_measures=[Measure("dx", coefficient_mesh)]).')
6266
elif not self._domain_integral_type_map[domain].startswith("interior_facet"):
6367
return kernel_arg
6468
else:

0 commit comments

Comments
 (0)