Thyra_MLPreconditionerFactory.hpp
Go to the documentation of this file.
00001 /*@HEADER
00002 // ***********************************************************************
00003 // 
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2002) 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 Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 //@HEADER
00028 */
00029 
00030 #ifndef THYRA_ML_PRECONDITIONER_FACTORY_DECL_HPP
00031 #define THYRA_ML_PRECONDITIONER_FACTORY_DECL_HPP
00032 
00033 #include "SundanceDefs.hpp"
00034 
00035 #ifndef TRILINOS_6
00036 
00037 #include "Thyra_PreconditionerFactoryBase.hpp"
00038 #include "Thyra_EpetraOperatorViewExtractorBase.hpp"
00039 #include "Teuchos_StandardCompositionMacros.hpp"
00040 
00041 namespace Thyra {
00042 
00043   using Teuchos::ParameterList;
00044   using Teuchos::RefCountPtr;
00045 
00046   /** These can be used to choose one of ML's predefined default parameter sets */
00047   enum EMLProblemType {ML_SmoothedAggregation, 
00048                        ML_DomainDecomposition,
00049                        ML_DomainDecompositionML,
00050                        ML_Maxwell};
00051 
00052 /** \brief Concrete preconditioner factory subclass based on ML.
00053  *
00054  * ToDo: Finish documentation!
00055  */
00056 class MLPreconditionerFactory : public PreconditionerFactoryBase<double> {
00057 public:
00058 
00059   /** @name Constructors/initializers/accessors */
00060   //@{
00061 
00062   /** \brief . */
00063   MLPreconditionerFactory(const RCP<ParameterList>& params);
00064   /** \brief . */
00065   MLPreconditionerFactory(const EMLProblemType& probType,
00066                           const ParameterList& revisions=ParameterList());
00067 
00068   /** */
00069   MLPreconditionerFactory(const std::string& probType,
00070                           const ParameterList& revisions=ParameterList());
00071     
00072   /** \brief Set the strategy object used to extract an
00073    * <tt>Epetra_Operator</tt> view of an input forward operator.
00074    *
00075    * This view will then be dynamically casted to <tt>Epetra_RowMatrix</tt>
00076    * before it is used.
00077    *
00078    * The default implementation used is <tt>EpetraOperatorViewExtractorBase</tt>.
00079    */
00080   STANDARD_COMPOSITION_MEMBERS( EpetraOperatorViewExtractorBase, epetraFwdOpViewExtractor )
00081 
00082   //@}
00083 
00084   /** @name Overridden from PreconditionerFactoryBase */
00085   //@{
00086 
00087   /** \brief . */
00088   bool isCompatible( const LinearOpBase<double> &fwdOp ) const;
00089   /** \brief . */
00090   bool applySupportsConj(EConj conj) const;
00091   /** \brief . */
00092   bool applyTransposeSupportsConj(EConj conj) const;
00093   /** \brief . */
00094   RCP<PreconditionerBase<double> > createPrec() const;
00095   /** \brief . */
00096   void initializePrec(
00097     const RCP<const LinearOpBase<double> >    &fwdOp
00098     ,PreconditionerBase<double>                                *prec
00099     ,const ESupportSolveUse                                    supportSolveUse
00100     ) const;
00101   /** \brief . */
00102   void uninitializePrec(
00103     PreconditionerBase<double>                          *prec
00104     ,RCP<const LinearOpBase<double> >  *fwdOp
00105     ,ESupportSolveUse                                   *supportSolveUse
00106     ) const;
00107 
00108   //@}
00109 
00110   /** @name Overridden from ParameterListAcceptor */
00111   //@{
00112 
00113   /** \brief . */
00114   void setParameterList(RCP<ParameterList> const& paramList);
00115   /** \brief . */
00116   RCP<ParameterList> getNonconstParameterList();
00117   /** \brief . */
00118   RCP<ParameterList> unsetParameterList();
00119   /** \brief . */
00120   RCP<const ParameterList> getParameterList() const;
00121   //@}
00122 
00123   /** \name Public functions overridden from Describable. */
00124   //@{
00125 
00126   /** \brief . */
00127   std::string description() const;
00128 
00129   //@}
00130 
00131 private:
00132 
00133   RCP<ParameterList> reviseDefaultList(const ParameterList& defaults, 
00134                                                const ParameterList& revisions) const;
00135 
00136   std::string probToString(const EMLProblemType& probType) const ;
00137 
00138   RCP<ParameterList> defaultParameters(const EMLProblemType& probType) const ;
00139 
00140   RCP<ParameterList> defaultParameters(const std::string& probType) const ;
00141 
00142   // ////////////////////////////////
00143   // Private data members
00144 
00145   RCP<ParameterList>       paramList_;
00146 
00147 
00148   // ////////////////////////////////
00149   // Private member functions
00150 
00151   static RCP<const ParameterList> generateAndGetValidParameters();
00152 
00153 };
00154 
00155 } // namespace Thyra
00156 
00157 #endif
00158 #endif // THYRA_ML_PRECONDITIONER_FACTORY_DECL_HPP

Site Contact