Debian Codegraph @

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