]> https://gitweb.dealii.org/ - dealii.git/commitdiff
petsc/solver_03_precondition_boomeramg_symmetric: make test more robust 4716/head
authorMatthias Maier <tamiko@43-1.org>
Mon, 7 Aug 2017 20:45:05 +0000 (15:45 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 7 Aug 2017 20:45:57 +0000 (15:45 -0500)
tests/petsc/solver_03_precondition_boomeramg_symmetric.cc
tests/petsc/solver_03_precondition_boomeramg_symmetric.with_mpi=true.output

index 594721f7b8050228647b1d9303b912614a8b5707..e67b6fb2258ef4581b7c7d840ed0b112b2b359ea 100644 (file)
 #include <deal.II/lac/vector_memory.h>
 #include <typeinfo>
 
-template <typename SolverType, typename MatrixType, typename VectorType, class PRECONDITION>
-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);
   }
 
 }
index af0f9b29f316cca354f601fa0b3294aee02535d0..e5af3042c018475d6d0e4006bf35cc31520f0a11 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.