Stratimikos Package Browser (Single Doxygen Collection)  Version of the Day
Thyra_BelosLinearOpWithSolveFactory_decl.hpp
Go to the documentation of this file.
1 /*
2 // @HEADER
3 // ***********************************************************************
4 //
5 // Stratimikos: Thyra-based strategies for linear solvers
6 // Copyright (2006) Sandia Corporation
7 //
8 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9 // license for use of this work by or on behalf of the U.S. Government.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
39 //
40 // ***********************************************************************
41 // @HEADER
42 */
43 
44 
45 #ifndef THYRA_BELOS_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
46 #define THYRA_BELOS_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
47 
48 #include "Thyra_LinearOpWithSolveFactoryBase.hpp"
51 
52 namespace Teuchos { class ParameterList; }
53 
54 namespace Thyra {
55 
66  };
67 
68  inline std::istream& operator>>(
69  std::istream& is, EBelosSolverType& sType)
70  {
71  int intval;
72  is >> intval;
73  sType = (EBelosSolverType)intval;
74  return is;
75  }
76 
77 
85 template<class Scalar>
86 class BelosLinearOpWithSolveFactory : public LinearOpWithSolveFactoryBase<Scalar> {
87 public:
88 
94 
96 
99 
101  static const std::string SolverType_name;
103  static const std::string SolverType_default;
105  static const std::string SolverTypes_name;
107  static const std::string BlockGMRES_name;
109  static const std::string PseudoBlockGMRES_name;
111  static const std::string BlockCG_name;
113  static const std::string PseudoBlockCG_name;
115  static const std::string PseudoBlockStochasticCG_name;
117  static const std::string GCRODR_name;
119  static const std::string RCG_name;
121  static const std::string MINRES_name;
123  static const std::string TFQMR_name;
125  static const std::string ConvergenceTestFrequency_name;
126 
128 
131 
134 
137  const Teuchos::RCP<PreconditionerFactoryBase<Scalar> > &precFactory
138  );
139 
141 
145  bool acceptsPreconditionerFactory() const;
148  const Teuchos::RCP<PreconditionerFactoryBase<Scalar> > &precFactory
149  ,const std::string &precFactoryName
150  );
155  Teuchos::RCP<PreconditionerFactoryBase<Scalar> > *precFactory
156  ,std::string *precFactoryName
157  );
159  bool isCompatible( const LinearOpSourceBase<Scalar> &fwdOpSrc ) const;
163  void initializeOp(
164  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
165  ,LinearOpWithSolveBase<Scalar> *Op
166  ,const ESupportSolveUse supportSolveUse
167  ) const;
170  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
171  ,LinearOpWithSolveBase<Scalar> *Op
172  ) const;
174  void uninitializeOp(
175  LinearOpWithSolveBase<Scalar> *Op
176  ,Teuchos::RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc
177  ,Teuchos::RCP<const PreconditionerBase<Scalar> > *prec
178  ,Teuchos::RCP<const LinearOpSourceBase<Scalar> > *approxFwdOpSrc
179  ,ESupportSolveUse *supportSolveUse
180  ) const;
182  bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const;
185  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
186  ,const Teuchos::RCP<const PreconditionerBase<Scalar> > &prec
187  ,LinearOpWithSolveBase<Scalar> *Op
188  ,const ESupportSolveUse supportSolveUse
189  ) const;
192  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
193  ,const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc
194  ,LinearOpWithSolveBase<Scalar> *Op
195  ,const ESupportSolveUse supportSolveUse
196  ) const;
198 
201 
212 
214 
217 
219  std::string description() const;
220 
222 
223 private:
224 
225  // /////////////////////////
226  // Private types
227 
228 
229  // /////////////////////////
230  // Private data members
231 
233  std::string precFactoryName_;
238 
239  // /////////////////////////
240  // Private member functions
241 
243 
245 
246  void initializeOpImpl(
247  const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc
248  ,const Teuchos::RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc
249  ,const Teuchos::RCP<const PreconditionerBase<Scalar> > &prec
250  ,const bool reusePrec
251  ,LinearOpWithSolveBase<Scalar> *Op
252  ,const ESupportSolveUse supportSolveUse
253  ) const;
254 
255 };
256 
258 
259 } // namespace Thyra
260 
261 #endif // THYRA_BELOS_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
Thyra::SOLVER_TYPE_BLOCK_GMRES
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:57
Thyra::BelosLinearOpWithSolveFactory::supportsPreconditionerInputType
bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:225
Thyra::BelosLinearOpWithSolveFactory::ConvergenceTestFrequency_name
static const std::string ConvergenceTestFrequency_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:125
Thyra::BelosLinearOpWithSolveFactory::uninitializeOp
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
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:262
Thyra::BelosLinearOpWithSolveFactory::description
std::string description() const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:350
Thyra::BelosLinearOpWithSolveFactory::setParameterList
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const &paramList)
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:297
Thyra::BelosLinearOpWithSolveFactory::unsetParameterList
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:322
Thyra::BelosLinearOpWithSolveFactory::BlockCG_name
static const std::string BlockCG_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:111
Thyra::BelosLinearOpWithSolveFactory::generateAndGetValidParameters
static Teuchos::RCP< const Teuchos::ParameterList > generateAndGetValidParameters()
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:366
Thyra::BelosLinearOpWithSolveFactory::initializeOp
void initializeOp(const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:202
Teuchos::Scalar
Thyra::BelosLinearOpWithSolveFactory::precFactory_
Teuchos::RCP< PreconditionerFactoryBase< Scalar > > precFactory_
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:232
Teuchos_StandardMemberCompositionMacros.hpp
Thyra::EBelosSolverType
EBelosSolverType
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:56
Thyra::BelosLinearOpWithSolveFactory::updateThisValidParamList
void updateThisValidParamList()
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:522
Thyra::BelosLinearOpWithSolveFactory::MINRES_name
static const std::string MINRES_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:121
Thyra::BelosLinearOpWithSolveFactory::PseudoBlockCG_name
static const std::string PseudoBlockCG_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:113
Thyra::SOLVER_TYPE_TFQMR
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:65
Teuchos_StandardCompositionMacros.hpp
Thyra::BelosLinearOpWithSolveFactory::SolverTypes_name
static const std::string SolverTypes_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:105
Teuchos::RCP
Thyra::BelosLinearOpWithSolveFactory::initializeAndReuseOp
void initializeAndReuseOp(const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, LinearOpWithSolveBase< Scalar > *Op) const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:214
Thyra::SOLVER_TYPE_PSEUDO_BLOCK_STOCHASTIC_CG
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:61
Thyra::BelosLinearOpWithSolveFactory::solverType_
EBelosSolverType solverType_
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:236
Thyra::BelosLinearOpWithSolveFactory::SolverType_default
static const std::string SolverType_default
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:103
Thyra::BelosLinearOpWithSolveFactory::unsetPreconditionerFactory
void unsetPreconditionerFactory(Teuchos::RCP< PreconditionerFactoryBase< Scalar > > *precFactory, std::string *precFactoryName)
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:169
Thyra::BelosLinearOpWithSolveFactory::initializeOpImpl
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
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:532
Thyra::SOLVER_TYPE_MINRES
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:64
Thyra::BelosLinearOpWithSolveFactory::createOp
Teuchos::RCP< LinearOpWithSolveBase< Scalar > > createOp() const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:195
Thyra::BelosLinearOpWithSolveFactory::getValidParameters
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:340
Thyra::BelosLinearOpWithSolveFactory::PseudoBlockGMRES_name
static const std::string PseudoBlockGMRES_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:109
Thyra::BelosLinearOpWithSolveFactory::initializeApproxPreconditionedOp
void initializeApproxPreconditionedOp(const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &approxFwdOpSrc, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:249
Thyra::BelosLinearOpWithSolveFactory::thisValidParamList_
Teuchos::RCP< Teuchos::ParameterList > thisValidParamList_
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:234
Thyra::BelosLinearOpWithSolveFactory::initializePreconditionedOp
void initializePreconditionedOp(const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const Teuchos::RCP< const PreconditionerBase< Scalar > > &prec, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:236
Thyra::BelosLinearOpWithSolveFactory::BelosLinearOpWithSolveFactory
BelosLinearOpWithSolveFactory()
Construct without preconditioner factory.
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:112
Thyra::BelosLinearOpWithSolveFactory::precFactoryName_
std::string precFactoryName_
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:233
Thyra::BelosLinearOpWithSolveFactory::acceptsPreconditionerFactory
bool acceptsPreconditionerFactory() const
Returns true .
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:134
Thyra::BelosLinearOpWithSolveFactory::getPreconditionerFactory
Teuchos::RCP< PreconditionerFactoryBase< Scalar > > getPreconditionerFactory() const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:162
Thyra::BelosLinearOpWithSolveFactory::getNonconstParameterList
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:314
Thyra::BelosLinearOpWithSolveFactory::convergenceTestFrequency_
int convergenceTestFrequency_
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:237
Thyra::operator>>
std::istream & operator>>(std::istream &is, EBelosSolverType &sType)
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:68
Thyra::BelosLinearOpWithSolveFactory::MagnitudeType
Teuchos::ScalarTraits< Scalar >::magnitudeType MagnitudeType
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:93
Thyra::BelosLinearOpWithSolveFactory::SolverType_name
static const std::string SolverType_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:101
Thyra::SOLVER_TYPE_GCRODR
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:62
Thyra::SOLVER_TYPE_PSEUDO_BLOCK_GMRES
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:58
Thyra::SOLVER_TYPE_RCG
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:63
Thyra::BelosLinearOpWithSolveFactory::GCRODR_name
static const std::string GCRODR_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:117
Thyra::BelosLinearOpWithSolveFactory
LinearOpWithSolveFactoryBase subclass implemented in terms of Belos.
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:86
Thyra::BelosLinearOpWithSolveFactory::getParameterList
Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:332
Thyra::BelosLinearOpWithSolveFactory::BlockGMRES_name
static const std::string BlockGMRES_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:107
Thyra::SOLVER_TYPE_BLOCK_CG
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:59
Thyra::BelosLinearOpWithSolveFactory::TFQMR_name
static const std::string TFQMR_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:123
Thyra::BelosLinearOpWithSolveFactory::isCompatible
bool isCompatible(const LinearOpSourceBase< Scalar > &fwdOpSrc) const
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:183
Teuchos
Thyra::BelosLinearOpWithSolveFactory::RCG_name
static const std::string RCG_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:119
Thyra::BelosLinearOpWithSolveFactory::paramList_
Teuchos::RCP< Teuchos::ParameterList > paramList_
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:235
Thyra::BelosLinearOpWithSolveFactory::setPreconditionerFactory
void setPreconditionerFactory(const Teuchos::RCP< PreconditionerFactoryBase< Scalar > > &precFactory, const std::string &precFactoryName)
Definition: Thyra_BelosLinearOpWithSolveFactory_def.hpp:141
Thyra::SOLVER_TYPE_PSEUDO_BLOCK_CG
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:60
Thyra::BelosLinearOpWithSolveFactory::PseudoBlockStochasticCG_name
static const std::string PseudoBlockStochasticCG_name
Definition: Thyra_BelosLinearOpWithSolveFactory_decl.hpp:115
Thyra