Commit 1cdb0b5e authored by Martin Reinecke's avatar Martin Reinecke
Browse files

fetch some useful things from mpi_experiments

parent 21024ed0
......@@ -149,6 +149,9 @@ class DomainTuple(object):
return ("DomainTuple, len: {}\n".format(len(self)) +
"\n".join(str(i) for i in self))
def __reduce__(self):
return (_unpickleDomainTuple, (self._dom,))
def scalar_domain():
if DomainTuple._scalarDomain is None:
......@@ -158,3 +161,7 @@ class DomainTuple(object):
def __repr__(self):
subs = "\n".join(sub.__repr__() for sub in self._dom)
return "DomainTuple:\n"+utilities.indent(subs)
def _unpickleDomainTuple(*args):
return DomainTuple.make(*args)
......@@ -73,6 +73,9 @@ class MultiDomain(object):
def keys(self):
return self._keys
def values(self):
return self._domains
def domains(self):
return self._domains
......@@ -95,7 +98,7 @@ class MultiDomain(object):
def __eq__(self, x):
if self is x:
return True
return self.items() == x.items()
return list(self.items()) == list(x.items())
def __ne__(self, x):
return not self.__eq__(x)
......@@ -121,7 +124,14 @@ class MultiDomain(object):
res[key] = subdom
return MultiDomain.make(res)
def __reduce__(self):
return (_unpickleMultiDomain, (dict(self),))
def __repr__(self):
subs = "\n".join("{}:\n {}".format(key, dom.__repr__())
for key, dom in self.items())
return "MultiDomain:\n"+indent(subs)
def _unpickleMultiDomain(*args):
return MultiDomain.make(*args)
Markdown is supported
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