Skip to content
Snippets Groups Projects
Commit 353244cd authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

fix write

parent 92ad8b22
Branches
Tags
No related merge requests found
...@@ -273,25 +273,28 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::write( ...@@ -273,25 +273,28 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::write(
MPI_SUM, MPI_SUM,
this->comm); this->comm);
delete[] yy; delete[] yy;
std::string temp_string = (std::string(this->name) + if (this->myrank == 0)
std::string("/") + {
std::string(dset_name)); std::string temp_string = (std::string(this->name) +
hid_t dset = H5Dopen(data_file_id, temp_string.c_str(), H5P_DEFAULT); std::string("/") +
hid_t mspace, wspace; std::string(dset_name));
hsize_t count[3], offset[3]; hid_t dset = H5Dopen(data_file_id, temp_string.c_str(), H5P_DEFAULT);
wspace = H5Dget_space(dset); hid_t mspace, wspace;
H5Sget_simple_extent_dims(wspace, count, NULL); hsize_t count[3], offset[3];
count[0] = 1; wspace = H5Dget_space(dset);
offset[0] = this->iteration / this->traj_skip; H5Sget_simple_extent_dims(wspace, count, NULL);
offset[1] = 0; count[0] = 1;
offset[2] = 0; offset[0] = this->iteration / this->traj_skip;
mspace = H5Screate_simple(3, count, NULL); offset[1] = 0;
H5Sselect_hyperslab(wspace, H5S_SELECT_SET, offset, NULL, count, NULL); offset[2] = 0;
H5Dwrite(dset, H5T_NATIVE_DOUBLE, mspace, wspace, H5P_DEFAULT, data); mspace = H5Screate_simple(3, count, NULL);
H5Sselect_hyperslab(wspace, H5S_SELECT_SET, offset, NULL, count, NULL);
H5Dwrite(dset, H5T_NATIVE_DOUBLE, mspace, wspace, H5P_DEFAULT, data);
H5Sclose(mspace);
H5Sclose(wspace);
H5Dclose(dset);
}
delete[] data; delete[] data;
H5Sclose(mspace);
H5Sclose(wspace);
H5Dclose(dset);
} }
template <int particle_type, class rnumber, int interp_neighbours> template <int particle_type, class rnumber, int interp_neighbours>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment