]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add MinRes option
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 18 Mar 2013 14:32:11 +0000 (14:32 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 18 Mar 2013 14:32:11 +0000 (14:32 +0000)
git-svn-id: https://svn.dealii.org/trunk@28929 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/solver_selector.h

index 87cc26e6a65c5a241533d857dd2d02e00364a4d5..39bfaddec74a48128720ae33888cd09ce5fb4e8d 100644 (file)
@@ -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 <deal.II/lac/solver_cg.h>
 #include <deal.II/lac/solver_bicgstab.h>
 #include <deal.II/lac/solver_gmres.h>
+#include <deal.II/lac/solver_minres.h>
 #include <deal.II/lac/vector_memory.h>
 #include <deal.II/lac/solver_richardson.h>
 #include <deal.II/lac/precondition.h>
@@ -160,6 +161,13 @@ public:
   void set_data(const typename SolverCG<VECTOR>
                 ::AdditionalData &data);
 
+  /**
+   * Set the additional data. For more
+   * info see the @p Solver class.
+   */
+  void set_data(const typename SolverMinRes<VECTOR>
+                ::AdditionalData &data);
+
   /**
    * Set the additional data. For more
    * info see the @p Solver class.
@@ -221,6 +229,11 @@ private:
    */
   typename SolverCG<VECTOR>::AdditionalData cg_data;
 
+  /**
+   * Stores the additional data.
+   */
+  typename SolverMinRes<VECTOR>::AdditionalData minres_data;
+
   /**
    * Stores the additional data.
    */
@@ -276,36 +289,34 @@ SolverSelector<VECTOR>::solve(const Matrix &A,
                               const VECTOR &b,
                               const Preconditioner &precond) const
 {
-  GrowingVectorMemory<VECTOR> vector_memory;
-
   if (solver_name=="richardson")
     {
-      SolverRichardson<VECTOR> solver(*control, vector_memory,
-                                      richardson_data);
+      SolverRichardson<VECTOR> solver(*control, richardson_data);
       solver.solve(A,x,b,precond);
     }
   else if (solver_name=="cg")
     {
-      SolverCG<VECTOR> solver(*control, vector_memory,
-                              cg_data);
+      SolverCG<VECTOR> solver(*control, cg_data);
+      solver.solve(A,x,b,precond);
+    }
+  else if (solver_name=="minres")
+    {
+      SolverMinRes<VECTOR> solver(*control, minres_data);
       solver.solve(A,x,b,precond);
     }
   else if (solver_name=="bicgstab")
     {
-      SolverBicgstab<VECTOR> solver(*control, vector_memory,
-                                    bicgstab_data);
+      SolverBicgstab<VECTOR> solver(*control, bicgstab_data);
       solver.solve(A,x,b,precond);
     }
   else if (solver_name=="gmres")
     {
-      SolverGMRES<VECTOR> solver(*control,vector_memory,
-                                 gmres_data);
+      SolverGMRES<VECTOR> solver(*control, gmres_data);
       solver.solve(A,x,b,precond);
     }
   else if (solver_name=="fgmres")
     {
-      SolverFGMRES<VECTOR> solver(*control,vector_memory,
-                                  fgmres_data);
+      SolverFGMRES<VECTOR> solver(*control, fgmres_data);
       solver.solve(A,x,b,precond);
     }
   else
@@ -324,7 +335,7 @@ void SolverSelector<VECTOR>::set_control(
 template <class VECTOR>
 std::string SolverSelector<VECTOR>::get_solver_names()
 {
-  return "richardson|cg|bicgstab|gmres|fgmres";
+  return "richardson|cg|bicgstab|gmres|fgmres|minres";
 }
 
 
@@ -360,6 +371,14 @@ void SolverSelector<VECTOR>::set_data(
 }
 
 
+template <class VECTOR>
+void SolverSelector<VECTOR>::set_data(
+  const typename SolverMinRes<VECTOR>::AdditionalData &data)
+{
+  minres_data=data;
+}
+
+
 template <class VECTOR>
 void SolverSelector<VECTOR>::set_data(
   const typename SolverBicgstab<VECTOR>::AdditionalData &data)

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.