Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
particle_methods
hysop
Commits
3200aecb
Commit
3200aecb
authored
11 years ago
by
Franck Pérignon
Browse files
Options
Downloads
Patches
Plain Diff
allow xmf output every time step
parent
76e3c0be
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
HySoP/hysop/operator/monitors/printer.py
+13
-2
13 additions, 2 deletions
HySoP/hysop/operator/monitors/printer.py
with
13 additions
and
2 deletions
HySoP/hysop/operator/monitors/printer.py
+
13
−
2
View file @
3200aecb
...
...
@@ -25,7 +25,7 @@ class Printer(Monitoring):
Print field(s) values on a given topo, in HDF5 or VTK format.
"""
def
__init__
(
self
,
variables
,
topo
,
prefix
=
None
,
frequency
=
1
,
formattype
=
None
,
task_id
=
None
):
frequency
=
1
,
formattype
=
None
,
task_id
=
None
,
xmfalways
=
False
):
"""
Create a results printer for given fields, prefix
prefix (relative path) and an output frequency.
...
...
@@ -35,6 +35,8 @@ class Printer(Monitoring):
@param prefix output file name. Default is None ==> no output.
Full or relative path.
@param formattype : output file format, default=vtk.
@param xmfalways : true if xmf output must be done every time
an hdf5 file is created
"""
Monitoring
.
__init__
(
self
,
variables
,
topo
,
task_id
=
task_id
)
assert
frequency
>
0
...
...
@@ -86,6 +88,8 @@ class Printer(Monitoring):
self
.
_get_filename
=
lambda
i
:
self
.
prefix
+
\
"
_{0:05d}
"
.
format
(
i
)
+
'
.h5
'
self
.
step
=
self
.
_step_HDF5
if
xmfalways
:
self
.
step
=
self
.
_step_HDF5_XMF
elif
self
.
formattype
==
DATA
:
self
.
_get_filename
=
lambda
i
:
self
.
prefix
+
\
"
_{0}_{1:05d}.dat
"
.
format
(
self
.
topo
.
rank
,
i
)
...
...
@@ -117,7 +121,7 @@ class Printer(Monitoring):
self
.
step
(
simulation
)
self
.
_count
+=
1
def
finaliz
e
(
self
):
def
createXMFFil
e
(
self
):
if
self
.
formattype
==
HDF5
and
self
.
topo
.
rank
==
self
.
io_rank
:
# Write the xmf file driving all h5 files.
# Writing only one file
...
...
@@ -139,6 +143,9 @@ class Printer(Monitoring):
f
.
write
(
"
</Domain>
\n
"
)
f
.
write
(
"
</Xdmf>
\n
"
)
f
.
close
()
def
finalize
(
self
):
self
.
createXMFFile
()
Monitoring
.
finalize
(
self
)
def
_build_vtk_dict
(
self
):
...
...
@@ -217,6 +224,10 @@ class Printer(Monitoring):
f
.
close
()
def
_step_HDF5_XMF
(
self
,
simu
):
self
.
_step_HDF5
(
simu
)
self
.
createXMFFile
()
def
_step_DATA
(
self
,
simu
):
f
=
open
(
self
.
_get_filename
(
self
.
_count
),
'
w
'
)
shape
=
self
.
topo
.
mesh
.
resolution
...
...
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