| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// ShyLU: Scalable Hybrid LU Preconditioner and Solver |
| 4 |
// |
| 5 |
// Copyright 2011 NTESS and the ShyLU contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#ifndef _FROSCH_THYRASOLVER_DECL_HPP |
| 11 |
#define _FROSCH_THYRASOLVER_DECL_HPP |
| 12 |
|
| 13 |
#include <ShyLU_DDFROSch_config.h> |
| 14 |
|
| 15 |
#include "Stratimikos_FROSch_decl.hpp" |
| 16 |
|
| 17 |
// FROSch |
| 18 |
#include <FROSch_Solver_def.hpp> |
| 19 |
|
| 20 |
|
| 21 |
namespace FROSch { |
| 22 |
|
| 23 |
using namespace Teuchos; |
| 24 |
using namespace Thyra; |
| 25 |
using namespace Xpetra; |
| 26 |
|
| 27 |
template <class SC = double, |
| 28 |
class LO = int, |
| 29 |
class GO = DefaultGlobalOrdinal, |
| 30 |
class NO = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType> |
| 31 |
class ThyraSolver : public Solver<SC,LO,GO,NO> { |
| 32 |
|
| 33 |
protected: |
| 34 |
|
| 35 |
// Xpetra |
| 36 |
using XMatrix = typename Solver<SC,LO,GO,NO>::XMatrix; |
| 37 |
using XMatrixPtr = typename Solver<SC,LO,GO,NO>::XMatrixPtr; |
| 38 |
using ConstXMatrixPtr = typename Solver<SC,LO,GO,NO>::ConstXMatrixPtr; |
| 39 |
|
| 40 |
using XMultiVector = typename Solver<SC,LO,GO,NO>::XMultiVector; |
| 41 |
using XMultiVectorPtr = typename Solver<SC,LO,GO,NO>::XMultiVectorPtr; |
| 42 |
using ConstXMultiVectorPtr = typename Solver<SC,LO,GO,NO>::ConstXMultiVectorPtr; |
| 43 |
|
| 44 |
using XMultiVectorFactory = typename Solver<SC,LO,GO,NO>::XMultiVectorFactory; |
| 45 |
|
| 46 |
// Teuchos |
| 47 |
using ParameterListPtr = typename Solver<SC,LO,GO,NO>::ParameterListPtr; |
| 48 |
|
| 49 |
// Thyra |
| 50 |
using MultiVectorBasePtr = RCP<MultiVectorBase<SC> >; |
| 51 |
using ConstMultiVectorBasePtr = RCP<const MultiVectorBase<SC> >; |
| 52 |
using LinearOpWithSolveBasePtr = RCP<LinearOpWithSolveBase<SC> >; |
| 53 |
using LinearOpWithSolveFactoryBasePtr = RCP<LinearOpWithSolveFactoryBase<SC> >; |
| 54 |
|
| 55 |
public: |
| 56 |
|
| 57 |
//! Initialize the internal solver |
| 58 |
virtual int initialize(); |
| 59 |
|
| 60 |
//! Compute the internal solver |
| 61 |
virtual int compute(); |
| 62 |
|
| 63 |
/*! |
| 64 |
\brief Computes the operator-multivector application. |
| 65 |
|
| 66 |
Loosely, performs \f$Y = \alpha \cdot A^{\textrm{mode}} \cdot X + \beta \cdot Y\f$. However, the details of operation |
| 67 |
vary according to the values of \c alpha and \c beta. Specifically |
| 68 |
- if <tt>beta == 0</tt>, apply() <b>must</b> overwrite \c Y, so that any values in \c Y (including NaNs) are ignored. |
| 69 |
- if <tt>alpha == 0</tt>, apply() <b>may</b> short-circuit the operator, so that any values in \c X (including NaNs) are ignored. |
| 70 |
*/ |
| 71 |
void apply(const XMultiVector &x, |
| 72 |
XMultiVector &y, |
| 73 |
ETransp mode=NO_TRANS, |
| 74 |
SC alpha=ScalarTraits<SC>::one(), |
| 75 |
SC beta=ScalarTraits<SC>::zero()) const; |
| 76 |
|
| 77 |
int updateMatrix(ConstXMatrixPtr k, |
| 78 |
bool reuseInitialize=false); |
| 79 |
|
| 80 |
protected: |
| 81 |
|
| 82 |
//! Constructor |
| 83 |
ThyraSolver(ConstXMatrixPtr k, |
| 84 |
ParameterListPtr parameterList, |
| 85 |
string description); |
| 86 |
|
| 87 |
mutable XMultiVectorPtr YX_ = null; |
| 88 |
mutable MultiVectorBasePtr YT_ = null; |
| 89 |
|
| 90 |
LinearOpWithSolveBasePtr ThyraSolver_ = null; |
| 91 |
|
| 92 |
friend class SolverFactory<SC,LO,GO,NO>; |
| 93 |
}; |
| 94 |
|
| 95 |
} |
| 96 |
|
| 97 |
#endif |