Thyra_AmesosLinearOpWithSolveFactory.hpp

00001 /*
00002 // @HEADER
00003 // ***********************************************************************
00004 // 
00005 //                Amesos: Direct Sparse Solver Package
00006 //                 Copyright (2004) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //  
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA
00025 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00026 // 
00027 // ***********************************************************************
00028 // @HEADER
00029 */
00030 
00031 #ifndef THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
00032 #define THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
00033 
00034 #include "Thyra_LinearOpWithSolveFactoryBase.hpp"
00035 #include "Thyra_AmesosTypes.hpp"
00036 #include "Amesos_BaseSolver.h"
00037 #include "Thyra_EpetraOperatorViewExtractorBase.hpp"
00038 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00039 #include "Teuchos_StandardCompositionMacros.hpp"
00040 
00041 namespace Thyra {
00042 
00069 class AmesosLinearOpWithSolveFactory : public LinearOpWithSolveFactoryBase<double> {
00070 public:
00071 
00074 
00076   static const std::string SolverType_name;
00078   static const std::string RefactorizationPolicy_name;
00080   static const std::string ThrowOnPreconditionerInput_name;
00082   static const std::string Amesos_Settings_name;
00083 
00085 
00088 
00090   ~AmesosLinearOpWithSolveFactory();
00091 
00094   AmesosLinearOpWithSolveFactory(
00095     const Amesos::ESolverType                 solverType
00096 #ifdef HAVE_AMESOS_KLU                        
00097                                                                      = Amesos::KLU
00098 #else                                         
00099                                                                      = Amesos::LAPACK
00100 #endif                                        
00101     ,const Amesos::ERefactorizationPolicy     refactorizationPolicy  = Amesos::REPIVOT_ON_REFACTORIZATION
00102     ,const bool                               throwOnPrecInput       = true
00103     );
00104     
00113   STANDARD_COMPOSITION_MEMBERS( EpetraOperatorViewExtractorBase, epetraFwdOpViewExtractor );
00114 
00116 
00119 
00123   bool isCompatible( const LinearOpSourceBase<double> &fwdOpSrc ) const;
00124 
00126   Teuchos::RCP<LinearOpWithSolveBase<double> > createOp() const;
00127 
00129   void initializeOp(
00130     const Teuchos::RCP<const LinearOpSourceBase<double> >    &fwdOpSrc
00131     ,LinearOpWithSolveBase<double>                                   *Op
00132     ,const ESupportSolveUse                                          supportSolveUse
00133     ) const;
00134 
00136   bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const;
00137 
00141   void initializePreconditionedOp(
00142     const Teuchos::RCP<const LinearOpSourceBase<double> >       &fwdOpSrc
00143     ,const Teuchos::RCP<const PreconditionerBase<double> >      &prec
00144     ,LinearOpWithSolveBase<double>                                      *Op
00145     ,const ESupportSolveUse                                             supportSolveUse
00146     ) const;
00147 
00151   void initializePreconditionedOp(
00152     const Teuchos::RCP<const LinearOpSourceBase<double> >       &fwdOpSrc
00153     ,const Teuchos::RCP<const LinearOpSourceBase<double> >      &approxFwdOpSrc
00154     ,LinearOpWithSolveBase<double>                                      *Op
00155     ,const ESupportSolveUse                                             supportSolveUse
00156     ) const;
00157 
00159   void uninitializeOp(
00160     LinearOpWithSolveBase<double>                               *Op
00161     ,Teuchos::RCP<const LinearOpSourceBase<double> >    *fwdOpSrc
00162     ,Teuchos::RCP<const PreconditionerBase<double> >    *prec
00163     ,Teuchos::RCP<const LinearOpSourceBase<double> >    *approxFwdOpSrc
00164     ,ESupportSolveUse                                           *supportSolveUse
00165     ) const;
00166 
00168 
00171 
00173   void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const& paramList);
00175   Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList();
00177   Teuchos::RCP<Teuchos::ParameterList> unsetParameterList();
00179   Teuchos::RCP<const Teuchos::ParameterList> getParameterList() const;
00181   Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
00182 
00184 
00187 
00189   std::string description() const;
00190 
00192 
00193 private:
00194 
00195   // /////////////////////////
00196   // Private data members
00197 
00198   Amesos::ESolverType                             solverType_;
00199   Amesos::ERefactorizationPolicy                  refactorizationPolicy_;
00200   bool                                            throwOnPrecInput_;
00201   Teuchos::RCP<Teuchos::ParameterList>    paramList_;
00202 
00203   // /////////////////////////
00204   // Private member functions
00205 
00206   static Teuchos::RCP<const Teuchos::ParameterList>
00207   generateAndGetValidParameters();
00208 
00209 };
00210 
00211 } // namespace Thyra
00212 
00213 #endif // THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Generated on Wed Apr 13 10:20:45 2011 for Stratimikos by  doxygen 1.6.3