SolverControl solver_control (1000, 1e-6);
SolverCG<> cg (solver_control);
- deallog.depth_file(0);
- cg.solve (system_matrix, solution, system_rhs,
- PreconditionIdentity());
- deallog.depth_file(3);
-
- const unsigned int steps = solver_control.last_step();
- if (steps >= 629 && steps <= 630)
- {
- deallog << "Solver stopped within 629 - 630 iterations"
- << std::endl;
- }
- else
- {
- deallog << "Solver stopped after " << steps << " iterations"
- << std::endl;
- }
+ check_solver_within_range(
+ cg.solve(system_matrix, solution, system_rhs, PreconditionIdentity()),
+ solver_control.last_step(), 629, 630);
solution.print (deallog.get_file_stream());
f = 1.;
try
{
- deallog.depth_file(0);
- solver.solve(A,u,f,P);
- deallog.depth_file(3);
+ check_solver_within_range(
+ solver.solve(A,u,f,P),
+ solver_control.last_step(), 49, 51);
}
catch (std::exception &e)
{
- deallog.depth_file(3);
deallog << e.what() << std::endl;
abort ();
}
-
- const unsigned int steps = solver_control.last_step();
- if (steps >= 49 && steps <= 51)
- {
- deallog << "Solver stopped within 49 - 51 iterations"
- << std::endl;
- }
- else
- {
- deallog << "Solver stopped after " << solver_control.last_step()
- << " iterations" << std::endl;
- }
}
f = 1.;
try
{
- deallog.depth_file(0);
- solver.solve(A,u,f,P);
- deallog.depth_file(3);
+ check_solver_within_range(
+ solver.solve(A,u,f,P),
+ solver_control.last_step(), 49, 51);
}
catch (std::exception &e)
{
- deallog.depth_file(3);
deallog << e.what() << std::endl;
abort ();
}
-
- const unsigned int steps = solver_control.last_step();
- if (steps >= 49 && steps <= 51)
- {
- deallog << "Solver stopped within 49 - 51 iterations"
- << std::endl;
- }
- else
- {
- deallog << "Solver stopped after " << solver_control.last_step()
- << " iterations" << std::endl;
- }
}