Debian Codegraph @

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