Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_Amesos2LinearOpWithSolve_decl.hpp
Go to the documentation of this file.
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_DECL_HPP
11 #define THYRA_AMESOS2_LINEAR_OP_WITH_SOLVE_DECL_HPP
12 
13 #include "Thyra_LinearOpWithSolveBase.hpp"
14 #include "Thyra_LinearOpSourceBase.hpp"
15 #include <Tpetra_Map.hpp>
16 #include <Tpetra_MultiVector.hpp>
17 #include <Tpetra_CrsMatrix.hpp>
18 
19 #include "Thyra_TpetraLinearOp.hpp"
21 #include "Thyra_DefaultDiagonalLinearOp.hpp"
22 #include "Thyra_LinearOpTester.hpp"
23 
24 #include "Amesos2.hpp"
25 #include "Amesos2_Version.hpp"
26 #include "Amesos2_Solver.hpp"
27 
28 namespace Thyra {
29 
37 template<typename Scalar>
38 class Amesos2LinearOpWithSolve: virtual public LinearOpWithSolveBase<Scalar>
39 {
40 public:
41  using MAT = Tpetra::CrsMatrix<Scalar>;
42  using Op = Tpetra::Operator<Scalar>;
43  using MV = Tpetra::MultiVector<Scalar>;
44  using Solver = ::Amesos2::Solver<MAT, MV>;
46 
49 
52 
55  const Teuchos::RCP<const LinearOpBase<Scalar> > &fwdOp,
56  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
57  const Teuchos::RCP< Solver > &amesos2Solver,
58  const EOpTransp amesos2SolverTransp,
59  const Scalar amesos2SolverScalar
60  );
61 
63  void initialize(
64  const Teuchos::RCP<const LinearOpBase<Scalar> > &fwdOp,
65  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
66  const Teuchos::RCP< Solver > &amesos2Solver
67  );
68 
78 
81 
84 
87 
97 
101  std::string description() const;
103  void describe(
105  const Teuchos::EVerbosityLevel verbLevel
106  ) const;
108 
109 protected:
110 
114  virtual bool opSupportedImpl(EOpTransp M_trans) const;
116  virtual void applyImpl(
117  const EOpTransp M_trans,
118  const MultiVectorBase<Scalar> &X,
119  const Ptr<MultiVectorBase<Scalar> > &Y,
120  const Scalar alpha,
121  const Scalar beta
122  ) const;
124 
128  virtual bool solveSupportsImpl(EOpTransp M_trans) const;
131  EOpTransp M_trans, const SolveMeasureType& solveMeasureType
132  ) const;
134  SolveStatus<Scalar> solveImpl(
135  const EOpTransp M_trans,
136  const MultiVectorBase<Scalar> &B,
137  const Ptr<MultiVectorBase<Scalar> > &X,
138  const Ptr<const SolveCriteria<Scalar> > solveCriteria
139  ) const;
141 
142 private:
143 
147 
148  void assertInitialized() const;
149 
150 };
151 
152 // ///////////////////////////
153 // Inline members
154 
155 template<typename Scalar>
156 inline
159 {
160  return fwdOp_;
161 }
162 
163 template<typename Scalar>
164 inline
167 {
168  return amesos2Solver_;
169 }
170 
171 template<typename Scalar>
172 inline
175 {
176  return fwdOpSrc_;
177 }
178 
179 } // namespace Thyra
180 
181 #endif // THYRA_AMESOS2_LINEAR_OP_WITH_SOLVE_HPP
virtual bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
void initialize(const Teuchos::RCP< const LinearOpBase< Scalar > > &fwdOp, const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const Teuchos::RCP< Solver > &amesos2Solver)
Initialize after construction.
SolveStatus< Scalar > solveImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
virtual void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
Concrete LinearOpWithSolveBase subclass in terms of Amesos2.
Teuchos::RCP< const LinearOpBase< Scalar > > fwdOp_
virtual bool opSupportedImpl(EOpTransp M_trans) const
Teuchos::RCP< const LinearOpSourceBase< Scalar > > fwdOpSrc_
Teuchos::RCP< const VectorSpaceBase< Scalar > > domain() const
Teuchos::RCP< const LinearOpBase< Scalar > > clone() const
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Teuchos::RCP< const LinearOpBase< Scalar > > get_fwdOp() const
Teuchos::RCP< const VectorSpaceBase< Scalar > > range() const
virtual bool solveSupportsImpl(EOpTransp M_trans) const
Teuchos::RCP< const LinearOpSourceBase< Scalar > > get_fwdOpSrc() const
Amesos2LinearOpWithSolve()
Construct to uninitialized.
Teuchos::RCP< const LinearOpSourceBase< Scalar > > extract_fwdOpSrc()
Extract the forward LinearOpSourceBase&lt;double&gt; object so that it can be modified and remove it from t...