From: Daniel Arndt Date: Tue, 8 Aug 2017 17:03:46 +0000 (+0200) Subject: Use check_solver_within_range in PETSc(serial) tests X-Git-Tag: v9.0.0-rc1~1328^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4724%2Fhead;p=dealii.git Use check_solver_within_range in PETSc(serial) tests --- diff --git a/tests/petsc/deal_solver_01.cc b/tests/petsc/deal_solver_01.cc index 44b2ef05e6..3b7b33e09b 100644 --- a/tests/petsc/deal_solver_01.cc +++ b/tests/petsc/deal_solver_01.cc @@ -36,33 +36,6 @@ #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) { @@ -94,7 +67,10 @@ int main(int argc, char **argv) GrowingVectorMemory mem; SolverCG solver(control,mem); PreconditionIdentity preconditioner; - 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(), 42, 44); } GrowingVectorMemory::release_unused_memory (); diff --git a/tests/petsc/deal_solver_01.output b/tests/petsc/deal_solver_01.output index ec2fa4d957..c8fbf3f810 100644 --- a/tests/petsc/deal_solver_01.output +++ b/tests/petsc/deal_solver_01.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii8SolverCGINS_13PETScWrappers3MPI6VectorEEE -DEAL:cg::Starting value 31.00 -DEAL:cg::Convergence step 43 value 0.0008189 -DEAL::Solver stopped after 43 iterations +DEAL::Solver stopped within 42 - 44 iterations diff --git a/tests/petsc/deal_solver_02.cc b/tests/petsc/deal_solver_02.cc index 09e9c664eb..8feb129750 100644 --- a/tests/petsc/deal_solver_02.cc +++ b/tests/petsc/deal_solver_02.cc @@ -38,32 +38,6 @@ #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 - { - check_solver_within_range( - solver.solve(A,u,f,P), - solver_control.last_step(), 48, 51); - } - catch (std::exception &e) - { - deallog << e.what() << std::endl; - abort (); - } -} - int main(int argc, char **argv) { @@ -95,7 +69,9 @@ int main(int argc, char **argv) GrowingVectorMemory mem; SolverBicgstab solver(control,mem); PreconditionIdentity preconditioner; - 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(), 48, 51); } GrowingVectorMemory::release_unused_memory (); diff --git a/tests/petsc/deal_solver_03.cc b/tests/petsc/deal_solver_03.cc index 268e208b0e..58893f133e 100644 --- a/tests/petsc/deal_solver_03.cc +++ b/tests/petsc/deal_solver_03.cc @@ -38,33 +38,6 @@ #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) { @@ -96,7 +69,9 @@ int main(int argc, char **argv) GrowingVectorMemory mem; SolverGMRES solver(control,mem); PreconditionIdentity preconditioner; - 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(), 74, 76); } GrowingVectorMemory::release_unused_memory (); diff --git a/tests/petsc/deal_solver_03.output b/tests/petsc/deal_solver_03.output index e2bdb9c6b9..ad1ddf8a19 100644 --- a/tests/petsc/deal_solver_03.output +++ b/tests/petsc/deal_solver_03.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii11SolverGMRESINS_13PETScWrappers3MPI6VectorEEE -DEAL:GMRES::Starting value 31.00 -DEAL:GMRES::Convergence step 75 value 0.0008096 -DEAL::Solver stopped after 75 iterations +DEAL::Solver stopped within 74 - 76 iterations diff --git a/tests/petsc/deal_solver_04.cc b/tests/petsc/deal_solver_04.cc index 49fa00fd1a..94c216cc76 100644 --- a/tests/petsc/deal_solver_04.cc +++ b/tests/petsc/deal_solver_04.cc @@ -37,33 +37,6 @@ #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) { @@ -96,7 +69,9 @@ int main(int argc, char **argv) GrowingVectorMemory mem; SolverMinRes solver(control,mem); PreconditionIdentity preconditioner; - 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(), 42, 44); } GrowingVectorMemory::release_unused_memory (); diff --git a/tests/petsc/deal_solver_04.output b/tests/petsc/deal_solver_04.output index cf60f86687..6601f40b3d 100644 --- a/tests/petsc/deal_solver_04.output +++ b/tests/petsc/deal_solver_04.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii12SolverMinResINS_13PETScWrappers3MPI6VectorEEE -DEAL:minres::Starting value 31.0000 -DEAL:minres::Convergence step 43 value 0.000691560 -DEAL::Solver stopped after 43 iterations +DEAL::Solver stopped within 42 - 44 iterations diff --git a/tests/petsc/deal_solver_05.cc b/tests/petsc/deal_solver_05.cc index 291378d5db..40cd730ce7 100644 --- a/tests/petsc/deal_solver_05.cc +++ b/tests/petsc/deal_solver_05.cc @@ -36,33 +36,6 @@ #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) { @@ -95,7 +68,9 @@ int main(int argc, char **argv) GrowingVectorMemory mem; SolverQMRS solver(control,mem); PreconditionIdentity preconditioner; - 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(), 45, 47); } GrowingVectorMemory::release_unused_memory (); diff --git a/tests/petsc/deal_solver_05.output b/tests/petsc/deal_solver_05.output index a662db55b7..f6882c4fea 100644 --- a/tests/petsc/deal_solver_05.output +++ b/tests/petsc/deal_solver_05.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii10SolverQMRSINS_13PETScWrappers3MPI6VectorEEE -DEAL:QMRS::Starting value 31.0000 -DEAL:QMRS::Convergence step 46 value 0.000906349 -DEAL::Solver stopped after 46 iterations +DEAL::Solver stopped within 45 - 47 iterations diff --git a/tests/petsc/solver_03.cc b/tests/petsc/solver_03.cc index 877053b04e..4842113e05 100644 --- a/tests/petsc/solver_03.cc +++ b/tests/petsc/solver_03.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionJacobi 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(), 40, 42); } } diff --git a/tests/petsc/solver_03.output b/tests/petsc/solver_03.output index 2237281800..7d010484c8 100644 --- a/tests/petsc/solver_03.output +++ b/tests/petsc/solver_03.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 7.750 -DEAL::Convergence step 41 value 0.0006730 -DEAL::Solver stopped after 41 iterations +DEAL::Solver stopped within 40 - 42 iterations diff --git a/tests/petsc/solver_03_mf.cc b/tests/petsc/solver_03_mf.cc index 32b1768d20..ce1bc5feb5 100644 --- a/tests/petsc/solver_03_mf.cc +++ b/tests/petsc/solver_03_mf.cc @@ -31,34 +31,6 @@ #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) - { - std::cout << e.what() << std::endl; - deallog << e.what() << std::endl; - abort (); - } - - deallog << "Solver stopped after " << solver_control.last_step() - << " iterations" << std::endl; -} - int main(int argc, char **argv) { @@ -86,7 +58,9 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionNone 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(), 42, 44); } } diff --git a/tests/petsc/solver_03_mf.output b/tests/petsc/solver_03_mf.output index bea3eb1acb..a6685358ae 100644 --- a/tests/petsc/solver_03_mf.output +++ b/tests/petsc/solver_03_mf.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 31.00 -DEAL::Convergence step 43 value 0.0008189 -DEAL::Solver stopped after 43 iterations +DEAL::Solver stopped within 42 - 44 iterations diff --git a/tests/petsc/solver_03_precondition_eisenstat.cc b/tests/petsc/solver_03_precondition_eisenstat.cc index 4e82eb6fce..7405517a74 100644 --- a/tests/petsc/solver_03_precondition_eisenstat.cc +++ b/tests/petsc/solver_03_precondition_eisenstat.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,10 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionEisenstat 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(), 19, 21); } } diff --git a/tests/petsc/solver_03_precondition_eisenstat.output b/tests/petsc/solver_03_precondition_eisenstat.output index 1a56252cae..1587b4f891 100644 --- a/tests/petsc/solver_03_precondition_eisenstat.output +++ b/tests/petsc/solver_03_precondition_eisenstat.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 60.26 -DEAL::Convergence step 20 value 0.0006908 -DEAL::Solver stopped after 20 iterations +DEAL::Solver stopped within 19 - 21 iterations diff --git a/tests/petsc/solver_03_precondition_icc.cc b/tests/petsc/solver_03_precondition_icc.cc index 7d4cb5e4cf..ac402465a1 100644 --- a/tests/petsc/solver_03_precondition_icc.cc +++ b/tests/petsc/solver_03_precondition_icc.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,10 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionICC 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(), 16, 18); } } diff --git a/tests/petsc/solver_03_precondition_icc.output b/tests/petsc/solver_03_precondition_icc.output index 3d30c3aa84..399218edbb 100644 --- a/tests/petsc/solver_03_precondition_icc.output +++ b/tests/petsc/solver_03_precondition_icc.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 48.96 -DEAL::Convergence step 17 value 0.0004044 -DEAL::Solver stopped after 17 iterations +DEAL::Solver stopped within 16 - 18 iterations diff --git a/tests/petsc/solver_03_precondition_ilu.cc b/tests/petsc/solver_03_precondition_ilu.cc index 3fc5c010b7..3d9e7e0e2d 100644 --- a/tests/petsc/solver_03_precondition_ilu.cc +++ b/tests/petsc/solver_03_precondition_ilu.cc @@ -31,33 +31,6 @@ #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) { @@ -89,7 +62,9 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionILU 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(), 16, 18); } } diff --git a/tests/petsc/solver_03_precondition_ilu.output b/tests/petsc/solver_03_precondition_ilu.output index 3d30c3aa84..399218edbb 100644 --- a/tests/petsc/solver_03_precondition_ilu.output +++ b/tests/petsc/solver_03_precondition_ilu.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 48.96 -DEAL::Convergence step 17 value 0.0004044 -DEAL::Solver stopped after 17 iterations +DEAL::Solver stopped within 16 - 18 iterations diff --git a/tests/petsc/solver_03_precondition_lu.cc b/tests/petsc/solver_03_precondition_lu.cc index 4316a41c25..6d3b5506ff 100644 --- a/tests/petsc/solver_03_precondition_lu.cc +++ b/tests/petsc/solver_03_precondition_lu.cc @@ -32,39 +32,6 @@ #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; - - // we use a direct solver as a - // preconditioner. this should - // converge in one step! - Assert (solver_control.last_step() == 1, - ExcInternalError()); -} - int main(int argc, char **argv) { @@ -95,7 +62,9 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionLU 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(), 1, 1); } } diff --git a/tests/petsc/solver_03_precondition_lu.output b/tests/petsc/solver_03_precondition_lu.output index 071b4be96e..ae203d0432 100644 --- a/tests/petsc/solver_03_precondition_lu.output +++ b/tests/petsc/solver_03_precondition_lu.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 1351. -DEAL::Convergence step 1 value 0 -DEAL::Solver stopped after 1 iterations +DEAL::Solver stopped within 1 - 1 iterations diff --git a/tests/petsc/solver_03_precondition_parasails.cc b/tests/petsc/solver_03_precondition_parasails.cc index a732255645..37bfa4d936 100644 --- a/tests/petsc/solver_03_precondition_parasails.cc +++ b/tests/petsc/solver_03_precondition_parasails.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionParaSails 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(), 18, 20); } } diff --git a/tests/petsc/solver_03_precondition_sor.cc b/tests/petsc/solver_03_precondition_sor.cc index 3923263fc3..782a8b1336 100644 --- a/tests/petsc/solver_03_precondition_sor.cc +++ b/tests/petsc/solver_03_precondition_sor.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionSOR 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(), 18, 20); } } diff --git a/tests/petsc/solver_03_precondition_sor.output b/tests/petsc/solver_03_precondition_sor.output index d08690178c..d3a8127003 100644 --- a/tests/petsc/solver_03_precondition_sor.output +++ b/tests/petsc/solver_03_precondition_sor.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 29.45 -DEAL::Convergence step 19 value 0.0005731 -DEAL::Solver stopped after 19 iterations +DEAL::Solver stopped within 18 - 20 iterations diff --git a/tests/petsc/solver_03_precondition_ssor.cc b/tests/petsc/solver_03_precondition_ssor.cc index 54cf6d49e1..6fc521ff0f 100644 --- a/tests/petsc/solver_03_precondition_ssor.cc +++ b/tests/petsc/solver_03_precondition_ssor.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverCG solver(control); PETScWrappers::PreconditionSSOR 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(), 18, 20); } } diff --git a/tests/petsc/solver_03_precondition_ssor.output b/tests/petsc/solver_03_precondition_ssor.output index d08690178c..d3a8127003 100644 --- a/tests/petsc/solver_03_precondition_ssor.output +++ b/tests/petsc/solver_03_precondition_ssor.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE -DEAL::Starting value 29.45 -DEAL::Convergence step 19 value 0.0005731 -DEAL::Solver stopped after 19 iterations +DEAL::Solver stopped within 18 - 20 iterations diff --git a/tests/petsc/solver_04.cc b/tests/petsc/solver_04.cc index 16af79ec64..552443aae7 100644 --- a/tests/petsc/solver_04.cc +++ b/tests/petsc/solver_04.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverBiCG solver(control); PETScWrappers::PreconditionJacobi 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(), 40, 42); } } diff --git a/tests/petsc/solver_04.output b/tests/petsc/solver_04.output index d69ef9440f..f0b25b1f7c 100644 --- a/tests/petsc/solver_04.output +++ b/tests/petsc/solver_04.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers10SolverBiCGE -DEAL::Starting value 7.750 -DEAL::Convergence step 41 value 0.0006730 -DEAL::Solver stopped after 41 iterations +DEAL::Solver stopped within 40 - 42 iterations diff --git a/tests/petsc/solver_05.cc b/tests/petsc/solver_05.cc index bcdbe9330d..663396c2c5 100644 --- a/tests/petsc/solver_05.cc +++ b/tests/petsc/solver_05.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverGMRES solver(control); PETScWrappers::PreconditionJacobi 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(), 47, 49); } } diff --git a/tests/petsc/solver_05.output b/tests/petsc/solver_05.output index d06c236119..9a755ab455 100644 --- a/tests/petsc/solver_05.output +++ b/tests/petsc/solver_05.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers11SolverGMRESE -DEAL::Starting value 7.750 -DEAL::Convergence step 48 value 0.0009841 -DEAL::Solver stopped after 48 iterations +DEAL::Solver stopped within 47 - 49 iterations diff --git a/tests/petsc/solver_06.cc b/tests/petsc/solver_06.cc index 5884307595..4356836956 100644 --- a/tests/petsc/solver_06.cc +++ b/tests/petsc/solver_06.cc @@ -31,36 +31,6 @@ #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 - { - deallog.depth_file(0); - solver.solve(A,u,f,P); - deallog.depth_file(3); - } - catch (std::exception &e) - { - deallog.depth_file(3); - deallog << e.what() << std::endl; - abort (); - } - - deallog << "Solver stopped after " << solver_control.last_step() - << " iterations" << std::endl; -} - int main(int argc, char **argv) { @@ -91,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverBicgstab solver(control); PETScWrappers::PreconditionJacobi 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(), 32, 34); } } diff --git a/tests/petsc/solver_06.output b/tests/petsc/solver_06.output index ce55c30c11..135fdd9e39 100644 --- a/tests/petsc/solver_06.output +++ b/tests/petsc/solver_06.output @@ -1,4 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers14SolverBicgstabE -DEAL::Solver stopped after 33 iterations +DEAL::Solver stopped within 32 - 34 iterations diff --git a/tests/petsc/solver_07.cc b/tests/petsc/solver_07.cc index bbc8741b6a..2a65aa9c72 100644 --- a/tests/petsc/solver_07.cc +++ b/tests/petsc/solver_07.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverCGS solver(control); PETScWrappers::PreconditionJacobi 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(), 39, 41); } } diff --git a/tests/petsc/solver_07.output b/tests/petsc/solver_07.output index f4c27026d0..cf567fb638 100644 --- a/tests/petsc/solver_07.output +++ b/tests/petsc/solver_07.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers9SolverCGSE -DEAL::Starting value 7.750 -DEAL::Convergence step 40 value 0.0007519 -DEAL::Solver stopped after 40 iterations +DEAL::Solver stopped within 39 - 41 iterations diff --git a/tests/petsc/solver_08.cc b/tests/petsc/solver_08.cc index 6916a06cbd..c04253976a 100644 --- a/tests/petsc/solver_08.cc +++ b/tests/petsc/solver_08.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverTFQMR solver(control); PETScWrappers::PreconditionJacobi 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(), 39, 41); } } diff --git a/tests/petsc/solver_08.output b/tests/petsc/solver_08.output index 7f1d94f542..4a79733f7b 100644 --- a/tests/petsc/solver_08.output +++ b/tests/petsc/solver_08.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers11SolverTFQMRE -DEAL::Starting value 7.750 -DEAL::Convergence step 40 value 0.0008680 -DEAL::Solver stopped after 40 iterations +DEAL::Solver stopped within 39 - 41 iterations diff --git a/tests/petsc/solver_09.cc b/tests/petsc/solver_09.cc index 03abcd3213..978e7500d4 100644 --- a/tests/petsc/solver_09.cc +++ b/tests/petsc/solver_09.cc @@ -35,33 +35,6 @@ #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) { @@ -92,7 +65,9 @@ int main(int argc, char **argv) PETScWrappers::SolverTCQMR solver(control); PETScWrappers::PreconditionJacobi 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(), 43, 45); } } diff --git a/tests/petsc/solver_09.output b/tests/petsc/solver_09.output index c1e7ffb703..d328e4b0a8 100644 --- a/tests/petsc/solver_09.output +++ b/tests/petsc/solver_09.output @@ -1,7 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE -DEAL::Starting value 7.750 -DEAL::Starting value 7.750 -DEAL::Convergence step 44 value 0.0007016 -DEAL::Solver stopped after 44 iterations +DEAL::Solver stopped within 43 - 45 iterations diff --git a/tests/petsc/solver_10.cc b/tests/petsc/solver_10.cc index b5e5997f7c..265371e92c 100644 --- a/tests/petsc/solver_10.cc +++ b/tests/petsc/solver_10.cc @@ -31,33 +31,6 @@ #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) { @@ -88,7 +61,9 @@ int main(int argc, char **argv) PETScWrappers::SolverCR solver(control); PETScWrappers::PreconditionJacobi 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(), 40, 42); } } diff --git a/tests/petsc/solver_10.output b/tests/petsc/solver_10.output index 0c6333fd40..9faf70331d 100644 --- a/tests/petsc/solver_10.output +++ b/tests/petsc/solver_10.output @@ -1,6 +1,4 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers8SolverCRE -DEAL::Starting value 7.750 -DEAL::Convergence step 41 value 0.0005700 -DEAL::Solver stopped after 41 iterations +DEAL::Solver stopped within 40 - 42 iterations diff --git a/tests/petsc/solver_12.cc b/tests/petsc/solver_12.cc index da8dd49cee..f6db7ea295 100644 --- a/tests/petsc/solver_12.cc +++ b/tests/petsc/solver_12.cc @@ -31,26 +31,6 @@ #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.; - - solver.solve(A,u,f,P); - - deallog << "Solver stopped after " << solver_control.last_step() - << " iterations" << std::endl; -} - int main(int argc, char **argv) { @@ -82,10 +62,15 @@ int main(int argc, char **argv) PETScWrappers::SolverPreOnly solver(control); PETScWrappers::PreconditionJacobi 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(), 1, 11); //run twice because this errored out at some point - check_solve (solver, control, A,u,f, preconditioner); + u = 0.; + deallog << "Solver type: " << typeid(solver).name() << std::endl; + check_solver_within_range(solver.solve(A,u,f,preconditioner), + control.last_step(), 1, 1); } } diff --git a/tests/petsc/solver_12.output b/tests/petsc/solver_12.output index c8dbde4e65..afd486a1b0 100644 --- a/tests/petsc/solver_12.output +++ b/tests/petsc/solver_12.output @@ -1,7 +1,6 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers13SolverPreOnlyE -DEAL::Convergence step 1 value 0 -DEAL::Solver stopped after 1 iterations +DEAL::Solver stopped within 1 - 11 iterations DEAL::Solver type: N6dealii13PETScWrappers13SolverPreOnlyE -DEAL::Solver stopped after 1 iterations +DEAL::Solver stopped within 1 - 1 iterations diff --git a/tests/petsc/solver_13.cc b/tests/petsc/solver_13.cc index 959a05f726..4f2c679964 100644 --- a/tests/petsc/solver_13.cc +++ b/tests/petsc/solver_13.cc @@ -31,23 +31,6 @@ #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; - - solver.solve(A,u,f,P); - - deallog << "Solver stopped after " << solver_control.last_step() - << " iterations" << std::endl; -} - int main(int argc, char **argv) { @@ -82,12 +65,14 @@ int main(int argc, char **argv) PETScWrappers::PreconditionJacobi 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(), 1, 1); deallog << u.l2_norm() << std::endl; - check_solve (solver, control, A,t,u, preconditioner); - + deallog << "Solver type: " << typeid(solver).name() << std::endl; + check_solver_within_range(solver.solve(A,t,u,preconditioner), + control.last_step(), 1, 1); deallog << t.l2_norm() << std::endl; u = 0; diff --git a/tests/petsc/solver_13.output b/tests/petsc/solver_13.output index 49e671b4b8..abc9dcad68 100644 --- a/tests/petsc/solver_13.output +++ b/tests/petsc/solver_13.output @@ -1,11 +1,10 @@ DEAL::Size 32 Unknowns 961 DEAL::Solver type: N6dealii13PETScWrappers13SolverPreOnlyE -DEAL::Convergence step 1 value 0 -DEAL::Solver stopped after 1 iterations +DEAL::Solver stopped within 1 - 1 iterations DEAL::7.750 DEAL::Solver type: N6dealii13PETScWrappers13SolverPreOnlyE -DEAL::Solver stopped after 1 iterations +DEAL::Solver stopped within 1 - 1 iterations DEAL::1.938 DEAL::7.750 DEAL::1.938