]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Get the pointer to the raw data of FullMatrix
authorDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Tue, 14 Aug 2018 22:12:26 +0000 (00:12 +0200)
committerDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Wed, 9 Jan 2019 17:23:00 +0000 (18:23 +0100)
source/base/hdf5.cc

index d1c5a96e667beb79a2c5c6475a116cc2fecc865c..e040012f027893fe65bf20b48b357e7c2c715a0a 100644 (file)
@@ -136,7 +136,8 @@ namespace HDF5
     get_container_pointer(FullMatrix<T> &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)
       {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.