| 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_TPETRAPRECONDITIONER_DECL_HPP |
| 11 |
#define _FROSCH_TPETRAPRECONDITIONER_DECL_HPP |
| 12 |
|
| 13 |
#if defined(HAVE_XPETRA_TPETRA) |
| 14 |
#include <Tpetra_Operator.hpp> |
| 15 |
|
| 16 |
#include <Xpetra_Operator.hpp> |
| 17 |
#include <Xpetra_Matrix_fwd.hpp> |
| 18 |
|
| 19 |
#include <ShyLU_DDFROSch_config.h> |
| 20 |
|
| 21 |
#include <FROSch_Types.h> |
| 22 |
#include <FROSch_SchwarzPreconditioner_decl.hpp> |
| 23 |
|
| 24 |
namespace FROSch { |
| 25 |
|
| 26 |
using namespace std; |
| 27 |
using namespace Teuchos; |
| 28 |
|
| 29 |
template <class SC = double, |
| 30 |
class LO = int, |
| 31 |
class GO = DefaultGlobalOrdinal, |
| 32 |
class NO = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType> |
| 33 |
class TpetraPreconditioner : public Tpetra::Operator<SC,LO,GO,NO> { |
| 34 |
|
| 35 |
protected: |
| 36 |
using TMap = Tpetra::Map<LO,GO,NO>; |
| 37 |
using TMultiVector = Tpetra::MultiVector<SC,LO,GO,NO>; |
| 38 |
public: |
| 39 |
|
| 40 |
TpetraPreconditioner(); |
| 41 |
TpetraPreconditioner(Teuchos::RCP<Xpetra::Operator<SC,LO,GO,NO> > preconditioner); |
| 42 |
|
| 43 |
~TpetraPreconditioner(); |
| 44 |
|
| 45 |
int initialize(bool useDefaultParameters = true); |
| 46 |
|
| 47 |
int compute(); |
| 48 |
|
| 49 |
// Y = alpha * A^mode * X + beta * Y |
| 50 |
void apply(const TMultiVector &X, |
| 51 |
TMultiVector &Y, |
| 52 |
ETransp mode=NO_TRANS, |
| 53 |
SC alpha=ScalarTraits<SC>::one(), |
| 54 |
SC beta=ScalarTraits<SC>::zero()) const; |
| 55 |
|
| 56 |
Teuchos::RCP<const TMap> getDomainMap() const; |
| 57 |
|
| 58 |
Teuchos::RCP<const TMap> getRangeMap() const; |
| 59 |
|
| 60 |
void describe(FancyOStream &out, |
| 61 |
const EVerbosityLevel verbLevel=Describable::verbLevel_default) const; |
| 62 |
|
| 63 |
string description() const; |
| 64 |
|
| 65 |
bool isInitialized() const; |
| 66 |
|
| 67 |
bool isComputed() const; |
| 68 |
|
| 69 |
void residual(const TMultiVector & X, |
| 70 |
const TMultiVector & B, |
| 71 |
TMultiVector& R) const; |
| 72 |
|
| 73 |
Teuchos::RCP<Xpetra::Operator<SC,LO,GO,NO> > |
| 74 |
getSchwarzPreconditioner(); |
| 75 |
|
| 76 |
protected: |
| 77 |
Teuchos::RCP<Xpetra::Operator<SC,LO,GO,NO> > preconditioner_; |
| 78 |
}; |
| 79 |
|
| 80 |
} |
| 81 |
#endif |
| 82 |
|
| 83 |
#endif |