From 5cedc926ebdd49e889faae9a88c0fa554efbe37d Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 7 Aug 2017 15:45:05 -0500 Subject: [PATCH] petsc/solver_03_precondition_boomeramg_symmetric: make test more robust --- ...ver_03_precondition_boomeramg_symmetric.cc | 36 ++++--------------- ...n_boomeramg_symmetric.with_mpi=true.output | 4 +-- 2 files changed, 7 insertions(+), 33 deletions(-) diff --git a/tests/petsc/solver_03_precondition_boomeramg_symmetric.cc b/tests/petsc/solver_03_precondition_boomeramg_symmetric.cc index 594721f7b8..e67b6fb225 100644 --- a/tests/petsc/solver_03_precondition_boomeramg_symmetric.cc +++ b/tests/petsc/solver_03_precondition_boomeramg_symmetric.cc @@ -33,39 +33,10 @@ #include #include -template -void -check_solve(SolverType &solver, - const SolverControl &solver_control, - const MatrixType &A, - VectorType &u, - VectorType &f, - const PRECONDITION &P) -{ - deallog << "Solver type: " << typeid(solver).name() << std::endl; - - u = 0.; - f = 1.; - try - { - solver.solve(A,u,f,P); - } - catch (std::exception &e) - { - deallog << e.what() << std::endl; - abort (); - } - - deallog << "Solver stopped after " << solver_control.last_step() - << " iterations" << std::endl; -} - int main(int argc, char **argv) { initlog(); - deallog << std::setprecision(4); - deallog.threshold_double(1.e-10); Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, 1); { @@ -90,7 +61,12 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionBoomerAMG preconditioner(A, true); - check_solve (solver, control, A,u,f, preconditioner); + + deallog << "Solver type: " << typeid(solver).name() << std::endl; + + check_solver_within_range( + solver.solve(A, u, f, preconditioner), + control.last_step(), 3, 5); } } diff --git a/tests/petsc/solver_03_precondition_boomeramg_symmetric.with_mpi=true.output b/tests/petsc/solver_03_precondition_boomeramg_symmetric.with_mpi=true.output index af0f9b29f3..e5af3042c0 100644 --- a/tests/petsc/solver_03_precondition_boomeramg_symmetric.with_mpi=true.output +++ b/tests/petsc/solver_03_precondition_boomeramg_symmetric.with_mpi=true.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 1279. -DEAL::Convergence step 4 value 2.478e-05 -DEAL::Solver stopped after 4 iterations +DEAL::Solver stopped within 3 - 5 iterations -- 2.39.5