Debian Codegraph @

packages/shylu/shylu_dd/frosch/src/SolverInterfaces/FROSch_Ifpack2PreconditionerTpetra_decl.hpp

raw
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_IFPACK2PRECONDITIONERTPETRA_DECL_HPP
11 #define _FROSCH_IFPACK2PRECONDITIONERTPETRA_DECL_HPP
12
13 #include <ShyLU_DDFROSch_config.h>
14
15 #include <Ifpack2_ReorderFilter_decl.hpp>
16 #include <Ifpack2_Details_OneLevelFactory_decl.hpp>
17
18 // FROSch
19 #include <FROSch_Solver_def.hpp>
20
21
22 namespace FROSch {
23
24 using namespace Teuchos;
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 Ifpack2PreconditionerTpetra : public Solver<SC,LO,GO,NO> {
32
33 protected:
34
35 // Xpetra
36 using ConstXMatrixPtr = typename Solver<SC,LO,GO,NO>::ConstXMatrixPtr;
37
38 using XMultiVector = typename Solver<SC,LO,GO,NO>::XMultiVector;
39 using XMultiVectorPtr = typename Solver<SC,LO,GO,NO>::XMultiVectorPtr;
40
41 using XMultiVectorFactory = typename Solver<SC,LO,GO,NO>::XMultiVectorFactory;
42
43 // Tpetra
44 using TOperator = Tpetra::Operator<SC,LO,GO,NO>;
45
46 using TRowMatrix = Tpetra::RowMatrix<SC,LO,GO,NO>;
47 using TRowMatrixPtr = RCP<TRowMatrix>;
48 using ConstTRowMatrixPtr = RCP<const TRowMatrix>;
49
50 using TCrsMatrix = Tpetra::CrsMatrix<SC,LO,GO,NO>;
51 using TCrsMatrixPtr = RCP<TCrsMatrix>;
52 using ConstTCrsMatrixPtr = RCP<const TCrsMatrix>;
53
54 using TMultiVector = Tpetra::MultiVector<SC,LO,GO,NO>;
55 using TMultiVectorPtr = RCP<TMultiVector>;
56
57 // Teuchos
58 using ParameterListPtr = typename Solver<SC,LO,GO,NO>::ParameterListPtr;
59
60 // Ifpack2
61 using Ifpack2PreconditionerPtr = RCP<Ifpack2::Preconditioner<SC,LO,GO,NO> >;
62 using TRowMatrixFilterType = Ifpack2::ReorderFilter<TRowMatrix>;
63
64 public:
65
66 //! Initialize the internal solver
67 virtual int initialize();
68
69 //! Compute the internal solver
70 virtual int compute();
71
72 /*!
73 \brief Computes the operator-multivector application.
74
75 Loosely, performs \f$Y = \alpha \cdot A^{\textrm{mode}} \cdot X + \beta \cdot Y\f$. However, the details of operation
76 vary according to the values of \c alpha and \c beta. Specifically
77 - if <tt>beta == 0</tt>, apply() <b>must</b> overwrite \c Y, so that any values in \c Y (including NaNs) are ignored.
78 - if <tt>alpha == 0</tt>, apply() <b>may</b> short-circuit the operator, so that any values in \c X (including NaNs) are ignored.
79 */
80 void apply(const XMultiVector &x,
81 XMultiVector &y,
82 ETransp mode=NO_TRANS,
83 SC alpha=ScalarTraits<SC>::one(),
84 SC beta=ScalarTraits<SC>::zero()) const;
85
86 int updateMatrix(ConstXMatrixPtr k,
87 bool reuseInitialize=false);
88
89 protected:
90
91 //! Constructor
92 Ifpack2PreconditionerTpetra(ConstXMatrixPtr k,
93 ParameterListPtr parameterList,
94 string description);
95
96 Ifpack2PreconditionerPtr Ifpack2Preconditioner_ = null;
97
98 bool useRILUK;
99 bool useZoltan2;
100 bool needToApplyPerm;
101 Teuchos::ArrayRCP<LO> perm;
102 Teuchos::ArrayRCP<LO> revperm;
103
104 friend class SolverFactory<SC,LO,GO,NO>;
105 };
106
107 }
108
109 #endif