Skip to content
GitLab
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
5cbe6880
Commit
5cbe6880
authored
May 20, 2016
by
csongor
Browse files
WIP: dim, dof and shape fix
parent
d8b9b918
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty_core.py
View file @
5cbe6880
...
...
@@ -1994,7 +1994,12 @@ class field(object):
return
gotten
def
get_shape
(
self
):
global_shape
=
np
.
sum
([
space
.
get_shape
()
for
space
in
self
.
domain
])
if
len
(
self
.
domain
)
>
1
:
global_shape
=
reduce
(
lambda
x
,
y
:
x
.
get_shape
()
+
y
.
get_shape
(),
self
.
domain
)
else
:
global_shape
=
self
.
domain
[
0
].
get_shape
()
if
isinstance
(
global_shape
,
tuple
):
return
global_shape
else
:
...
...
@@ -2017,10 +2022,14 @@ class field(object):
Dimension of space.
"""
return
np
.
prod
(
np
.
sum
([
space
.
get_shape
()
for
space
in
self
.
domain
]
))
return
np
.
prod
(
self
.
get_shape
(
))
def
get_dof
(
self
,
split
=
False
):
return
np
.
sum
([
len
(
space
.
get_shape
())
for
space
in
self
.
domain
])
dim
=
self
.
get_dim
()
if
np
.
issubdtype
(
self
.
dtype
,
np
.
complex
):
return
2
*
dim
else
:
return
dim
def
_map
(
self
,
function
,
*
args
):
return
utilities
.
field_map
(
self
.
get_shape
(),
function
,
*
args
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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