Thyra_DefaultPreconditionerDecl.hpp

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::RCP<LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00081     ,const Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00082     );
00083 
00087   DefaultPreconditioner(
00088     const Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00089     ,const Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00090     );
00091 
00094   DefaultPreconditioner(
00095     const Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00096     );
00097 
00100   DefaultPreconditioner(
00101     const Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00102     );
00103 
00106   void initializeLeft(
00107     const Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00108     );
00109 
00112   void initializeLeft(
00113     const Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00114     );
00115 
00118   void initializeRight(
00119     const Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> >    &rightPrecOp
00120     );
00121 
00124   void initializeRight(
00125     const Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> >    &rightPrecOp
00126     );
00127 
00130   void initializeLeftRight(
00131     const Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00132     ,const Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00133     );
00134 
00137   void initializeLeftRight(
00138     const Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> >    &leftPrecOp
00139     ,const Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> >   &rightPrecOp
00140     );
00141 
00145   void initializeUnspecified(
00146     const Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00147     );
00148 
00152   void initializeUnspecified(
00153     const Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> >    &unspecifiedPrecOp
00154     );
00155 
00162   void uninitialize();
00163 
00165 
00169   std::string description() const;
00171   void describe(
00172     Teuchos::FancyOStream &out,
00173     const Teuchos::EVerbosityLevel verbLevel
00174     ) const;
00176 
00180   bool isLeftPrecOpConst() const;
00182   Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> > getNonconstLeftPrecOp();
00184   Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> > getLeftPrecOp() const;
00186   bool isRightPrecOpConst() const;
00188   Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> > getNonconstRightPrecOp();
00190   Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> > getRightPrecOp() const;
00192   bool isUnspecifiedPrecOpConst() const;
00194   Teuchos::RCP<LinearOpBase<RangeScalar,DomainScalar> > getNonconstUnspecifiedPrecOp();
00196   Teuchos::RCP<const LinearOpBase<RangeScalar,DomainScalar> > getUnspecifiedPrecOp() const;
00198   
00199 private:
00200   
00201   Teuchos::ConstNonconstObjectContainer<LinearOpBase<RangeScalar,DomainScalar> >  leftPrecOp_;
00202   Teuchos::ConstNonconstObjectContainer<LinearOpBase<RangeScalar,DomainScalar> >  rightPrecOp_;
00203   Teuchos::ConstNonconstObjectContainer<LinearOpBase<RangeScalar,DomainScalar> >  unspecifiedPrecOp_;
00204   
00205 };
00206 
00207 // ///////////////////////
00208 // Related functions
00209 
00215 template <class Scalar>
00216 Teuchos::RCP<const DefaultPreconditioner<Scalar> >
00217 unspecifiedPrec(
00218   const Teuchos::RCP<const LinearOpBase<Scalar> >    &unspecifiedPrecOp
00219   )
00220 {
00221   return Teuchos::rcp(new DefaultPreconditioner<Scalar>(unspecifiedPrecOp));
00222 }
00223 
00229 template <class Scalar>
00230 Teuchos::RCP<const DefaultPreconditioner<Scalar> >
00231 leftPrec(
00232   const Teuchos::RCP<const LinearOpBase<Scalar> >    &leftPrecOp
00233   )
00234 {
00235   return Teuchos::rcp(new DefaultPreconditioner<Scalar>(leftPrecOp,Teuchos::null));
00236 }
00237 
00243 template <class Scalar>
00244 Teuchos::RCP<const DefaultPreconditioner<Scalar> >
00245 rightPrec(
00246   const Teuchos::RCP<const LinearOpBase<Scalar> >    &rightPrecOp
00247   )
00248 {
00249   return Teuchos::rcp(new DefaultPreconditioner<Scalar>(Teuchos::null,rightPrecOp));
00250 }
00251 
00257 template <class Scalar>
00258 Teuchos::RCP<const DefaultPreconditioner<Scalar> >
00259 splitPrec(
00260   const Teuchos::RCP<const LinearOpBase<Scalar> >     &leftPrecOp
00261   ,const Teuchos::RCP<const LinearOpBase<Scalar> >    &rightPrecOp
00262   )
00263 {
00264   return Teuchos::rcp(new DefaultPreconditioner<Scalar>(leftPrecOp,rightPrecOp));
00265 }
00266 
00267 } // namespace Thyra
00268 
00269 #endif // THYRA_DEFUALT_PRECONDITIONER_DECL_HPP

Generated on Tue Oct 20 12:47:11 2009 for Thyra Operator Solve Support by doxygen 1.4.7