From be6ae56f4e8cbc37df3a7819e159a514c804c25e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 21 Sep 2022 14:34:12 -0600 Subject: [PATCH] Introduce a new exception for HDF5. --- include/deal.II/base/exceptions.h | 9 +++++++++ source/base/data_out_base.cc | 6 +----- source/lac/scalapack.cc | 12 ++---------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index e4e62af343..dbcf2e6b94 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -1106,6 +1106,15 @@ namespace StandardExceptions "if deal.II was configured to use LAPACK, but cmake did not " "find a valid LAPACK library."); + /** + * This function requires support for the HDF5 library. + */ + DeclExceptionMsg( + ExcNeedsHDF5, + "You are attempting to use functionality that requires that deal.II is configured " + "with HDF5 support. However, when you called 'cmake', HDF5 support " + "was not detected."); + /** * This function requires support for the MPI library. */ diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index e4d8710562..4cff7171f5 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -8825,11 +8825,7 @@ DataOutBase::write_hdf5_parallel( (void)mesh_filename; (void)solution_filename; (void)comm; - AssertThrow(false, - ExcMessage( - "This function requires that deal.II is configured " - "with HDF5 support, but when you called 'cmake', HDF5 support " - "was not detected.")); + AssertThrow(false, ExcNeedsHDF5()); #else const unsigned int n_ranks = Utilities::MPI::n_mpi_processes(comm); diff --git a/source/lac/scalapack.cc b/source/lac/scalapack.cc index ff104138d2..01470b6d8d 100644 --- a/source/lac/scalapack.cc +++ b/source/lac/scalapack.cc @@ -2611,11 +2611,7 @@ ScaLAPACKMatrix::save( # ifndef DEAL_II_WITH_HDF5 (void)filename; (void)chunk_size; - AssertThrow(false, - ExcMessage( - "This function requires that deal.II is configured " - "with HDF5 support, but when you called 'cmake', HDF5 support " - "was not detected.")); + AssertThrow(false, ExcNeedsHDF5()); # else std::pair chunks_size_ = chunk_size; @@ -3047,11 +3043,7 @@ ScaLAPACKMatrix::load(const std::string &filename) { # ifndef DEAL_II_WITH_HDF5 (void)filename; - AssertThrow(false, - ExcMessage( - "This function requires that deal.II is configured " - "with HDF5 support, but when you called 'cmake', HDF5 support " - "was not detected.")); + AssertThrow(false, ExcNeedsHDF5()); # else # ifdef H5_HAVE_PARALLEL // implementation for configurations equipped with a parallel file system -- 2.39.5