]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify Trilinos solver implementation 14919/head
authorSebastian Proell <sebastian.proell@tum.de>
Mon, 20 Mar 2023 10:34:22 +0000 (11:34 +0100)
committerSebastian Proell <sebastian.proell@tum.de>
Mon, 20 Mar 2023 10:34:22 +0000 (11:34 +0100)
include/deal.II/lac/trilinos_solver.h
source/lac/trilinos_solver.cc

index 170f333192abf3adf561507fdb42c8c883045faa..12a6be7447fc8150e564a368a2904dae761765fb 100644 (file)
@@ -365,7 +365,6 @@ namespace TrilinosWrappers
                                  const Epetra_Operator &preconditioner);
 
 
-
   /**
    * An implementation of the solver interface using the Trilinos CG solver.
    *
@@ -374,18 +373,6 @@ namespace TrilinosWrappers
   class SolverCG : public SolverBase
   {
   public:
-    /**
-     * Standardized data struct to pipe additional data to the solver.
-     */
-
-    struct AdditionalData : public SolverBase::AdditionalData
-    {
-      /**
-       * Set the additional data field to the desired output format.
-       */
-      explicit AdditionalData(const bool output_solver_details = false);
-    };
-
     /**
      * Constructor. In contrast to deal.II's own solvers, there is no need to
      * give a vector memory object.
@@ -394,12 +381,6 @@ namespace TrilinosWrappers
      * flags for tuning.
      */
     SolverCG(SolverControl &cn, const AdditionalData &data = AdditionalData());
-
-  protected:
-    /**
-     * Store a copy of the flags for this particular solver.
-     */
-    const AdditionalData additional_data;
   };
 
 
@@ -412,17 +393,6 @@ namespace TrilinosWrappers
   class SolverCGS : public SolverBase
   {
   public:
-    /**
-     * Standardized data struct to pipe additional data to the solver.
-     */
-    struct AdditionalData : public SolverBase::AdditionalData
-    {
-      /**
-       * Set the additional data field to the desired output format.
-       */
-      explicit AdditionalData(const bool output_solver_details = false);
-    };
-
     /**
      * Constructor. In contrast to deal.II's own solvers, there is no need to
      * give a vector memory object.
@@ -431,12 +401,6 @@ namespace TrilinosWrappers
      * flags for tuning.
      */
     SolverCGS(SolverControl &cn, const AdditionalData &data = AdditionalData());
-
-  protected:
-    /**
-     * Store a copy of the flags for this particular solver.
-     */
-    const AdditionalData additional_data;
   };
 
 
@@ -448,19 +412,6 @@ namespace TrilinosWrappers
   class SolverGMRES : public SolverBase
   {
   public:
-    /**
-     * Standardized data struct to pipe additional data to the solver.
-     */
-    struct AdditionalData : public SolverBase::AdditionalData
-    {
-      /**
-       * Constructor. By default, set the number of temporary vectors to 30,
-       * i.e. do a restart every 30 iterations.
-       */
-      explicit AdditionalData(const bool         output_solver_details = false,
-                              const unsigned int restart_parameter     = 30);
-    };
-
     /**
      * Constructor. In contrast to deal.II's own solvers, there is no need to
      * give a vector memory object.
@@ -470,12 +421,6 @@ namespace TrilinosWrappers
      */
     SolverGMRES(SolverControl &       cn,
                 const AdditionalData &data = AdditionalData());
-
-  protected:
-    /**
-     * Store a copy of the flags for this particular solver.
-     */
-    const AdditionalData additional_data;
   };
 
 
@@ -489,17 +434,6 @@ namespace TrilinosWrappers
   class SolverBicgstab : public SolverBase
   {
   public:
-    /**
-     * Standardized data struct to pipe additional data to the solver.
-     */
-    struct AdditionalData : public SolverBase::AdditionalData
-    {
-      /**
-       * Set the additional data field to the desired output format.
-       */
-      explicit AdditionalData(const bool output_solver_details = false);
-    };
-
     /**
      * Constructor. In contrast to deal.II's own solvers, there is no need to
      * give a vector memory object.
@@ -509,12 +443,6 @@ namespace TrilinosWrappers
      */
     SolverBicgstab(SolverControl &       cn,
                    const AdditionalData &data = AdditionalData());
-
-  protected:
-    /**
-     * Store a copy of the flags for this particular solver.
-     */
-    const AdditionalData additional_data;
   };
 
 
@@ -528,17 +456,6 @@ namespace TrilinosWrappers
   class SolverTFQMR : public SolverBase
   {
   public:
-    /**
-     * Standardized data struct to pipe additional data to the solver.
-     */
-    struct AdditionalData : public SolverBase::AdditionalData
-    {
-      /**
-       * Set the additional data field to the desired output format.
-       */
-      explicit AdditionalData(const bool output_solver_details = false);
-    };
-
     /**
      * Constructor. In contrast to deal.II's own solvers, there is no need to
      * give a vector memory object.
@@ -548,12 +465,6 @@ namespace TrilinosWrappers
      */
     SolverTFQMR(SolverControl &       cn,
                 const AdditionalData &data = AdditionalData());
-
-  protected:
-    /**
-     * Store a copy of the flags for this particular solver.
-     */
-    const AdditionalData additional_data;
   };
 
 
index 57784d7ba54cfd490ce2af90be908338c8b313f5..bb20437dbdf97a06f433c7bbe54c0497adbc1bfc 100644 (file)
@@ -591,85 +591,37 @@ namespace TrilinosWrappers
 
   /* ---------------------- SolverCG ------------------------ */
 
-  SolverCG::AdditionalData::AdditionalData(const bool output_solver_details)
-    : SolverBase::AdditionalData(output_solver_details)
-  {}
-
-
-
   SolverCG::SolverCG(SolverControl &cn, const AdditionalData &data)
-    : SolverBase(cn, data)
-    , additional_data(data)
-  {
-    solver_name = cg;
-  }
-
-
-  /* ---------------------- SolverGMRES ------------------------ */
-
-  SolverGMRES::AdditionalData::AdditionalData(
-    const bool         output_solver_details,
-    const unsigned int restart_parameter)
-    : SolverBase::AdditionalData(output_solver_details, restart_parameter)
+    : SolverBase(cg, cn, data)
   {}
 
 
+  /* ---------------------- SolverGMRES ------------------------ */
 
   SolverGMRES::SolverGMRES(SolverControl &cn, const AdditionalData &data)
-    : SolverBase(cn, data)
-    , additional_data(data)
-  {
-    solver_name = gmres;
-  }
-
-
-  /* ---------------------- SolverBicgstab ------------------------ */
-
-  SolverBicgstab::AdditionalData::AdditionalData(
-    const bool output_solver_details)
-    : SolverBase::AdditionalData(output_solver_details)
+    : SolverBase(gmres, cn, data)
   {}
 
 
+  /* ---------------------- SolverBicgstab ------------------------ */
 
   SolverBicgstab::SolverBicgstab(SolverControl &cn, const AdditionalData &data)
-    : SolverBase(cn, data)
-    , additional_data(data)
-  {
-    solver_name = bicgstab;
-  }
-
-
-  /* ---------------------- SolverCGS ------------------------ */
-
-  SolverCGS::AdditionalData::AdditionalData(const bool output_solver_details)
-    : SolverBase::AdditionalData(output_solver_details)
+    : SolverBase(bicgstab, cn, data)
   {}
 
 
+  /* ---------------------- SolverCGS ------------------------ */
 
   SolverCGS::SolverCGS(SolverControl &cn, const AdditionalData &data)
-    : SolverBase(cn, data)
-    , additional_data(data)
-  {
-    solver_name = cgs;
-  }
-
-
-  /* ---------------------- SolverTFQMR ------------------------ */
-
-  SolverTFQMR::AdditionalData::AdditionalData(const bool output_solver_details)
-    : SolverBase::AdditionalData(output_solver_details)
+    : SolverBase(cgs, cn, data)
   {}
 
 
+  /* ---------------------- SolverTFQMR ------------------------ */
 
   SolverTFQMR::SolverTFQMR(SolverControl &cn, const AdditionalData &data)
-    : SolverBase(cn, data)
-    , additional_data(data)
-  {
-    solver_name = tfqmr;
-  }
+    : SolverBase(tfqmr, cn, 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.