#ifdef DEAL_II_WITH_HDF5
+# include <deal.II/base/array_view.h>
# include <deal.II/base/hdf5.h>
# include <deal.II/lac/full_matrix.h>
- // This function returns the pointer to the raw data of a container
- template <typename number>
- void *
- get_container_pointer(std::vector<number> &data)
- {
- // It is very important to pass the variable "data" by reference otherwise
- // the pointer will be wrong
- return data.data();
- }
-
-
-
- template <typename number>
- void *
- get_container_pointer(Vector<number> &data)
- {
- // It is very important to pass the variable "data" by reference otherwise
- // the pointer will be wrong.
- // Use the first element of FullMatrix to get the pointer to the raw data
- return &data[0];
- }
-
-
-
- template <typename number>
- void *
- get_container_pointer(FullMatrix<number> &data)
- {
- // It is very important to pass the variable "data" by reference otherwise
- // the pointer will be wrong.
- // Use the first element of FullMatrix to get the pointer to the raw data
- return &data[0][0];
- }
-
-
-
- // This function returns the pointer to the raw data of a container
- // The returned pointer is const, which means that it can be used only to
- // read the data
- template <typename number>
- const void *
- get_container_const_pointer(const std::vector<number> &data)
- {
- // It is very important to pass the variable "data" by reference otherwise
- // the pointer will be wrong
- return data.data();
- }
-
-
-
- template <typename number>
- const void *
- get_container_const_pointer(const Vector<number> &data)
- {
- // It is very important to pass the variable "data" by reference otherwise
- // the pointer will be wrong.
- // Use the first element of FullMatrix to get the pointer to the raw data
- return &*data.begin();
- }
-
-
-
- template <typename number>
- const void *
- get_container_const_pointer(const FullMatrix<number> &data)
- {
- // It is very important to pass the variable "data" by reference otherwise
- // the pointer will be wrong.
- // Use the first element of FullMatrix to get the pointer to the raw data
- return &data[0][0];
- }
-
-
-
// This function initializes and returns a container of type std::vector,
// Vector or FullMatrix. The function does not set the values of the
// elements of the container. The container can store data of a HDF5 dataset
H5S_ALL,
H5S_ALL,
plist,
- internal::get_container_pointer(data));
+ make_array_view(data).data());
Assert(ret >= 0, ExcInternalError());
if (mpi)
memory_dataspace,
*dataspace,
plist,
- internal::get_container_pointer(data));
+ make_array_view(data).data());
Assert(ret >= 0, ExcMessage("Error at H5Dread"));
if (mpi)
memory_dataspace,
*dataspace,
plist,
- internal::get_container_pointer(data));
+ make_array_view(data).data());
Assert(ret >= 0, ExcMessage("Error at H5Dread"));
if (mpi)
memory_dataspace,
*dataspace,
plist,
- internal::get_container_pointer(data));
+ make_array_view(data).data());
Assert(ret >= 0, ExcMessage("Error at H5Dread"));
if (mpi)
H5S_ALL,
H5S_ALL,
plist,
- internal::get_container_const_pointer(data));
+ make_array_view(data).data());
Assert(ret >= 0, ExcMessage("Error at H5Dwrite"));
if (mpi)
memory_dataspace,
*dataspace,
plist,
- internal::get_container_const_pointer(data));
+ make_array_view(data).data());
Assert(ret >= 0, ExcMessage("Error at H5Dwrite"));
if (mpi)
memory_dataspace,
*dataspace,
plist,
- internal::get_container_const_pointer(data));
+ make_array_view(data).data());
Assert(ret >= 0, ExcMessage("Error at H5Dwrite"));
if (mpi)
memory_dataspace,
*dataspace,
plist,
- internal::get_container_const_pointer(data));
+ make_array_view(data).data());
Assert(ret >= 0, ExcMessage("Error at H5Dwrite"));
if (mpi)