From: kronbichler Date: Thu, 14 Aug 2008 21:06:01 +0000 (+0000) Subject: Made the AMG preconditioner class even more generic. Deleted the ILU/UMFPACK typedef... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76585ebc7bc9c3ca490bcc0dad98d0ab7d0559f5;p=dealii-svn.git Made the AMG preconditioner class even more generic. Deleted the ILU/UMFPACK typedef in the beginning since we won't need that part any more. git-svn-id: https://svn.dealii.org/trunk@16556 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-31/step-31.cc b/deal.II/examples/step-31/step-31.cc index d726a58865..7a072b7a59 100644 --- a/deal.II/examples/step-31/step-31.cc +++ b/deal.II/examples/step-31/step-31.cc @@ -73,29 +73,7 @@ using namespace dealii; - // @sect3{Defining the inner preconditioner type} - - // This class creates a local typedef that - // specifies the preconditioner we're - // going to use in the code below, depending - // on the space dimension. This - // is in complete analogy to step-22. -template -struct InnerPreconditioner; - -template <> -struct InnerPreconditioner<2> -{ - typedef SparseDirectUMFPACK type; -}; - -template <> -struct InnerPreconditioner<3> -{ - typedef SparseILU type; -}; - - + // @sect3{Defining the AMG preconditioner} // This implements an AMG // preconditioner based on the @@ -131,11 +109,10 @@ struct InnerPreconditioner<3> // entries in the preconditioner matrix // are zero and hence can be // neglected. -template -class TrilinosAmgPreconditioner : public Subscriptor +class PreconditionerTrilinosAmg : public Subscriptor { public: - TrilinosAmgPreconditioner (); + PreconditionerTrilinosAmg (); void initialize (const SparseMatrix &preconditioner_matrix, const std::vector &null_space, @@ -157,12 +134,10 @@ class TrilinosAmgPreconditioner : public Subscriptor }; -template -TrilinosAmgPreconditioner::TrilinosAmgPreconditioner () +PreconditionerTrilinosAmg::PreconditionerTrilinosAmg () {} -template -void TrilinosAmgPreconditioner::initialize ( +void PreconditionerTrilinosAmg::initialize ( const SparseMatrix &preconditioner_matrix, const std::vector &null_space, const unsigned int null_space_dimension, @@ -257,7 +232,11 @@ void TrilinosAmgPreconditioner::initialize ( MLList.set("smoother: sweeps", 4); } else - ML_Epetra::SetDefaults("NSSA",MLList); + { + ML_Epetra::SetDefaults("NSSA",MLList); + MLList.set("aggregation: type", "Uncoupled"); + MLList.set("aggregation: block scaling", true); + } if (output_details) MLList.set("ML output", 10); @@ -301,8 +280,7 @@ void TrilinosAmgPreconditioner::initialize ( // calls) to non-constant value, as // this is the way Trilinos wants to // have them. -template -void TrilinosAmgPreconditioner::vmult (Vector &dst, +void PreconditionerTrilinosAmg::vmult (Vector &dst, const Vector &src) const { Epetra_Vector LHS (View, *Map, dst.begin()); @@ -373,8 +351,7 @@ class BoussinesqFlowProblem BlockVector old_old_solution; BlockVector system_rhs; - //boost::shared_ptr::type> A_preconditioner; - boost::shared_ptr > Amg_preconditioner; + boost::shared_ptr Amg_preconditioner; boost::shared_ptr > Mp_preconditioner; bool rebuild_matrices; @@ -1654,9 +1631,8 @@ void BoussinesqFlowProblem::assemble_system () A_preconditioner->initialize (preconditioner_matrix.block(0,0), typename InnerPreconditioner::type::AdditionalData());*/ - Amg_preconditioner = - boost::shared_ptr > - (new TrilinosAmgPreconditioner()); + Amg_preconditioner = boost::shared_ptr + (new PreconditionerTrilinosAmg()); const unsigned int n_u = preconditioner_matrix.block(0,0).m(); std::vector null_space (dim * n_u, 0.); @@ -2068,7 +2044,7 @@ void BoussinesqFlowProblem::solve () /*BlockSchurPreconditioner::type, SparseILU > preconditioner (system_matrix, mp_inverse, *A_preconditioner);*/ - BlockSchurPreconditioner, SparseILU > + BlockSchurPreconditioner > preconditioner (system_matrix, mp_inverse, *Amg_preconditioner); // Set up GMRES solver and