]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Be more lenient with the exact number of iterations. 3510/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 9 Nov 2016 02:22:27 +0000 (19:22 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 9 Nov 2016 06:15:10 +0000 (23:15 -0700)
tests/slepc/solve_04.cc
tests/slepc/solve_04.output

index b397f6d870951a581ed866966d999505f5bf8a9d..a058b3c32fe0d25484d450837e746b6eb2070901 100644 (file)
@@ -39,6 +39,7 @@
 template<typename SolverType, typename MatrixType, typename VectorType>
 void
 check_solve( SolverType &solver,
+             const unsigned int solver_number,
              const SolverControl &solver_control,
              const MatrixType &A,
              std::vector<VectorType> &u, std::vector<PetscScalar > &v)
@@ -63,8 +64,41 @@ check_solve( SolverType &solver,
       deallog << "Exception: " << e.get_exc_name() << std::endl;
     }
 
-  deallog << "Solver stopped after " << solver_control.last_step()
-          << " iterations" << std::endl;
+  switch (solver_number)
+    {
+    case 1:
+      check_solver_within_range ((void)true,
+                                 solver_control.last_step(),
+                                 5,5);
+      break;
+    case 2:
+      check_solver_within_range ((void)true,
+                                 solver_control.last_step(),
+                                 24,24);
+      break;
+    case 3:
+      check_solver_within_range ((void)true,
+                                 solver_control.last_step(),
+                                 21,21);
+      break;
+    case 4:
+      check_solver_within_range ((void)true,
+                                 solver_control.last_step(),
+                                 123,128);
+      break;
+    case 5:
+      check_solver_within_range ((void)true,
+                                 solver_control.last_step(),
+                                 137,138);
+      break;
+    case 6:
+      check_solver_within_range ((void)true,
+                                 solver_control.last_step(),
+                                 50,51);
+      break;
+    default:
+      Assert (false, ExcNotImplemented());
+    }
 
   deallog << "Eigenvalues:";
   for (unsigned int i = 0; i < v.size(); i++)
@@ -108,28 +142,28 @@ int main(int argc, char **argv)
 
     {
       SLEPcWrappers::SolverKrylovSchur solver(control);
-      check_solve (solver, control, A,u,v);
+      check_solve (solver, 1, control, A,u,v);
     }
 
     {
       SLEPcWrappers::SolverArnoldi solver(control);
-      check_solve (solver, control, A,u,v);
+      check_solve (solver, 2, control, A,u,v);
     }
 
     {
       SLEPcWrappers::SolverLanczos solver(control);
-      check_solve (solver, control, A,u,v);
+      check_solve (solver, 3, control, A,u,v);
     }
 
     {
       SLEPcWrappers::SolverGeneralizedDavidson solver(control);
-      check_solve (solver, control, A,u,v);
+      check_solve (solver, 4, control, A,u,v);
     }
 
     {
       SLEPcWrappers::SolverGeneralizedDavidson::AdditionalData data(true);
       SLEPcWrappers::SolverGeneralizedDavidson solver(control,PETSC_COMM_SELF,data);
-      check_solve (solver, control, A,u,v);
+      check_solve (solver, 5, control, A,u,v);
     }
 
     // set extra settings for JD; Otherwise, at least on OSX,
@@ -139,7 +173,7 @@ int main(int argc, char **argv)
     PETScWrappers::set_option_value("-st_ksp_max_it", "10");
     {
       SLEPcWrappers::SolverJacobiDavidson solver(control);
-      check_solve (solver, control, A,u,v);
+      check_solve (solver, 6, control, A,u,v);
     }
 
   }
index ef11b2948de8e016639a2d175ed6874c239b81da..d1cbd44b6b2889606f0e9fcc17f63f11e538aae5 100644 (file)
@@ -2,26 +2,26 @@
 DEAL::Size 31 Unknowns 30
 DEAL::
 DEAL::Solver type: N6dealii13SLEPcWrappers17SolverKrylovSchurE
-DEAL::Solver stopped after 5 iterations
+DEAL::Solver stopped within 5 - 5 iterations
 DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792
 DEAL::
 DEAL::Solver type: N6dealii13SLEPcWrappers13SolverArnoldiE
-DEAL::Solver stopped after 24 iterations
+DEAL::Solver stopped within 24 - 24 iterations
 DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792
 DEAL::
 DEAL::Solver type: N6dealii13SLEPcWrappers13SolverLanczosE
-DEAL::Solver stopped after 21 iterations
+DEAL::Solver stopped within 21 - 21 iterations
 DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792
 DEAL::
 DEAL::Solver type: N6dealii13SLEPcWrappers25SolverGeneralizedDavidsonE
-DEAL::Solver stopped after 123 iterations
+DEAL::Solver stopped within 123 - 128 iterations
 DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792
 DEAL::
 DEAL::Solver type: N6dealii13SLEPcWrappers25SolverGeneralizedDavidsonE
-DEAL::Solver stopped after 138 iterations
+DEAL::Solver stopped within 137 - 138 iterations
 DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792
 DEAL::
 DEAL::Solver type: N6dealii13SLEPcWrappers20SolverJacobiDavidsonE
-DEAL::Solver stopped after 50 iterations
+DEAL::Solver stopped within 50 - 51 iterations
 DEAL::Eigenvalues: 3.98974, 3.95906, 3.90828, 3.83792
 DEAL::

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.