Debian Codegraph @

packages/stratimikos/adapters/amesos2/src/Thyra_Amesos2LinearOpWithSolveFactory_decl.hpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // Stratimikos: Thyra-based strategies for linear solvers
4 //
5 // Copyright 2006 NTESS and the Stratimikos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #ifndef THYRA_AMESOS2_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
11 #define THYRA_AMESOS2_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
12
13 #include "Thyra_LinearOpWithSolveFactoryBase.hpp"
14 #include "Thyra_TpetraThyraWrappers.hpp"
15 #include "Thyra_Amesos2Types.hpp"
16 #include "Amesos2.hpp"
17 #include "Amesos2_Version.hpp"
18 #include "Teuchos_StandardMemberCompositionMacros.hpp"
19 #include "Teuchos_StandardCompositionMacros.hpp"
20 #include "Trilinos_Details_LinearSolver.hpp"
21 #include "Trilinos_Details_LinearSolverFactory.hpp"
22 #include "Thyra_Amesos2LinearOpWithSolve_decl.hpp"
23
24 namespace Thyra {
25
26 template<typename Scalar>
27 class Amesos2LinearOpWithSolveFactory : public LinearOpWithSolveFactoryBase<Scalar> {
28 public:
29 using ConverterT = typename Amesos2LinearOpWithSolve<Scalar>::ConverterT;
30 using MAT = typename Amesos2LinearOpWithSolve<Scalar>::MAT;
31 using MV = typename Amesos2LinearOpWithSolve<Scalar>::MV;
32 using Solver = typename Amesos2LinearOpWithSolve<Scalar>::Solver;
33
34 /** \name Parameter names for Paramter List */
35 //@{
36
37 /** \brief . */
38 static const std::string SolverType_name;
39 /** \brief . */
40 static const std::string RefactorizationPolicy_name;
41 /** \brief . */
42 static const std::string ThrowOnPreconditionerInput_name;
43 /** \brief . */
44 static const std::string Amesos2_Settings_name;
45
46 //@}
47
48 /** \name Constructors/initializers/accessors */
49 //@{
50
51 /** \brief . */
52 ~Amesos2LinearOpWithSolveFactory();
53
54 /** \brief Constructor which sets the defaults.
55 */
56 Amesos2LinearOpWithSolveFactory(
57 const Amesos2::ESolverType solverType
58 #ifdef HAVE_AMESOS2_KLU2
59 = Amesos2::KLU2,
60 #else
61 = Amesos2::LAPACK,
62 #endif
63 const Amesos2::ERefactorizationPolicy refactorizationPolicy
64 = Amesos2::REPIVOT_ON_REFACTORIZATION,
65 const bool throwOnPrecInput = true
66 );
67
68 //@}
69
70 /** @name Overridden public functions from LinearOpWithSolveFactoryBase */
71 //@{
72
73 /** \brief . */
74 bool isCompatible( const LinearOpSourceBase<Scalar> &fwdOpSrc ) const;
75
76 /** \brief . */
77 Teuchos::RCP<LinearOpWithSolveBase<Scalar> > createOp() const;
78
79 /** \brief . */
80 void initializeOp(
81 const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
82 LinearOpWithSolveBase<Scalar> *Op,
83 const ESupportSolveUse supportSolveUse
84 ) const;
85
86 /** \brief Returns <tt>false</tt> . */
87 bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const;
88
89 /** \brief Throws exception if <tt>this->throwOnPrecInput()==true</tt> and
90 * calls <tt>this->initializeOp(fwdOpSrc,Op)</tt> otherwise
91 */
92 void initializePreconditionedOp(
93 const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
94 const Teuchos::RCP<const PreconditionerBase<Scalar> > &prec,
95 LinearOpWithSolveBase<Scalar> *Op,
96 const ESupportSolveUse supportSolveUse
97 ) const;
98
99 /** \brief Throws exception if <tt>this->throwOnPrecInput()==true</tt> and
100 * calls <tt>this->initializeOp(fwdOpSrc,Op)</tt> otherwise
101 */
102 void initializePreconditionedOp(
103 const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
104 const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
105 LinearOpWithSolveBase<Scalar> *Op,
106 const ESupportSolveUse supportSolveUse
107 ) const;
108
109 /** \brief . */
110 void uninitializeOp(
111 LinearOpWithSolveBase<Scalar> *Op,
112 Teuchos::RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc,
113 Teuchos::RCP<const PreconditionerBase<Scalar> > *prec,
114 Teuchos::RCP<const LinearOpSourceBase<Scalar> > *approxFwdOpSrc,
115 ESupportSolveUse *supportSolveUse
116 ) const;
117
118 //@}
119
120 /** @name Overridden from ParameterListAcceptor */
121 //@{
122
123 /** \brief . */
124 void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const& paramList);
125 /** \brief . */
126 Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList();
127 /** \brief . */
128 Teuchos::RCP<Teuchos::ParameterList> unsetParameterList();
129 /** \brief . */
130 Teuchos::RCP<const Teuchos::ParameterList> getParameterList() const;
131 /** \brief . */
132 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
133
134 //@}
135
136 /** \name Public functions overridden from Teuchos::Describable. */
137 //@{
138
139 /** \brief . */
140 std::string description() const;
141
142 //@}
143
144 private:
145
146 // /////////////////////////
147 // Private data members
148
149 Amesos2::ESolverType solverType_;
150 Amesos2::ERefactorizationPolicy refactorizationPolicy_;
151 bool throwOnPrecInput_;
152 Teuchos::RCP<Teuchos::ParameterList> paramList_;
153
154 // /////////////////////////
155 // Private member functions
156
157 static Teuchos::RCP<const Teuchos::ParameterList>
158 generateAndGetValidParameters();
159
160 };
161
162 } // namespace Thyra
163
164 #endif // THYRA_AMESOS2_LINEAR_OP_WITH_SOLVE_FACTORY_HPP