PlayaPreconditioner.hpp

00001 /* @HEADER@ */
00002 //   
00003 /* @HEADER@ */
00004 
00005 #ifndef PLAYA_PRECONDITIONER_HPP
00006 #define PLAYA_PRECONDITIONER_HPP
00007 
00008 #include "PlayaDefs.hpp"
00009 #include "PlayaHandle.hpp"
00010 #include "PlayaPreconditionerBase.hpp"
00011 
00012 namespace Playa
00013 {
00018   template <class Scalar> 
00019   class Preconditioner : public Playa::Handle<PreconditionerBase<Scalar> >
00020   {
00021   public:
00022     /* Boilerplate ctors */
00023     HANDLE_CTORS(Preconditioner, PreconditionerBase<Scalar>);
00024 
00026     void changeParameter(const std::string& name, const double& value);
00027 
00029     void changeParameter(const std::string& name, int value);
00030 
00031     
00032     
00034     LinearOperator<Scalar> left() const ;
00035     
00037     LinearOperator<Scalar> right() const ;
00038     
00041     bool isTwoSided() const {return hasLeft() && hasRight();}
00042     
00044     bool hasLeft() const ;
00045     
00048     bool hasRight() const ;
00049     
00052     bool isIdentity() const {return !hasLeft() && !hasRight();}
00053   };
00054 
00055   
00056 
00057   template <class Scalar> inline 
00058   LinearOperator<Scalar> Preconditioner<Scalar>::left() const 
00059   {
00060     TEUCHOS_TEST_FOR_EXCEPTION(this->ptr().get()==0, std::runtime_error,
00061                        "null pointer in Preconditioner<Scalar>::left()");
00062     return this->ptr()->left();
00063   }
00064 
00065   template <class Scalar> inline 
00066   LinearOperator<Scalar> Preconditioner<Scalar>::right() const 
00067   {
00068     TEUCHOS_TEST_FOR_EXCEPTION(this->ptr().get()==0, std::runtime_error,
00069                        "null pointer in Preconditioner<Scalar>::right()");
00070     return this->ptr()->right();
00071   }
00072 
00073   template <class Scalar> inline
00074   bool Preconditioner<Scalar>::hasLeft() const 
00075   {
00076     return (this->ptr().get()!=0 && this->ptr()->hasLeft());
00077   }
00078 
00079   template <class Scalar> inline
00080   bool Preconditioner<Scalar>::hasRight() const 
00081   {
00082     return (this->ptr().get()!=0 && this->ptr()->hasRight());
00083   }
00084 
00085   
00086 }
00087 
00088 #endif

doxygen