From 84ac1748c104c0330af5fbbced8955f0100acfc5 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Fri, 19 Jul 2024 20:07:15 +0200 Subject: [PATCH] Guard isSupported check in preconditioners to Trilinos >=13.0.0 --- .../trilinos_tpetra_precondition.templates.h | 12 +++--- tests/trilinos_tpetra/precondition.cc | 2 + ... precondition.with_trilinos.geq.13.output} | 0 .../precondition.with_trilinos.le.13.output | 43 +++++++++++++++++++ 4 files changed, 51 insertions(+), 6 deletions(-) rename tests/trilinos_tpetra/{precondition.output => precondition.with_trilinos.geq.13.output} (100%) create mode 100644 tests/trilinos_tpetra/precondition.with_trilinos.le.13.output diff --git a/include/deal.II/lac/trilinos_tpetra_precondition.templates.h b/include/deal.II/lac/trilinos_tpetra_precondition.templates.h index 554f6236a3..fc4a9c1250 100644 --- a/include/deal.II/lac/trilinos_tpetra_precondition.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_precondition.templates.h @@ -259,13 +259,13 @@ namespace LinearAlgebra const std::string &preconditioner_type) : preconditioner_type(preconditioner_type) { +# if DEAL_II_TRILINOS_VERSION_GTE(13, 0, 0) Ifpack2::Factory factory; - bool supported = - factory.isSupported>( - preconditioner_type); - AssertThrow(supported, - ExcTrilinosIpack2PreconditionerUnsupported( - preconditioner_type)); + AssertThrow( + (factory.isSupported>( + preconditioner_type)), + ExcTrilinosIpack2PreconditionerUnsupported(preconditioner_type)); +# endif } diff --git a/tests/trilinos_tpetra/precondition.cc b/tests/trilinos_tpetra/precondition.cc index efbdcc81e3..3104e0c01d 100644 --- a/tests/trilinos_tpetra/precondition.cc +++ b/tests/trilinos_tpetra/precondition.cc @@ -500,6 +500,7 @@ Step4::solve(int cycle) // deallog.pop(); // } +#if DEAL_II_TRILINOS_VERSION_GTE(13, 0, 0) { // Make sure the general Ifpack preconditioner throws an Exception for an // unsupported solver. @@ -519,6 +520,7 @@ Step4::solve(int cycle) } deallog.pop(); } +#endif deallog.pop(); } diff --git a/tests/trilinos_tpetra/precondition.output b/tests/trilinos_tpetra/precondition.with_trilinos.geq.13.output similarity index 100% rename from tests/trilinos_tpetra/precondition.output rename to tests/trilinos_tpetra/precondition.with_trilinos.geq.13.output diff --git a/tests/trilinos_tpetra/precondition.with_trilinos.le.13.output b/tests/trilinos_tpetra/precondition.with_trilinos.le.13.output new file mode 100644 index 0000000000..30f6004ca7 --- /dev/null +++ b/tests/trilinos_tpetra/precondition.with_trilinos.le.13.output @@ -0,0 +1,43 @@ + +DEAL:01089:Identity::Solver stopped within 49 - 51 iterations +DEAL:01089:CustomSGS::Solver stopped after 41 iterations +DEAL:01089:Jacobi::Solver stopped within 49 - 51 iterations +DEAL:01089:l1Jacobi::Solver stopped within 49 - 51 iterations +DEAL:01089:l1GaussSeidel::Solver stopped after 48 iterations +DEAL:01089:SOR::Solver stopped after 25 iterations +DEAL:01089:SSOR::Solver stopped within 40 - 42 iterations +DEAL:01089:BlockJacobi::Solver stopped after 58 iterations +DEAL:01089:BlockSOR::Solver stopped after 16 iterations +DEAL:01089:BlockSSOR::Solver stopped after 28 iterations +DEAL:01089:ILU::Solver stopped within 30 - 32 iterations +DEAL:01089:ILUT::Solver stopped after 5 iterations +DEAL:01089:Chebyshev::Solver stopped after 38 iterations +DEAL:01089:CustomIGLOO::Error: + You tried to select the preconditioner type +but this preconditioner is not supported by Trilinos/Ifpack22 +due to one of the following reasons: +* This preconditioner does not exist +* This preconditioner has a specialized constructor not supported by the Ifpack2 Factory. +* This preconditioner is not (yet) supported by Trilinos/Ifpack2 +* Trilinos/Ifpack2 was not configured for its use. +DEAL:04225:Identity::Solver stopped within 100 - 102 iterations +DEAL:04225:CustomSGS::Solver stopped after 78 iterations +DEAL:04225:Jacobi::Solver stopped within 100 - 102 iterations +DEAL:04225:l1Jacobi::Solver stopped within 100 - 102 iterations +DEAL:04225:l1GaussSeidel::Solver stopped after 98 iterations +DEAL:04225:SOR::Solver stopped after 46 iterations +DEAL:04225:SSOR::Solver stopped within 77 - 79 iterations +DEAL:04225:BlockJacobi::Solver stopped after 82 iterations +DEAL:04225:BlockSOR::Solver stopped after 20 iterations +DEAL:04225:BlockSSOR::Solver stopped after 40 iterations +DEAL:04225:ILU::Solver stopped within 56 - 58 iterations +DEAL:04225:ILUT::Solver stopped after 10 iterations +DEAL:04225:Chebyshev::Solver stopped after 75 iterations +DEAL:04225:CustomIGLOO::Error: + You tried to select the preconditioner type +but this preconditioner is not supported by Trilinos/Ifpack22 +due to one of the following reasons: +* This preconditioner does not exist +* This preconditioner has a specialized constructor not supported by the Ifpack2 Factory. +* This preconditioner is not (yet) supported by Trilinos/Ifpack2 +* Trilinos/Ifpack2 was not configured for its use. \ No newline at end of file -- 2.39.5