Debian Codegraph @

packages/shylu/shylu_dd/frosch/src/SolverInterfaces/FROSch_ThyraPreconditioner_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_THYRAPRECONDITIONER_DECL_HPP
11 #define _FROSCH_THYRAPRECONDITIONER_DECL_HPP
12
13 #include <ShyLU_DDFROSch_config.h>
14
15 #include "Stratimikos_FROSch_decl.hpp"
16
17 #include <Xpetra_ThyraUtils.hpp>
18
19 // FROSch
20 #include <FROSch_Solver_def.hpp>
21
22
23 namespace FROSch {
24
25 using namespace Teuchos;
26 using namespace Thyra;
27 using namespace Xpetra;
28
29 template <class SC = double,
30 class LO = int,
31 class GO = DefaultGlobalOrdinal,
32 class NO = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
33 class ThyraPreconditioner : public Solver<SC,LO,GO,NO> {
34
35 protected:
36
37 // Xpetra
38 using XMatrix = typename Solver<SC,LO,GO,NO>::XMatrix;
39 using XMatrixPtr = typename Solver<SC,LO,GO,NO>::XMatrixPtr;
40 using ConstXMatrixPtr = typename Solver<SC,LO,GO,NO>::ConstXMatrixPtr;
41
42 using XMultiVector = typename Solver<SC,LO,GO,NO>::XMultiVector;
43 using XMultiVectorPtr = typename Solver<SC,LO,GO,NO>::XMultiVectorPtr;
44 using ConstXMultiVectorPtr = typename Solver<SC,LO,GO,NO>::ConstXMultiVectorPtr;
45
46 using XMultiVectorFactory = typename Solver<SC,LO,GO,NO>::XMultiVectorFactory;
47
48 // Tpetra
49 using TCrsMatrix = Tpetra::CrsMatrix<SC,LO,GO,NO>;
50 using TCrsMatrixPtr = RCP<TCrsMatrix>;
51 using ConstTCrsMatrixPtr = RCP<const TCrsMatrix>;
52
53 using TMultiVector = Tpetra::MultiVector<SC,LO,GO,NO>;
54 using TMultiVectorPtr = RCP<TMultiVector>;
55
56 // Teuchos
57 using ParameterListPtr = typename Solver<SC,LO,GO,NO>::ParameterListPtr;
58
59 // Thyra
60 using MultiVectorBasePtr = RCP<MultiVectorBase<SC> >;
61 using ConstMultiVectorBasePtr = RCP<const MultiVectorBase<SC> >;
62 using PreconditionerBasePtr = RCP<PreconditionerBase<SC> >;
63 using PreconditionerFactoryBasePtr = RCP<PreconditionerFactoryBase<SC> >;
64
65 public:
66
67 //! Initialize the internal solver
68 virtual int initialize();
69
70 //! Compute the internal solver
71 virtual int compute();
72
73 /*!
74 \brief Computes the operator-multivector application.
75
76 Loosely, performs \f$Y = \alpha \cdot A^{\textrm{mode}} \cdot X + \beta \cdot Y\f$. However, the details of operation
77 vary according to the values of \c alpha and \c beta. Specifically
78 - if <tt>beta == 0</tt>, apply() <b>must</b> overwrite \c Y, so that any values in \c Y (including NaNs) are ignored.
79 - if <tt>alpha == 0</tt>, apply() <b>may</b> short-circuit the operator, so that any values in \c X (including NaNs) are ignored.
80 */
81 void apply(const XMultiVector &x,
82 XMultiVector &y,
83 ETransp mode=NO_TRANS,
84 SC alpha=ScalarTraits<SC>::one(),
85 SC beta=ScalarTraits<SC>::zero()) const;
86
87 int updateMatrix(ConstXMatrixPtr k,
88 bool reuseInitialize=false);
89
90 protected:
91
92 //! Constructor
93 ThyraPreconditioner(ConstXMatrixPtr k,
94 ParameterListPtr parameterList,
95 string description);
96
97 // mutable MultiVectorBasePtr Y_ = null;
98
99 PreconditionerBasePtr ThyraPreconditioner_ = null;
100
101 friend class SolverFactory<SC,LO,GO,NO>;
102 };
103
104 }
105
106 #endif