From cdc6aaad58a260607db3d89d77dcbb68f71cd963 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sun, 2 Jul 2017 12:32:28 -0500 Subject: [PATCH] Port arpack/parpack_advection_diffusion_trilinos to use inverse_operator --- .../parpack_advection_diffusion_trilinos.cc | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/arpack/parpack_advection_diffusion_trilinos.cc b/tests/arpack/parpack_advection_diffusion_trilinos.cc index 09c4ce7d8c..84bd8c998f 100644 --- a/tests/arpack/parpack_advection_diffusion_trilinos.cc +++ b/tests/arpack/parpack_advection_diffusion_trilinos.cc @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include @@ -50,6 +50,7 @@ #include #include +#include #include #include @@ -288,15 +289,20 @@ void test () SolverControl solver_control (dof_handler.n_dofs(), 1e-9,/*log_history*/false,/*log_results*/false); SolverControl solver_control_lin (dof_handler.n_dofs(), 1e-10,/*log_history*/false,/*log_results*/false); - PArpackSolver::Shift shifted_matrix(stiffness_matrix,mass_matrix,shift); - TrilinosWrappers::PreconditionIdentity preconditioner; - IterativeInverse shift_and_invert; - shift_and_invert.initialize(shifted_matrix,preconditioner); - shift_and_invert.solver.select("gmres"); static ReductionControl inner_control_c(/*maxiter*/stiffness_matrix.m(), /*tolerance (global)*/ 0.0, /*reduce (w.r.t. initial)*/ 1.e-13); - shift_and_invert.solver.set_control(inner_control_c); + + typedef TrilinosWrappers::MPI::Vector VectorType; + SolverGMRES solver_c(inner_control_c); + TrilinosWrappers::PreconditionIdentity preconditioner; + + const auto shifted_matrix = + linear_operator(stiffness_matrix) - + shift * linear_operator(mass_matrix); + + const auto shift_and_invert = + inverse_operator(shifted_matrix, solver_c, preconditioner); const unsigned int num_arnoldi_vectors = 2*eigenvalues.size() + 2; -- 2.39.5