Amesos Package Browser (Single Doxygen Collection) Development
Amesos_Taucs.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 
00039 #ifndef AMESOS_TAUCS_H
00040 #define AMESOS_TAUCS_H
00041 
00042 #include "Amesos_ConfigDefs.h"
00043 #include "Amesos_BaseSolver.h"
00044 #include "Amesos_NoCopiable.h"
00045 #include "Amesos_Utils.h"
00046 #include "Amesos_Time.h"
00047 #include "Amesos_Status.h"
00048 #include "Amesos_Control.h"
00049 #include "Epetra_LinearProblem.h"
00050 #include "Epetra_Map.h"
00051 #include "Epetra_Import.h"
00052 #include "Epetra_Comm.h"
00053 #include "Epetra_RowMatrix.h"
00054 #include "Epetra_CrsMatrix.h"
00055 #include "Teuchos_ParameterList.hpp"
00056 #include "Teuchos_RCP.hpp"
00057 extern "C" {
00058   //  #include "taucs.h"
00059 }
00060 
00069 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00070 class Amesos_Taucs_Pimpl ; 
00071 #endif
00072 
00073 class Amesos_Taucs: public Amesos_BaseSolver, 
00074                     private Amesos_Time, 
00075                     private Amesos_NoCopiable, 
00076                     private Amesos_Utils, 
00077                     private Amesos_Control, 
00078                     private Amesos_Status { 
00079 
00080 public: 
00081 
00083 
00085   Amesos_Taucs(const Epetra_LinearProblem& LinearProblem );
00086 
00088   ~Amesos_Taucs(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 
00105 
00106 
00107   bool MatrixShapeOK() const;
00108 
00110 
00112   int SetUseTranspose(bool UseTranspose) {UseTranspose_ = UseTranspose; return(0);};
00113 
00114   bool UseTranspose() const {return(UseTranspose_);};
00115 
00116   const Epetra_Comm& Comm() const {return(GetProblem()->GetOperator()->Comm());};
00117 
00118   int SetParameters( Teuchos::ParameterList &ParameterList);
00119 
00121   int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00122 
00124   int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00125 
00127   int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00128 
00130   void PrintTiming() const;
00131   
00133   void PrintStatus() const;
00134  
00136   void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
00137  
00138 private:  
00139 
00141 
00142 
00144   inline const Epetra_Map& Map() const
00145   {
00146     return(Matrix_->RowMatrixRowMap());
00147   }
00148   
00150   inline const Epetra_RowMatrix& Matrix() const
00151   {
00152     return(*Matrix_);
00153   }
00154 
00156   inline Epetra_Map& SerialMap() 
00157   {
00158     return(*(SerialMap_.get()));
00159   }
00160   
00162   inline Epetra_RowMatrix& SerialMatrix()
00163   {
00164     return(*(SerialMatrix_.get()));
00165   }
00166 
00168   inline Epetra_CrsMatrix& SerialCrsMatrix()
00169   {
00170     return(*(SerialCrsMatrix_.get()));
00171   }
00172 
00174   inline Epetra_Import& Importer()
00175   {
00176     return(*(Importer_.get()));
00177   }
00178   
00180   int ConvertToSerial();
00181 
00183   int ConvertToTaucs();
00184   
00186   int PerformSymbolicFactorization();
00187 
00189   int PerformNumericFactorization(); 
00190 
00191   // @}
00192   
00194   bool UseTranspose_;
00195 
00196   Teuchos::RCP<Epetra_Map> SerialMap_;
00197   Teuchos::RCP<Epetra_CrsMatrix> SerialCrsMatrix_;
00198   Teuchos::RCP<Epetra_RowMatrix> SerialMatrix_;
00199   Teuchos::RCP<Epetra_Import> Importer_;
00200 
00201   const Epetra_Map* Map_;
00202   const Epetra_RowMatrix* Matrix_;
00203 
00205   const Epetra_LinearProblem* Problem_;
00206 
00208   int MtxConvTime_, MtxRedistTime_, VecRedistTime_;
00209   int SymFactTime_, NumFactTime_, SolveTime_;
00210 
00211   //
00212   //  PrivateTaucsData_ contains pointers to data needed by taucs whose
00213   //  data structures are defined by taucs.h
00214   //
00215   Teuchos::RCP<Amesos_Taucs_Pimpl> PrivateTaucsData_; 
00216 
00217 
00218 };  // class Amesos_Taucs  
00219 
00220 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines