|
Stratimikos Package Browser (Single Doxygen Collection)
Version of the Day
|
00001 /*@HEADER 00002 // *********************************************************************** 00003 // 00004 // AztecOO: An Object-Oriented Aztec Linear Solver Package 00005 // Copyright (2002) 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_AZTECOO_LINEAR_OP_WITH_SOLVE_HPP 00031 #define THYRA_AZTECOO_LINEAR_OP_WITH_SOLVE_HPP 00032 00033 #include "Thyra_LinearOpWithSolveBase.hpp" 00034 #include "Thyra_LinearOpSourceBase.hpp" 00035 #include "Thyra_EpetraLinearOp.hpp" 00036 #include "Thyra_PreconditionerBase.hpp" 00037 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00038 #include "AztecOO.h" 00039 00040 00041 namespace Thyra { 00042 00043 00065 class AztecOOLinearOpWithSolve : virtual public LinearOpWithSolveBase<double> 00066 { 00067 public: 00068 00071 00078 AztecOOLinearOpWithSolve( 00079 const int fwdDefaultMaxIterations = 400, 00080 const double fwdDefaultTol = 1e-6, 00081 const int adjDefaultMaxIterations = 400, 00082 const double adjDefaultTol = 1e-6, 00083 const bool outputEveryRhs = false 00084 ); 00085 00087 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, fwdDefaultMaxIterations ); 00089 STANDARD_MEMBER_COMPOSITION_MEMBERS( double, fwdDefaultTol ); 00091 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, adjDefaultMaxIterations ); 00093 STANDARD_MEMBER_COMPOSITION_MEMBERS( double, adjDefaultTol ); 00095 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, outputEveryRhs ); 00096 00170 void initialize( 00171 const RCP<const LinearOpBase<double> > &fwdOp, 00172 const RCP<const LinearOpSourceBase<double> > &fwdOpSrc, 00173 const RCP<const PreconditionerBase<double> > &prec, 00174 const bool isExternalPrec, 00175 const RCP<const LinearOpSourceBase<double> > &approxFwdOpSrc, 00176 const RCP<AztecOO> &aztecFwdSolver, 00177 const bool allowInexactFwdSolve = false, 00178 const RCP<AztecOO> &aztecAdjSolver = Teuchos::null, 00179 const bool allowInexactAdjSolve = false, 00180 const double aztecSolverScalar = 1.0 00181 ); 00182 00186 RCP<const LinearOpSourceBase<double> > extract_fwdOpSrc(); 00187 00190 RCP<const PreconditionerBase<double> > extract_prec(); 00191 00194 bool isExternalPrec() const; 00195 00196 00200 RCP<const LinearOpSourceBase<double> > extract_approxFwdOpSrc(); 00201 00203 void uninitialize( 00204 RCP<const LinearOpBase<double> > *fwdOp = NULL, 00205 RCP<const LinearOpSourceBase<double> > *fwdOpSrc = NULL, 00206 RCP<const PreconditionerBase<double> > *prec = NULL, 00207 bool *isExternalPrec = NULL, 00208 RCP<const LinearOpSourceBase<double> > *approxFwdOpSrc = NULL, 00209 RCP<AztecOO> *aztecFwdSolver = NULL, 00210 bool *allowInexactFwdSolve = NULL, 00211 RCP<AztecOO> *aztecAdjSolver = NULL, 00212 bool *allowInexactAdjSolve = NULL, 00213 double *aztecSolverScalar = NULL 00214 ); 00215 00217 00221 RCP< const VectorSpaceBase<double> > range() const; 00223 RCP< const VectorSpaceBase<double> > domain() const; 00225 RCP<const LinearOpBase<double> > clone() const; 00227 00231 std::string description() const; 00233 void describe( 00234 Teuchos::FancyOStream &out, 00235 const Teuchos::EVerbosityLevel verbLevel 00236 ) const; 00238 00239 protected: 00240 00244 virtual bool opSupportedImpl(EOpTransp M_trans) const; 00246 virtual void applyImpl( 00247 const EOpTransp M_trans, 00248 const MultiVectorBase<double> &X, 00249 const Ptr<MultiVectorBase<double> > &Y, 00250 const double alpha, 00251 const double beta 00252 ) const; 00254 00258 virtual bool solveSupportsImpl(EOpTransp M_trans) const; 00260 virtual bool solveSupportsSolveMeasureTypeImpl( 00261 EOpTransp M_trans, const SolveMeasureType& solveMeasureType 00262 ) const; 00264 SolveStatus<double> solveImpl( 00265 const EOpTransp M_trans, 00266 const MultiVectorBase<double> &B, 00267 const Ptr<MultiVectorBase<double> > &X, 00268 const Ptr<const SolveCriteria<double> > solveCriteria 00269 ) const; 00271 00272 private: 00273 00274 RCP<const LinearOpBase<double> > fwdOp_; 00275 RCP<const LinearOpSourceBase<double> > fwdOpSrc_; 00276 RCP<const PreconditionerBase<double> > prec_; 00277 bool isExternalPrec_; 00278 RCP<const LinearOpSourceBase<double> > approxFwdOpSrc_; 00279 RCP<AztecOO> aztecFwdSolver_; 00280 bool allowInexactFwdSolve_; 00281 RCP<AztecOO> aztecAdjSolver_; 00282 bool allowInexactAdjSolve_; 00283 double aztecSolverScalar_; 00284 00285 void assertInitialized() const; 00286 00287 }; 00288 00289 00290 } // namespace Thyra 00291 00292 #endif // THYRA_AZTECOO_LINEAR_OP_WITH_SOLVE_HPP
1.7.6.1