00001 /* @HEADER@ */ 00002 // 00003 /* @HEADER@ */ 00004 00005 #ifndef PLAYA_BELOSSOLVER_HPP 00006 #define PLAYA_BELOSSOLVER_HPP 00007 00008 #include "PlayaDefs.hpp" 00009 #include "PlayaLinearSolverBaseDecl.hpp" 00010 #include "PlayaPreconditionerFactory.hpp" 00011 #include "PlayaHandleable.hpp" 00012 #include "PlayaPrintable.hpp" 00013 #include "PlayaBelosAdapter.hpp" 00014 #include "Teuchos_Describable.hpp" 00015 #include "BelosBlockGmresSolMgr.hpp" 00016 #include "BelosBlockCGSolMgr.hpp" 00017 #include "BelosGCRODRSolMgr.hpp" 00018 #include "BelosRCGSolMgr.hpp" 00019 #include "BelosTFQMRSolMgr.hpp" 00020 #include "BelosConfigDefs.hpp" 00021 #include "BelosLinearProblem.hpp" 00022 00023 #include "Teuchos_RefCountPtr.hpp" 00024 #include "Teuchos_ParameterList.hpp" 00025 00026 00027 namespace Playa 00028 { 00029 using namespace Teuchos; 00030 00031 /** 00032 * 00033 */ 00034 class BelosSolver : public LinearSolverBase<double>, 00035 public Handleable<LinearSolverBase<double> >, 00036 public Printable, 00037 public Describable 00038 { 00039 public: 00040 /** */ 00041 BelosSolver(const Teuchos::ParameterList& params); 00042 00043 /** */ 00044 virtual ~BelosSolver(){;} 00045 00046 /** Set the preconditioning operator */ 00047 void setUserPrec(const PreconditionerFactory<double>& pf) {pf_=pf;} 00048 00049 /** \name Printable interface */ 00050 //@{ 00051 /** Write to a stream */ 00052 void print(std::ostream& os) const 00053 { 00054 os << description() << std::endl; 00055 } 00056 //@} 00057 00058 /** \name Describable interface */ 00059 //@{ 00060 /** Write a brief description */ 00061 std::string description() const {return "BelosSolver";} 00062 //@} 00063 00064 00065 00066 /** */ 00067 virtual SolverState<double> solve(const LinearOperator<double>& op, 00068 const Vector<double>& rhs, 00069 Vector<double>& soln) const ; 00070 00071 /** \name Handleable interface */ 00072 //@{ 00073 /** Return a ref count pointer to a newly created object */ 00074 virtual RCP<LinearSolverBase<double> > getRcp() 00075 {return rcp(this);} 00076 //@} 00077 00078 00079 protected: 00080 00081 private: 00082 00083 /** */ 00084 PreconditionerFactory<double> pf_; 00085 /** */ 00086 mutable RCP<Belos::SolverManager<double,Anasazi::SimpleMV, LinearOperator<double> > > solver_ ; 00087 /** */ 00088 mutable bool hasSolver_; 00089 }; 00090 00091 } 00092 00093 #endif