00001 /* @HEADER@ */ 00002 // 00003 /* @HEADER@ */ 00004 00005 #ifndef PLAYA_LINEARSOLVERBASEDECL_HPP 00006 #define PLAYA_LINEARSOLVERBASEDECL_HPP 00007 00008 #include "PlayaDefs.hpp" 00009 #include "PlayaSolverState.hpp" 00010 #include "PlayaObjectWithVerbosity.hpp" 00011 #include "Teuchos_ParameterList.hpp" 00012 00013 namespace Playa 00014 { 00015 using namespace Teuchos; 00016 template <class Scalar> 00017 class LinearOperator; 00018 00019 template <class Scalar> 00020 class Preconditioner; 00021 00022 template <class Scalar> 00023 class PreconditionerFactory; 00024 00025 template <class Scalar> 00026 class Vector; 00027 00028 00029 /** */ 00030 template <class Scalar> 00031 class LinearSolverBase : public ObjectWithVerbosity 00032 { 00033 public: 00034 /** */ 00035 LinearSolverBase(const ParameterList& params); 00036 00037 /** */ 00038 virtual ~LinearSolverBase(){;} 00039 00040 /** */ 00041 virtual SolverState<Scalar> solve(const LinearOperator<Scalar>& op, 00042 const Vector<Scalar>& rhs, 00043 Vector<Scalar>& soln) const = 0; 00044 00045 /** Change the convergence tolerance. Default does nothing. */ 00046 virtual void updateTolerance(const double& tol) {;} 00047 00048 /** Set a user-defined preconditioning operator. Default is an error. */ 00049 virtual void setUserPrec(const PreconditionerFactory<Scalar>& pf); 00050 00051 /** Set a user-defined preconditioning operator. Default is an error. */ 00052 virtual void setUserPrec(const LinearOperator<Scalar>& P, 00053 const LinearSolver<Scalar>& pSolver); 00054 00055 /** */ 00056 const ParameterList& parameters() const ; 00057 00058 /** */ 00059 ParameterList& parameters(); 00060 00061 /** */ 00062 std::string verbosityParam() const ; 00063 00064 /** */ 00065 template <typename T> 00066 static void setParameter(const ParameterList& params, 00067 T* valuePtr, 00068 const std::string& paramName); 00069 private: 00070 ParameterList params_; 00071 }; 00072 } 00073 00074 #endif