// @HEADER // ***************************************************************************** // Stratimikos: Thyra-based strategies for linear solvers // // Copyright 2006 NTESS and the Stratimikos contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef THYRA_AMESOS2_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP #define THYRA_AMESOS2_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP #include "Thyra_LinearOpWithSolveFactoryBase.hpp" #include "Thyra_TpetraThyraWrappers.hpp" #include "Thyra_Amesos2Types.hpp" #include "Amesos2.hpp" #include "Amesos2_Version.hpp" #include "Teuchos_StandardMemberCompositionMacros.hpp" #include "Teuchos_StandardCompositionMacros.hpp" #include "Trilinos_Details_LinearSolver.hpp" #include "Trilinos_Details_LinearSolverFactory.hpp" #include "Thyra_Amesos2LinearOpWithSolve_decl.hpp" namespace Thyra { template class Amesos2LinearOpWithSolveFactory : public LinearOpWithSolveFactoryBase { public: using ConverterT = typename Amesos2LinearOpWithSolve::ConverterT; using MAT = typename Amesos2LinearOpWithSolve::MAT; using MV = typename Amesos2LinearOpWithSolve::MV; using Solver = typename Amesos2LinearOpWithSolve::Solver; /** \name Parameter names for Paramter List */ //@{ /** \brief . */ static const std::string SolverType_name; /** \brief . */ static const std::string RefactorizationPolicy_name; /** \brief . */ static const std::string ThrowOnPreconditionerInput_name; /** \brief . */ static const std::string Amesos2_Settings_name; //@} /** \name Constructors/initializers/accessors */ //@{ /** \brief . */ ~Amesos2LinearOpWithSolveFactory(); /** \brief Constructor which sets the defaults. */ Amesos2LinearOpWithSolveFactory( const Amesos2::ESolverType solverType #ifdef HAVE_AMESOS2_KLU2 = Amesos2::KLU2, #else = Amesos2::LAPACK, #endif const Amesos2::ERefactorizationPolicy refactorizationPolicy = Amesos2::REPIVOT_ON_REFACTORIZATION, const bool throwOnPrecInput = true ); //@} /** @name Overridden public functions from LinearOpWithSolveFactoryBase */ //@{ /** \brief . */ bool isCompatible( const LinearOpSourceBase &fwdOpSrc ) const; /** \brief . */ Teuchos::RCP > createOp() const; /** \brief . */ void initializeOp( const Teuchos::RCP > &fwdOpSrc, LinearOpWithSolveBase *Op, const ESupportSolveUse supportSolveUse ) const; /** \brief Returns false . */ bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const; /** \brief Throws exception if this->throwOnPrecInput()==true and * calls this->initializeOp(fwdOpSrc,Op) otherwise */ void initializePreconditionedOp( const Teuchos::RCP > &fwdOpSrc, const Teuchos::RCP > &prec, LinearOpWithSolveBase *Op, const ESupportSolveUse supportSolveUse ) const; /** \brief Throws exception if this->throwOnPrecInput()==true and * calls this->initializeOp(fwdOpSrc,Op) otherwise */ void initializePreconditionedOp( const Teuchos::RCP > &fwdOpSrc, const Teuchos::RCP > &approxFwdOpSrc, LinearOpWithSolveBase *Op, const ESupportSolveUse supportSolveUse ) const; /** \brief . */ void uninitializeOp( LinearOpWithSolveBase *Op, Teuchos::RCP > *fwdOpSrc, Teuchos::RCP > *prec, Teuchos::RCP > *approxFwdOpSrc, ESupportSolveUse *supportSolveUse ) const; //@} /** @name Overridden from ParameterListAcceptor */ //@{ /** \brief . */ void setParameterList(Teuchos::RCP const& paramList); /** \brief . */ Teuchos::RCP getNonconstParameterList(); /** \brief . */ Teuchos::RCP unsetParameterList(); /** \brief . */ Teuchos::RCP getParameterList() const; /** \brief . */ Teuchos::RCP getValidParameters() const; //@} /** \name Public functions overridden from Teuchos::Describable. */ //@{ /** \brief . */ std::string description() const; //@} private: // ///////////////////////// // Private data members Amesos2::ESolverType solverType_; Amesos2::ERefactorizationPolicy refactorizationPolicy_; bool throwOnPrecInput_; Teuchos::RCP paramList_; // ///////////////////////// // Private member functions static Teuchos::RCP generateAndGetValidParameters(); }; } // namespace Thyra #endif // THYRA_AMESOS2_LINEAR_OP_WITH_SOLVE_FACTORY_HPP