From: Wolfgang Bangerth Date: Wed, 9 Nov 2016 02:22:27 +0000 (-0700) Subject: Be more lenient with the exact number of iterations. X-Git-Tag: v8.5.0-rc1~424^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=296b91679abefe3218b9c86d956abfe3932ad2c1;p=dealii.git Be more lenient with the exact number of iterations. --- diff --git a/tests/slepc/solve_04.cc b/tests/slepc/solve_04.cc index b397f6d870..a058b3c32f 100644 --- a/tests/slepc/solve_04.cc +++ b/tests/slepc/solve_04.cc @@ -39,6 +39,7 @@ template void check_solve( SolverType &solver, + const unsigned int solver_number, const SolverControl &solver_control, const MatrixType &A, std::vector &u, std::vector &v) @@ -63,8 +64,41 @@ check_solve( SolverType &solver, deallog << "Exception: " << e.get_exc_name() << std::endl; } - deallog << "Solver stopped after " << solver_control.last_step() - << " iterations" << std::endl; + switch (solver_number) + { + case 1: + check_solver_within_range ((void)true, + solver_control.last_step(), + 5,5); + break; + case 2: + check_solver_within_range ((void)true, + solver_control.last_step(), + 24,24); + break; + case 3: + check_solver_within_range ((void)true, + solver_control.last_step(), + 21,21); + break; + case 4: + check_solver_within_range ((void)true, + solver_control.last_step(), + 123,128); + break; + case 5: + check_solver_within_range ((void)true, + solver_control.last_step(), + 137,138); + break; + case 6: + check_solver_within_range ((void)true, + solver_control.last_step(), + 50,51); + break; + default: + Assert (false, ExcNotImplemented()); + } deallog << "Eigenvalues:"; for (unsigned int i = 0; i < v.size(); i++) @@ -108,28 +142,28 @@ int main(int argc, char **argv) { SLEPcWrappers::SolverKrylovSchur solver(control); - check_solve (solver, control, A,u,v); + check_solve (solver, 1, control, A,u,v); } { SLEPcWrappers::SolverArnoldi solver(control); - check_solve (solver, control, A,u,v); + check_solve (solver, 2, control, A,u,v); } { SLEPcWrappers::SolverLanczos solver(control); - check_solve (solver, control, A,u,v); + check_solve (solver, 3, control, A,u,v); } { SLEPcWrappers::SolverGeneralizedDavidson solver(control); - check_solve (solver, control, A,u,v); + check_solve (solver, 4, control, A,u,v); } { SLEPcWrappers::SolverGeneralizedDavidson::AdditionalData data(true); SLEPcWrappers::SolverGeneralizedDavidson solver(control,PETSC_COMM_SELF,data); - check_solve (solver, control, A,u,v); + check_solve (solver, 5, control, A,u,v); } // set extra settings for JD; Otherwise, at least on OSX, @@ -139,7 +173,7 @@ int main(int argc, char **argv) PETScWrappers::set_option_value("-st_ksp_max_it", "10"); { SLEPcWrappers::SolverJacobiDavidson solver(control); - check_solve (solver, control, A,u,v); + check_solve (solver, 6, control, A,u,v); } } diff --git a/tests/slepc/solve_04.output b/tests/slepc/solve_04.output index ef11b2948d..d1cbd44b6b 100644 --- a/tests/slepc/solve_04.output +++ b/tests/slepc/solve_04.output @@ -2,26 +2,26 @@ DEAL::Size 31 Unknowns 30 DEAL:: DEAL::Solver type: N6dealii13SLEPcWrappers17SolverKrylovSchurE -DEAL::Solver stopped after 5 iterations +DEAL::Solver stopped within 5 - 5 iterations DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792 DEAL:: DEAL::Solver type: N6dealii13SLEPcWrappers13SolverArnoldiE -DEAL::Solver stopped after 24 iterations +DEAL::Solver stopped within 24 - 24 iterations DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792 DEAL:: DEAL::Solver type: N6dealii13SLEPcWrappers13SolverLanczosE -DEAL::Solver stopped after 21 iterations +DEAL::Solver stopped within 21 - 21 iterations DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792 DEAL:: DEAL::Solver type: N6dealii13SLEPcWrappers25SolverGeneralizedDavidsonE -DEAL::Solver stopped after 123 iterations +DEAL::Solver stopped within 123 - 128 iterations DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792 DEAL:: DEAL::Solver type: N6dealii13SLEPcWrappers25SolverGeneralizedDavidsonE -DEAL::Solver stopped after 138 iterations +DEAL::Solver stopped within 137 - 138 iterations DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792 DEAL:: DEAL::Solver type: N6dealii13SLEPcWrappers20SolverJacobiDavidsonE -DEAL::Solver stopped after 50 iterations +DEAL::Solver stopped within 50 - 51 iterations DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792 DEAL::