Amesos Package Browser (Single Doxygen Collection) Development
Amesos_Lapack.h
Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //                Amesos: Direct Sparse Solver Package
00005 //                 Copyright (2004) 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 #ifndef AMESOS_LAPACK_H
00030 #define AMESOS_LAPACK_H
00031 
00032 #include "Amesos_ConfigDefs.h"
00033 #include "Amesos_BaseSolver.h"
00034 #include "Amesos_NoCopiable.h"
00035 #include "Amesos_Utils.h"
00036 #include "Amesos_Time.h"
00037 #include "Amesos_Status.h"
00038 #include "Amesos_Control.h"
00039 #include "Epetra_Comm.h"
00040 #include "Epetra_Map.h"
00041 #include "Epetra_SerialDenseMatrix.h"
00042 #include "Epetra_SerialDenseVector.h"
00043 #include "Epetra_SerialDenseSolver.h"
00044 #include "Epetra_CrsMatrix.h"
00045 #include "Epetra_Import.h"
00046 #include "Epetra_Export.h"
00047 class Epetra_RowMatrix;
00048 class Epetra_LinearProblem;
00049 #include "Teuchos_RCP.hpp"
00050 
00052 
00065 class Amesos_Lapack: public Amesos_BaseSolver,
00066                      private Amesos_Time,
00067                      private Amesos_NoCopiable,
00068                      private Amesos_Utils,
00069          private Amesos_Control, 
00070                      private Amesos_Status 
00071 {
00072 public: 
00073 
00075 
00076 
00083   Amesos_Lapack(const Epetra_LinearProblem& LinearProblem );
00084 
00086 
00088   ~Amesos_Lapack(void);
00089   
00091 
00092 
00093   int SymbolicFactorization() ;
00094 
00095   int NumericFactorization() ;
00096 
00097   int Solve();
00098 
00100 
00101 
00102   const Epetra_LinearProblem *GetProblem() const { return(Problem_); };
00103 
00104   bool MatrixShapeOK() const;
00105 
00106   int SetUseTranspose(bool UseTranspose_in) {
00107     UseTranspose_ = UseTranspose_in; 
00108     return(0);
00109   }
00110 
00111   bool UseTranspose() const {return(UseTranspose_);};
00112 
00113   const Epetra_Comm & Comm() const {
00114     return(GetProblem()->GetOperator()->Comm());
00115   }
00116 
00118 
00120   void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const& paramList) ;
00121 
00122   Teuchos::RCP<Teuchos::ParameterList> unsetParameterList() ;
00123 
00124 
00126   int SetParameters( Teuchos::ParameterList &ParameterList )  ;
00127 
00129 
00139   int GEEV(Epetra_Vector& Er, Epetra_Vector& Ei);
00140 
00142   int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00143 
00145   int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00146 
00148   int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00149 
00151   void PrintTiming() const;
00152   
00154   void PrintStatus() const;
00155 
00157   void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
00158   
00160 
00161 protected:
00162 
00164   const Epetra_RowMatrix* Matrix() const
00165   {
00166     return(Problem_->GetMatrix());
00167   }
00168 
00170   inline int NumGlobalRows() const
00171   {
00172     return(Matrix()->NumGlobalRows());
00173   }
00174 
00176   inline int NumMyRows() const
00177   {
00178     return(Matrix()->NumMyRows());
00179   }
00180 
00182   inline const Epetra_Map& SerialMap()
00183   {
00184     return(*(SerialMap_.get()));
00185   }
00186 
00188   inline Epetra_RowMatrix& SerialMatrix()
00189   {
00190     return(*(SerialMatrix_.get()));
00191   }
00192 
00193   inline Epetra_CrsMatrix& SerialCrsMatrix()
00194   {
00195     return(*(SerialCrsMatrix_.get()));
00196   }
00197 
00199   const Epetra_Import& MatrixImporter()
00200   {
00201     return(*(MatrixImporter_.get()));
00202   }
00203 
00205   const Epetra_Export& RhsExporter()
00206   {
00207     return(*(RhsExporter_.get()));
00208   }
00209 
00211   const Epetra_Import& SolutionImporter()
00212   {
00213     return(*(SolutionImporter_.get()));
00214   }
00215 
00216   Teuchos::RCP<Teuchos::ParameterList> pl_ ; 
00217 
00219   int SolveSerial(Epetra_MultiVector& X,
00220       const Epetra_MultiVector& B);
00221   
00223   int SolveDistributed(Epetra_MultiVector& X,
00224            const Epetra_MultiVector& B);
00225   
00227   int DistributedToSerial();
00228 
00230   int SerialToDense();
00231 
00233   int DenseToFactored();
00234 
00235   Teuchos::RCP<Epetra_RowMatrix> SerialMatrix_;
00236   Teuchos::RCP<Epetra_CrsMatrix> SerialCrsMatrix_;
00237   Teuchos::RCP<Epetra_Map> SerialMap_;
00238   Teuchos::RCP<Epetra_Import> MatrixImporter_;
00239   Teuchos::RCP<Epetra_Export> RhsExporter_;
00240   Teuchos::RCP<Epetra_Import> SolutionImporter_;
00241 
00243   Epetra_SerialDenseMatrix DenseMatrix_;
00245   Epetra_SerialDenseMatrix DenseLHS_;
00247   Epetra_SerialDenseMatrix DenseRHS_;
00249   Epetra_SerialDenseSolver DenseSolver_;
00250 
00252   bool UseTranspose_;
00254   const Epetra_LinearProblem* Problem_;
00255 
00257   int MtxRedistTime_, MtxConvTime_, VecRedistTime_, SymFactTime_, NumFactTime_, SolveTime_;
00258 
00259   int NumGlobalRows_;
00260   int NumGlobalNonzeros_;
00261 
00262   Teuchos::RCP<Teuchos::ParameterList> ParameterList_ ; 
00263 
00264 };  // End of  class Amesos_Lapack
00265 #endif /* AMESOS_LAPACK_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines