From de39c4d252ed1dd26ff1d01005595c068db6fc3d 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, 21 Nov 2017 11:15:52 +0100
Subject: [PATCH] Reserve count 2 for time variable

---
 python/dune/perftool/ufl/execution.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/python/dune/perftool/ufl/execution.py b/python/dune/perftool/ufl/execution.py
index b7942c94..30a5b915 100644
--- a/python/dune/perftool/ufl/execution.py
+++ b/python/dune/perftool/ufl/execution.py
@@ -12,7 +12,7 @@ from ufl import *
 class TrialFunction(ufl.Coefficient):
     """ A coefficient that always takes the reserved index 0 """
     def __init__(self, element, count=None):
-        if count and count is not 0:
+        if count is not None and count != 0:
             raise PerftoolUFLError("The trial function must be the coefficient of index 0 in uflpdelab")
         ufl.Coefficient.__init__(self, element, count=0)
 
@@ -20,12 +20,14 @@ class TrialFunction(ufl.Coefficient):
 class Coefficient(ufl.Coefficient):
     """ A coefficient that honors the reserved index 0. """
     def __init__(self, element, count=None):
-        if count and count is 0:
+        if count == 0:
             raise PerftoolUFLError("The coefficient of index 0 is reserved for the trial function in uflpdelab")
-        if count and count is 1:
+        if count == 1:
             raise PerftoolUFLError("The coefficient of index 1 is reserved for the jacobian apply vector in uflpdelab")
-        if not count and ufl.Coefficient._globalcount < 2:
-            count = 2
+        if count == 2:
+            raise PerftoolUFLError("The coefficient of index 2 is reserved for the time variable in uflpdelab")
+        if count is None and ufl.Coefficient._globalcount < 3:
+            count = 3
         ufl.Coefficient.__init__(self, element, count)
 
 
-- 
GitLab