|
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_DELAYED_LINEAR_OP_WITH_SOLVE_FACTORY_HPP 00030 #define THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_FACTORY_HPP 00031 00032 00033 #include "Thyra_DelayedLinearOpWithSolveFactory_decl.hpp" 00034 #include "Thyra_LinearOpWithSolveBase.hpp" 00035 #include "Thyra_DelayedLinearOpWithSolve.hpp" 00036 00037 00038 namespace Thyra { 00039 00040 00041 // Overridden from Constructors/Initializers/Accessors 00042 00043 00044 template<class Scalar> 00045 DelayedLinearOpWithSolveFactory<Scalar>::DelayedLinearOpWithSolveFactory( 00046 const RCP<LinearOpWithSolveFactoryBase<Scalar> > &lowsf 00047 ) 00048 { 00049 #ifdef TEUCHOS_DEBUG 00050 TEST_FOR_EXCEPT(is_null(lowsf)); 00051 #endif 00052 lowsf_ = lowsf; 00053 } 00054 00055 template<class Scalar> 00056 RCP<LinearOpWithSolveFactoryBase<Scalar> > 00057 DelayedLinearOpWithSolveFactory<Scalar>::getUnderlyingLOWSF() 00058 { 00059 return lowsf_; 00060 } 00061 00062 00063 template<class Scalar> 00064 RCP<const LinearOpWithSolveFactoryBase<Scalar> > 00065 DelayedLinearOpWithSolveFactory<Scalar>::getUnderlyingLOWSF() const 00066 { 00067 return lowsf_; 00068 } 00069 00070 00071 // Overridden from Teuchos::Describable 00072 00073 00074 template<class Scalar> 00075 std::string DelayedLinearOpWithSolveFactory<Scalar>::description() const 00076 { 00077 std::ostringstream oss; 00078 oss << this->Teuchos::Describable::description() 00079 << "{" 00080 << "lowsf="; 00081 if (!is_null(lowsf_)) 00082 oss << lowsf_->description(); 00083 else 00084 oss << "NULL"; 00085 oss << "}"; 00086 return oss.str(); 00087 } 00088 00089 00090 // Overridden from ParameterListAcceptor 00091 00092 00093 template<class Scalar> 00094 void DelayedLinearOpWithSolveFactory<Scalar>::setParameterList( 00095 RCP<ParameterList> const& paramList 00096 ) 00097 { 00098 lowsf_->setParameterList(paramList); 00099 } 00100 00101 00102 template<class Scalar> 00103 RCP<ParameterList> 00104 DelayedLinearOpWithSolveFactory<Scalar>::getNonconstParameterList() 00105 { 00106 return lowsf_->getNonconstParameterList(); 00107 } 00108 00109 00110 template<class Scalar> 00111 RCP<ParameterList> 00112 DelayedLinearOpWithSolveFactory<Scalar>::unsetParameterList() 00113 { 00114 return lowsf_->unsetParameterList(); 00115 } 00116 00117 00118 template<class Scalar> 00119 RCP<const ParameterList> 00120 DelayedLinearOpWithSolveFactory<Scalar>::getParameterList() const 00121 { 00122 return lowsf_->getParameterList(); 00123 } 00124 00125 00126 template<class Scalar> 00127 RCP<const ParameterList> 00128 DelayedLinearOpWithSolveFactory<Scalar>::getValidParameters() const 00129 { 00130 return lowsf_->getValidParameters(); 00131 } 00132 00133 00134 // Overridden from LinearOpWithSolveFactoyBase 00135 00136 00137 template<class Scalar> 00138 bool DelayedLinearOpWithSolveFactory<Scalar>::acceptsPreconditionerFactory() const 00139 { 00140 return lowsf_->acceptsPreconditionerFactory(); 00141 } 00142 00143 00144 template<class Scalar> 00145 void DelayedLinearOpWithSolveFactory<Scalar>::setPreconditionerFactory( 00146 const RCP<PreconditionerFactoryBase<Scalar> > &precFactory, 00147 const std::string &precFactoryName 00148 ) 00149 { 00150 lowsf_->setPreconditionerFactory(precFactory,precFactoryName); 00151 } 00152 00153 00154 template<class Scalar> 00155 RCP<PreconditionerFactoryBase<Scalar> > 00156 DelayedLinearOpWithSolveFactory<Scalar>::getPreconditionerFactory() const 00157 { 00158 return lowsf_->getPreconditionerFactory(); 00159 } 00160 00161 00162 template<class Scalar> 00163 void DelayedLinearOpWithSolveFactory<Scalar>::unsetPreconditionerFactory( 00164 RCP<PreconditionerFactoryBase<Scalar> > *precFactory, 00165 std::string *precFactoryName 00166 ) 00167 { 00168 lowsf_->unsetPreconditionerFactory(precFactory); 00169 } 00170 00171 00172 template<class Scalar> 00173 bool DelayedLinearOpWithSolveFactory<Scalar>::isCompatible( 00174 const LinearOpSourceBase<Scalar> &fwdOpSrc 00175 ) const 00176 { 00177 return lowsf_->isCompatible(fwdOpSrc); 00178 } 00179 00180 00181 template<class Scalar> 00182 RCP<LinearOpWithSolveBase<Scalar> > 00183 DelayedLinearOpWithSolveFactory<Scalar>::createOp() const 00184 { 00185 RCP<LinearOpWithSolveBase<Scalar> > 00186 dlows = Teuchos::rcp(new DelayedLinearOpWithSolve<Scalar>()); 00187 dlows->setVerbLevel(this->getVerbLevel()); 00188 dlows->setOStream(this->getOStream()); 00189 return dlows; 00190 } 00191 00192 00193 template<class Scalar> 00194 void DelayedLinearOpWithSolveFactory<Scalar>::initializeOp( 00195 const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc, 00196 LinearOpWithSolveBase<Scalar> *Op, 00197 const ESupportSolveUse supportSolveUse 00198 ) const 00199 { 00200 using Teuchos::null; 00201 #ifdef TEUCHOS_DEBUG 00202 TEST_FOR_EXCEPT(is_null(fwdOpSrc)); 00203 TEST_FOR_EXCEPT(0==Op); 00204 #endif 00205 DelayedLinearOpWithSolve<Scalar> 00206 &dlows = Teuchos::dyn_cast<DelayedLinearOpWithSolve<Scalar> >(*Op); 00207 dlows.initialize( fwdOpSrc, null, null, supportSolveUse, lowsf_ ); 00208 } 00209 00210 00211 template<class Scalar> 00212 void DelayedLinearOpWithSolveFactory<Scalar>::initializeAndReuseOp( 00213 const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc, 00214 LinearOpWithSolveBase<Scalar> *Op 00215 ) const 00216 { 00217 TEST_FOR_EXCEPT(true); 00218 } 00219 00220 00221 template<class Scalar> 00222 void DelayedLinearOpWithSolveFactory<Scalar>::uninitializeOp( 00223 LinearOpWithSolveBase<Scalar> *Op, 00224 RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc, 00225 RCP<const PreconditionerBase<Scalar> > *prec, 00226 RCP<const LinearOpSourceBase<Scalar> > *approxFwdOpSrc, 00227 ESupportSolveUse *supportSolveUse 00228 ) const 00229 { 00230 00231 using Teuchos::dyn_cast; 00232 00233 #ifdef TEUCHOS_DEBUG 00234 TEST_FOR_EXCEPT(0==Op); 00235 #endif 00236 00237 DelayedLinearOpWithSolve<Scalar> 00238 &dlows = dyn_cast<DelayedLinearOpWithSolve<Scalar> >(*Op); 00239 00240 if (fwdOpSrc) 00241 *fwdOpSrc = dlows.getFwdOpSrc(); 00242 if (prec) 00243 *prec = dlows.getPrec(); 00244 if (approxFwdOpSrc) 00245 *approxFwdOpSrc = dlows.getApproxFwdOpSrc(); 00246 if (supportSolveUse) 00247 *supportSolveUse = dlows.getSupportSolveUse(); 00248 00249 // ToDo: 2007/08/16: rabartl: Consider uninitalizing dlows? 00250 00251 } 00252 00253 00254 template<class Scalar> 00255 bool DelayedLinearOpWithSolveFactory<Scalar>::supportsPreconditionerInputType( 00256 const EPreconditionerInputType precOpType 00257 ) const 00258 { 00259 return lowsf_->supportsPreconditionerInputType(precOpType); 00260 } 00261 00262 00263 template<class Scalar> 00264 void DelayedLinearOpWithSolveFactory<Scalar>::initializePreconditionedOp( 00265 const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc, 00266 const RCP<const PreconditionerBase<Scalar> > &prec, 00267 LinearOpWithSolveBase<Scalar> *Op, 00268 const ESupportSolveUse supportSolveUse 00269 ) const 00270 { 00271 using Teuchos::null; 00272 #ifdef TEUCHOS_DEBUG 00273 TEST_FOR_EXCEPT(is_null(fwdOpSrc)); 00274 TEST_FOR_EXCEPT(0==Op); 00275 #endif 00276 DelayedLinearOpWithSolve<Scalar> 00277 &dlows = Teuchos::dyn_cast<DelayedLinearOpWithSolve<Scalar> >(*Op); 00278 dlows.initialize( fwdOpSrc, prec, null, supportSolveUse, lowsf_ ); 00279 } 00280 00281 00282 template<class Scalar> 00283 void DelayedLinearOpWithSolveFactory<Scalar>::initializeApproxPreconditionedOp( 00284 const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc, 00285 const RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc, 00286 LinearOpWithSolveBase<Scalar> *Op, 00287 const ESupportSolveUse supportSolveUse 00288 ) const 00289 { 00290 using Teuchos::null; 00291 #ifdef TEUCHOS_DEBUG 00292 TEST_FOR_EXCEPT(is_null(fwdOpSrc)); 00293 TEST_FOR_EXCEPT(0==Op); 00294 #endif 00295 DelayedLinearOpWithSolve<Scalar> 00296 &dlows = Teuchos::dyn_cast<DelayedLinearOpWithSolve<Scalar> >(*Op); 00297 dlows.initialize( fwdOpSrc, null, approxFwdOpSrc, supportSolveUse, lowsf_ ); 00298 } 00299 00300 00301 // protected 00302 00303 00304 template<class Scalar> 00305 void DelayedLinearOpWithSolveFactory<Scalar>::informUpdatedVerbosityState() const 00306 { 00307 lowsf_->setVerbLevel(this->getVerbLevel()); 00308 lowsf_->setOStream(this->getOStream()); 00309 } 00310 00311 00312 } // namespace Thyra 00313 00314 00315 #endif // THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
1.7.4