From 3091caac2a350cc8aba0d16f8404c0aa6482ec3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20He=C3=9F?= <rene.hess@iwr.uni-heidelberg.de>
Date: Tue, 8 Nov 2016 13:20:20 +0100
Subject: [PATCH] Dummy sumfact trialfunction gradient function

---
 python/dune/perftool/sumfact/__init__.py |  4 ++++
 python/dune/perftool/sumfact/basis.py    | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/python/dune/perftool/sumfact/__init__.py b/python/dune/perftool/sumfact/__init__.py
index c4de2b61..16ab4fd1 100644
--- a/python/dune/perftool/sumfact/__init__.py
+++ b/python/dune/perftool/sumfact/__init__.py
@@ -5,6 +5,7 @@ from dune.perftool.sumfact.quadrature import (quadrature_inames,
 from dune.perftool.sumfact.basis import (lfs_inames,
                                          pymbolic_basis,
                                          pymbolic_trialfunction,
+                                         pymbolic_trialfunction_gradient,
                                          )
 
 from dune.perftool.pdelab import PDELabInterface
@@ -17,6 +18,9 @@ class SumFactInterface(PDELabInterface):
     def pymbolic_basis(self, element, restriction, number):
         return pymbolic_basis(element, restriction, number)
 
+    def pymbolic_trialfunction_gradient(self, element, restriction, component):
+        return pymbolic_trialfunction_gradient(element, restriction, component)
+
     def pymbolic_trialfunction(self, element, restriction, component):
         return pymbolic_trialfunction(element, restriction, component)
 
diff --git a/python/dune/perftool/sumfact/basis.py b/python/dune/perftool/sumfact/basis.py
index 0d625679..fb4b411c 100644
--- a/python/dune/perftool/sumfact/basis.py
+++ b/python/dune/perftool/sumfact/basis.py
@@ -31,6 +31,19 @@ from pytools import product
 import pymbolic.primitives as prim
 
 
+@cached
+def pymbolic_trialfunction_gradient(element, restriction, component):
+    # palpo TODO -> copied from argument.py
+    rawname = "gradu" + "_".join(str(c) for c in component)
+    name = restricted_name(rawname, restriction)
+    from dune.perftool.pdelab.argument import name_coefficientcontainer
+    container = name_coefficientcontainer(restriction)
+    from dune.perftool.pdelab.argument import evaluate_coefficient_gradient
+    evaluate_coefficient_gradient(element, name, container, restriction, component)
+    from pymbolic.primitives import Variable
+    return Variable(name)
+
+
 @cached
 def pymbolic_trialfunction(element, restriction, component):
     theta = name_theta()
-- 
GitLab