* and <tt>chunk_size.second</tt> the number of columns.
*/
void
+ save(const std::string & filename,
+ const std::pair<unsigned int, unsigned int> &chunk_size =
+ std::make_pair(numbers::invalid_unsigned_int,
+ numbers::invalid_unsigned_int)) const;
+
+ /**
+ * Same as above but takes a filename as a <code>char</code> pointer.
+ *
+ * @deprecated This function is deprecated. Use the one taking <code>std::string</code> instead.
+ */
+ DEAL_II_DEPRECATED void
save(const char * filename,
const std::pair<unsigned int, unsigned int> &chunk_size =
std::make_pair(numbers::invalid_unsigned_int,
* and distribute the content to the other processes subsequently.
*/
void
+ load(const std::string &filename);
+
+ /**
+ * Same as above but takes a filename as a <code>char</code> pointer.
+ *
+ * @deprecated This function is deprecated. Use the one taking <code>std::string</code> instead.
+ */
+ DEAL_II_DEPRECATED void
load(const char *filename);
/**
* using serial routines
*/
void
- save_serial(const char * filename,
+ save_serial(const std::string & filename,
const std::pair<unsigned int, unsigned int> &chunk_size) const;
/*
* using serial routines
*/
void
- load_serial(const char *filename);
+ load_serial(const std::string &filename);
/*
* Stores the distributed matrix in @p filename
* using parallel routines
*/
void
- save_parallel(const char * filename,
+ save_parallel(const std::string & filename,
const std::pair<unsigned int, unsigned int> &chunk_size) const;
/*
* using parallel routines
*/
void
- load_parallel(const char *filename);
+ load_parallel(const std::string &filename);
/**
* Since ScaLAPACK operations notoriously change the meaning of the matrix
template <typename NumberType>
void
ScaLAPACKMatrix<NumberType>::save(
- const char * filename,
+ const std::string & filename,
const std::pair<unsigned int, unsigned int> &chunk_size) const
{
# ifndef DEAL_II_WITH_HDF5
template <typename NumberType>
void
-ScaLAPACKMatrix<NumberType>::save_serial(
+ScaLAPACKMatrix<NumberType>::save(
const char * filename,
const std::pair<unsigned int, unsigned int> &chunk_size) const
+{
+ save(std::string(filename), chunk_size);
+}
+
+
+
+template <typename NumberType>
+void
+ScaLAPACKMatrix<NumberType>::save_serial(
+ const std::string & filename,
+ const std::pair<unsigned int, unsigned int> &chunk_size) const
{
# ifndef DEAL_II_WITH_HDF5
(void)filename;
// create a new file using default properties
hid_t file_id =
- H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ H5Fcreate(filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
// modify dataset creation properties, i.e. enable chunking
hsize_t chunk_dims[2];
template <typename NumberType>
void
ScaLAPACKMatrix<NumberType>::save_parallel(
- const char * filename,
+ const std::string & filename,
const std::pair<unsigned int, unsigned int> &chunk_size) const
{
# ifndef DEAL_II_WITH_HDF5
AssertThrow(status >= 0, ExcIO());
// create a new file collectively and release property list identifier
- hid_t file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id);
- status = H5Pclose(plist_id);
+ hid_t file_id =
+ H5Fcreate(filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, plist_id);
+ status = H5Pclose(plist_id);
AssertThrow(status >= 0, ExcIO());
// As ScaLAPACK, and therefore the class ScaLAPACKMatrix, uses column-major
if (tmp.grid->this_mpi_process == 0)
{
// open file using default properties
- hid_t file_id_reopen = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
+ hid_t file_id_reopen =
+ H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
// create HDF5 enum type for LAPACKSupport::State and
// LAPACKSupport::Property
template <typename NumberType>
void
-ScaLAPACKMatrix<NumberType>::load(const char *filename)
+ScaLAPACKMatrix<NumberType>::load(const std::string &filename)
{
# ifndef DEAL_II_WITH_HDF5
(void)filename;
template <typename NumberType>
void
-ScaLAPACKMatrix<NumberType>::load_serial(const char *filename)
+ScaLAPACKMatrix<NumberType>::load(const char *filename)
+{
+ load(std::string(filename));
+}
+
+
+
+template <typename NumberType>
+void
+ScaLAPACKMatrix<NumberType>::load_serial(const std::string &filename)
{
# ifndef DEAL_II_WITH_HDF5
(void)filename;
herr_t status;
// open the file in read-only mode
- hid_t file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
+ hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
// open the dataset in the file
hid_t dataset_id = H5Dopen2(file_id, "/matrix", H5P_DEFAULT);
template <typename NumberType>
void
-ScaLAPACKMatrix<NumberType>::load_parallel(const char *filename)
+ScaLAPACKMatrix<NumberType>::load_parallel(const std::string &filename)
{
# ifndef DEAL_II_WITH_HDF5
(void)filename;
// open file collectively in read-only mode and release property list
// identifier
- hid_t file_id = H5Fopen(filename, H5F_ACC_RDONLY, plist_id);
+ hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDONLY, plist_id);
status = H5Pclose(plist_id);
AssertThrow(status >= 0, ExcIO());
size, size, grid, block_size, block_size);
scalapack_matrix = full;
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
FullMatrix<NumberType> copy(size);
scalapack_matrix_copy.copy_to(copy);
matrix = full;
matrix_one = full;
- matrix.save(filename_parallel.c_str());
- matrix_one.save(filename_serial.c_str());
+ matrix.save(filename_parallel);
+ matrix_one.save(filename_serial);
- matrix.load(filename_serial.c_str());
- matrix_one.load(filename_parallel.c_str());
+ matrix.load(filename_serial);
+ matrix_one.load(filename_parallel);
std::remove(filename_serial.c_str());
std::remove(filename_parallel.c_str());
size.first, size.second, grid, block_size, block_size);
scalapack_matrix = full;
- scalapack_matrix.save(filename.c_str(), chunk_size);
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename, chunk_size);
+ scalapack_matrix_copy.load(filename);
FullMatrix<NumberType> copy(size.first, size.second);
scalapack_matrix_copy.copy_to(copy);
size, size, grid, block_size, block_size);
scalapack_matrix.set_property(LAPACKSupport::Property::diagonal);
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
std::remove(filename.c_str());
AssertThrow(scalapack_matrix.get_property() ==
scalapack_matrix_copy.get_property(),
ExcInternalError());
scalapack_matrix.set_property(LAPACKSupport::Property::general);
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
std::remove(filename.c_str());
AssertThrow(scalapack_matrix.get_property() ==
scalapack_matrix_copy.get_property(),
ExcInternalError());
scalapack_matrix.set_property(LAPACKSupport::Property::hessenberg);
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
std::remove(filename.c_str());
AssertThrow(scalapack_matrix.get_property() ==
scalapack_matrix_copy.get_property(),
ExcInternalError());
scalapack_matrix.set_property(LAPACKSupport::Property::lower_triangular);
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
std::remove(filename.c_str());
AssertThrow(scalapack_matrix.get_property() ==
scalapack_matrix_copy.get_property(),
ExcInternalError());
scalapack_matrix.set_property(LAPACKSupport::Property::symmetric);
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
std::remove(filename.c_str());
AssertThrow(scalapack_matrix.get_property() ==
scalapack_matrix_copy.get_property(),
ExcInternalError());
scalapack_matrix.set_property(LAPACKSupport::Property::upper_triangular);
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
std::remove(filename.c_str());
AssertThrow(scalapack_matrix.get_property() ==
scalapack_matrix_copy.get_property(),
ExcInternalError());
// after construction the matrix state is LAPACKSupport::State::unusable
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
std::remove(filename.c_str());
AssertThrow(scalapack_matrix.get_state() == scalapack_matrix_copy.get_state(),
ExcInternalError());
// the assignment operator changes the state to LAPACKSupport::State::matrix
scalapack_matrix = full;
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
std::remove(filename.c_str());
AssertThrow(scalapack_matrix.get_state() == scalapack_matrix_copy.get_state(),
ExcInternalError());
// calling invert changes the state to LAPACKSupport::inverse_matrix
scalapack_matrix.set_property(LAPACKSupport::Property::symmetric);
scalapack_matrix.invert();
- scalapack_matrix.save(filename.c_str());
- scalapack_matrix_copy.load(filename.c_str());
+ scalapack_matrix.save(filename);
+ scalapack_matrix_copy.load(filename);
std::remove(filename.c_str());
AssertThrow(scalapack_matrix.get_state() == scalapack_matrix_copy.get_state(),
ExcInternalError());
size, size, grid_1, block_size, block_size);
scalapack_matrix_1 = full;
- scalapack_matrix_1.save(filename.c_str());
+ scalapack_matrix_1.save(filename);
ScaLAPACKMatrix<NumberType> scalapack_matrix(filename,
grid,