|
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 // 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 Roscoe A. Bartlett (rabartl@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef STRATIMIKOS_DEFAULT_LINEAR_SOLVER_BUILDING_BASE 00030 #define STRATIMIKOS_DEFAULT_LINEAR_SOLVER_BUILDING_BASE 00031 00032 #include "Stratimikos_ConfigDefs.hpp" 00033 #include "Thyra_LinearSolverBuilderBase.hpp" 00034 #include "Teuchos_AbstractFactory.hpp" 00035 #include "Teuchos_StandardMemberCompositionMacros.hpp" 00036 00037 // Include these to make all of the helpful decls appear 00038 #include "Thyra_EpetraThyraWrappers.hpp" 00039 #include "Thyra_EpetraLinearOp.hpp" 00040 #include "Thyra_LinearOpWithSolveFactoryHelpers.hpp" 00041 #include "Thyra_LinearOpWithSolveBase.hpp" 00042 #include "Thyra_PreconditionerFactoryHelpers.hpp" 00043 #include "Thyra_DefaultScaledAdjointLinearOp.hpp" 00044 #include "Thyra_DefaultPreconditioner.hpp" 00045 #include "Thyra_MultiVectorStdOps.hpp" 00046 #include "Thyra_VectorStdOps.hpp" 00047 #include "Thyra_VectorBase.hpp" 00048 00049 00050 namespace Teuchos { class CommandLineProcessor; } 00051 00052 00053 namespace Stratimikos { 00054 00055 00057 using Teuchos::RCP; 00059 using Teuchos::Array; 00061 using Teuchos::AbstractFactory; 00063 using Teuchos::ParameterList; 00064 00065 00094 class DefaultLinearSolverBuilder 00095 : public Thyra::LinearSolverBuilderBase<double> 00096 { 00097 public: 00098 00101 00109 DefaultLinearSolverBuilder( 00110 const std::string ¶msXmlFileName = "" 00111 ,const std::string &extraParamsXmlString = "" 00112 ,const std::string ¶msUsedXmlOutFileName = "" 00113 ,const std::string ¶msXmlFileNameOption = "linear-solver-params-file" 00114 ,const std::string &extraParamsXmlStringOption = "extra-linear-solver-params" 00115 ,const std::string ¶msUsedXmlOutFileNameOption = "linear-solver-params-used-file" 00116 ); 00117 00119 ~DefaultLinearSolverBuilder(); 00120 00124 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsXmlFileName); 00125 00129 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extraParamsXmlString); 00130 00134 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsUsedXmlOutFileName); 00135 00139 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsXmlFileNameOption); 00140 00144 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extraParamsXmlStringOption); 00145 00149 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsUsedXmlOutFileNameOption); 00150 00152 void setLinearSolveStrategyFactory( 00153 const RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<double> > > 00154 &solveStrategyFactory, 00155 const std::string &solveStrategyName 00156 ); 00157 00159 void setPreconditioningStrategyFactory( 00160 const RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<double> > > 00161 &precStrategyFactory, 00162 const std::string &precStrategyName 00163 ); 00164 00181 void setupCLP( Teuchos::CommandLineProcessor *clp ); 00182 00201 void readParameters( std::ostream *out ); 00202 00218 void writeParamsFile( 00219 const Thyra::LinearOpWithSolveFactoryBase<double> &lowsFactory, 00220 const std::string &outputXmlFileName = "" 00221 ) const; 00222 00226 std::string getLinearSolveStrategyName() const; 00227 00231 std::string getPreconditionerStrategyName() const; 00232 00234 00237 00239 void setParameterList(RCP<ParameterList> const& paramList); 00241 RCP<ParameterList> getNonconstParameterList(); 00243 RCP<ParameterList> unsetParameterList(); 00245 RCP<const ParameterList> getParameterList() const; 00247 RCP<const ParameterList> getValidParameters() const; 00248 00250 00253 00255 RCP<Thyra::LinearOpWithSolveFactoryBase<double> > 00256 createLinearSolveStrategy( 00257 const std::string &linearSolveStrategyName 00258 ) const; 00260 RCP<Thyra::PreconditionerFactoryBase<double> > 00261 createPreconditioningStrategy( 00262 const std::string &preconditioningStrategyName 00263 ) const; 00264 00266 00267 private: 00268 00269 // ////////////////////////////////////// 00270 // Private types 00271 00272 typedef RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<double> > > 00273 lowsf_fcty_t; 00274 typedef RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<double> > > 00275 pf_fcty_t; 00276 00277 // ////////////////////////////////////// 00278 // Private data members 00279 00280 RCP<ParameterList> paramList_; 00281 mutable RCP<const ParameterList> validParamList_; 00282 Array<std::string> validLowsfNames_; 00283 Array<lowsf_fcty_t> lowsfArray_; 00284 std::string defaultLOWSF_; 00285 Array<std::string> validPfNames_; // Contains "None" as the 0th entry! 00286 Array<pf_fcty_t> pfArray_; 00287 std::string defaultPF_; 00288 bool enableDelayedSolverConstruction_; 00289 00290 // ////////////////////////////////////// 00291 // Private member functions 00292 00293 void initializeDefaults(); 00294 00295 }; 00296 00297 00298 } // namespace Stratimikos 00299 00300 00301 #endif // STRATIMIKOS_DEFAULT_LINEAR_SOLVER_BUILDING_BASE
1.7.4