|
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 00030 #ifndef THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_DECL_HPP 00031 #define THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_DECL_HPP 00032 00033 00034 #include "Thyra_LinearOpWithSolveBase.hpp" 00035 #include "Thyra_LinearOpSourceBase.hpp" 00036 00037 00038 namespace Thyra { 00039 00040 00052 template <class Scalar> 00053 class DelayedLinearOpWithSolve : virtual public LinearOpWithSolveBase<Scalar> 00054 { 00055 public: 00056 00059 00061 DelayedLinearOpWithSolve(); 00062 00064 void initialize( 00065 const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc, 00066 const RCP<const PreconditionerBase<Scalar> > &prec, 00067 const RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc, 00068 const ESupportSolveUse supportSolveUse, 00069 const RCP<LinearOpWithSolveFactoryBase<Scalar> > &lowsf 00070 ); 00071 00073 RCP<const LinearOpSourceBase<Scalar> > getFwdOpSrc() const; 00074 00076 RCP<const PreconditionerBase<Scalar> > getPrec() const; 00077 00079 RCP<const LinearOpSourceBase<Scalar> > getApproxFwdOpSrc() const; 00080 00082 ESupportSolveUse getSupportSolveUse() const; 00083 00085 00088 00090 std::string description() const; 00091 00093 00096 00098 RCP< const VectorSpaceBase<Scalar> > range() const; 00100 RCP< const VectorSpaceBase<Scalar> > domain() const; 00102 RCP<const LinearOpBase<Scalar> > clone() const; 00103 00105 00106 protected: 00107 00111 void informUpdatedVerbosityState() const; 00113 00117 virtual bool opSupportedImpl(EOpTransp M_trans) const; 00119 virtual void applyImpl( 00120 const EOpTransp M_trans, 00121 const MultiVectorBase<Scalar> &X, 00122 const Ptr<MultiVectorBase<Scalar> > &Y, 00123 const Scalar alpha, 00124 const Scalar beta 00125 ) const; 00127 00131 virtual bool solveSupportsImpl(EOpTransp M_trans) const; 00133 virtual bool solveSupportsSolveMeasureTypeImpl( 00134 EOpTransp M_trans, const SolveMeasureType& solveMeasureType 00135 ) const; 00137 SolveStatus<Scalar> solveImpl( 00138 const EOpTransp transp, 00139 const MultiVectorBase<Scalar> &B, 00140 const Ptr<MultiVectorBase<Scalar> > &X, 00141 const Ptr<const SolveCriteria<Scalar> > solveCriteria 00142 ) const; 00144 00145 private: 00146 00147 // ////////////////////// 00148 // Private data members 00149 00150 RCP<const LinearOpSourceBase<Scalar> > fwdOpSrc_; 00151 RCP<const PreconditionerBase<Scalar> > prec_; 00152 RCP<const LinearOpSourceBase<Scalar> > approxFwdOpSrc_; 00153 ESupportSolveUse supportSolveUse_; 00154 RCP<LinearOpWithSolveFactoryBase<Scalar> > lowsf_; 00155 00156 RCP<const LinearOpBase<Scalar> > fwdOp_; 00157 00158 mutable bool lows_is_valid_; 00159 mutable RCP<LinearOpWithSolveBase<Scalar> > lows_; 00160 00161 // /////////////////////////// 00162 // Private member functions 00163 00164 void updateSolver() const; 00165 00166 }; 00167 00168 00173 template <class Scalar> 00174 RCP<DelayedLinearOpWithSolve<Scalar> > delayedLinearOpWithSolve() 00175 { 00176 return Teuchos::rcp(new DelayedLinearOpWithSolve<Scalar>()); 00177 } 00178 00179 00184 template <class Scalar> 00185 RCP<DelayedLinearOpWithSolve<Scalar> > 00186 delayedLinearOpWithSolve( 00187 const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc, 00188 const RCP<LinearOpWithSolveFactoryBase<Scalar> > &lowsf 00189 ) 00190 { 00191 using Teuchos::null; 00192 const RCP<DelayedLinearOpWithSolve<Scalar> > dlows = 00193 delayedLinearOpWithSolve<Scalar>(); 00194 dlows->initialize(fwdOpSrc, null, null, SUPPORT_SOLVE_UNSPECIFIED, lowsf); 00195 return dlows; 00196 } 00197 00198 00199 } // namespace Thyra 00200 00201 00202 #endif // THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_DECL_HPP
1.7.4