From: Sebastian Proell Date: Mon, 20 Mar 2023 10:34:22 +0000 (+0100) Subject: Simplify Trilinos solver implementation X-Git-Tag: v9.5.0-rc1~447^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=927a225a216da11a5690abca7f87a508d46c52ed;p=dealii.git Simplify Trilinos solver implementation --- diff --git a/include/deal.II/lac/trilinos_solver.h b/include/deal.II/lac/trilinos_solver.h index 170f333192..12a6be7447 100644 --- a/include/deal.II/lac/trilinos_solver.h +++ b/include/deal.II/lac/trilinos_solver.h @@ -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; }; diff --git a/source/lac/trilinos_solver.cc b/source/lac/trilinos_solver.cc index 57784d7ba5..bb20437dbd 100644 --- a/source/lac/trilinos_solver.cc +++ b/source/lac/trilinos_solver.cc @@ -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) + {}