SolverControl solver_control (dof_handler.n_dofs(), 1e-12);
-#ifdef USE_PETSC_LA
-
- PETScWrappers::SolverCG solver(solver_control, mpi_communicator);
-
- // Ask for a symmetric preconditioner by setting the first parameter in
- // AdditionalData to true.
- LA::MPI::PreconditionAMG
- preconditioner(system_matrix,
- PETScWrappers::PreconditionBoomerAMG::AdditionalData(true));
-
- solver.solve (system_matrix, completely_distributed_solution, system_rhs,
- preconditioner);
+ LA::SolverCG solver(solver_control, mpi_communicator);
+ LA::MPI::PreconditionAMG preconditioner;
- pcout << " Solved in " << solver_control.last_step()
- << " iterations." << std::endl;
+ LA::MPI::PreconditionAMG::AdditionalData data;
+#ifdef USE_PETSC_LA
+ data.symmetric_operator = true;
#else
-
- TrilinosWrappers::SolverCG solver(solver_control);
-
- // Ask for a symmetric preconditioner by
- // setting the first parameter in
- // AdditionalData to true.
- LA::MPI::PreconditionAMG
- preconditioner;
- preconditioner.initialize(system_matrix);
-
+ //trilinos defaults are good
+#endif
+ preconditioner.initialize(system_matrix, data);
solver.solve (system_matrix, completely_distributed_solution, system_rhs,
preconditioner);
pcout << " Solved in " << solver_control.last_step()
<< " iterations." << std::endl;
-#endif
-
constraints.distribute (completely_distributed_solution);
locally_relevant_solution = completely_distributed_solution;