From aa8e6183585d9ecf2f5165a049b1b13e5bb83f24 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Mon, 28 Nov 2022 09:15:10 -0500 Subject: [PATCH] Call the base class constructor with MPI_COMM_NULL instead --- include/deal.II/lac/petsc_precondition.h | 32 +++++++---- source/lac/petsc_precondition.cc | 72 ++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 12 deletions(-) diff --git a/include/deal.II/lac/petsc_precondition.h b/include/deal.II/lac/petsc_precondition.h index 010d2fc750..53b708ba39 100644 --- a/include/deal.II/lac/petsc_precondition.h +++ b/include/deal.II/lac/petsc_precondition.h @@ -62,7 +62,15 @@ namespace PETScWrappers /** * Constructor. */ - explicit PreconditionBase(const MPI_Comm &mpi_communicator = MPI_COMM_NULL); + explicit PreconditionBase(const MPI_Comm &mpi_communicator); + + /** + * Constructor. This constructor is deprecated. + * + * @deprecated + */ + DEAL_II_DEPRECATED + PreconditionBase(); /** * Destructor. @@ -162,7 +170,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionJacobi() = default; + PreconditionJacobi(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -244,7 +252,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionBlockJacobi() = default; + PreconditionBlockJacobi(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -322,7 +330,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionSOR() = default; + PreconditionSOR(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -382,7 +390,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionSSOR() = default; + PreconditionSSOR(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -440,7 +448,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionICC() = default; + PreconditionICC(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -500,7 +508,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionILU() = default; + PreconditionILU(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -582,7 +590,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionLU() = default; + PreconditionLU(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -751,7 +759,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionBoomerAMG() = default; + PreconditionBoomerAMG(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -892,7 +900,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionParaSails() = default; + PreconditionParaSails(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -940,7 +948,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionNone() = default; + PreconditionNone(); /** * Constructor. Take the matrix which is used to form the preconditioner, @@ -1041,7 +1049,7 @@ namespace PETScWrappers * Empty Constructor. You need to call initialize() before using this * object. */ - PreconditionBDDC() = default; + PreconditionBDDC(); /** * Constructor. Take the matrix which is used to form the preconditioner, diff --git a/source/lac/petsc_precondition.cc b/source/lac/petsc_precondition.cc index 6f145d31de..f79e7ac1db 100644 --- a/source/lac/petsc_precondition.cc +++ b/source/lac/petsc_precondition.cc @@ -41,6 +41,12 @@ namespace PETScWrappers + PreconditionBase::PreconditionBase() + : PreconditionBase(MPI_COMM_NULL) + {} + + + PreconditionBase::~PreconditionBase() { try @@ -133,6 +139,13 @@ namespace PETScWrappers /* ----------------- PreconditionJacobi -------------------- */ + + PreconditionJacobi::PreconditionJacobi() + : PreconditionBase(MPI_COMM_NULL) + {} + + + PreconditionJacobi::PreconditionJacobi(const MPI_Comm & comm, const AdditionalData &additional_data_) : PreconditionBase(comm) @@ -191,6 +204,9 @@ namespace PETScWrappers /* ----------------- PreconditionBlockJacobi -------------------- */ + PreconditionBlockJacobi::PreconditionBlockJacobi() + : PreconditionBase(MPI_COMM_NULL) + {} PreconditionBlockJacobi::PreconditionBlockJacobi( const MPI_Comm & comm, @@ -250,6 +266,12 @@ namespace PETScWrappers /* ----------------- PreconditionSOR -------------------- */ + PreconditionSOR::PreconditionSOR() + : PreconditionBase(MPI_COMM_NULL) + {} + + + PreconditionSOR::AdditionalData::AdditionalData(const double omega) : omega(omega) {} @@ -294,6 +316,12 @@ namespace PETScWrappers /* ----------------- PreconditionSSOR -------------------- */ + PreconditionSSOR::PreconditionSSOR() + : PreconditionBase(MPI_COMM_NULL) + {} + + + PreconditionSSOR::AdditionalData::AdditionalData(const double omega) : omega(omega) {} @@ -342,6 +370,11 @@ namespace PETScWrappers /* ----------------- PreconditionICC -------------------- */ + PreconditionICC::PreconditionICC() + : PreconditionBase(MPI_COMM_NULL) + {} + + PreconditionICC::AdditionalData::AdditionalData(const unsigned int levels) : levels(levels) @@ -387,6 +420,12 @@ namespace PETScWrappers /* ----------------- PreconditionILU -------------------- */ + PreconditionILU::PreconditionILU() + : PreconditionBase(MPI_COMM_NULL) + {} + + + PreconditionILU::AdditionalData::AdditionalData(const unsigned int levels) : levels(levels) {} @@ -537,6 +576,14 @@ namespace PETScWrappers } // namespace # endif + + + PreconditionBoomerAMG::PreconditionBoomerAMG() + : PreconditionBase(MPI_COMM_NULL) + {} + + + PreconditionBoomerAMG::PreconditionBoomerAMG( const MPI_Comm & comm, const AdditionalData &additional_data_) @@ -724,6 +771,12 @@ namespace PETScWrappers + PreconditionParaSails::PreconditionParaSails() + : PreconditionBase(MPI_COMM_NULL) + {} + + + PreconditionParaSails::PreconditionParaSails( const MatrixBase & matrix, const AdditionalData &additional_data) @@ -822,6 +875,12 @@ namespace PETScWrappers /* ----------------- PreconditionNone ------------------------- */ + PreconditionNone::PreconditionNone() + : PreconditionBase(MPI_COMM_NULL) + {} + + + PreconditionNone::PreconditionNone(const MatrixBase & matrix, const AdditionalData &additional_data) : PreconditionBase(matrix.get_mpi_communicator()) @@ -866,6 +925,12 @@ namespace PETScWrappers + PreconditionLU::PreconditionLU() + : PreconditionBase(MPI_COMM_NULL) + {} + + + PreconditionLU::PreconditionLU(const MatrixBase & matrix, const AdditionalData &additional_data) : PreconditionBase(matrix.get_mpi_communicator()) @@ -925,6 +990,13 @@ namespace PETScWrappers + template + PreconditionBDDC::PreconditionBDDC() + : PreconditionBase(MPI_COMM_NULL) + {} + + + template PreconditionBDDC::PreconditionBDDC( const MPI_Comm comm, -- 2.39.5