Thyra_LinearOpWithSolveFactoryBase.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_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 
00038 namespace Thyra {
00039 
00040 
00390 template <class RangeScalar, class DomainScalar = RangeScalar>
00391 class LinearOpWithSolveFactoryBase
00392   : virtual public Teuchos::Describable, 
00393     virtual public Teuchos::VerboseObject<LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar> >,
00394     virtual public Teuchos::ParameterListAcceptor
00395 {
00396 public:
00397 
00400 
00405   virtual bool acceptsPreconditionerFactory() const;
00406 
00428   virtual void setPreconditionerFactory(
00429     const RCP<PreconditionerFactoryBase<RangeScalar,DomainScalar> >  &precFactory,
00430     const std::string &precFactoryName
00431     );
00432 
00437   virtual RCP<PreconditionerFactoryBase<RangeScalar,DomainScalar> >
00438   getPreconditionerFactory() const;
00439 
00448   virtual void unsetPreconditionerFactory(
00449     RCP<PreconditionerFactoryBase<RangeScalar,DomainScalar> >  *precFactory = NULL,
00450     std::string *precFactoryName = NULL
00451     );
00452 
00454 
00457 
00461   virtual bool isCompatible(
00462     const LinearOpSourceBase<RangeScalar,DomainScalar> &fwdOpSrc ) const = 0;
00463 
00472   virtual RCP<LinearOpWithSolveBase<RangeScalar,DomainScalar> >
00473   createOp() const = 0;
00474 
00548   virtual void initializeOp(
00549     const RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > &fwdOpSrc,
00550     LinearOpWithSolveBase<RangeScalar,DomainScalar> *Op,
00551     const ESupportSolveUse supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
00552     ) const = 0;
00553 
00620   virtual void initializeAndReuseOp(
00621     const RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > &fwdOpSrc,
00622     LinearOpWithSolveBase<RangeScalar,DomainScalar> *Op
00623     ) const;
00624 
00684   virtual void uninitializeOp(
00685     LinearOpWithSolveBase<RangeScalar,DomainScalar> *Op,
00686     RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > *fwdOpSrc = NULL,
00687     RCP<const PreconditionerBase<RangeScalar,DomainScalar> > *prec = NULL,
00688     RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > *approxFwdOpSrc = NULL,
00689     ESupportSolveUse *supportSolveUse = NULL
00690     ) const = 0;
00691   
00693 
00696 
00701   virtual bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const;
00702 
00820   virtual void initializePreconditionedOp(
00821     const RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > &fwdOpSrc,
00822     const RCP<const PreconditionerBase<RangeScalar,DomainScalar> > &prec,
00823     LinearOpWithSolveBase<RangeScalar,DomainScalar> *Op,
00824     const ESupportSolveUse supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
00825     ) const;
00826 
00852   virtual void initializeApproxPreconditionedOp(
00853     const RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > &fwdOpSrc,
00854     const RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > &approxFwdOpSrc,
00855     LinearOpWithSolveBase<RangeScalar,DomainScalar> *Op,
00856     const ESupportSolveUse supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
00857     ) const;
00858   
00860 
00861 };
00862 
00863 
00864 // /////////////////////////
00865 // Implementations
00866 
00867 
00868 template<class RangeScalar, class DomainScalar>
00869 bool LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::acceptsPreconditionerFactory() const
00870 {
00871   return false;
00872 }
00873 
00874 
00875 template<class RangeScalar, class DomainScalar>
00876 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::setPreconditionerFactory(
00877   const RCP<PreconditionerFactoryBase<RangeScalar,DomainScalar> > &precFactory
00878   ,const std::string &precFactoryName
00879   )
00880 {
00881   TEST_FOR_EXCEPTION(
00882     true,std::logic_error
00883     ,"Error, the concrete implementation described as \'"<<this->description()<<"\' did not override this "
00884     "setPreconditionerFactory(...) function and the default implementation throws this exception!"
00885     );
00886 }
00887 
00888 
00889 template<class RangeScalar, class DomainScalar>
00890 RCP<PreconditionerFactoryBase<RangeScalar,DomainScalar> >
00891 LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::getPreconditionerFactory() const
00892 {
00893   return Teuchos::null;
00894 }
00895 
00896 
00897 template<class RangeScalar, class DomainScalar>
00898 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::unsetPreconditionerFactory(
00899   RCP<PreconditionerFactoryBase<RangeScalar,DomainScalar> > *precFactory
00900   ,std::string *precFactoryName
00901   )
00902 {
00903   if(precFactory) *precFactory = Teuchos::null;
00904   if(precFactoryName) *precFactoryName = "";
00905 }
00906 
00907 
00908 template<class RangeScalar, class DomainScalar>
00909 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::initializeAndReuseOp(
00910   const RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > &fwdOpSrc
00911   ,LinearOpWithSolveBase<RangeScalar,DomainScalar> *Op
00912   ) const
00913 {
00914   this->initializeOp(fwdOpSrc,Op);
00915 }
00916 
00917 
00918 template<class RangeScalar, class DomainScalar>
00919 bool LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::supportsPreconditionerInputType(
00920   const EPreconditionerInputType precOpType
00921   ) const
00922 {
00923   return false;
00924 }
00925 
00926 
00927 template<class RangeScalar, class DomainScalar>
00928 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::initializePreconditionedOp(
00929   const RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > &fwdOpSrc
00930   ,const RCP<const PreconditionerBase<RangeScalar,DomainScalar> > &prec
00931   ,LinearOpWithSolveBase<RangeScalar,DomainScalar> *Op
00932   ,const ESupportSolveUse supportSolveUse
00933   ) const
00934 {
00935   TEST_FOR_EXCEPTION(
00936     true,std::logic_error
00937     ,"Error, the concrete implementation described as \'"<<this->description()<<"\' did not override this "
00938     "initializePreconditionedOp(...) function and the default implementation throws this exception!"
00939     );
00940 }
00941 
00942 
00943 template<class RangeScalar, class DomainScalar>
00944 void LinearOpWithSolveFactoryBase<RangeScalar,DomainScalar>::initializeApproxPreconditionedOp(
00945   const RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > &fwdOpSrc
00946   ,const RCP<const LinearOpSourceBase<RangeScalar,DomainScalar> > &approxFwdOpSrc
00947   ,LinearOpWithSolveBase<RangeScalar,DomainScalar> *Op
00948   ,const ESupportSolveUse supportSolveUse
00949   ) const
00950 {
00951   TEST_FOR_EXCEPTION(
00952     true,std::logic_error
00953     ,"Error, the concrete implementation described as \'"<<this->description()<<"\' did not override this "
00954     "initializePreconditionedOp(...) function and the default implementation throws this exception!"
00955     );
00956 }
00957 
00958 
00959 } // namespace Thyra
00960 
00961 
00962 #endif // THYRA_LINEAR_OP_WITH_SOLVE_FACTORY_BASE_DECL_HPP

Generated on Wed May 12 21:42:14 2010 for Thyra ANA Operator Solve Interfaces by  doxygen 1.4.7