PlayaGenericRightPreconditioner.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 //   
00003  /* @HEADER@ */
00004 
00005 #ifndef PLAYA_GENERICRIGHTPRECONDITIONER_HPP
00006 #define PLAYA_GENERICRIGHTPRECONDITIONER_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 right preconditioner that can be constructed by
00020  * accepting an operator for the right op of the preconditioner. 
00021  */
00022 template <class Scalar>
00023 class GenericRightPreconditioner : public PreconditionerBase<Scalar>
00024 {
00025 public:
00026   /** construct with an operator for the right preconditioner */
00027   GenericRightPreconditioner(const LinearOperator<Scalar>& right) 
00028     : PreconditionerBase<Scalar>(), right_(right) {;}
00029 
00030   /** virtual dtor */
00031   virtual ~GenericRightPreconditioner(){;}
00032 
00033     
00034   /** Return the right operator */
00035   virtual LinearOperator<Scalar> right() const {return right_;}
00036 
00037   /** A call to left() results in an error for a right precond. */
00038   virtual LinearOperator<Scalar> left() const
00039     {
00040       TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "left() called for a "
00041         "preconditioner known to be a right precond");
00042       return LinearOperator<Scalar>();
00043     }
00044 
00045   /** return true because 
00046    * this preconditioner has a nontrivial right component. */
00047   virtual bool hasRight() const {return true;}
00048 
00049   /** return false, because this preconditioner has
00050    * no nontrivial left component */
00051   virtual bool hasLeft() const {return false;}
00052 
00053   /* Handleable boilerplate */
00054   GET_RCP(PreconditionerBase<Scalar>);
00055 
00056 private:
00057   LinearOperator<Scalar> right_;
00058 };
00059 
00060 
00061 
00062 }
00063 
00064 #endif

Site Contact