From: Daniel Garcia-Sanchez Date: Mon, 29 Oct 2018 21:18:27 +0000 (+0100) Subject: Rename enum Mode X-Git-Tag: v9.1.0-rc1~453^2~21 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c41537331c5aba89e3935d8e703a74bdc439761f;p=dealii.git Rename enum Mode --- diff --git a/include/deal.II/base/hdf5.h b/include/deal.II/base/hdf5.h index a51feb221d..2b0fd84bae 100644 --- a/include/deal.II/base/hdf5.h +++ b/include/deal.II/base/hdf5.h @@ -934,7 +934,7 @@ namespace HDF5 /** * Group access mode */ - enum class Mode + enum class GroupAccessMode { /** * Creates a new group @@ -952,10 +952,10 @@ namespace HDF5 * parallel. This is an internal constructor, the functions group() and * create_group() should be used to open or create a group. */ - Group(const std::string &name, - const Group & parent_group, - const bool mpi, - const Mode mode); + Group(const std::string & name, + const Group & parent_group, + const bool mpi, + const GroupAccessMode mode); /** * Internal constructor used by File. The constructor sets the protected @@ -1032,7 +1032,7 @@ namespace HDF5 /** * File access mode */ - enum class Mode + enum class FileAccessMode { /** * Create file, truncate if exists @@ -1052,10 +1052,10 @@ namespace HDF5 * File(const std::string &, const Mode) * should be used to open or create HDF5 files. */ - File(const std::string &name, - const bool mpi, - const MPI_Comm mpi_communicator, - const Mode mode); + File(const std::string & name, + const bool mpi, + const MPI_Comm mpi_communicator, + const FileAccessMode mode); public: /** @@ -1065,16 +1065,17 @@ namespace HDF5 * defines the processes that participate in this call; `MPI_COMM_WORLD` is * a common value for the MPI communicator. */ - File(const std::string &name, - const MPI_Comm mpi_communicator, - const Mode mode = Mode::create); + File(const std::string & name, + const MPI_Comm mpi_communicator, + const FileAccessMode mode = FileAccessMode::create); /** * Creates or opens a hdf5 file for serial operations. This call does not * require MPI support. It creates or opens a HDF5 file depending on the * value of @p mode. */ - File(const std::string &name, const Mode mode = Mode::create); + File(const std::string & name, + const FileAccessMode mode = FileAccessMode::create); }; } // namespace HDF5 diff --git a/source/base/hdf5.cc b/source/base/hdf5.cc index 65e95fffae..7d1a55b786 100644 --- a/source/base/hdf5.cc +++ b/source/base/hdf5.cc @@ -1434,10 +1434,10 @@ namespace HDF5 - Group::Group(const std::string &name, - const Group & parentGroup, - const bool mpi, - const Mode mode) + Group::Group(const std::string & name, + const Group & parentGroup, + const bool mpi, + const GroupAccessMode mode) : HDF5Object(name, mpi) { hdf5_reference = std::shared_ptr(new hid_t, [](auto pointer) { @@ -1447,7 +1447,7 @@ namespace HDF5 }); switch (mode) { - case (Mode::create): + case (GroupAccessMode::create): *hdf5_reference = H5Gcreate2(*(parentGroup.hdf5_reference), name.data(), H5P_DEFAULT, @@ -1455,7 +1455,7 @@ namespace HDF5 H5P_DEFAULT); Assert(*hdf5_reference >= 0, ExcMessage("Error at H5Gcreate2")); break; - case (Mode::open): + case (GroupAccessMode::open): *hdf5_reference = H5Gopen2(*(parentGroup.hdf5_reference), name.data(), H5P_DEFAULT); Assert(*hdf5_reference >= 0, ExcMessage("Error at H5Gopen2")); @@ -1477,7 +1477,7 @@ namespace HDF5 Group Group::group(const std::string &name) { - return Group(name, *this, mpi, Mode::open); + return Group(name, *this, mpi, GroupAccessMode::open); } @@ -1485,7 +1485,7 @@ namespace HDF5 Group Group::create_group(const std::string &name) { - return Group(name, *this, mpi, Mode::create); + return Group(name, *this, mpi, GroupAccessMode::create); } @@ -1519,10 +1519,10 @@ namespace HDF5 dataset.write(data); } - File::File(const std::string &name, - const bool mpi, - const MPI_Comm mpi_communicator, - const Mode mode) + File::File(const std::string & name, + const bool mpi, + const MPI_Comm mpi_communicator, + const FileAccessMode mode) : Group(name, mpi) { hdf5_reference = std::shared_ptr(new hid_t, [](auto pointer) { @@ -1554,12 +1554,12 @@ namespace HDF5 switch (mode) { - case (Mode::create): + case (FileAccessMode::create): *hdf5_reference = H5Fcreate(name.data(), H5F_ACC_TRUNC, H5P_DEFAULT, plist); Assert(*hdf5_reference >= 0, ExcMessage("Error at H5Fcreate")); break; - case (Mode::open): + case (FileAccessMode::open): *hdf5_reference = H5Fopen(name.data(), H5F_ACC_RDWR, plist); Assert(*hdf5_reference >= 0, ExcMessage("Error at H5Fopen")); break; @@ -1578,15 +1578,15 @@ namespace HDF5 - File::File(const std::string &name, - const MPI_Comm mpi_communicator, - const Mode mode) + File::File(const std::string & name, + const MPI_Comm mpi_communicator, + const FileAccessMode mode) : File(name, true, mpi_communicator, mode) {} - File::File(const std::string &name, const Mode mode) + File::File(const std::string &name, const FileAccessMode mode) : File(name, false, MPI_COMM_NULL, mode) {} diff --git a/tests/base/hdf5_01.cc b/tests/base/hdf5_01.cc index f34534e176..15778f179d 100644 --- a/tests/base/hdf5_01.cc +++ b/tests/base/hdf5_01.cc @@ -29,7 +29,7 @@ test() // Write data { // Create file - HDF5::File data_file(filename, HDF5::File::Mode::create); + HDF5::File data_file(filename, HDF5::File::FileAccessMode::create); // Create attributes attached to the root const float root_float = 2.45681934e5; @@ -73,7 +73,7 @@ test() // Read data { // Read attributes attached to the root - HDF5::File data_file(filename, HDF5::File::Mode::open); + HDF5::File data_file(filename, HDF5::File::FileAccessMode::open); auto root_float = data_file.get_attribute("root_float"); auto root_double = data_file.get_attribute("root_double"); auto root_int = data_file.get_attribute("root_int"); diff --git a/tests/base/hdf5_02.cc b/tests/base/hdf5_02.cc index 2826454e17..dc4686dc0f 100644 --- a/tests/base/hdf5_02.cc +++ b/tests/base/hdf5_02.cc @@ -29,7 +29,9 @@ test() // Write data { // Create file - HDF5::File data_file(filename, MPI_COMM_WORLD, HDF5::File::Mode::create); + HDF5::File data_file(filename, + MPI_COMM_WORLD, + HDF5::File::FileAccessMode::create); // Create attributes attached to the root const float root_float = 2.45681934e5; @@ -73,7 +75,9 @@ test() // Read data { // Read attributes attached to the root - HDF5::File data_file(filename, MPI_COMM_WORLD, HDF5::File::Mode::open); + HDF5::File data_file(filename, + MPI_COMM_WORLD, + HDF5::File::FileAccessMode::open); auto root_float = data_file.get_attribute("root_float"); auto root_double = data_file.get_attribute("root_double"); auto root_int = data_file.get_attribute("root_int"); diff --git a/tests/base/hdf5_03.cc b/tests/base/hdf5_03.cc index aa923aca43..dba6dde6e5 100644 --- a/tests/base/hdf5_03.cc +++ b/tests/base/hdf5_03.cc @@ -770,7 +770,7 @@ main(int argc, char **argv) { HDF5::File data_file(filename, mpi_communicator, - HDF5::File::Mode::create); + HDF5::File::FileAccessMode::create); write_test(data_file, dataset_dimensions, @@ -844,7 +844,7 @@ main(int argc, char **argv) { HDF5::File data_file(filename, mpi_communicator, - HDF5::File::Mode::open); + HDF5::File::FileAccessMode::open); read_test(data_file, mpi_communicator, pcout); read_test(data_file, mpi_communicator, pcout); diff --git a/tests/base/hdf5_04.cc b/tests/base/hdf5_04.cc index 4b4b246b4d..882b7dd923 100644 --- a/tests/base/hdf5_04.cc +++ b/tests/base/hdf5_04.cc @@ -730,7 +730,7 @@ main() const std::vector dataset_dimensions = {50, 30}; { - HDF5::File data_file(filename, HDF5::File::Mode::create); + HDF5::File data_file(filename, HDF5::File::FileAccessMode::create); write_test(data_file, dataset_dimensions); write_test(data_file, dataset_dimensions); @@ -764,7 +764,7 @@ main() } { - HDF5::File data_file(filename, HDF5::File::Mode::open); + HDF5::File data_file(filename, HDF5::File::FileAccessMode::open); read_test(data_file); read_test(data_file); diff --git a/tests/base/hdf5_05.cc b/tests/base/hdf5_05.cc index 3ad6e838b7..7be7ec55ef 100644 --- a/tests/base/hdf5_05.cc +++ b/tests/base/hdf5_05.cc @@ -1170,7 +1170,7 @@ main(int argc, char **argv) { HDF5::File data_file(filename, mpi_communicator, - HDF5::File::Mode::create); + HDF5::File::FileAccessMode::create); write_test(data_file, mpi_communicator, pcout); write_test(data_file, mpi_communicator, pcout); @@ -1184,7 +1184,7 @@ main(int argc, char **argv) { HDF5::File data_file(filename, mpi_communicator, - HDF5::File::Mode::open); + HDF5::File::FileAccessMode::open); read_test(data_file, mpi_communicator, pcout); read_test(data_file, mpi_communicator, pcout);