Amesos Package Browser (Single Doxygen Collection) Development
Amesos_CSparse.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_CSPARSE_H
00030 #define AMESOS_CSPARSE_H
00031 #ifdef HAVE_AMESOS_CSPARSE
00032 
00033 #include "Amesos_ConfigDefs.h"
00034 #include "Amesos_BaseSolver.h"
00035 #include "Amesos_NoCopiable.h"
00036 #include "Amesos_Utils.h"
00037 #include "Amesos_Time.h"
00038 #include "Amesos_Status.h"
00039 #include "Amesos_Control.h"
00040 #include "Amesos_Support.h"
00041 #include "Epetra_LinearProblem.h"
00042 #include "Epetra_Time.h"
00043 #include "Epetra_Map.h"
00044 #include "Epetra_Import.h"
00045 #include "Epetra_Comm.h"
00046 #include "Epetra_RowMatrix.h"
00047 #include "Epetra_CrsMatrix.h"
00048 #include "Teuchos_ParameterList.hpp"
00049 #include "Teuchos_RCP.hpp"
00050 
00051 #include "cs.h"
00052 
00054 
00061 class Amesos_CSparse: public Amesos_BaseSolver, 
00062                       private Amesos_Time, 
00063                       private Amesos_NoCopiable, 
00064                       private Amesos_Utils, 
00065                       private Amesos_Control, 
00066                       private Amesos_Status { 
00067 
00068 public: 
00069 
00071 
00072   Amesos_CSparse(const Epetra_LinearProblem& LinearProblem );
00073 
00075   ~Amesos_CSparse();
00077 
00079 
00081   int SymbolicFactorization() ;
00082 
00084   int NumericFactorization() ;
00085 
00087   int Solve();
00089   
00091 
00093   const Epetra_LinearProblem* GetProblem() const { return(Problem_); }
00094 
00096 
00099   bool MatrixShapeOK() const;
00100 
00102 
00106   int SetUseTranspose(bool UseTranspose) { UseTranspose_ = UseTranspose; return(0); }
00107 
00109   bool UseTranspose() const { return(UseTranspose_); }
00110 
00112   const Epetra_Comm& Comm() const { return(GetProblem()->GetOperator()->Comm()); }
00113 
00115   int SetParameters( Teuchos::ParameterList &ParameterList );
00116 
00118   int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00119 
00121   int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00122 
00124   int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00125 
00127   void PrintTiming() const;
00128   
00130   void PrintStatus() const;
00131 
00133   void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
00134  
00136 
00137 private:  
00138   
00139   int CheckError(const int error) const;
00140 
00141   inline const Epetra_Map& Map() const
00142   {
00143     return(Matrix_->RowMatrixRowMap());
00144   }
00145   
00146   inline const Epetra_RowMatrix& Matrix() const
00147   {
00148     return(*Matrix_);
00149   }
00150 
00151   inline Epetra_Map& SerialMap() 
00152   {
00153     return(*(SerialMap_.get()));
00154   }
00155   
00156   inline Epetra_RowMatrix& SerialMatrix()
00157   {
00158     return(*(SerialMatrix_.get()));
00159   }
00160 
00161   inline Epetra_CrsMatrix& SerialCrsMatrix()
00162   {
00163     return(*(SerialCrsMatrix_.get()));
00164   }
00165 
00166   inline Epetra_Import& Importer()
00167   {
00168     return(*(Importer_.get()));
00169   }
00170   
00171   int ConvertToSerial();
00172   int ConvertToCSparse();
00173   int PerformSymbolicFactorization();
00174   int PerformNumericFactorization(); 
00175 
00176   Teuchos::RCP<Epetra_Map> SerialMap_;
00177   Teuchos::RCP<Epetra_CrsMatrix> SerialCrsMatrix_;
00178   Teuchos::RCP<Epetra_RowMatrix> SerialMatrix_;
00179   Teuchos::RCP<Epetra_Import> Importer_;
00180   Teuchos::RCP<Amesos_StandardIndex> StdIndex_; 
00181   Teuchos::RCP<Amesos_StandardIndex> StdIndexRange_; 
00182   Teuchos::RCP<Amesos_StandardIndex> StdIndexDomain_; 
00183 
00184   const Epetra_Map* Map_;
00185   const Epetra_RowMatrix* Matrix_;
00186 
00188   bool UseTranspose_;
00190   const Epetra_LinearProblem* Problem_;
00191 
00193   int MtxConvTime_, MtxRedistTime_, VecRedistTime_;
00194   int SymFactTime_, NumFactTime_, SolveTime_;
00195 
00196 #ifdef HAVE_AMESOS_CSPARSE
00197   // Data for CSparse
00198   cs csMatrix;
00199   cs *csTranMatrix;
00200   css *csSymbolic;
00201   csn *csNumeric;
00202 #endif
00203 
00204   //int mtype_;
00205   //void* pt_[64];
00206 
00207   //int iparm_[64];
00208   //int maxfct_; // Maximal number of factors with idential nonzero pattern (always 1)
00209   //int mnum_; //! Actual matrix for solution phase (always 1)
00210   //int msglvl_; //! Output level
00211   //int nrhs_; // Number of RHS
00212 
00213 };  // class Amesos_CSparse  
00214 
00215 #endif
00216 #endif // AMESOS_CSPARSE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines