Commit 9f326661 authored by Martin Reinecke's avatar Martin Reinecke Committed by Philipp Arras
Browse files

debugging helper


Add counter
parent 3d1fadb6
......@@ -737,6 +737,8 @@ class Field(object):
return self.isEquivalentTo(other)
for op in ["__add__", "__radd__", "__iadd__",
"__sub__", "__rsub__", "__isub__",
"__mul__", "__rmul__", "__imul__",
......@@ -747,10 +749,17 @@ for op in ["__add__", "__radd__", "__iadd__",
"__lt__", "__le__", "__gt__", "__ge__", "__eq__", "__ne__"]:
def func(op):
def func2(self, other):
global COUNTER
# if other is a field, make sure that the domains match
if isinstance(other, Field):
if other._domain != self._domain:
raise ValueError("domains are incompatible.")
if (self==0).all() or (other==0).all():
print("({}) zero Field detected".format(COUNTER))
print("op = ", op)
# import traceback
# traceback.print_stack()
tval = getattr(self.val, op)(other.val)
return self if tval is self.val else Field(self._domain, tval)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment