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
Tom Harke
pystencils
Commits
a78c0879
Commit
a78c0879
authored
Feb 15, 2018
by
Martin Bauer
Browse files
Datahandling VTK fix
parent
8ecc7676
Changes
2
Hide whitespace changes
Inline
Side-by-side
datahandling/parallel_datahandling.py
View file @
a78c0879
...
...
@@ -6,8 +6,10 @@ from pystencils.utils import DotDict
import
waLBerla
as
wlb
import
warnings
class
ParallelDataHandling
(
DataHandling
):
GPU_DATA_PREFIX
=
"gpu_"
VTK_COUNTER
=
0
def
__init__
(
self
,
blocks
,
defaultGhostLayers
=
1
,
defaultLayout
=
'SoA'
,
dim
=
3
):
"""
...
...
@@ -294,7 +296,8 @@ class ParallelDataHandling(DataHandling):
ghostLayers
=
0
if
ghostLayers
is
True
:
ghostLayers
=
min
(
self
.
ghostLayersOfField
(
n
)
for
n
in
dataNames
)
fileName
=
"%s_%02d"
%
(
fileName
,
ParallelDataHandling
.
VTK_COUNTER
)
ParallelDataHandling
.
VTK_COUNTER
+=
1
output
=
wlb
.
vtk
.
makeOutput
(
self
.
blocks
,
fileName
,
ghostLayers
=
ghostLayers
)
for
n
in
dataNames
:
output
.
addCellDataWriter
(
wlb
.
field
.
createVTKWriter
(
self
.
blocks
,
n
))
...
...
datahandling/serial_datahandling.py
View file @
a78c0879
...
...
@@ -304,17 +304,21 @@ class SerialDataHandling(DataHandling):
for
name
in
dataNames
:
field
=
self
.
_getFieldWithGivenNumberOfGhostLayers
(
name
,
ghostLayers
)
if
self
.
dim
==
2
:
field
=
field
[:,
:,
np
.
newaxis
]
cellData
[
name
]
=
field
[:,
:,
np
.
newaxis
]
if
len
(
field
.
shape
)
==
3
:
field
=
np
.
ascontiguousarray
(
field
)
cellData
[
name
]
=
np
.
ascontiguousarray
(
field
)
elif
len
(
field
.
shape
)
==
4
:
field
=
[
np
.
ascontiguousarray
(
field
[...,
i
])
for
i
in
range
(
field
.
shape
[
-
1
])]
if
len
(
field
)
==
2
:
field
.
append
(
np
.
zeros_like
(
field
[
0
]))
field
=
tuple
(
field
)
fSize
=
field
.
shape
[
-
1
]
if
fSize
==
self
.
dim
:
field
=
[
np
.
ascontiguousarray
(
field
[...,
i
])
for
i
in
range
(
fSize
)]
if
len
(
field
)
==
2
:
field
.
append
(
np
.
zeros_like
(
field
[
0
]))
cellData
[
name
]
=
tuple
(
field
)
else
:
for
i
in
range
(
fSize
):
cellData
[
"%s[%d]"
%
(
name
,
i
)]
=
np
.
ascontiguousarray
(
field
[...,
i
])
else
:
assert
False
cellData
[
name
]
=
field
imageToVTK
(
fullFileName
,
cellData
=
cellData
)
return
writer
...
...
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