Stratimikos Package Browser (Single Doxygen Collection) Version of the Day
Thyra_BelosLinearOpWithSolveFactory_decl.hpp
Go to the documentation of this file.
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 
00013   enum EBelosSolverType {
00014     SOLVER_TYPE_BLOCK_GMRES,
00015     SOLVER_TYPE_PSEUDO_BLOCK_GMRES,
00016     SOLVER_TYPE_BLOCK_CG,
00017     SOLVER_TYPE_PSEUDO_BLOCK_CG,
00018     SOLVER_TYPE_GCRODR,
00019     SOLVER_TYPE_RCG,
00020     SOLVER_TYPE_MINRES
00021   };
00022 
00023   inline std::istream& operator>>(
00024     std::istream& is, EBelosSolverType& sType)
00025   {
00026     int intval;
00027     is >> intval;
00028     sType = (EBelosSolverType)intval;
00029     return is;
00030   }
00031 
00032 
00040 template<class Scalar>
00041 class BelosLinearOpWithSolveFactory : public LinearOpWithSolveFactoryBase<Scalar> {
00042 public:
00043 
00048   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType  MagnitudeType;
00049 
00051 
00054 
00056   static const std::string  SolverType_name;
00058   static const std::string  SolverType_default;
00060   static const std::string  SolverTypes_name;
00062   static const std::string  BlockGMRES_name;
00064   static const std::string  PseudoBlockGMRES_name;
00066   static const std::string  BlockCG_name;
00068   static const std::string  PseudoBlockCG_name;
00070   static const std::string  GCRODR_name;
00072   static const std::string  RCG_name;
00074   static const std::string  MINRES_name;
00076   static const std::string  ConvergenceTestFrequency_name;
00077 
00079 
00082 
00084   BelosLinearOpWithSolveFactory();
00085 
00087   BelosLinearOpWithSolveFactory(
00088     const Teuchos::RCP<PreconditionerFactoryBase<Scalar> >      &precFactory
00089     );
00090 
00092 
00096   bool acceptsPreconditionerFactory() const;
00098   void setPreconditionerFactory(
00099     const Teuchos::RCP<PreconditionerFactoryBase<Scalar> >      &precFactory
00100     ,const std::string                                          &precFactoryName
00101     );
00103   Teuchos::RCP<PreconditionerFactoryBase<Scalar> > getPreconditionerFactory() const;
00105   void unsetPreconditionerFactory(
00106     Teuchos::RCP<PreconditionerFactoryBase<Scalar> >            *precFactory
00107     ,std::string                                                *precFactoryName
00108     );
00110   bool isCompatible( const LinearOpSourceBase<Scalar> &fwdOpSrc ) const;
00112   Teuchos::RCP<LinearOpWithSolveBase<Scalar> > createOp() const;
00114   void initializeOp(
00115     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00116     ,LinearOpWithSolveBase<Scalar>                              *Op
00117     ,const ESupportSolveUse                                     supportSolveUse
00118     ) const;
00120   void initializeAndReuseOp(
00121     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00122     ,LinearOpWithSolveBase<Scalar>                              *Op
00123     ) const;
00125   void uninitializeOp(
00126     LinearOpWithSolveBase<Scalar>                               *Op
00127     ,Teuchos::RCP<const LinearOpSourceBase<Scalar> >            *fwdOpSrc
00128     ,Teuchos::RCP<const PreconditionerBase<Scalar> >            *prec
00129     ,Teuchos::RCP<const LinearOpSourceBase<Scalar> >            *approxFwdOpSrc
00130     ,ESupportSolveUse                                           *supportSolveUse
00131     ) const;
00133   bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const;
00135   void initializePreconditionedOp(
00136     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00137     ,const Teuchos::RCP<const PreconditionerBase<Scalar> >      &prec
00138     ,LinearOpWithSolveBase<Scalar>                              *Op
00139     ,const ESupportSolveUse                                     supportSolveUse
00140     ) const;
00142   void initializeApproxPreconditionedOp(
00143     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00144     ,const Teuchos::RCP<const LinearOpSourceBase<Scalar> >      &approxFwdOpSrc
00145     ,LinearOpWithSolveBase<Scalar>                              *Op
00146     ,const ESupportSolveUse                                     supportSolveUse
00147     ) const;
00149 
00152 
00154   void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const& paramList);
00156   Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList();
00158   Teuchos::RCP<Teuchos::ParameterList> unsetParameterList();
00160   Teuchos::RCP<const Teuchos::ParameterList> getParameterList() const;
00162   Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
00163 
00165 
00168 
00170   std::string description() const;
00171 
00173 
00174 private:
00175 
00176   // /////////////////////////
00177   // Private types
00178 
00179 
00180   // /////////////////////////
00181   // Private data members
00182 
00183   Teuchos::RCP<PreconditionerFactoryBase<Scalar> >  precFactory_;
00184   std::string                                       precFactoryName_;
00185   Teuchos::RCP<Teuchos::ParameterList>              thisValidParamList_;
00186   Teuchos::RCP<Teuchos::ParameterList>              paramList_;
00187   EBelosSolverType solverType_;
00188   int convergenceTestFrequency_;
00189 
00190   // /////////////////////////
00191   // Private member functions
00192 
00193   static Teuchos::RCP<const Teuchos::ParameterList> generateAndGetValidParameters();
00194 
00195   void updateThisValidParamList();
00196 
00197   void initializeOpImpl(
00198     const Teuchos::RCP<const LinearOpSourceBase<Scalar> >       &fwdOpSrc
00199     ,const Teuchos::RCP<const LinearOpSourceBase<Scalar> >      &approxFwdOpSrc
00200     ,const Teuchos::RCP<const PreconditionerBase<Scalar> >      &prec
00201     ,const bool                                                 reusePrec
00202     ,LinearOpWithSolveBase<Scalar>                              *Op
00203     ,const ESupportSolveUse                                     supportSolveUse
00204     ) const;
00205 
00206 };
00207 
00209 
00210 } // namespace Thyra
00211 
00212 #endif // THYRA_BELOS_LINEAR_OP_WITH_SOLVE_FACTORY_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines