00001 /* @HEADER@ */ 00002 // 00003 /* @HEADER@ */ 00004 00005 #ifndef PLAYA_GENERICTWOSIDEDPRECONDITIONER_HPP 00006 #define PLAYA_GENERICTWOSIDEDPRECONDITIONER_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 GenericTwoSidedPreconditioner : public PreconditionerBase<Scalar> 00024 { 00025 public: 00026 /** construct with an operator for the two-sided preconditioner */ 00027 GenericTwoSidedPreconditioner(const LinearOperator<Scalar>& left, const LinearOperator<Scalar>& right) 00028 : PreconditionerBase<Scalar>(), left_(left), right_(right) {;} 00029 00030 /** virtual dtor */ 00031 virtual ~GenericTwoSidedPreconditioner(){;} 00032 00033 00034 /** Return the left operator */ 00035 virtual LinearOperator<Scalar> left() const {return left_;} 00036 00037 /** Return the right operator */ 00038 virtual LinearOperator<Scalar> right() const {return right_;} 00039 00040 /** return true because 00041 * this preconditioner has a nontrivial left component. */ 00042 virtual bool hasLeft() const {return true;} 00043 00044 /** return true because 00045 * this preconditioner has a nontrivial right component. */ 00046 virtual bool hasRight() const {return true;} 00047 00048 /* Handleable boilerplate */ 00049 GET_RCP(PreconditionerBase<Scalar>); 00050 00051 private: 00052 LinearOperator<Scalar> left_; 00053 LinearOperator<Scalar> right_; 00054 }; 00055 00056 } 00057 00058 #endif