Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_BelosLinearOpWithSolveFactory_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_FACTORY_DECL_HPP
11 #define THYRA_BELOS_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
12 
13 #include "Thyra_LinearOpWithSolveFactoryBase.hpp"
16 
17 
18 namespace Teuchos { class ParameterList; }
19 
20 
21 namespace Thyra {
22 
23 
25 enum EBelosSolverType {
26  SOLVER_TYPE_BLOCK_GMRES,
27  SOLVER_TYPE_PSEUDO_BLOCK_GMRES,
28  SOLVER_TYPE_BLOCK_CG,
29  SOLVER_TYPE_PSEUDO_BLOCK_CG,
30  SOLVER_TYPE_PSEUDO_BLOCK_STOCHASTIC_CG,
31  SOLVER_TYPE_GCRODR,
32  SOLVER_TYPE_RCG,
33  SOLVER_TYPE_MINRES,
34  SOLVER_TYPE_TFQMR,
35  SOLVER_TYPE_BICGSTAB,
36  SOLVER_TYPE_FIXEDPOINT,
37  SOLVER_TYPE_TPETRA_GMRES,
38  SOLVER_TYPE_TPETRA_GMRES_PIPELINE,
39  SOLVER_TYPE_TPETRA_GMRES_SINGLE_REDUCE,
40  SOLVER_TYPE_TPETRA_GMRES_SSTEP
41 };
42 
43 
45 inline std::istream& operator>>(
46  std::istream& is, EBelosSolverType& sType)
47 {
48  int intval;
49  is >> intval;
50  sType = (EBelosSolverType)intval;
51  return is;
52 }
53 
54 
62 template<class Scalar>
63 class BelosLinearOpWithSolveFactory : public LinearOpWithSolveFactoryBase<Scalar> {
64 public:
65 
71 
73 
76 
78  static const std::string SolverType_name;
80  static const std::string SolverType_default;
82  static const std::string SolverTypes_name;
84  static const std::string BlockGMRES_name;
86  static const std::string PseudoBlockGMRES_name;
88  static const std::string BlockCG_name;
90  static const std::string PseudoBlockCG_name;
92  static const std::string PseudoBlockStochasticCG_name;
94  static const std::string GCRODR_name;
96  static const std::string RCG_name;
98  static const std::string MINRES_name;
100  static const std::string TFQMR_name;
102  static const std::string BiCGStab_name;
104  static const std::string FixedPoint_name;
106  static const std::string TpetraGmres_name;
108  static const std::string TpetraGmresPipeline_name;
110  static const std::string TpetraGmresSingleReduce_name;
112  static const std::string TpetraGmresSstep_name;
114  static const std::string ConvergenceTestFrequency_name;
115 
117 
120 
123 
126  const Teuchos::RCP<PreconditionerFactoryBase<Scalar> > &precFactory
127  );
128 
130 
134  bool acceptsPreconditionerFactory() const;
137  const Teuchos::RCP<PreconditionerFactoryBase<Scalar> > &precFactory
138  ,const std::string &precFactoryName
139  );
144  Teuchos::RCP<PreconditionerFactoryBase<Scalar> > *precFactory
145  ,std::string *precFactoryName
146  );
148  bool isCompatible( const LinearOpSourceBase<Scalar> &fwdOpSrc ) const;
152  void initializeOp(
153  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
154  ,LinearOpWithSolveBase<Scalar> *Op
155  ,const ESupportSolveUse supportSolveUse
156  ) const;
159  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
160  ,LinearOpWithSolveBase<Scalar> *Op
161  ) const;
163  void uninitializeOp(
164  LinearOpWithSolveBase<Scalar> *Op
165  ,Teuchos::RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc
166  ,Teuchos::RCP<const PreconditionerBase<Scalar> > *prec
167  ,Teuchos::RCP<const LinearOpSourceBase<Scalar> > *approxFwdOpSrc
168  ,ESupportSolveUse *supportSolveUse
169  ) const;
171  bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const;
174  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
175  ,const Teuchos::RCP<const PreconditionerBase<Scalar> > &prec
176  ,LinearOpWithSolveBase<Scalar> *Op
177  ,const ESupportSolveUse supportSolveUse
178  ) const;
181  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
182  ,const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc
183  ,LinearOpWithSolveBase<Scalar> *Op
184  ,const ESupportSolveUse supportSolveUse
185  ) const;
187 
190 
201 
203 
206 
208  std::string description() const;
209 
211 
212 private:
213 
214  // /////////////////////////
215  // Private types
216 
217 
218  // /////////////////////////
219  // Private data members
220 
222  std::string precFactoryName_;
225  EBelosSolverType solverType_;
227 
228  // /////////////////////////
229  // Private member functions
230 
232 
234 
235  void initializeOpImpl(
236  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
237  ,const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc
238  ,const Teuchos::RCP<const PreconditionerBase<Scalar> > &prec
239  ,const bool reusePrec
240  ,LinearOpWithSolveBase<Scalar> *Op
241  ,const ESupportSolveUse supportSolveUse
242  ) const;
243 
244 };
245 
247 
248 } // namespace Thyra
249 
250 #endif // THYRA_BELOS_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void uninitializeOp(LinearOpWithSolveBase< Scalar > *Op, Teuchos::RCP< const LinearOpSourceBase< Scalar > > *fwdOpSrc, Teuchos::RCP< const PreconditionerBase< Scalar > > *prec, Teuchos::RCP< const LinearOpSourceBase< Scalar > > *approxFwdOpSrc, ESupportSolveUse *supportSolveUse) const
void initializeAndReuseOp(const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, LinearOpWithSolveBase< Scalar > *Op) const
static Teuchos::RCP< const Teuchos::ParameterList > generateAndGetValidParameters()
void unsetPreconditionerFactory(Teuchos::RCP< PreconditionerFactoryBase< Scalar > > *precFactory, std::string *precFactoryName)
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const &paramList)
bool isCompatible(const LinearOpSourceBase< Scalar > &fwdOpSrc) const
std::istringstream & operator>>(std::istringstream &in, TwoDArray< T > &array)
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
void initializeOp(const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
void setPreconditionerFactory(const Teuchos::RCP< PreconditionerFactoryBase< Scalar > > &precFactory, const std::string &precFactoryName)
LinearOpWithSolveFactoryBase subclass implemented in terms of Belos.
bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const
Teuchos::ScalarTraits< Scalar >::magnitudeType MagnitudeType
Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
Teuchos::RCP< PreconditionerFactoryBase< Scalar > > getPreconditionerFactory() const
Teuchos::RCP< Teuchos::ParameterList > thisValidParamList_
void initializeApproxPreconditionedOp(const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &approxFwdOpSrc, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
void initializePreconditionedOp(const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const Teuchos::RCP< const PreconditionerBase< Scalar > > &prec, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
Teuchos::RCP< LinearOpWithSolveBase< Scalar > > createOp() const
BelosLinearOpWithSolveFactory()
Construct without preconditioner factory.
Teuchos::RCP< PreconditionerFactoryBase< Scalar > > precFactory_
void initializeOpImpl(const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &approxFwdOpSrc, const Teuchos::RCP< const PreconditionerBase< Scalar > > &prec, const bool reusePrec, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()