|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
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_PRECONDITIONER_FACTORY_HELPERS_DECL_HPP 00030 #define THYRA_PRECONDITIONER_FACTORY_HELPERS_DECL_HPP 00031 00032 00033 #include "Thyra_PreconditionerFactoryBase.hpp" 00034 #include "Thyra_DefaultLinearOpSource.hpp" 00035 #include "Thyra_DefaultPreconditioner.hpp" 00036 00037 00038 namespace Thyra { 00039 00040 00045 template <class Scalar> 00046 void initializePrec( 00047 const PreconditionerFactoryBase<Scalar> &precFactory, 00048 const Teuchos::RCP<const LinearOpBase<Scalar> > &fwdOp, 00049 const Teuchos::Ptr<PreconditionerBase<Scalar> > &prec, 00050 const ESupportSolveUse supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED 00051 ) 00052 { 00053 precFactory.initializePrec(defaultLinearOpSource(fwdOp), prec.get(), 00054 supportSolveUse); 00055 } 00056 00057 00063 template <class Scalar> 00064 void uninitializePrec( 00065 const PreconditionerFactoryBase<Scalar> &precFactory, 00066 const Teuchos::Ptr<PreconditionerBase<Scalar> > &prec, 00067 const Teuchos::Ptr<Teuchos::RCP<const LinearOpBase<Scalar> > > &fwdOp = Teuchos::null, 00068 const Teuchos::Ptr<ESupportSolveUse> &supportSolveUse = Teuchos::null 00069 ) 00070 { 00071 Teuchos::RCP<const LinearOpSourceBase<Scalar> > fwdOpSrc; 00072 precFactory.uninitializePrec(prec, Teuchos::outArg(fwdOpSrc), supportSolveUse); 00073 if (nonnull(fwdOp)) {*fwdOp = fwdOpSrc->getOp();} 00074 } 00075 00076 00081 template <class Scalar> 00082 Teuchos::RCP<PreconditionerBase<Scalar> > 00083 prec( 00084 const PreconditionerFactoryBase<Scalar> &precFactory, 00085 const Teuchos::RCP<const LinearOpBase<Scalar> > &fwdOp, 00086 const ESupportSolveUse supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED 00087 ) 00088 { 00089 Teuchos::RCP<PreconditionerBase<Scalar> > prec = 00090 precFactory.createPrec(); 00091 precFactory.initializePrec(defaultLinearOpSource(fwdOp), &*prec, supportSolveUse); 00092 return prec; 00093 } 00094 00095 00096 // 00097 // Deprecated 00098 // 00099 00100 00105 template <class Scalar> 00106 THYRA_DEPRECATED 00107 void initializePrec( 00108 const PreconditionerFactoryBase<Scalar> &precFactory, 00109 const Teuchos::RCP<const LinearOpBase<Scalar> > &fwdOp, 00110 PreconditionerBase<Scalar> *prec, 00111 const ESupportSolveUse supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED 00112 ) 00113 { 00114 initializePrec<Scalar>(precFactory, fwdOp, Teuchos::ptr(prec), 00115 supportSolveUse); 00116 } 00117 00118 00123 template <class Scalar> 00124 THYRA_DEPRECATED 00125 void uninitializePrec( 00126 const PreconditionerFactoryBase<Scalar> &precFactory, 00127 PreconditionerBase<Scalar> *prec, 00128 Teuchos::RCP<const LinearOpBase<Scalar> > *fwdOp = NULL, 00129 ESupportSolveUse *supportSolveUse = NULL 00130 ) 00131 { 00132 using Teuchos::ptr; 00133 uninitializePrec<Scalar>(precFactory, ptr(prec), ptr(fwdOp), 00134 ptr(supportSolveUse)); 00135 } 00136 00137 00138 } // namespace Thyra 00139 00140 00141 #endif // THYRA_PRECONDITIONER_FACTORY_HELPERS_DECL_HPP
1.7.4