00001 /* @HEADER@ */ 00002 // 00003 /* @HEADER@ */ 00004 00005 #ifndef PLAYA_GENERICLEFTPRECONDITIONER_HPP 00006 #define PLAYA_GENERICLEFTPRECONDITIONER_HPP 00007 00008 #include "PlayaDefs.hpp" 00009 #include "PlayaVectorDecl.hpp" 00010 #include "PlayaLinearOperatorDecl.hpp" 00011 #include "PlayaPreconditionerBase.hpp" 00012 00013 00014 namespace Playa 00015 { 00016 using namespace Teuchos; 00017 00018 /** 00019 * A one-size-fits-most left preconditioner that can be constructed by 00020 * accepting an operator for the left op of the preconditioner. 00021 */ 00022 template <class Scalar> 00023 class GenericLeftPreconditioner : public PreconditionerBase<Scalar> 00024 { 00025 public: 00026 /** construct with an operator for the left preconditioner */ 00027 GenericLeftPreconditioner(const LinearOperator<Scalar>& left) 00028 : PreconditionerBase<Scalar>(), left_(left) {;} 00029 00030 /** virtual dtor */ 00031 virtual ~GenericLeftPreconditioner(){;} 00032 00033 00034 /** Return the left operator */ 00035 virtual LinearOperator<Scalar> left() const {return left_;} 00036 00037 /** A call to right() results in an error for a left precond. */ 00038 virtual LinearOperator<Scalar> right() const 00039 { 00040 TEUCHOS_TEST_FOR_EXCEPTION(true, logic_error, "right() called for a " 00041 "preconditioner known to be a left precond"); 00042 return LinearOperator<Scalar>(); 00043 } 00044 00045 /** return true because 00046 * this preconditioner has a nontrivial left component. */ 00047 virtual bool hasLeft() const {return true;} 00048 00049 /** return false, because this preconditioner has 00050 * no nontrivial right component */ 00051 virtual bool hasRight() const {return false;} 00052 00053 /* Handleable boilerplate */ 00054 GET_RCP(PreconditionerBase<Scalar>); 00055 00056 private: 00057 LinearOperator<Scalar> left_; 00058 }; 00059 00060 } 00061 00062 #endif