Stratimikos_DefaultLinearSolverBuilder.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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
00038 namespace Teuchos { class CommandLineProcessor; }
00039
00040
00041 namespace Stratimikos {
00042
00043
00045 using Teuchos::RCP;
00047 using Teuchos::Array;
00049 using Teuchos::AbstractFactory;
00051 using Teuchos::ParameterList;
00052
00053
00082 class DefaultLinearSolverBuilder
00083 : public Thyra::LinearSolverBuilderBase<double>
00084 {
00085 public:
00086
00089
00097 DefaultLinearSolverBuilder(
00098 const std::string ¶msXmlFileName = ""
00099 ,const std::string &extraParamsXmlString = ""
00100 ,const std::string ¶msUsedXmlOutFileName = ""
00101 ,const std::string ¶msXmlFileNameOption = "linear-solver-params-file"
00102 ,const std::string &extraParamsXmlStringOption = "extra-linear-solver-params"
00103 ,const std::string ¶msUsedXmlOutFileNameOption = "linear-solver-params-used-file"
00104 );
00105
00107 ~DefaultLinearSolverBuilder();
00108
00112 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsXmlFileName);
00113
00117 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extraParamsXmlString);
00118
00122 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsUsedXmlOutFileName);
00123
00127 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsXmlFileNameOption);
00128
00132 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extraParamsXmlStringOption);
00133
00137 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsUsedXmlOutFileNameOption);
00138
00140 void setLinearSolveStrategyFactory(
00141 const RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<double> > >
00142 &solveStrategyFactory,
00143 const std::string &solveStrategyName
00144 );
00145
00147 void setPreconditioningStrategyFactory(
00148 const RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<double> > >
00149 &precStrategyFactory,
00150 const std::string &precStrategyName
00151 );
00152
00169 void setupCLP( Teuchos::CommandLineProcessor *clp );
00170
00189 void readParameters( std::ostream *out );
00190
00206 void writeParamsFile(
00207 const Thyra::LinearOpWithSolveFactoryBase<double> &lowsFactory,
00208 const std::string &outputXmlFileName = ""
00209 ) const;
00210
00214 std::string getLinearSolveStrategyName() const;
00215
00219 std::string getPreconditionerStrategyName() const;
00220
00222
00225
00227 void setParameterList(RCP<ParameterList> const& paramList);
00229 RCP<ParameterList> getNonconstParameterList();
00231 RCP<ParameterList> unsetParameterList();
00233 RCP<const ParameterList> getParameterList() const;
00235 RCP<const ParameterList> getValidParameters() const;
00236
00238
00241
00243 RCP<Thyra::LinearOpWithSolveFactoryBase<double> >
00244 createLinearSolveStrategy(
00245 const std::string &linearSolveStrategyName
00246 ) const;
00248 RCP<Thyra::PreconditionerFactoryBase<double> >
00249 createPreconditioningStrategy(
00250 const std::string &preconditioningStrategyName
00251 ) const;
00252
00254
00255 private:
00256
00257
00258
00259
00260 typedef RCP<const AbstractFactory<Thyra::LinearOpWithSolveFactoryBase<double> > >
00261 lowsf_fcty_t;
00262 typedef RCP<const AbstractFactory<Thyra::PreconditionerFactoryBase<double> > >
00263 pf_fcty_t;
00264
00265
00266
00267
00268 RCP<ParameterList> paramList_;
00269 mutable RCP<const ParameterList> validParamList_;
00270 Array<std::string> validLowsfNames_;
00271 Array<lowsf_fcty_t> lowsfArray_;
00272 std::string defaultLOWSF_;
00273 Array<std::string> validPfNames_;
00274 Array<pf_fcty_t> pfArray_;
00275 std::string defaultPF_;
00276 bool enableDelayedSolverConstruction_;
00277
00278
00279
00280
00281 void initializeDefaults();
00282
00283 };
00284
00285
00286 }
00287
00288
00289 #endif // STRATIMIKOS_DEFAULT_LINEAR_SOLVER_BUILDING_BASE