Amesos Package Browser (Single Doxygen Collection) Development
Amesos_Pardiso.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_PARDISO_H
00030 #define AMESOS_PARDISO_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_LinearProblem.h"
00040 #include "Epetra_Time.h"
00041 #include "Epetra_Map.h"
00042 #include "Epetra_Import.h"
00043 #include "Epetra_Comm.h"
00044 #include "Epetra_RowMatrix.h"
00045 #include "Epetra_CrsMatrix.h"
00046 #include "Teuchos_ParameterList.hpp"
00047 #include "Teuchos_RCP.hpp"
00048 
00050 
00057 class Amesos_Pardiso: public Amesos_BaseSolver, 
00058                       private Amesos_Time, 
00059                       private Amesos_NoCopiable, 
00060                       private Amesos_Utils, 
00061                       private Amesos_Control, 
00062                       private Amesos_Status { 
00063 
00064 public: 
00065 
00067 
00068   Amesos_Pardiso(const Epetra_LinearProblem& LinearProblem );
00069 
00071   ~Amesos_Pardiso();
00073 
00075 
00077   int SymbolicFactorization() ;
00078 
00080   int NumericFactorization() ;
00081 
00083   int Solve();
00085   
00087 
00089   const Epetra_LinearProblem* GetProblem() const { return(Problem_); }
00090 
00092 
00095   bool MatrixShapeOK() const;
00096 
00098 
00102   int SetUseTranspose(bool UseTranspose) { UseTranspose_ = UseTranspose; return(0); }
00103 
00105   bool UseTranspose() const { return(UseTranspose_); }
00106 
00108   const Epetra_Comm& Comm() const { return(GetProblem()->GetOperator()->Comm()); }
00109 
00111   int SetParameters( Teuchos::ParameterList &ParameterList );
00112 
00114   int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00115 
00117   int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00118 
00120   int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00121 
00123   void PrintTiming() const;
00124   
00126   void PrintStatus() const;
00127 
00129   void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
00130  
00132 
00133 private:  
00134   
00135   int CheckError(const int error) const;
00136 
00137   inline const Epetra_Map& Map() const
00138   {
00139     return(Matrix_->RowMatrixRowMap());
00140   }
00141   
00142   inline const Epetra_RowMatrix& Matrix() const
00143   {
00144     return(*Matrix_);
00145   }
00146 
00147   inline Epetra_Map& SerialMap() 
00148   {
00149     return(*(SerialMap_.get()));
00150   }
00151   
00152   inline Epetra_RowMatrix& SerialMatrix()
00153   {
00154     return(*(SerialMatrix_.get()));
00155   }
00156 
00157   inline Epetra_CrsMatrix& SerialCrsMatrix()
00158   {
00159     return(*(SerialCrsMatrix_.get()));
00160   }
00161 
00162   inline Epetra_Import& Importer()
00163   {
00164     return(*(Importer_.get()));
00165   }
00166   
00167   int ConvertToSerial();
00168   int ConvertToPardiso();
00169   int PerformSymbolicFactorization();
00170   int PerformNumericFactorization(); 
00171 
00172   Teuchos::RCP<Epetra_Map> SerialMap_;
00173   Teuchos::RCP<Epetra_CrsMatrix> SerialCrsMatrix_;
00174   Teuchos::RCP<Epetra_RowMatrix> SerialMatrix_;
00175   Teuchos::RCP<Epetra_Import> Importer_;
00176 
00177   const Epetra_Map* Map_;
00178   const Epetra_RowMatrix* Matrix_;
00179 
00181   bool UseTranspose_;
00183   const Epetra_LinearProblem* Problem_;
00184 
00186   int MtxConvTime_, MtxRedistTime_, VecRedistTime_;
00187   int SymFactTime_, NumFactTime_, SolveTime_;
00188 
00189   // Data for PARDISO
00190   std::vector<double> aa_;
00191   std::vector<int>    ia_;
00192   std::vector<int>    ja_;
00193 
00194   bool pardiso_initialized_ ; 
00195   int mtype_;
00196   void* pt_[64];
00197 
00198   int iparm_[64];
00199   double dparm_[64];
00200   int maxfct_; // Maximal number of factors with idential nonzero pattern (always 1)
00201   int mnum_; 
00202   int msglvl_; 
00203   int nrhs_; // Number of RHS
00204 
00205   Teuchos::ParameterList param_;
00206 
00207 };  // class Amesos_Pardiso  
00208 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines