// @HEADER // ***************************************************************************** // ShyLU: Scalable Hybrid LU Preconditioner and Solver // // Copyright 2011 NTESS and the ShyLU contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef _FROSCH_AMESOS2SOLVEREPETRA_DECL_HPP #define _FROSCH_AMESOS2SOLVEREPETRA_DECL_HPP #include #include "Amesos2.hpp" #include // FROSch #include namespace FROSch { using namespace Teuchos; using namespace Xpetra; template class Amesos2SolverEpetra : public Solver { protected: // Xpetra using ConstXMatrixPtr = typename Solver::ConstXMatrixPtr; using XMultiVector = typename Solver::XMultiVector; using XMultiVectorPtr = typename Solver::XMultiVectorPtr; using XMultiVectorFactory = typename Solver::XMultiVectorFactory; // Epetra using ECrsMatrix = Epetra_CrsMatrix; using ECrsMatrixPtr = RCP; using ConstECrsMatrixPtr = RCP; using EMultiVector = Epetra_MultiVector; using EMultiVectorPtr = RCP; // Teuchos using ParameterListPtr = typename Solver::ParameterListPtr; // Amesos2 using Amesos2SolverEpetraPtr = RCP >; public: ~Amesos2SolverEpetra(); //! 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 Amesos2SolverEpetra(ConstXMatrixPtr k, ParameterListPtr parameterList, string description); mutable XMultiVectorPtr Y_ = null; Amesos2SolverEpetraPtr Amesos2Solver_ = null; friend class SolverFactory; }; } #endif