]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix solving for Trilinos
authorcazamias <cazamias@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 16 Nov 2012 23:18:54 +0000 (23:18 +0000)
committercazamias <cazamias@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 16 Nov 2012 23:18:54 +0000 (23:18 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_unify_linear_algebra@27555 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-40/step-40.cc

index 3717d275880441140aa05163a909d33c3a21af6f..5156a151e14b30f7d0b3f09e28471ffd3ab8c288 100644 (file)
@@ -622,6 +622,7 @@ namespace Step40
     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
@@ -637,6 +638,24 @@ namespace Step40
     pcout << "   Solved in " << solver_control.last_step()
           << " iterations." << std::endl;
 
+#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);
+                     
+
+    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);

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.