diff --git a/python/dune/codegen/sumfact/accumulation.py b/python/dune/codegen/sumfact/accumulation.py index 4219ba26b6e2eb9530ede298a251a2fe0968e0fb..b32541f69169a23d0c626d280a53f0ec91698122 100644 --- a/python/dune/codegen/sumfact/accumulation.py +++ b/python/dune/codegen/sumfact/accumulation.py @@ -102,6 +102,9 @@ class AccumulationOutput(SumfactKernelInterfaceBase, ImmutableRecord): trial_element_index=None, ): + # See comment regarding get_keyword_arguments why we assert that matrix_sequence is not None + assert matrix_sequence is not None + # Note: The function sumfact_quadrature_permutation_strategy does not # work anymore after the visiting process since get_facedir and # get_facemod are not well defined. But we need the @@ -131,6 +134,19 @@ class AccumulationOutput(SumfactKernelInterfaceBase, ImmutableRecord): def __repr__(self): return ImmutableRecord.__repr__(self) + def get_keyword_arguments(self): + """Get dictionary of keyword arguments needed to initialize this classIFIERS + + Extract keyword arguments from the ImmutableRecord and modify + accordingly. You need to set the correct matrix sequence before using + this dict to create an interface. + """ + dict = self.get_copy_kwargs() + del dict['_cost_permutation'] + del dict['_quadrature_permutation'] + dict['matrix_sequence'] = None + return dict + @property def quadrature_permutation(self): return self._quadrature_permutation diff --git a/python/dune/codegen/sumfact/basis.py b/python/dune/codegen/sumfact/basis.py index fb0b905f8f5047b4b308269f862c9ff392a6c327..067f31e7384c43d9e31875cf705234fbd8b35a91 100644 --- a/python/dune/codegen/sumfact/basis.py +++ b/python/dune/codegen/sumfact/basis.py @@ -94,6 +94,19 @@ class LFSSumfactKernelInput(SumfactKernelInterfaceBase, ImmutableRecord): def __str__(self): return repr(self) + def get_keyword_arguments(self): + """Get dictionary of keyword arguments needed to initialize this classIFIERS + + Extract keyword arguments from the ImmutableRecord and modify + accordingly. You need to set the correct matrix sequence before using + this dict to create an interface. + """ + dict = self.get_copy_kwargs() + del dict['_cost_permutation'] + del dict['_quadrature_permutation'] + dict['matrix_sequence'] = None + return dict + @property def quadrature_permutation(self): return self._quadrature_permutation diff --git a/python/dune/codegen/sumfact/geometry.py b/python/dune/codegen/sumfact/geometry.py index 7de23836ee0333fb34be71d7945a2bbbff702449..cd0d34b7a07d0e1cf341fb0a629dc3500f1684e2 100644 --- a/python/dune/codegen/sumfact/geometry.py +++ b/python/dune/codegen/sumfact/geometry.py @@ -103,6 +103,19 @@ class GeoCornersInput(SumfactKernelInterfaceBase, ImmutableRecord): def __str__(self): return repr(self) + def get_keyword_arguments(self): + """Get dictionary of keyword arguments needed to initialize this classIFIERS + + Extract keyword arguments from the ImmutableRecord and modify + accordingly. You need to set the correct matrix sequence before using + this dict to create an interface. + """ + dict = self.get_copy_kwargs() + del dict['_cost_permutation'] + del dict['_quadrature_permutation'] + dict['matrix_sequence'] = None + return dict + @property def quadrature_permutation(self): return self._quadrature_permutation diff --git a/python/dune/codegen/sumfact/vectorization.py b/python/dune/codegen/sumfact/vectorization.py index 53c442577070e69f563436fdd83c2e0fe62d5cef..8b1915932211ac594675feae4e8630dc61de779e 100644 --- a/python/dune/codegen/sumfact/vectorization.py +++ b/python/dune/codegen/sumfact/vectorization.py @@ -459,7 +459,12 @@ def get_vectorization_dict(sumfacts, vertical, horizontal, qp): seq = list(sf.matrix_sequence_quadrature_permuted) seq[slice_direction] = oldtab.copy(slice_size=vertical, slice_index=i) - kernels.append(sf.copy(matrix_sequence=tuple(seq))) + + # Create new sf kernel with new interface + kwargs = sf.interface.get_keyword_arguments() + kwargs.update({'matrix_sequence': tuple(seq)}) + newinterface = type(sf.interface)(**kwargs) + kernels.append(sf.copy(matrix_sequence=tuple(seq), interface=newinterface)) # Join the new kernels into a sum factorization node buffer = get_counted_variable("joined_buffer")