Thyra_DefaultRealLinearSolverBuilder.hpp

Go to the documentation of this file.
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 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    &paramsXmlFileName                = ""
00077     ,const std::string   &extraParamsXmlString             = ""
00078     ,const std::string   &paramsUsedXmlOutFileName         = ""
00079     ,const std::string   &paramsXmlFileNameOption          = "linear-solver-params-file"
00080     ,const std::string   &extraParamsXmlStringOption       = "extra-linear-solver-params"
00081     ,const std::string   &paramsUsedXmlOutFileNameOption   = "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   // Private types
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   // Private data members
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   // Private member functions
00253 
00254   void initializeDefaults();
00255   std::string validLinearSolveStrategyNames() const;
00256   std::string validPreconditioningStrategyNames() const;
00257 
00258 };
00259 
00260 } // namespace Thyra
00261 
00262 #endif // THYRA_DEFAULT_REAL_LINEAR_SOLVER_BUILDING_BASE

Generated on Thu Sep 18 12:37:35 2008 for Stratimikos Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1