From: Daniel Garcia-Sanchez Date: Tue, 14 Aug 2018 22:12:26 +0000 (+0200) Subject: Get the pointer to the raw data of FullMatrix X-Git-Tag: v9.1.0-rc1~453^2~68 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=956bb8ceb5a5d353c0b00cf3e599c8beb64fd0f3;p=dealii.git Get the pointer to the raw data of FullMatrix --- diff --git a/source/base/hdf5.cc b/source/base/hdf5.cc index d1c5a96e66..e040012f02 100644 --- a/source/base/hdf5.cc +++ b/source/base/hdf5.cc @@ -136,7 +136,8 @@ namespace HDF5 get_container_pointer(FullMatrix &data) { // It is very important to pass the variable "data" by reference otherwise - // the pointer will be wrong + // the pointer will be wrong. + // Use the first element of FullMatrix to get the pointer to the raw data return &data[0][0]; } @@ -210,11 +211,7 @@ namespace HDF5 // user has to free the memory. // // Todo: - // - In debug mode, check the type of the attribute. If it is not a variable - // length string raise an exception - // - Use valgrind to check that there are no memory leaks // - Use H5Dvlen_reclaim instead of free - // - Use collective char * string_out; hid_t attr; @@ -514,9 +511,8 @@ namespace HDF5 plist = H5P_DEFAULT; } - // The iterator of FullMatrix has to be converted to a pointer to the raw - // data - H5Dwrite(*hdf5_reference, *t_type, H5S_ALL, H5S_ALL, plist, &*data.begin()); + // Use the first element of FullMatrix to get the pointer to the raw data + H5Dwrite(*hdf5_reference, *t_type, H5S_ALL, H5S_ALL, plist, &data[0][0]); if (mpi) {