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 
00044   BelosLinearOpWithSolve(
00045     const RCP<Belos::LinearProblem<Scalar,MV_t,LO_t> > &lp,
00046     const RCP<Teuchos::ParameterList> &solverPL,
00047     const RCP<Belos::SolverManager<Scalar,MV_t,LO_t> > &iterativeSolver,
00048     const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
00049     const RCP<const PreconditionerBase<Scalar> > &prec,
00050     const bool isExternalPrec,
00051     const RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
00052     const ESupportSolveUse &supportSolveUse
00053     );
00054 
00094   void initialize(
00095     const RCP<Belos::LinearProblem<Scalar,MV_t,LO_t> > &lp,
00096     const RCP<Teuchos::ParameterList> &solverPL,
00097     const RCP<Belos::SolverManager<Scalar,MV_t,LO_t> > &iterativeSolver,
00098     const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
00099     const RCP<const PreconditionerBase<Scalar> > &prec,
00100     const bool isExternalPrec,
00101     const RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
00102     const ESupportSolveUse &supportSolveUse
00103     );
00104 
00106   RCP<const LinearOpSourceBase<Scalar> > extract_fwdOpSrc();
00107 
00109   RCP<const PreconditionerBase<Scalar> > extract_prec();
00110 
00112   bool isExternalPrec() const;
00113 
00115   RCP<const LinearOpSourceBase<Scalar> > extract_approxFwdOpSrc();
00116 
00118   ESupportSolveUse supportSolveUse() const;
00119 
00124   void uninitialize(
00125     RCP<Belos::LinearProblem<Scalar,MV_t,LO_t> > *lp = NULL,
00126     RCP<Teuchos::ParameterList> *solverPL = NULL,
00127     RCP<Belos::SolverManager<Scalar,MV_t,LO_t> > *iterativeSolver = NULL,
00128     RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc = NULL,
00129     RCP<const PreconditionerBase<Scalar> > *prec = NULL,
00130     bool *isExternalPrec = NULL,
00131     RCP<const LinearOpSourceBase<Scalar> > *approxFwdOpSrc = NULL,
00132     ESupportSolveUse *supportSolveUse = NULL
00133     );
00134 
00136 
00140   RCP< const VectorSpaceBase<Scalar> > range() const;
00142   RCP< const VectorSpaceBase<Scalar> > domain() const;
00144   RCP<const LinearOpBase<Scalar> > clone() const;
00146 
00150   std::string description() const;
00152   void describe(
00153     Teuchos::FancyOStream &out,
00154     const Teuchos::EVerbosityLevel verbLevel
00155     ) const;
00157 
00160 
00162   void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
00164   RCP<Teuchos::ParameterList> getNonconstParameterList();
00166   RCP<Teuchos::ParameterList> unsetParameterList();
00168   RCP<const Teuchos::ParameterList> getParameterList() const;
00170   RCP<const Teuchos::ParameterList> getValidParameters() const;
00171 
00173 
00174 protected:
00175 
00179   virtual bool opSupportedImpl(EOpTransp M_trans) const;
00181   virtual void applyImpl(
00182     const EOpTransp M_trans,
00183     const MultiVectorBase<Scalar> &X,
00184     const Ptr<MultiVectorBase<Scalar> > &Y,
00185     const Scalar alpha,
00186     const Scalar beta
00187     ) const;
00189 
00193   virtual bool solveSupportsImpl(EOpTransp M_trans) const;
00195   virtual bool solveSupportsSolveMeasureTypeImpl(
00196     EOpTransp M_trans, const SolveMeasureType& solveMeasureType
00197     ) const;
00199   SolveStatus<Scalar> solveImpl(
00200     const EOpTransp transp,
00201     const MultiVectorBase<Scalar> &B,
00202     const Ptr<MultiVectorBase<Scalar> > &X,
00203     const Ptr<const SolveCriteria<Scalar> > solveCriteria
00204     ) const;
00206   
00207 private:
00208   
00209   // ///////////////////////////////
00210   // Private data members
00211 
00212 
00213   RCP<Belos::LinearProblem<Scalar,MV_t,LO_t> > lp_;
00214   RCP<Teuchos::ParameterList> solverPL_;
00215   RCP<Belos::SolverManager<Scalar,MV_t,LO_t> > iterativeSolver_;
00216 
00217   RCP<const LinearOpSourceBase<Scalar> > fwdOpSrc_;
00218   RCP<const PreconditionerBase<Scalar> > prec_;
00219   bool isExternalPrec_;
00220   RCP<const LinearOpSourceBase<Scalar> > approxFwdOpSrc_;
00221   ESupportSolveUse supportSolveUse_;
00222 
00223   typename Teuchos::ScalarTraits<Scalar>::magnitudeType defaultTol_;
00224                                                      
00225   void assertInitialized() const;
00226   
00227 };
00228 
00229 
00230 } // namespace Thyra
00231 
00232 
00233 #endif  // THYRA_BELOS_LINEAR_OP_WITH_SOLVE_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