Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pySDC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
atml-ati
pySDC
Commits
a132a92f
Commit
a132a92f
authored
4 months ago
by
Thibaut Lunet
Browse files
Options
Downloads
Patches
Plain Diff
TL: corrected Rectilinear.toVTR for paraview groups
parent
1874244a
No related branches found
No related tags found
No related merge requests found
Pipeline
#253474
passed
4 months ago
Stage: benchmark
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pySDC/helpers/fieldsIO.py
+7
-8
7 additions, 8 deletions
pySDC/helpers/fieldsIO.py
pySDC/tests/test_helpers/test_fieldsIO.py
+2
-4
2 additions, 4 deletions
pySDC/tests/test_helpers/test_fieldsIO.py
with
9 additions
and
12 deletions
pySDC/helpers/fieldsIO.py
+
7
−
8
View file @
a132a92f
...
@@ -457,7 +457,7 @@ class Rectilinear(Scalar):
...
@@ -457,7 +457,7 @@ class Rectilinear(Scalar):
"""
Number of degrees of freedom for one variable
"""
"""
Number of degrees of freedom for one variable
"""
return
np
.
prod
(
self
.
gridSizes
)
return
np
.
prod
(
self
.
gridSizes
)
def
toVTR
(
self
,
baseName
,
varNames
,
suffix
=
"
{:06d}_t={:1.2f}s
"
):
def
toVTR
(
self
,
baseName
,
varNames
,
idxFormat
=
"
{:06d}
"
):
"""
"""
Convert all 3D fields stored in binary format (FieldsIO) into a list
Convert all 3D fields stored in binary format (FieldsIO) into a list
of VTR files, that can be read later with Paraview or equivalent to
of VTR files, that can be read later with Paraview or equivalent to
...
@@ -469,10 +469,9 @@ class Rectilinear(Scalar):
...
@@ -469,10 +469,9 @@ class Rectilinear(Scalar):
Base name of the VTR file.
Base name of the VTR file.
varNames : list[str]
varNames : list[str]
Variable names of the fields.
Variable names of the fields.
suffix : str, optional
idxFormat : str, optional
Formating string for the suffix of the VTR file, containing the
Formatting string for the index of the VTR file.
index in first position, and the time in second position.
The default is
"
{:06d}
"
.
The default is
"
{:06d}_t={:1.2f}s
"
.
Example
Example
-------
-------
...
@@ -486,10 +485,10 @@ class Rectilinear(Scalar):
...
@@ -486,10 +485,10 @@ class Rectilinear(Scalar):
assert
self
.
dim
==
3
,
"
can only be used with 3D fields
"
assert
self
.
dim
==
3
,
"
can only be used with 3D fields
"
from
pySDC.helpers.vtkIO
import
writeToVTR
from
pySDC.helpers.vtkIO
import
writeToVTR
template
=
f
"
{
baseName
}
_
{
suffix
}
"
template
=
f
"
{
baseName
}
_
{
idxFormat
}
"
for
i
in
range
(
self
.
nFields
):
for
i
in
range
(
self
.
nFields
):
t
,
u
=
self
.
readField
(
i
)
_
,
u
=
self
.
readField
(
i
)
writeToVTR
(
template
.
format
(
i
,
t
),
u
,
self
.
header
[
"
coords
"
],
varNames
)
writeToVTR
(
template
.
format
(
i
),
u
,
self
.
header
[
"
coords
"
],
varNames
)
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# MPI-parallel implementation
# MPI-parallel implementation
...
...
This diff is collapsed.
Click to expand it.
pySDC/tests/test_helpers/test_fieldsIO.py
+
2
−
4
View file @
a132a92f
...
@@ -184,12 +184,10 @@ def testToVTR(nVar, nX, nY, nZ, nSteps):
...
@@ -184,12 +184,10 @@ def testToVTR(nVar, nX, nY, nZ, nSteps):
vtrFiles
=
glob
.
glob
(
"
testToVTR*.vtr
"
)
vtrFiles
=
glob
.
glob
(
"
testToVTR*.vtr
"
)
assert
len
(
vtrFiles
)
==
file
.
nFields
assert
len
(
vtrFiles
)
==
file
.
nFields
vtrFiles
.
sort
(
key
=
lambda
name
:
int
(
name
.
split
(
"
_
"
)[
1
]))
vtrFiles
.
sort
(
key
=
lambda
name
:
int
(
name
.
split
(
"
_
"
)[
-
1
][:
-
4
]))
for
i
,
vFile
in
enumerate
(
vtrFiles
):
for
i
,
vFile
in
enumerate
(
vtrFiles
):
uVTR
,
coords
,
_
=
readFromVTR
(
vFile
)
uVTR
,
coords
,
_
=
readFromVTR
(
vFile
)
tVTR
=
float
(
vFile
.
split
(
"
_t=
"
)[
-
1
].
split
(
"
s.vtr
"
)[
0
])
_
,
uFile
=
file
.
readField
(
i
)
tFile
,
uFile
=
file
.
readField
(
i
)
assert
np
.
allclose
(
tFile
,
tVTR
),
"
mismatch between field times
"
assert
np
.
allclose
(
uFile
,
uVTR
),
"
mismatch between data
"
assert
np
.
allclose
(
uFile
,
uVTR
),
"
mismatch between data
"
for
i
,
(
xVTR
,
xFile
)
in
enumerate
(
zip
(
coords
,
file
.
header
[
"
coords
"
])):
for
i
,
(
xVTR
,
xFile
)
in
enumerate
(
zip
(
coords
,
file
.
header
[
"
coords
"
])):
assert
np
.
allclose
(
xVTR
,
xFile
),
f
"
coordinate mismatch in dir.
{
i
}
"
assert
np
.
allclose
(
xVTR
,
xFile
),
f
"
coordinate mismatch in dir.
{
i
}
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment