Amesos Package Browser (Single Doxygen Collection) Development
Amesos_Superludist.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_SUPERLUDIST_H
00030 #define AMESOS_SUPERLUDIST_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 "Teuchos_RCP.hpp"
00041 #ifdef EPETRA_MPI
00042 #include "Epetra_MpiComm.h"
00043 #else
00044 #include "Epetra_Comm.h"
00045 #endif
00046 
00047 
00048 // Amesos_Superludist_Pimpl contains a pointer to structures defined in 
00049 // superlu_ddefs.h.  This prevents Amesos_Superludist.h 
00050 // from having to include superludist.h.
00051 //
00052 //  Doxygen does not handle forward class references well.
00053 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00054 class Amesos_Superlu_Pimpl ; 
00055 #endif
00056 
00057 
00059 
00064 class Amesos_Superludist: 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 
00072 public: 
00073 
00075 
00076 
00083   Amesos_Superludist(const Epetra_LinearProblem& LinearProblem);
00084 
00086   ~Amesos_Superludist(void);
00089 
00091 
00092   int SymbolicFactorization() ;
00093 
00094   int NumericFactorization() ;
00095 
00096   int Solve();
00097 
00098 
00100 
00101   
00103 
00105   int SetUseTranspose(bool UseTranspose) { return( UseTranspose?1:0 );};
00106 
00108 
00109 
00110   const Epetra_LinearProblem *GetProblem() const { return(Problem_); };
00111 
00113 
00116   bool MatrixShapeOK() const;
00117 
00119   bool UseTranspose() const {return(true);};
00121 
00122   int SetParameters( Teuchos::ParameterList &ParameterList ) ;
00123 
00125   int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00126 
00128   int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00129 
00131   int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00132 
00134   void PrintTiming() const;
00135   
00137   void PrintStatus() const;
00138 
00140   void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
00141   
00142 private:  
00143   inline const Epetra_Comm& Comm() const {return(GetProblem()->GetOperator()->Comm());};
00144 
00145   inline const Epetra_Import& Importer() const
00146   {
00147     return(*(Importer_.get()));
00148   }
00149 
00150   inline const Epetra_Map& UniformMap() const
00151   {
00152     return(*(UniformMap_.get()));
00153   }
00154 
00155   inline const Epetra_RowMatrix& UniformMatrix() const
00156   {
00157     return(*(UniformMatrix_.get()));
00158   }
00159 
00160   inline Epetra_CrsMatrix& CrsUniformMatrix()
00161   {
00162     return(*(CrsUniformMatrix_.get()));
00163   }
00164 
00165   //
00166   //  PrivateSuperluData_ contains pointers to data needed by klu whose
00167   //  data structures are defined by klu.h
00168   //
00169   Teuchos::RCP<Amesos_Superlu_Pimpl> PrivateSuperluData_; 
00170 
00171   int RedistributeA();
00172 
00173   int ReFactor();
00174   int Factor();
00175   
00176   const Epetra_LinearProblem* Problem_;
00177   Epetra_RowMatrix *RowMatrixA_ ;  // Problem_->GetOperator()
00178 
00179   RCP<Epetra_Map> UniformMap_;
00180   RCP<Epetra_CrsMatrix> CrsUniformMatrix_;  
00181   RCP<Epetra_RowMatrix> UniformMatrix_;  
00182   Teuchos::RCP<Epetra_Import> Importer_;
00183 
00185   bool ReuseSymbolic_; 
00187   bool Redistribute_ ; 
00188 
00190   int GridCreated_ ; 
00191   int FactorizationDone_ ; 
00193   bool FactorizationOK_ ;
00194 
00196   int NumGlobalRows_; 
00197 
00198   // Ap, Ai, Aval form the compressed row storage used by SuperLU_DIST
00199   std::vector <int> Ap_;
00200   std::vector <int> Ai_;
00201   std::vector <double> Aval_;
00203   int* Global_Columns_;
00204 
00205   int nprow_;
00206   int npcol_;
00207 
00208   bool PrintNonzeros_;
00209   std::string ColPerm_;
00210   std::string RowPerm_;
00211   int* perm_c_;
00212   int* perm_r_;
00213   std::string IterRefine_;
00214   bool ReplaceTinyPivot_;
00215   bool Equil_;
00216 
00217   int MtxConvTime_, MtxRedistTime_, VecRedistTime_;
00218   int NumFactTime_, SolveTime_, OverheadTime_;
00219  
00220 };  // End of  class Amesos_Superludist  
00221 #endif /* AMESOS_SUPERLUDIST_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines