From 12465c581d91451f91f28cc529d7af1cab4ed064 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 7 Aug 2017 15:41:01 -0500 Subject: [PATCH] petsc/solver_03_precondition_boomeramg: make test more robust Use solver_within_range macro instead of custom check_solve function. --- .../petsc/solver_03_precondition_boomeramg.cc | 36 ++++--------------- ...recondition_boomeramg.with_mpi=true.output | 4 +-- 2 files changed, 7 insertions(+), 33 deletions(-) diff --git a/tests/petsc/solver_03_precondition_boomeramg.cc b/tests/petsc/solver_03_precondition_boomeramg.cc index 5163b149a9..34d6af0e42 100644 --- a/tests/petsc/solver_03_precondition_boomeramg.cc +++ b/tests/petsc/solver_03_precondition_boomeramg.cc @@ -32,39 +32,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); { @@ -89,7 +60,12 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionBoomerAMG preconditioner(A); - 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.with_mpi=true.output b/tests/petsc/solver_03_precondition_boomeramg.with_mpi=true.output index cd0525a826..e5af3042c0 100644 --- a/tests/petsc/solver_03_precondition_boomeramg.with_mpi=true.output +++ b/tests/petsc/solver_03_precondition_boomeramg.with_mpi=true.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 1315. -DEAL::Convergence step 4 value 8.048e-05 -DEAL::Solver stopped after 4 iterations +DEAL::Solver stopped within 3 - 5 iterations -- 2.39.5