diff --git a/firedrake/assemble.py b/firedrake/assemble.py index 181909161e..82d4ca80db 100644 --- a/firedrake/assemble.py +++ b/firedrake/assemble.py @@ -1610,7 +1610,7 @@ def _integral_type(self): @cached_property def _mesh(self): - return self._form.ufl_domains()[self._kinfo.domain_number] + return tuple(self._form.ufl_domains())[self._kinfo.domain_number] @cached_property def _needs_subset(self): @@ -1731,7 +1731,7 @@ def _as_global_kernel_arg_coefficient(_, self): ufl_element = V.ufl_element() if ufl_element.family() == "Real": - return op2.GlobalKernelArg((ufl_element.value_size,)) + return op2.GlobalKernelArg((V.value_size,)) else: return self._make_dat_global_kernel_arg(V, index=index) @@ -1945,7 +1945,7 @@ def _indexed_tensor(self): @cached_property def _mesh(self): - return self._form.ufl_domains()[self._kinfo.domain_number] + return tuple(self._form.ufl_domains())[self._kinfo.domain_number] @cached_property def _iterset(self): diff --git a/firedrake/slate/slac/compiler.py b/firedrake/slate/slac/compiler.py index 1333a04039..7e1b14281c 100644 --- a/firedrake/slate/slac/compiler.py +++ b/firedrake/slate/slac/compiler.py @@ -82,7 +82,8 @@ def _compile_expression_hashkey(slate_expr, compiler_parameters=None): def _compile_expression_comm(*args, **kwargs): # args[0] is a slate_expr - return args[0].ufl_domains()[0].comm + domain, = args[0].ufl_domains() + return domain.comm @memory_and_disk_cache( diff --git a/firedrake/slate/slate.py b/firedrake/slate/slate.py index 79b65ba79a..8176b9d57d 100644 --- a/firedrake/slate/slate.py +++ b/firedrake/slate/slate.py @@ -247,11 +247,11 @@ def ufl_domain(self): The function will fail if multiple domains are found. """ - domains = self.ufl_domains() - assert all(domain == domains[0] for domain in domains), ( - "All integrals must share the same domain of integration." - ) - return domains[0] + try: + domain, = self.ufl_domains() + except ValueError: + raise ValueError("All integrals must share the same domain of integration.") + return domain @abstractmethod def ufl_domains(self):