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
TurTLE
TurTLE
Commits
6ddcee26
Commit
6ddcee26
authored
Jan 22, 2020
by
Cristian Lalescu
Browse files
Merge branch 'bugfix/kraichnan_checkpointing' into develop
parents
82f9568b
93bfe5a8
Pipeline
#67559
passed with stage
in 12 minutes and 12 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
cpp/full_code/kraichnan_field.cpp
View file @
6ddcee26
...
...
@@ -104,26 +104,17 @@ int kraichnan_field<rnumber>::initialize(void)
DEBUG_MSG
(
"Coefficient: %g
\n
"
,
this
->
spectrum_coefficient
);
this
->
generate_random_velocity
();
// is this the first iteration?
if
((
this
->
iteration
==
0
)
and
(
this
->
output_velocity
==
1
))
{
// if yes, generate random field and save it
this
->
generate_random_velocity
();
this
->
velocity
->
io
(
this
->
get_current_fname
(),
"velocity"
,
this
->
iteration
,
false
);
}
else
{
// if not, read the random field that exists in the checkpoint file
this
->
velocity
->
io
(
this
->
get_current_fname
(),
"velocity"
,
this
->
iteration
,
true
);
}
return
EXIT_SUCCESS
;
}
...
...
@@ -336,14 +327,23 @@ void kraichnan_field<rnumber>::update_checkpoint()
hsize_t
fields_stored
;
hid_t
fid
,
group_id
;
fid
=
H5Fopen
(
fname
.
c_str
(),
H5F_ACC_RDONLY
,
H5P_DEFAULT
);
group_id
=
H5Gopen
(
fid
,
"velocity/real"
,
H5P_DEFAULT
);
H5Gget_num_objs
(
group_id
=
H5Gopen
(
fid
,
"tracers0/state"
,
H5P_DEFAULT
);
bool
dset_exists
;
if
(
group_id
>
0
)
{
H5Gget_num_objs
(
group_id
,
&
fields_stored
);
bool
dset_exists
=
H5Lexists
(
dset_exists
=
H5Lexists
(
group_id
,
std
::
to_string
(
this
->
iteration
).
c_str
(),
H5P_DEFAULT
);
}
else
{
fields_stored
=
0
;
dset_exists
=
false
;
}
H5Gclose
(
group_id
);
H5Fclose
(
fid
);
if
((
int
(
fields_stored
)
>=
this
->
checkpoints_per_file
)
&&
...
...
@@ -360,13 +360,13 @@ void kraichnan_field<rnumber>::update_checkpoint()
H5P_DEFAULT
);
hid_t
gg
=
H5Gcreate
(
fid
,
"
velocity
"
,
"
tracers0
"
,
H5P_DEFAULT
,
H5P_DEFAULT
,
H5P_DEFAULT
);
hid_t
ggg
=
H5Gcreate
(
gg
,
"
real
"
,
"
state
"
,
H5P_DEFAULT
,
H5P_DEFAULT
,
H5P_DEFAULT
);
...
...
cpp/particles/particles_output_hdf5.hpp
View file @
6ddcee26
...
...
@@ -29,6 +29,7 @@
#include
<memory>
#include
<vector>
#include
<hdf5.h>
#include
<sys/stat.h>
#include
"abstract_particles_output.hpp"
#include
"scope_timer.hpp"
...
...
@@ -140,10 +141,23 @@ public:
if
(
Parent
::
isInvolved
()){
if
(
Parent
::
getMyRank
()
==
0
)
{
hid_t
file_id
=
H5Fopen
(
bool
file_exists
=
false
;
{
struct
stat
file_buffer
;
file_exists
=
(
stat
(
filename
.
c_str
(),
&
file_buffer
)
==
0
);
}
hid_t
file_id
;
if
(
file_exists
)
file_id
=
H5Fopen
(
filename
.
c_str
(),
H5F_ACC_RDWR
|
H5F_ACC_DEBUG
,
H5P_DEFAULT
);
else
file_id
=
H5Fcreate
(
filename
.
c_str
(),
H5F_ACC_EXCL
|
H5F_ACC_DEBUG
,
H5P_DEFAULT
,
H5P_DEFAULT
);
assert
(
file_id
>=
0
);
bool
group_exists
=
H5Lexists
(
file_id
,
...
...
Write
Preview
Supports
Markdown
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