]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Updated Step 40 to use PETSc or Trilinos Vectors
authorcazamias <cazamias@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 16 Nov 2012 22:44:46 +0000 (22:44 +0000)
committercazamias <cazamias@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 16 Nov 2012 22:44:46 +0000 (22:44 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_unify_linear_algebra@27552 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 8d62aa5f79f2850964e3bd3110a57384dd089ca3..b958a72ba82379b08647e1920950e5f0ff35822f 100644 (file)
 
 #include <deal.II/lac/abstract_linear_algebra.h>
 
+#define USE_PETSC_LA
+
 namespace LA
 {
+#ifdef USE_PETSC_LA
   using namespace dealii::LinearAlgebraPETSc;
-//  using namespace dealii::LinearAlgebraTrilinos;
+#else
+  using namespace dealii::LinearAlgebraTrilinos;
+#endif
 }
 
 
@@ -334,8 +339,8 @@ namespace Step40
                                       locally_relevant_dofs);
     locally_relevant_solution = 0;
     system_rhs.reinit (mpi_communicator,
-                       dof_handler.n_dofs(),
-                       dof_handler.n_locally_owned_dofs());
+                       locally_owned_dofs);
+                       
     system_rhs = 0;
 
                                      // The next step is to compute hanging node
@@ -608,6 +613,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
@@ -623,6 +629,8 @@ namespace Step40
     pcout << "   Solved in " << solver_control.last_step()
           << " iterations." << std::endl;
 
+#endif
+
     constraints.distribute (completely_distributed_solution);
 
     locally_relevant_solution = 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.