From: Matthias Maier Date: Mon, 7 Aug 2017 20:45:05 +0000 (-0500) Subject: petsc/solver_03_precondition_boomeramg_symmetric: make test more robust X-Git-Tag: v9.0.0-rc1~1345^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4716%2Fhead;p=dealii.git petsc/solver_03_precondition_boomeramg_symmetric: make test more robust --- 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