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 class Epetra_RowMatrix;
00047 class Epetra_LinearProblem;
00048 #include "Teuchos_RCP.hpp"
00049 
00051 
00064 class Amesos_Lapack: public Amesos_BaseSolver,
00065                      private Amesos_Time,
00066                      private Amesos_NoCopiable,
00067                      private Amesos_Utils,
00068          private Amesos_Control, 
00069                      private Amesos_Status 
00070 {
00071 public: 
00072 
00074 
00075 
00082   Amesos_Lapack(const Epetra_LinearProblem& LinearProblem );
00083 
00085 
00087   ~Amesos_Lapack(void);
00088   
00090 
00091 
00092   int SymbolicFactorization() ;
00093 
00094   int NumericFactorization() ;
00095 
00096   int Solve();
00097 
00099 
00100 
00101   const Epetra_LinearProblem *GetProblem() const { return(Problem_); };
00102 
00103   bool MatrixShapeOK() const;
00104 
00105   int SetUseTranspose(bool UseTranspose_in) {
00106     UseTranspose_ = UseTranspose_in; 
00107     return(0);
00108   }
00109 
00110   bool UseTranspose() const {return(UseTranspose_);};
00111 
00112   const Epetra_Comm & Comm() const {
00113     return(GetProblem()->GetOperator()->Comm());
00114   }
00115 
00117 
00119   void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const& paramList) ;
00120 
00121   Teuchos::RCP<Teuchos::ParameterList> unsetParameterList() ;
00122 
00123 
00125   int SetParameters( Teuchos::ParameterList &ParameterList )  ;
00126 
00128 
00138   int GEEV(Epetra_Vector& Er, Epetra_Vector& Ei);
00139 
00141   int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00142 
00144   int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00145 
00147   int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00148 
00150   void PrintTiming() const;
00151   
00153   void PrintStatus() const;
00154 
00156   void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
00157   
00159 
00160 protected:
00161 
00163   const Epetra_RowMatrix* Matrix() const
00164   {
00165     return(Problem_->GetMatrix());
00166   }
00167 
00169   inline int NumGlobalRows() const
00170   {
00171     return(Matrix()->NumGlobalRows());
00172   }
00173 
00175   inline int NumMyRows() const
00176   {
00177     return(Matrix()->NumMyRows());
00178   }
00179 
00181   inline const Epetra_Map& SerialMap()
00182   {
00183     return(*(SerialMap_.get()));
00184   }
00185 
00187   inline Epetra_RowMatrix& SerialMatrix()
00188   {
00189     return(*(SerialMatrix_.get()));
00190   }
00191 
00192   inline Epetra_CrsMatrix& SerialCrsMatrix()
00193   {
00194     return(*(SerialCrsMatrix_.get()));
00195   }
00196 
00198   const Epetra_Import& Importer()
00199   {
00200     return(*(Importer_.get()));
00201   }
00202 
00203   Teuchos::RCP<Teuchos::ParameterList> pl_ ; 
00204 
00206   int SolveSerial(Epetra_MultiVector& X,
00207       const Epetra_MultiVector& B);
00208   
00210   int SolveDistributed(Epetra_MultiVector& X,
00211            const Epetra_MultiVector& B);
00212   
00214   int DistributedToSerial();
00215 
00217   int SerialToDense();
00218 
00220   int DenseToFactored();
00221 
00222   Teuchos::RCP<Epetra_RowMatrix> SerialMatrix_;
00223   Teuchos::RCP<Epetra_CrsMatrix> SerialCrsMatrix_;
00224   Teuchos::RCP<Epetra_Map> SerialMap_;
00225   Teuchos::RCP<Epetra_Import> Importer_;
00226 
00228   Epetra_SerialDenseMatrix DenseMatrix_;
00230   Epetra_SerialDenseMatrix DenseLHS_;
00232   Epetra_SerialDenseMatrix DenseRHS_;
00234   Epetra_SerialDenseSolver DenseSolver_;
00235 
00237   bool UseTranspose_;
00239   const Epetra_LinearProblem* Problem_;
00240 
00242   int MtxRedistTime_, MtxConvTime_, VecRedistTime_, SymFactTime_, NumFactTime_, SolveTime_;
00243 
00244   int NumGlobalRows_;
00245   int NumGlobalNonzeros_;
00246 
00247   Teuchos::RCP<Teuchos::ParameterList> ParameterList_ ; 
00248 
00249 };  // End of  class Amesos_Lapack
00250 #endif /* AMESOS_LAPACK_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines