Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
1cdb0b5e
Commit
1cdb0b5e
authored
Sep 11, 2018
by
Martin Reinecke
Browse files
fetch some useful things from mpi_experiments
parent
21024ed0
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty5/domain_tuple.py
View file @
1cdb0b5e
...
...
@@ -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
,))
@
staticmethod
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
)
nifty5/multi_domain.py
View file @
1cdb0b5e
...
...
@@ -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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment