Thyra_BelosLinearOpWithSolveFactory_decl.hpp

00001 
00002 #ifndef THYRA_BELOS_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
00003 #define THYRA_BELOS_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
00004 
00005 #include "Thyra_LinearOpWithSolveFactoryBase.hpp"
00006 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00007 #include "Teuchos_StandardCompositionMacros.hpp"
00008 
00009 namespace Teuchos { class ParameterList; }
00010 
00011 namespace Thyra {
00012 
00020 template<class Scalar>
00021 class BelosLinearOpWithSolveFactory : public LinearOpWithSolveFactoryBase<Scalar> {
00022 public:
00023 
00028   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType  MagnitudeType;
00029 
00031 
00034 
00036   static const std::string  SolverType_name;
00038   static const std::string  SolverType_default;
00040   static const std::string  SolverTypes_name;
00042   static const std::string  BlockGMRES_name;
00044   static const std::string  PseudoBlockGMRES_name;
00046   static const std::string  BlockCG_name;
00048   static const std::string  PseudoBlockCG_name;
00050   static const std::string  GCRODR_name;
00051 
00053 
00056 
00058   BelosLinearOpWithSolveFactory();
00059 
00061   BelosLinearOpWithSolveFactory(
00062     const Teuchos::RCP<PreconditionerFactoryBase<Scalar> >      &precFactory
00063     );
00064 
00066 
00070   bool acceptsPreconditionerFactory() const;
00072   void setPreconditionerFactory(
00073     const Teuchos::RCP<PreconditionerFactoryBase<Scalar> >      &precFactory
00074     ,const std::string                                          &precFactoryName
00075     );
00077   Teuchos::RCP<PreconditionerFactoryBase<Scalar> > getPreconditionerFactory() const;
00079   void unsetPreconditionerFactory(
00080     Teuchos::RCP<PreconditionerFactoryBase<Scalar> >            *precFactory
00081     ,std::string                                                *precFactoryName
00082     );
00084   bool isCompatible( const LinearOpSourceBase<Scalar> &fwdOpSrc ) const;
00086   Teuchos::RCP<LinearOpWithSolveBase<Scalar> > createOp() const;
00088   void initializeOp(
00089     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00090     ,LinearOpWithSolveBase<Scalar>                              *Op
00091     ,const ESupportSolveUse                                     supportSolveUse
00092     ) const;
00094   void initializeAndReuseOp(
00095     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00096     ,LinearOpWithSolveBase<Scalar>                              *Op
00097     ) const;
00099   void uninitializeOp(
00100     LinearOpWithSolveBase<Scalar>                               *Op
00101     ,Teuchos::RCP<const LinearOpSourceBase<Scalar> >            *fwdOpSrc
00102     ,Teuchos::RCP<const PreconditionerBase<Scalar> >            *prec
00103     ,Teuchos::RCP<const LinearOpSourceBase<Scalar> >            *approxFwdOpSrc
00104     ,ESupportSolveUse                                           *supportSolveUse
00105     ) const;
00107   bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const;
00109   void initializePreconditionedOp(
00110     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00111     ,const Teuchos::RCP<const PreconditionerBase<Scalar> >      &prec
00112     ,LinearOpWithSolveBase<Scalar>                              *Op
00113     ,const ESupportSolveUse                                     supportSolveUse
00114     ) const;
00116   void initializeApproxPreconditionedOp(
00117     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00118     ,const Teuchos::RCP<const LinearOpSourceBase<Scalar> >      &approxFwdOpSrc
00119     ,LinearOpWithSolveBase<Scalar>                              *Op
00120     ,const ESupportSolveUse                                     supportSolveUse
00121     ) const;
00123 
00126 
00128   void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const& paramList);
00130   Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList();
00132   Teuchos::RCP<Teuchos::ParameterList> unsetParameterList();
00134   Teuchos::RCP<const Teuchos::ParameterList> getParameterList() const;
00136   Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
00137 
00139 
00142 
00144   std::string description() const;
00145 
00147 
00148 private:
00149 
00150   // /////////////////////////
00151   // Private types
00152 
00153   enum ESolverType {
00154     SOLVER_TYPE_BLOCK_GMRES,
00155     SOLVER_TYPE_PSEUDO_BLOCK_GMRES,
00156     SOLVER_TYPE_BLOCK_CG,
00157     SOLVER_TYPE_PSEUDO_BLOCK_CG,
00158     SOLVER_TYPE_GCRODR
00159   };
00160 
00161   // /////////////////////////
00162   // Private data members
00163 
00164   Teuchos::RCP<PreconditionerFactoryBase<Scalar> >  precFactory_;
00165   std::string                                       precFactoryName_;
00166   Teuchos::RCP<Teuchos::ParameterList>              thisValidParamList_;
00167   Teuchos::RCP<Teuchos::ParameterList>              paramList_;
00168   ESolverType solverType_;
00169 
00170   // /////////////////////////
00171   // Private member functions
00172 
00173   static Teuchos::RCP<const Teuchos::ParameterList> generateAndGetValidParameters();
00174 
00175   void updateThisValidParamList();
00176 
00177   void initializeOpImpl(
00178     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00179     ,const Teuchos::RCP<const LinearOpSourceBase<Scalar> >      &approxFwdOpSrc
00180     ,const Teuchos::RCP<const PreconditionerBase<Scalar> >      &prec
00181     ,const bool                                                 reusePrec
00182     ,LinearOpWithSolveBase<Scalar>                              *Op
00183     ,const ESupportSolveUse                                     supportSolveUse
00184     ) const;
00185 
00186 };
00187 
00189 
00190 } // namespace Thyra
00191 
00192 #endif // THYRA_BELOS_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Generated on Wed Apr 13 10:20:45 2011 for Stratimikos by  doxygen 1.6.3