diff --git a/python/dune/codegen/sumfact/accumulation.py b/python/dune/codegen/sumfact/accumulation.py index 9b906a6fb9cb3a814e1262ad89d4ede694b441c5..89c43c0b5132650ba0a4afec1d4ba656409fb3ef 100644 --- a/python/dune/codegen/sumfact/accumulation.py +++ b/python/dune/codegen/sumfact/accumulation.py @@ -176,11 +176,21 @@ class AccumulationOutput(SumfactKernelInterfaceBase, ImmutableRecord): def accumulate_output(self, sf, result, insn_dep, inames=None, additional_inames=()): trial_leaf_element = get_leaf(self.trial_element, self.trial_element_index) if self.trial_element is not None else None + # Note: Using matrix_sequence_quadrature_permuted is ok in this place since: + # + # - If the grid is unstructured we assume that the polynomial degree + # for each direction is the same. + # + # - If the grid is structured the quadrature permuted matrix sequence + # is the same as the original one. We still need to call this one + # since VectorizedSumfactKernels do not have the matrix_sequence + # attribute. basis_size = tuple(mat.basis_size for mat in sf.matrix_sequence_quadrature_permuted) + if get_option('grid_unstructured'): + assert len(set(basis_size)) == 1 if inames is None: - inames = tuple(accum_iname(trial_leaf_element, mat.rows, i) - for i, mat in enumerate(sf.matrix_sequence_quadrature_permuted)) + inames = tuple(accum_iname(trial_leaf_element, size, i) for i, size in enumerate(basis_size)) # Determine the expression to accumulate with. This depends on the vectorization strategy! from dune.codegen.tools import maybe_wrap_subscript