Skip to content
Snippets Groups Projects
Commit de39c4d2 authored by René Heß's avatar René Heß
Browse files

Reserve count 2 for time variable

parent 005d3848
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment