From 3bf66a7f9eeccded6d96abde96f97da8aa2fa213 Mon Sep 17 00:00:00 2001 From: "[6~" <inform@tiker.net> Date: Sun, 17 May 2020 14:08:15 -0500 Subject: [PATCH] Equality comparison and hashability for DTAG_BOUNDARY --- grudge/symbolic/primitives.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/grudge/symbolic/primitives.py b/grudge/symbolic/primitives.py index 4f50b636..0e57fcef 100644 --- a/grudge/symbolic/primitives.py +++ b/grudge/symbolic/primitives.py @@ -124,6 +124,18 @@ class DTAG_BOUNDARY: # noqa def __init__(self, tag): self.tag = tag + def __eq__(self, other): + return isinstance(other, DTAG_BOUNDARY) and self.tag == other.tag + + def __ne__(self, other): + return not self.__eq__(other) + + def __hash__(self): + return hash(type(self)) ^ hash(self.tag) + + def __repr__(self): + return "<%s(%s)>" % (type(self).__name__, repr(self.tag)) + class QTAG_NONE: # noqa pass -- GitLab