From 3709281b8872156ad35f4317b55019311570ed33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20He=C3=9F?= <rene.hess@iwr.uni-heidelberg.de>
Date: Fri, 14 Dec 2018 16:24:25 +0100
Subject: [PATCH] Document and cleanup

---
 python/dune/codegen/sumfact/accumulation.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/python/dune/codegen/sumfact/accumulation.py b/python/dune/codegen/sumfact/accumulation.py
index 9b906a6f..89c43c0b 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
-- 
GitLab