// @HEADER // ***************************************************************************** // ShyLU: Scalable Hybrid LU Preconditioner and Solver // // Copyright 2011 NTESS and the ShyLU contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef _FROSCH_BELOSSOLVERTPETRA_DECL_HPP #define _FROSCH_BELOSSOLVERTPETRA_DECL_HPP #include #include #include #include #include // FROSch #include namespace FROSch { using namespace Teuchos; using namespace Xpetra; template class BelosSolverTpetra : public Solver { protected: // Xpetra using ConstXMatrixPtr = typename Solver::ConstXMatrixPtr; using XMultiVector = typename Solver::XMultiVector; using XMultiVectorPtr = typename Solver::XMultiVectorPtr; using XMultiVectorFactory = typename Solver::XMultiVectorFactory; // Tpetra using TOperator = Tpetra::Operator; using TCrsMatrix = Tpetra::CrsMatrix; using TCrsMatrixPtr = RCP; using ConstTCrsMatrixPtr = RCP; using TMultiVector = Tpetra::MultiVector; using TMultiVectorPtr = RCP; // Teuchos using ParameterListPtr = typename Solver::ParameterListPtr; // Belos using BelosLinearProblem = Belos::LinearProblem; using BelosLinearProblemPtr = RCP; using BelosSolverFactory = Belos::SolverFactory; using BelosSolverFactoryPtr = RCP; using BelosSolverManager = Belos::SolverManager; using BelosSolverManagerPtr = RCP; public: //! Initialize the internal solver virtual int initialize(); //! Compute the internal solver virtual int compute(); /*! \brief Computes the operator-multivector application. Loosely, performs \f$Y = \alpha \cdot A^{\textrm{mode}} \cdot X + \beta \cdot Y\f$. However, the details of operation vary according to the values of \c alpha and \c beta. Specifically - if beta == 0, apply() must overwrite \c Y, so that any values in \c Y (including NaNs) are ignored. - if alpha == 0, apply() may short-circuit the operator, so that any values in \c X (including NaNs) are ignored. */ void apply(const XMultiVector &x, XMultiVector &y, ETransp mode=NO_TRANS, SC alpha=ScalarTraits::one(), SC beta=ScalarTraits::zero()) const; int updateMatrix(ConstXMatrixPtr k, bool reuseInitialize=false); protected: //! Constructor BelosSolverTpetra(ConstXMatrixPtr k, ParameterListPtr parameterList, string description); mutable XMultiVectorPtr Y_ = null; BelosLinearProblemPtr BelosLinearProblem_ = null; BelosSolverManagerPtr BelosSolver_ = null; friend class SolverFactory; }; } #endif