From: cazamias Date: Fri, 16 Nov 2012 22:44:46 +0000 (+0000) Subject: Updated Step 40 to use PETSc or Trilinos Vectors X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c45bb96e63d7d2d22fe4ec279ea8c841caf28d4d;p=dealii-svn.git Updated Step 40 to use PETSc or Trilinos Vectors git-svn-id: https://svn.dealii.org/branches/branch_unify_linear_algebra@27552 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-40/step-40.cc b/deal.II/examples/step-40/step-40.cc index 8d62aa5f79..b958a72ba8 100644 --- a/deal.II/examples/step-40/step-40.cc +++ b/deal.II/examples/step-40/step-40.cc @@ -23,10 +23,15 @@ #include +#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;