Stratimikos Version of the Day
Thyra_BelosLinearOpWithSolve_decl.hpp
00001 
00002 #ifndef THYRA_BELOS_LINEAR_OP_WITH_SOLVE_DECL_HPP
00003 #define THYRA_BELOS_LINEAR_OP_WITH_SOLVE_DECL_HPP
00004 
00005 #include "Thyra_LinearOpWithSolveBase.hpp"
00006 #include "Thyra_LinearOpSourceBase.hpp"
00007 #include "BelosSolverManager.hpp"
00008 #include "BelosThyraAdapter.hpp"
00009 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00010 
00011 
00012 namespace Thyra {
00013 
00014 
00022 template<class Scalar>
00023 class BelosLinearOpWithSolve : virtual public LinearOpWithSolveBase<Scalar>
00024 {
00025 public:
00026 
00029 
00031   typedef MultiVectorBase<Scalar>    MV_t;
00033   typedef LinearOpBase<Scalar>       LO_t;
00034 
00036 
00039 
00041   BelosLinearOpWithSolve();
00042 
00082   void initialize(
00083     const RCP<Belos::LinearProblem<Scalar,MV_t,LO_t> > &lp,
00084     const RCP<Teuchos::ParameterList> &solverPL,
00085     const RCP<Belos::SolverManager<Scalar,MV_t,LO_t> > &iterativeSolver,
00086     const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
00087     const RCP<const PreconditionerBase<Scalar> > &prec,
00088     const bool isExternalPrec,
00089     const RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
00090     const ESupportSolveUse &supportSolveUse,
00091     const int convergenceTestFrequency
00092     );
00093 
00095   RCP<const LinearOpSourceBase<Scalar> > extract_fwdOpSrc();
00096 
00098   RCP<const PreconditionerBase<Scalar> > extract_prec();
00099 
00101   bool isExternalPrec() const;
00102 
00104   RCP<const LinearOpSourceBase<Scalar> > extract_approxFwdOpSrc();
00105 
00107   ESupportSolveUse supportSolveUse() const;
00108 
00113   void uninitialize(
00114     RCP<Belos::LinearProblem<Scalar,MV_t,LO_t> > *lp = NULL,
00115     RCP<Teuchos::ParameterList> *solverPL = NULL,
00116     RCP<Belos::SolverManager<Scalar,MV_t,LO_t> > *iterativeSolver = NULL,
00117     RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc = NULL,
00118     RCP<const PreconditionerBase<Scalar> > *prec = NULL,
00119     bool *isExternalPrec = NULL,
00120     RCP<const LinearOpSourceBase<Scalar> > *approxFwdOpSrc = NULL,
00121     ESupportSolveUse *supportSolveUse = NULL
00122     );
00123 
00125 
00129   RCP< const VectorSpaceBase<Scalar> > range() const;
00131   RCP< const VectorSpaceBase<Scalar> > domain() const;
00133   RCP<const LinearOpBase<Scalar> > clone() const;
00135 
00139   std::string description() const;
00141   void describe(
00142     Teuchos::FancyOStream &out,
00143     const Teuchos::EVerbosityLevel verbLevel
00144     ) const;
00146 
00149 
00151   void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
00153   RCP<Teuchos::ParameterList> getNonconstParameterList();
00155   RCP<Teuchos::ParameterList> unsetParameterList();
00157   RCP<const Teuchos::ParameterList> getParameterList() const;
00159   RCP<const Teuchos::ParameterList> getValidParameters() const;
00160 
00162 
00163 protected:
00164 
00168   virtual bool opSupportedImpl(EOpTransp M_trans) const;
00170   virtual void applyImpl(
00171     const EOpTransp M_trans,
00172     const MultiVectorBase<Scalar> &X,
00173     const Ptr<MultiVectorBase<Scalar> > &Y,
00174     const Scalar alpha,
00175     const Scalar beta
00176     ) const;
00178 
00182   virtual bool solveSupportsImpl(EOpTransp M_trans) const;
00184   virtual bool solveSupportsNewImpl(EOpTransp transp,
00185     const Ptr<const SolveCriteria<Scalar> > solveCriteria) const;
00187   virtual bool solveSupportsSolveMeasureTypeImpl(
00188     EOpTransp M_trans, const SolveMeasureType& solveMeasureType
00189     ) const;
00191   virtual SolveStatus<Scalar> solveImpl(
00192     const EOpTransp transp,
00193     const MultiVectorBase<Scalar> &B,
00194     const Ptr<MultiVectorBase<Scalar> > &X,
00195     const Ptr<const SolveCriteria<Scalar> > solveCriteria
00196     ) const;
00198   
00199 private:
00200   
00201   // ///////////////////////////////
00202   // Private data members
00203 
00204 
00205   RCP<Belos::LinearProblem<Scalar,MV_t,LO_t> > lp_;
00206   RCP<Teuchos::ParameterList> solverPL_;
00207   RCP<Belos::SolverManager<Scalar,MV_t,LO_t> > iterativeSolver_;
00208   int convergenceTestFrequency_;
00209 
00210   RCP<const LinearOpSourceBase<Scalar> > fwdOpSrc_;
00211   RCP<const PreconditionerBase<Scalar> > prec_;
00212   bool isExternalPrec_;
00213   RCP<const LinearOpSourceBase<Scalar> > approxFwdOpSrc_;
00214   ESupportSolveUse supportSolveUse_;
00215 
00216   typename Teuchos::ScalarTraits<Scalar>::magnitudeType defaultTol_;
00217                                                      
00218   void assertInitialized() const;
00219   
00220 };
00221 
00222 
00223 } // namespace Thyra
00224 
00225 
00226 #endif  // THYRA_BELOS_LINEAR_OP_WITH_SOLVE_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends