Debian Codegraph @

packages/shylu/shylu_dd/frosch/src/SolverInterfaces/FROSch_AmesosSolverEpetra_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_AMESOSSOLVEREPETRA_DECL_HPP
11 #define _FROSCH_AMESOSSOLVEREPETRA_DECL_HPP
12
13 #include <ShyLU_DDFROSch_config.h>
14
15 #include "Amesos_ConfigDefs.h"
16 #include "Amesos.h"
17 #include "Amesos_BaseSolver.h"
18
19 #include <Xpetra_EpetraMultiVector.hpp>
20
21 // FROSch
22 #include <FROSch_Solver_def.hpp>
23
24
25 namespace FROSch {
26
27 using namespace Teuchos;
28 using namespace Xpetra;
29
30 template <class SC = double,
31 class LO = int,
32 class GO = DefaultGlobalOrdinal,
33 class NO = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
34 class AmesosSolverEpetra : public Solver<SC,LO,GO,NO> {
35
36 protected:
37
38 // Xpetra
39 using ConstXMatrixPtr = typename Solver<SC,LO,GO,NO>::ConstXMatrixPtr;
40
41 using XMultiVector = typename Solver<SC,LO,GO,NO>::XMultiVector;
42 using XMultiVectorPtr = typename Solver<SC,LO,GO,NO>::XMultiVectorPtr;
43
44 using XMultiVectorFactory = typename Solver<SC,LO,GO,NO>::XMultiVectorFactory;
45
46 // Epetra
47 using ECrsMatrix = Epetra_CrsMatrix;
48 using ECrsMatrixPtr = RCP<ECrsMatrix>;
49 using ConstECrsMatrixPtr = RCP<const ECrsMatrix>;
50
51 using EMultiVector = Epetra_MultiVector;
52 using EMultiVectorPtr = RCP<EMultiVector>;
53
54 using ELinearProblem = Epetra_LinearProblem;
55 using ELinearProblemPtr = RCP<Epetra_LinearProblem>;
56
57 // Teuchos
58 using ParameterListPtr = typename Solver<SC,LO,GO,NO>::ParameterListPtr;
59
60 // Amesos
61 using AmesosSolverPtr = RCP<Amesos_BaseSolver>;
62
63 public:
64
65 ~AmesosSolverEpetra();
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 AmesosSolverEpetra(ConstXMatrixPtr k,
94 ParameterListPtr parameterList,
95 string description);
96
97 mutable XMultiVectorPtr Y_ = null;
98
99 AmesosSolverPtr AmesosSolver_ = null;
100
101 ELinearProblemPtr EpetraLinearProblem_ = null;
102
103 friend class SolverFactory<SC,LO,GO,NO>;
104 };
105
106 }
107
108 #endif