diff --git a/cpp/full_code/kraichnan_field.cpp b/cpp/full_code/kraichnan_field.cpp index 6712354566f66649981d0e3126cb373e2cc0dfe5..3ec76efc03ce3c39ab2151cfaac27346e71ed950 100644 --- a/cpp/full_code/kraichnan_field.cpp +++ b/cpp/full_code/kraichnan_field.cpp @@ -327,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) && @@ -351,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);