From: Matthias Maier Date: Fri, 28 Mar 2025 21:03:49 +0000 (-0500) Subject: SolverFGMRES: fix compilation X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ceba1369f1c42b02c03773376d5f7700f827a0f;p=dealii.git SolverFGMRES: fix compilation --- diff --git a/include/deal.II/lac/solver_gmres.h b/include/deal.II/lac/solver_gmres.h index 47c880334c..42b85b5833 100644 --- a/include/deal.II/lac/solver_gmres.h +++ b/include/deal.II/lac/solver_gmres.h @@ -2204,7 +2204,8 @@ void SolverMPGMRES::solve_internal( // A lambda that cycles through all preconditioners in sequence applying // one to the vector src and storing the result in dst: // - const auto preconditioner_vmult = [&](auto &dst, const auto &src) { + const auto preconditioner_vmult = [&, n_preconditioners](auto &dst, + const auto &src) { // We have no preconditioner that we could apply if (n_preconditioners == 0) { @@ -2233,7 +2234,8 @@ void SolverMPGMRES::solve_internal( // Return the correct index for constructing the next vector in the // Krylov space sequence according to the chosen indexing strategy // - const auto previous_vector_index = [this](unsigned int i) -> unsigned int { + const auto previous_vector_index = + [this, n_preconditioners](unsigned int i) -> unsigned int { switch (indexing_strategy) { case IndexingStrategy::fgmres: @@ -2245,6 +2247,9 @@ void SolverMPGMRES::solve_internal( case IndexingStrategy::truncated_mpgmres: // 0, 0, ..., 1, 2, 3, ... return (1 + i >= n_preconditioners) ? (1 + i - n_preconditioners) : 0; + default: + DEAL_II_ASSERT_UNREACHABLE(); + return 0; } }; @@ -2342,10 +2347,13 @@ DEAL_II_CXX20_REQUIRES(concepts::is_vector_space_vector) SolverFGMRES::SolverFGMRES(SolverControl &cn, VectorMemory &mem, const AdditionalData &data) - : SolverMPGMRES(cn, - mem, - {data.max_basis_size, - data.orthogonalization_strategy}) + : SolverMPGMRES( + cn, + mem, + typename SolverMPGMRES::AdditionalData{ + data.max_basis_size, + true, + data.orthogonalization_strategy}) { this->indexing_strategy = SolverMPGMRES::IndexingStrategy::fgmres; } @@ -2356,9 +2364,12 @@ template DEAL_II_CXX20_REQUIRES(concepts::is_vector_space_vector) SolverFGMRES::SolverFGMRES(SolverControl &cn, const AdditionalData &data) - : SolverMPGMRES(cn, - {data.max_basis_size, - data.orthogonalization_strategy}) + : SolverMPGMRES( + cn, + typename SolverMPGMRES::AdditionalData{ + data.max_basis_size, + true, + data.orthogonalization_strategy}) { this->indexing_strategy = SolverMPGMRES::IndexingStrategy::fgmres; }