|
Stratimikos Package Browser (Single Doxygen Collection)
Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Stratimikos: Thyra-based strategies for linear solvers 00005 // Copyright (2006) 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 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 // @HEADER 00041 00042 #ifndef THYRA_AZTECOO_LINEAR_OP_WITH_SOLVE_HPP 00043 #define THYRA_AZTECOO_LINEAR_OP_WITH_SOLVE_HPP 00044 00045 #include "Thyra_LinearOpWithSolveBase.hpp" 00046 #include "Thyra_LinearOpSourceBase.hpp" 00047 #include "Thyra_EpetraLinearOp.hpp" 00048 #include "Thyra_PreconditionerBase.hpp" 00049 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00050 #include "AztecOO.h" 00051 00052 00053 namespace Thyra { 00054 00055 00077 class AztecOOLinearOpWithSolve : virtual public LinearOpWithSolveBase<double> 00078 { 00079 public: 00080 00083 00090 AztecOOLinearOpWithSolve( 00091 const int fwdDefaultMaxIterations = 400, 00092 const double fwdDefaultTol = 1e-6, 00093 const int adjDefaultMaxIterations = 400, 00094 const double adjDefaultTol = 1e-6, 00095 const bool outputEveryRhs = false 00096 ); 00097 00099 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, fwdDefaultMaxIterations ); 00101 STANDARD_MEMBER_COMPOSITION_MEMBERS( double, fwdDefaultTol ); 00103 STANDARD_MEMBER_COMPOSITION_MEMBERS( int, adjDefaultMaxIterations ); 00105 STANDARD_MEMBER_COMPOSITION_MEMBERS( double, adjDefaultTol ); 00107 STANDARD_MEMBER_COMPOSITION_MEMBERS( bool, outputEveryRhs ); 00108 00182 void initialize( 00183 const RCP<const LinearOpBase<double> > &fwdOp, 00184 const RCP<const LinearOpSourceBase<double> > &fwdOpSrc, 00185 const RCP<const PreconditionerBase<double> > &prec, 00186 const bool isExternalPrec, 00187 const RCP<const LinearOpSourceBase<double> > &approxFwdOpSrc, 00188 const RCP<AztecOO> &aztecFwdSolver, 00189 const bool allowInexactFwdSolve = false, 00190 const RCP<AztecOO> &aztecAdjSolver = Teuchos::null, 00191 const bool allowInexactAdjSolve = false, 00192 const double aztecSolverScalar = 1.0 00193 ); 00194 00198 RCP<const LinearOpSourceBase<double> > extract_fwdOpSrc(); 00199 00202 RCP<const PreconditionerBase<double> > extract_prec(); 00203 00206 bool isExternalPrec() const; 00207 00208 00212 RCP<const LinearOpSourceBase<double> > extract_approxFwdOpSrc(); 00213 00215 void uninitialize( 00216 RCP<const LinearOpBase<double> > *fwdOp = NULL, 00217 RCP<const LinearOpSourceBase<double> > *fwdOpSrc = NULL, 00218 RCP<const PreconditionerBase<double> > *prec = NULL, 00219 bool *isExternalPrec = NULL, 00220 RCP<const LinearOpSourceBase<double> > *approxFwdOpSrc = NULL, 00221 RCP<AztecOO> *aztecFwdSolver = NULL, 00222 bool *allowInexactFwdSolve = NULL, 00223 RCP<AztecOO> *aztecAdjSolver = NULL, 00224 bool *allowInexactAdjSolve = NULL, 00225 double *aztecSolverScalar = NULL 00226 ); 00227 00229 00233 RCP< const VectorSpaceBase<double> > range() const; 00235 RCP< const VectorSpaceBase<double> > domain() const; 00237 RCP<const LinearOpBase<double> > clone() const; 00239 00243 std::string description() const; 00245 void describe( 00246 Teuchos::FancyOStream &out, 00247 const Teuchos::EVerbosityLevel verbLevel 00248 ) const; 00250 00251 protected: 00252 00256 virtual bool opSupportedImpl(EOpTransp M_trans) const; 00258 virtual void applyImpl( 00259 const EOpTransp M_trans, 00260 const MultiVectorBase<double> &X, 00261 const Ptr<MultiVectorBase<double> > &Y, 00262 const double alpha, 00263 const double beta 00264 ) const; 00266 00270 virtual bool solveSupportsImpl(EOpTransp M_trans) const; 00272 virtual bool solveSupportsSolveMeasureTypeImpl( 00273 EOpTransp M_trans, const SolveMeasureType& solveMeasureType 00274 ) const; 00276 SolveStatus<double> solveImpl( 00277 const EOpTransp M_trans, 00278 const MultiVectorBase<double> &B, 00279 const Ptr<MultiVectorBase<double> > &X, 00280 const Ptr<const SolveCriteria<double> > solveCriteria 00281 ) const; 00283 00284 private: 00285 00286 RCP<const LinearOpBase<double> > fwdOp_; 00287 RCP<const LinearOpSourceBase<double> > fwdOpSrc_; 00288 RCP<const PreconditionerBase<double> > prec_; 00289 bool isExternalPrec_; 00290 RCP<const LinearOpSourceBase<double> > approxFwdOpSrc_; 00291 RCP<AztecOO> aztecFwdSolver_; 00292 bool allowInexactFwdSolve_; 00293 RCP<AztecOO> aztecAdjSolver_; 00294 bool allowInexactAdjSolve_; 00295 double aztecSolverScalar_; 00296 00297 void assertInitialized() const; 00298 00299 }; 00300 00301 00302 } // namespace Thyra 00303 00304 #endif // THYRA_AZTECOO_LINEAR_OP_WITH_SOLVE_HPP
1.7.6.1