|
Stratimikos Package Browser (Single Doxygen Collection)
Version of the Day
|
00001 /* 00002 // @HEADER 00003 // *********************************************************************** 00004 // 00005 // Stratimikos: Thyra-based strategies for linear solvers 00006 // Copyright (2006) Sandia Corporation 00007 // 00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00009 // license for use of this work by or on behalf of the U.S. Government. 00010 // 00011 // Redistribution and use in source and binary forms, with or without 00012 // modification, are permitted provided that the following conditions are 00013 // met: 00014 // 00015 // 1. Redistributions of source code must retain the above copyright 00016 // notice, this list of conditions and the following disclaimer. 00017 // 00018 // 2. Redistributions in binary form must reproduce the above copyright 00019 // notice, this list of conditions and the following disclaimer in the 00020 // documentation and/or other materials provided with the distribution. 00021 // 00022 // 3. Neither the name of the Corporation nor the names of the 00023 // contributors may be used to endorse or promote products derived from 00024 // this software without specific prior written permission. 00025 // 00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00037 // 00038 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00039 // 00040 // *********************************************************************** 00041 // @HEADER 00042 */ 00043 00044 #ifndef THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_FACTORY_HPP 00045 #define THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_FACTORY_HPP 00046 00047 #include "Thyra_LinearOpWithSolveFactoryBase.hpp" 00048 #include "Thyra_AmesosTypes.hpp" 00049 #include "Amesos_BaseSolver.h" 00050 #include "Thyra_EpetraOperatorViewExtractorBase.hpp" 00051 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00052 #include "Teuchos_StandardCompositionMacros.hpp" 00053 00054 namespace Thyra { 00055 00082 class AmesosLinearOpWithSolveFactory : public LinearOpWithSolveFactoryBase<double> { 00083 public: 00084 00087 00089 static const std::string SolverType_name; 00091 static const std::string RefactorizationPolicy_name; 00093 static const std::string ThrowOnPreconditionerInput_name; 00095 static const std::string Amesos_Settings_name; 00096 00098 00101 00103 ~AmesosLinearOpWithSolveFactory(); 00104 00107 AmesosLinearOpWithSolveFactory( 00108 const Amesos::ESolverType solverType 00109 #ifdef HAVE_AMESOS_KLU 00110 = Amesos::KLU 00111 #else 00112 = Amesos::LAPACK 00113 #endif 00114 ,const Amesos::ERefactorizationPolicy refactorizationPolicy = Amesos::REPIVOT_ON_REFACTORIZATION 00115 ,const bool throwOnPrecInput = true 00116 ); 00117 00126 STANDARD_COMPOSITION_MEMBERS( EpetraOperatorViewExtractorBase, epetraFwdOpViewExtractor ); 00127 00129 00132 00136 bool isCompatible( const LinearOpSourceBase<double> &fwdOpSrc ) const; 00137 00139 Teuchos::RCP<LinearOpWithSolveBase<double> > createOp() const; 00140 00142 void initializeOp( 00143 const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc 00144 ,LinearOpWithSolveBase<double> *Op 00145 ,const ESupportSolveUse supportSolveUse 00146 ) const; 00147 00149 bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const; 00150 00154 void initializePreconditionedOp( 00155 const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc 00156 ,const Teuchos::RCP<const PreconditionerBase<double> > &prec 00157 ,LinearOpWithSolveBase<double> *Op 00158 ,const ESupportSolveUse supportSolveUse 00159 ) const; 00160 00164 void initializePreconditionedOp( 00165 const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc 00166 ,const Teuchos::RCP<const LinearOpSourceBase<double> > &approxFwdOpSrc 00167 ,LinearOpWithSolveBase<double> *Op 00168 ,const ESupportSolveUse supportSolveUse 00169 ) const; 00170 00172 void uninitializeOp( 00173 LinearOpWithSolveBase<double> *Op 00174 ,Teuchos::RCP<const LinearOpSourceBase<double> > *fwdOpSrc 00175 ,Teuchos::RCP<const PreconditionerBase<double> > *prec 00176 ,Teuchos::RCP<const LinearOpSourceBase<double> > *approxFwdOpSrc 00177 ,ESupportSolveUse *supportSolveUse 00178 ) const; 00179 00181 00184 00186 void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const& paramList); 00188 Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList(); 00190 Teuchos::RCP<Teuchos::ParameterList> unsetParameterList(); 00192 Teuchos::RCP<const Teuchos::ParameterList> getParameterList() const; 00194 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const; 00195 00197 00200 00202 std::string description() const; 00203 00205 00206 private: 00207 00208 // ///////////////////////// 00209 // Private data members 00210 00211 Amesos::ESolverType solverType_; 00212 Amesos::ERefactorizationPolicy refactorizationPolicy_; 00213 bool throwOnPrecInput_; 00214 Teuchos::RCP<Teuchos::ParameterList> paramList_; 00215 00216 // ///////////////////////// 00217 // Private member functions 00218 00219 static Teuchos::RCP<const Teuchos::ParameterList> 00220 generateAndGetValidParameters(); 00221 00222 }; 00223 00224 } // namespace Thyra 00225 00226 #endif // THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
1.7.6.1