Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_BelosLinearOpWithSolve_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_BELOS_LINEAR_OP_WITH_SOLVE_DECL_HPP
11 #define THYRA_BELOS_LINEAR_OP_WITH_SOLVE_DECL_HPP
12 
13 #include "Thyra_LinearOpWithSolveBase.hpp"
14 #include "Thyra_LinearOpSourceBase.hpp"
15 #include "BelosSolverManager.hpp"
16 #include "BelosThyraAdapter.hpp"
18 
19 
20 namespace Thyra {
21 
22 
30 template<class Scalar>
31 class BelosLinearOpWithSolve : virtual public LinearOpWithSolveBase<Scalar>
32 {
33 public:
34 
37 
39  typedef MultiVectorBase<Scalar> MV_t;
41  typedef LinearOpBase<Scalar> LO_t;
42 
44 
47 
50 
90  void initialize(
91  const RCP<Belos::LinearProblem<Scalar,MV_t,LO_t> > &lp,
92  const RCP<Teuchos::ParameterList> &solverPL,
93  const RCP<Belos::SolverManager<Scalar,MV_t,LO_t> > &iterativeSolver,
94  const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
95  const RCP<const PreconditionerBase<Scalar> > &prec,
96  const bool isExternalPrec,
97  const RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
98  const ESupportSolveUse &supportSolveUse,
99  const int convergenceTestFrequency
100  );
101 
104 
107 
109  bool isExternalPrec() const;
110 
113 
115  ESupportSolveUse supportSolveUse() const;
116 
121  void uninitialize(
122  RCP<Belos::LinearProblem<Scalar,MV_t,LO_t> > *lp = NULL,
123  RCP<Teuchos::ParameterList> *solverPL = NULL,
124  RCP<Belos::SolverManager<Scalar,MV_t,LO_t> > *iterativeSolver = NULL,
125  RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc = NULL,
126  RCP<const PreconditionerBase<Scalar> > *prec = NULL,
127  bool *isExternalPrec = NULL,
128  RCP<const LinearOpSourceBase<Scalar> > *approxFwdOpSrc = NULL,
129  ESupportSolveUse *supportSolveUse = NULL
130  );
131 
133 
143 
147  std::string description() const;
149  void describe(
151  const Teuchos::EVerbosityLevel verbLevel
152  ) const;
154 
157 
159  void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
168 
170 
171 protected:
172 
176  virtual bool opSupportedImpl(EOpTransp M_trans) const;
178  virtual void applyImpl(
179  const EOpTransp M_trans,
180  const MultiVectorBase<Scalar> &X,
181  const Ptr<MultiVectorBase<Scalar> > &Y,
182  const Scalar alpha,
183  const Scalar beta
184  ) const;
186 
190  virtual bool solveSupportsImpl(EOpTransp M_trans) const;
192  virtual bool solveSupportsNewImpl(EOpTransp transp,
193  const Ptr<const SolveCriteria<Scalar> > solveCriteria) const;
196  EOpTransp M_trans, const SolveMeasureType& solveMeasureType
197  ) const;
199  virtual SolveStatus<Scalar> solveImpl(
200  const EOpTransp transp,
201  const MultiVectorBase<Scalar> &B,
202  const Ptr<MultiVectorBase<Scalar> > &X,
203  const Ptr<const SolveCriteria<Scalar> > solveCriteria
204  ) const;
206 
207 private:
208 
209  // ///////////////////////////////
210  // Private data members
211 
212 
217 
222  ESupportSolveUse supportSolveUse_;
223 
225 
226  void assertInitialized() const;
227 
229  mutable int counter_;
230 
231 };
232 
233 
234 } // namespace Thyra
235 
236 
237 #endif // THYRA_BELOS_LINEAR_OP_WITH_SOLVE_DECL_HPP
virtual bool solveSupportsImpl(EOpTransp M_trans) const
RCP< const VectorSpaceBase< Scalar > > domain() const
RCP< Belos::LinearProblem< Scalar, MV_t, LO_t > > lp_
RCP< const Teuchos::ParameterList > getValidParameters() const
virtual SolveStatus< Scalar > solveImpl(const EOpTransp transp, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
RCP< const LinearOpSourceBase< Scalar > > extract_approxFwdOpSrc()
void initialize(const RCP< Belos::LinearProblem< Scalar, MV_t, LO_t > > &lp, const RCP< Teuchos::ParameterList > &solverPL, const RCP< Belos::SolverManager< Scalar, MV_t, LO_t > > &iterativeSolver, const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< const PreconditionerBase< Scalar > > &prec, const bool isExternalPrec, const RCP< const LinearOpSourceBase< Scalar > > &approxFwdOpSrc, const ESupportSolveUse &supportSolveUse, const int convergenceTestFrequency)
Initializes given precreated solver objects.
Concrete LinearOpWithSolveBase subclass in terms of Belos.
RCP< const PreconditionerBase< Scalar > > extract_prec()
virtual bool solveSupportsNewImpl(EOpTransp transp, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
RCP< const PreconditionerBase< Scalar > > prec_
RCP< const VectorSpaceBase< Scalar > > range() const
virtual void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
void setParameterList(RCP< Teuchos::ParameterList > const &paramList)
Thyra specializations of MultiVecTraits and OperatorTraits.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
RCP< const LinearOpSourceBase< Scalar > > extract_fwdOpSrc()
Teuchos::ScalarTraits< Scalar >::magnitudeType defaultTol_
BelosLinearOpWithSolve()
Construct to unintialize.
void uninitialize(RCP< Belos::LinearProblem< Scalar, MV_t, LO_t > > *lp=NULL, RCP< Teuchos::ParameterList > *solverPL=NULL, RCP< Belos::SolverManager< Scalar, MV_t, LO_t > > *iterativeSolver=NULL, RCP< const LinearOpSourceBase< Scalar > > *fwdOpSrc=NULL, RCP< const PreconditionerBase< Scalar > > *prec=NULL, bool *isExternalPrec=NULL, RCP< const LinearOpSourceBase< Scalar > > *approxFwdOpSrc=NULL, ESupportSolveUse *supportSolveUse=NULL)
Uninitializes and returns stored quantities.
RCP< const LinearOpSourceBase< Scalar > > approxFwdOpSrc_
RCP< const LinearOpBase< Scalar > > clone() const
RCP< const Teuchos::ParameterList > getParameterList() const
RCP< Teuchos::ParameterList > unsetParameterList()
virtual bool opSupportedImpl(EOpTransp M_trans) const
virtual bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
RCP< const LinearOpSourceBase< Scalar > > fwdOpSrc_
RCP< Teuchos::ParameterList > getNonconstParameterList()
RCP< Belos::SolverManager< Scalar, MV_t, LO_t > > iterativeSolver_