From 903f8561dc7f752eb020516d55ac5a826be6efa8 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Thu, 7 Apr 2016 14:57:02 +0200 Subject: [PATCH] Implement the IndexSum handler correctly --- python/dune/perftool/loopy/transformer.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/python/dune/perftool/loopy/transformer.py b/python/dune/perftool/loopy/transformer.py index 3ad304f1..71681e95 100644 --- a/python/dune/perftool/loopy/transformer.py +++ b/python/dune/perftool/loopy/transformer.py @@ -53,11 +53,25 @@ class UFL2LoopyVisitor(ModifiedTerminalTracker, UFL2PymbolicMapper): super(UFL2LoopyVisitor, self).__init__() def coefficient(self, o): - # All trial functions should already be handled by the TrialFunctionExtractor class! + # All trial functions should already be handled assert o.count() != 0 # TODO implement non-trialfunction coefficients raise NotImplementedError + def index_sum(self, o): + from dune.perftool.ufl.shape import determine_shape + + # Define an iname for each of the indices in the multiindex + for i in o.ufl_operands[1].indices(): + shape = determine_shape(o.ufl_operands[0], i) + from dune.perftool.pdelab import name_index + name = name_index(i) + iname(name) + domain(name, shape) + + # Now continue processing the expression + return self.call(o.ufl_operands[0]) + # TODO use multiple inheritance and have a geometry transformer in the pdelab subpackage def facet_area(self, o): from pymbolic.primitives import Variable -- GitLab