From: kanschat Date: Mon, 18 Mar 2013 14:32:11 +0000 (+0000) Subject: add MinRes option X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=541acab23058b52a9f816bdab11dd7ef85a7aa98;p=dealii-svn.git add MinRes option git-svn-id: https://svn.dealii.org/trunk@28929 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/solver_selector.h b/deal.II/include/deal.II/lac/solver_selector.h index 87cc26e6a6..39bfaddec7 100644 --- a/deal.II/include/deal.II/lac/solver_selector.h +++ b/deal.II/include/deal.II/lac/solver_selector.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012, 2013 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -160,6 +161,13 @@ public: void set_data(const typename SolverCG ::AdditionalData &data); + /** + * Set the additional data. For more + * info see the @p Solver class. + */ + void set_data(const typename SolverMinRes + ::AdditionalData &data); + /** * Set the additional data. For more * info see the @p Solver class. @@ -221,6 +229,11 @@ private: */ typename SolverCG::AdditionalData cg_data; + /** + * Stores the additional data. + */ + typename SolverMinRes::AdditionalData minres_data; + /** * Stores the additional data. */ @@ -276,36 +289,34 @@ SolverSelector::solve(const Matrix &A, const VECTOR &b, const Preconditioner &precond) const { - GrowingVectorMemory vector_memory; - if (solver_name=="richardson") { - SolverRichardson solver(*control, vector_memory, - richardson_data); + SolverRichardson solver(*control, richardson_data); solver.solve(A,x,b,precond); } else if (solver_name=="cg") { - SolverCG solver(*control, vector_memory, - cg_data); + SolverCG solver(*control, cg_data); + solver.solve(A,x,b,precond); + } + else if (solver_name=="minres") + { + SolverMinRes solver(*control, minres_data); solver.solve(A,x,b,precond); } else if (solver_name=="bicgstab") { - SolverBicgstab solver(*control, vector_memory, - bicgstab_data); + SolverBicgstab solver(*control, bicgstab_data); solver.solve(A,x,b,precond); } else if (solver_name=="gmres") { - SolverGMRES solver(*control,vector_memory, - gmres_data); + SolverGMRES solver(*control, gmres_data); solver.solve(A,x,b,precond); } else if (solver_name=="fgmres") { - SolverFGMRES solver(*control,vector_memory, - fgmres_data); + SolverFGMRES solver(*control, fgmres_data); solver.solve(A,x,b,precond); } else @@ -324,7 +335,7 @@ void SolverSelector::set_control( template std::string SolverSelector::get_solver_names() { - return "richardson|cg|bicgstab|gmres|fgmres"; + return "richardson|cg|bicgstab|gmres|fgmres|minres"; } @@ -360,6 +371,14 @@ void SolverSelector::set_data( } +template +void SolverSelector::set_data( + const typename SolverMinRes::AdditionalData &data) +{ + minres_data=data; +} + + template void SolverSelector::set_data( const typename SolverBicgstab::AdditionalData &data)