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 THYRA_DEFAULT_REAL_LINEAR_SOLVER_BUILDING_BASE
00030 #define THYRA_DEFAULT_REAL_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 namespace Teuchos { class CommandLineProcessor; }
00038
00039 namespace Thyra {
00040
00061 class DefaultRealLinearSolverBuilder : public LinearSolverBuilderBase<double>
00062 {
00063 public:
00064
00067
00075 DefaultRealLinearSolverBuilder(
00076 const std::string ¶msXmlFileName = ""
00077 ,const std::string &extraParamsXmlString = ""
00078 ,const std::string ¶msUsedXmlOutFileName = ""
00079 ,const std::string ¶msXmlFileNameOption = "linear-solver-params-file"
00080 ,const std::string &extraParamsXmlStringOption = "extra-linear-solver-params"
00081 ,const std::string ¶msUsedXmlOutFileNameOption = "linear-solver-params-used-file"
00082 );
00083
00085 ~DefaultRealLinearSolverBuilder();
00086
00090 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsXmlFileName)
00091
00092
00095 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extraParamsXmlString)
00096
00100 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsUsedXmlOutFileName)
00101
00105 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsXmlFileNameOption)
00106
00110 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,extraParamsXmlStringOption)
00111
00115 STANDARD_MEMBER_COMPOSITION_MEMBERS(std::string,paramsUsedXmlOutFileNameOption)
00116
00118 void setLinearSolveStrategyFactory(
00119 const Teuchos::RefCountPtr<const Teuchos::AbstractFactory<LinearOpWithSolveFactoryBase<double> > > &solveStrategyFactory
00120 ,const std::string &solveStrategyName
00121 );
00122
00124 void setPreconditioningStrategyFactory(
00125 const Teuchos::RefCountPtr<const Teuchos::AbstractFactory<PreconditionerFactoryBase<double> > > &precStrategyFactory
00126 ,const std::string &precStrategyName
00127 );
00128
00145 void setupCLP( Teuchos::CommandLineProcessor *clp );
00146
00165 void readParameters( std::ostream *out );
00166
00182 void writeParamsFile(
00183 const LinearOpWithSolveFactoryBase<double> &lowsFactory
00184 ,const std::string &outputXmlFileName = ""
00185 ) const;
00186
00190 std::string getLinearSolveStrategyName() const;
00191
00195 std::string getPreconditionerStrategyName() const;
00196
00198
00201
00203 void setParameterList(Teuchos::RefCountPtr<Teuchos::ParameterList> const& paramList);
00205 Teuchos::RefCountPtr<Teuchos::ParameterList> getParameterList();
00207 Teuchos::RefCountPtr<Teuchos::ParameterList> unsetParameterList();
00209 Teuchos::RefCountPtr<const Teuchos::ParameterList> getParameterList() const;
00211 Teuchos::RefCountPtr<const Teuchos::ParameterList> getValidParameters() const;
00212
00214
00217
00219 Teuchos::RefCountPtr<LinearOpWithSolveFactoryBase<double> >
00220 createLinearSolveStrategy(
00221 const std::string &linearSolveStrategyName
00222 ) const;
00224 Teuchos::RefCountPtr<PreconditionerFactoryBase<double> >
00225 createPreconditioningStrategy(
00226 const std::string &preconditioningStrategyName
00227 ) const;
00228
00230
00231 private:
00232
00233
00234
00235
00236 typedef std::map<std::string,Teuchos::RefCountPtr<const Teuchos::AbstractFactory<LinearOpWithSolveFactoryBase<double> > > > lowsf_map_t;
00237 typedef std::map<std::string,Teuchos::RefCountPtr<const Teuchos::AbstractFactory<PreconditionerFactoryBase<double> > > > pf_map_t;
00238
00239
00240
00241
00242 Teuchos::RefCountPtr<Teuchos::ParameterList> paramList_;
00243 mutable Teuchos::RefCountPtr<const Teuchos::ParameterList> validParamList_;
00244 lowsf_map_t lowsf_map_;
00245 std::vector<std::string> validLowsfNames_;
00246 std::string defaultLOWSF_;
00247 pf_map_t pf_map_;
00248 std::vector<std::string> validPfNames_;
00249 std::string defaultPF_;
00250
00251
00252
00253
00254 void initializeDefaults();
00255 std::string validLinearSolveStrategyNames() const;
00256 std::string validPreconditioningStrategyNames() const;
00257
00258 };
00259
00260 }
00261
00262 #endif