Thyra_LinearOpWithSolveFactoryBase.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_LINEAR_OP_WITH_SOLVE_FACTORY_BASE_DECL_HPP
00030 #define THYRA_LINEAR_OP_WITH_SOLVE_FACTORY_BASE_DECL_HPP
00031 
00032 #include "Thyra_LinearOpWithSolveBaseDecl.hpp"
00033 #include "Thyra_PreconditionerFactoryBase.hpp"
00034 #include "Teuchos_ParameterListAcceptor.hpp"
00035 #include "Teuchos_VerboseObject.hpp"
00036 
00037 namespace Thyra {
00038 
00388 template <class RangeScalar, class DomainScalar = RangeScalar>
00389 class LinearOpWithSolveFactoryBase
00390   : virtual public Teuchos::Describable
00391   , virtual public Teuchos::ParameterListAcceptor
00392   , virtual public Teuchos::VerboseObject<LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar> >
00393 {
00394 public:
00395 
00398 
00403   virtual bool acceptsPreconditionerFactory() const;
00404 
00424   virtual void setPreconditionerFactory(
00425     const Teuchos::RefCountPtr<PreconditionerFactoryBase<RangeScalar,DomainScalar> >  &precFactory
00426     ,const std::string                                                                &precFactoryName
00427     );
00428 
00433   virtual Teuchos::RefCountPtr<PreconditionerFactoryBase<RangeScalar,DomainScalar> > getPreconditionerFactory() const;
00434 
00443   virtual void unsetPreconditionerFactory(
00444     Teuchos::RefCountPtr<PreconditionerFactoryBase<RangeScalar,DomainScalar> >  *precFactory      = NULL
00445     ,std::string                                                                *precFactoryName  = NULL
00446     );
00447 
00449 
00452 
00456   virtual bool isCompatible( const LinearOpSourceBase<RangeScalar,DomainScalar> &fwdOpSrc ) const = 0;
00457 
00466   virtual Teuchos::RefCountPtr<LinearOpWithSolveBase<RangeScalar,DomainScalar> > createOp() const = 0;
00467 
00515   virtual void initializeOp(
00516     const Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >    &fwdOpSrc
00517     ,LinearOpWithSolveBase<RangeScalar,DomainScalar>                                   *Op
00518     ,const ESupportSolveUse                                                            supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
00519     ) const = 0;
00520 
00569   virtual void initializeAndReuseOp(
00570     const Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >    &fwdOpSrc
00571     ,LinearOpWithSolveBase<RangeScalar,DomainScalar>                                   *Op
00572     ) const;
00573 
00615   virtual void uninitializeOp(
00616     LinearOpWithSolveBase<RangeScalar,DomainScalar>                               *Op
00617     ,Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >    *fwdOpSrc        = NULL
00618     ,Teuchos::RefCountPtr<const PreconditionerBase<RangeScalar,DomainScalar> >    *prec            = NULL
00619     ,Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >    *approxFwdOpSrc  = NULL
00620     ,ESupportSolveUse                                                             *supportSolveUse = NULL
00621     ) const = 0;
00622   
00624 
00627 
00632   virtual bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const;
00633 
00712   virtual void initializePreconditionedOp(
00713     const Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >       &fwdOpSrc
00714     ,const Teuchos::RefCountPtr<const PreconditionerBase<RangeScalar,DomainScalar> >      &prec
00715     ,LinearOpWithSolveBase<RangeScalar,DomainScalar>                                      *Op
00716     ,const ESupportSolveUse                                                               supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
00717     ) const;
00718 
00739   virtual void initializeApproxPreconditionedOp(
00740     const Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >       &fwdOpSrc
00741     ,const Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >      &approxFwdOpSrc
00742     ,LinearOpWithSolveBase<RangeScalar,DomainScalar>                                      *Op
00743     ,const ESupportSolveUse                                                               supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
00744     ) const;
00745 
00747 
00748 };
00749 
00750 // /////////////////////////
00751 // Implementations
00752 
00753 template<class RangeScalar, class DomainScalar>
00754 bool LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::acceptsPreconditionerFactory() const
00755 {
00756   return false;
00757 }
00758 
00759 template<class RangeScalar, class DomainScalar>
00760 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::setPreconditionerFactory(
00761   const Teuchos::RefCountPtr<PreconditionerFactoryBase<RangeScalar,DomainScalar> >  &precFactory
00762   ,const std::string                                                                &precFactoryName
00763   )
00764 {
00765   TEST_FOR_EXCEPTION(
00766     true,std::logic_error
00767     ,"Error, the concrete implementation described as \'"<<this->description()<<"\' did not override this "
00768     "setPreconditionerFactory(...) function and the default implementation throws this exception!"
00769     );
00770 }
00771 
00772 template<class RangeScalar, class DomainScalar>
00773 Teuchos::RefCountPtr<PreconditionerFactoryBase<RangeScalar,DomainScalar> >
00774 LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::getPreconditionerFactory() const
00775 {
00776   return Teuchos::null;
00777 }
00778 
00779 template<class RangeScalar, class DomainScalar>
00780 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::unsetPreconditionerFactory(
00781   Teuchos::RefCountPtr<PreconditionerFactoryBase<RangeScalar,DomainScalar> >  *precFactory
00782   ,std::string                                                                *precFactoryName
00783   )
00784 {
00785   if(precFactory) *precFactory = Teuchos::null;
00786   if(precFactoryName) *precFactoryName = "";
00787 }
00788 
00789 template<class RangeScalar, class DomainScalar>
00790 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::initializeAndReuseOp(
00791   const Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >    &fwdOpSrc
00792   ,LinearOpWithSolveBase<RangeScalar,DomainScalar>                                   *Op
00793   ) const
00794 {
00795   this->initializeOp(fwdOpSrc,Op);
00796 }
00797 
00798 template<class RangeScalar, class DomainScalar>
00799 bool LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::supportsPreconditionerInputType(
00800   const EPreconditionerInputType precOpType
00801   ) const
00802 {
00803   return false;
00804 }
00805 
00806 template<class RangeScalar, class DomainScalar>
00807 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::initializePreconditionedOp(
00808   const Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >       &fwdOpSrc
00809   ,const Teuchos::RefCountPtr<const PreconditionerBase<RangeScalar,DomainScalar> >      &prec
00810   ,LinearOpWithSolveBase<RangeScalar,DomainScalar>                                      *Op
00811   ,const ESupportSolveUse                                                               supportSolveUse
00812   ) const
00813 {
00814   TEST_FOR_EXCEPTION(
00815     true,std::logic_error
00816     ,"Error, the concrete implementation described as \'"<<this->description()<<"\' did not override this "
00817     "initializePreconditionedOp(...) function and the default implementation throws this exception!"
00818     );
00819 }
00820 
00821 template<class RangeScalar, class DomainScalar>
00822 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::initializeApproxPreconditionedOp(
00823   const Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >       &fwdOpSrc
00824   ,const Teuchos::RefCountPtr<const LinearOpSourceBase<RangeScalar,DomainScalar> >      &approxFwdOpSrc
00825   ,LinearOpWithSolveBase<RangeScalar,DomainScalar>                                      *Op
00826   ,const ESupportSolveUse                                                               supportSolveUse
00827   ) const
00828 {
00829   TEST_FOR_EXCEPTION(
00830     true,std::logic_error
00831     ,"Error, the concrete implementation described as \'"<<this->description()<<"\' did not override this "
00832     "initializePreconditionedOp(...) function and the default implementation throws this exception!"
00833     );
00834 }
00835 
00836 } // namespace Thyra
00837 
00838 #endif // THYRA_LINEAR_OP_WITH_SOLVE_FACTORY_BASE_DECL_HPP

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