Thyra_DefaultPreconditionerDecl.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef THYRA_DEFUALT_PRECONDITIONER_DECL_HPP
00030 #define THYRA_DEFUALT_PRECONDITIONER_DECL_HPP
00031 
00032 #include "Thyra_PreconditionerBase.hpp"
00033 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00034 
00035 namespace Thyra {
00036 
00064 template <class RangeScalar, class DomainScalar = RangeScalar>
00065 class DefaultPreconditioner : virtual public PreconditionerBase<RangeScalar,DomainScalar>
00066 {
00067 public:
00068 
00071 
00074   DefaultPreconditioner();
00075 
00079   DefaultPreconditioner(
00080     const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00081     ,const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00082     );
00083 
00087   DefaultPreconditioner(
00088     const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00089     ,const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00090     );
00091 
00094   DefaultPreconditioner(
00095     const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00096     );
00097 
00100   DefaultPreconditioner(
00101     const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00102     );
00103 
00106   void initializeLeft(
00107     const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00108     );
00109 
00112   void initializeLeft(
00113     const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00114     );
00115 
00118   void initializeRight(
00119     const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &rightPrecOp
00120     );
00121 
00124   void initializeRight(
00125     const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &rightPrecOp
00126     );
00127 
00130   void initializeLeftRight(
00131     const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00132     ,const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00133     );
00134 
00137   void initializeLeftRight(
00138     const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00139     ,const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00140     );
00141 
00145   void initializeUnspecified(
00146     const Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00147     );
00148 
00152   void initializeUnspecified(
00153     const Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00154     );
00155 
00162   void uninitialize();
00163 
00165 
00166   // ToDo: Override functions from Describable!
00167 
00171   bool isLeftPrecOpConst() const;
00173   Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> > getNonconstLeftPrecOp();
00175   Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> > getLeftPrecOp() const;
00177   bool isRightPrecOpConst() const;
00179   Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> > getNonconstRightPrecOp();
00181   Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> > getRightPrecOp() const;
00183   bool isUnspecifiedPrecOpConst() const;
00185   Teuchos::RefCountPtr<LinearOpBase<RangeScalar,DomainScalar> > getNonconstUnspecifiedPrecOp();
00187   Teuchos::RefCountPtr<const LinearOpBase<RangeScalar,DomainScalar> > getUnspecifiedPrecOp() const;
00189   
00190 private:
00191   
00192   Teuchos::ConstNonconstObjectContainer<LinearOpBase<RangeScalar,DomainScalar> >  leftPrecOp_;
00193   Teuchos::ConstNonconstObjectContainer<LinearOpBase<RangeScalar,DomainScalar> >  rightPrecOp_;
00194   Teuchos::ConstNonconstObjectContainer<LinearOpBase<RangeScalar,DomainScalar> >  unspecifiedPrecOp_;
00195   
00196 };
00197 
00198 // ///////////////////////
00199 // Related functions
00200 
00206 template <class Scalar>
00207 Teuchos::RefCountPtr<const DefaultPreconditioner<Scalar> >
00208 unspecifiedPrec(
00209   const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    &unspecifiedPrecOp
00210   )
00211 {
00212   return Teuchos::rcp(new DefaultPreconditioner<Scalar>(unspecifiedPrecOp));
00213 }
00214 
00220 template <class Scalar>
00221 Teuchos::RefCountPtr<const DefaultPreconditioner<Scalar> >
00222 leftPrec(
00223   const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    &leftPrecOp
00224   )
00225 {
00226   return Teuchos::rcp(new DefaultPreconditioner<Scalar>(leftPrecOp,Teuchos::null));
00227 }
00228 
00234 template <class Scalar>
00235 Teuchos::RefCountPtr<const DefaultPreconditioner<Scalar> >
00236 rightPrec(
00237   const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    &rightPrecOp
00238   )
00239 {
00240   return Teuchos::rcp(new DefaultPreconditioner<Scalar>(Teuchos::null,rightPrecOp));
00241 }
00242 
00248 template <class Scalar>
00249 Teuchos::RefCountPtr<const DefaultPreconditioner<Scalar> >
00250 splitPrec(
00251   const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >     &leftPrecOp
00252   ,const Teuchos::RefCountPtr<const LinearOpBase<Scalar> >    &rightPrecOp
00253   )
00254 {
00255   return Teuchos::rcp(new DefaultPreconditioner<Scalar>(leftPrecOp,rightPrecOp));
00256 }
00257 
00258 } // namespace Thyra
00259 
00260 #endif // THYRA_DEFUALT_PRECONDITIONER_DECL_HPP

Generated on Thu Sep 18 12:33:02 2008 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1