Amesos Package Browser (Single Doxygen Collection) Development
Amesos_Mumps.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_MUMPS_H
00030 #define AMESOS_MUMPS_H
00031 
00032 class Epetra_Import;
00033 class Epetra_RowMatrix;
00034 class Epetra_MultiVector;
00035 #include "Epetra_Import.h"
00036 #include "Epetra_CrsMatrix.h"
00037 #include "Epetra_Map.h"
00038 #include "Epetra_SerialDenseVector.h"
00039 class Epetra_IntSerialDenseVector;
00040 class Epetra_SerialDenseMatrix;
00041 class Amesos_EpetraInterface;
00042 
00043 #include "Amesos_ConfigDefs.h"
00044 #include "Amesos_BaseSolver.h"
00045 #include "Amesos_NoCopiable.h"
00046 #include "Amesos_Utils.h"
00047 #include "Amesos_Time.h"
00048 #include "Amesos_Status.h"
00049 #include "Amesos_Control.h"
00050 #include "Epetra_LinearProblem.h"
00051 #ifdef EPETRA_MPI
00052 #include "Epetra_MpiComm.h"
00053 #else
00054 #include "Epetra_Comm.h"
00055 #endif
00056 #include "Teuchos_RCP.hpp"
00057 #include <map>
00058 using namespace Teuchos;
00059 
00061 
00108 extern "C" {
00109 #include "dmumps_c.h"
00110 }
00111 
00112 class Amesos_Mumps: public Amesos_BaseSolver,
00113                     private Amesos_Time, 
00114                     private Amesos_NoCopiable, 
00115                     private Amesos_Utils,  
00116                     private Amesos_Control,  
00117                     private Amesos_Status { 
00118 
00119 public: 
00120 
00122 
00123 
00126   Amesos_Mumps(const Epetra_LinearProblem& LinearProblem);
00127 
00129 
00131   ~Amesos_Mumps(void);
00133 
00135 
00136   int SymbolicFactorization() ;
00137 
00138   int NumericFactorization() ;
00139 
00140   int Solve();
00141 
00143   void Destroy();
00144   
00145   int SetUseTranspose(bool UseTranspose_in)
00146   {
00147     UseTranspose_ = UseTranspose_in;
00148     if (UseTranspose_in)
00149       return (-1);
00150     return (0);
00151   };
00152   
00153   bool UseTranspose() const {return(UseTranspose_);};
00154 
00155   int SetParameters( Teuchos::ParameterList &ParameterList );
00156   
00158 
00160 
00162   int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00163 
00165   int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00166 
00168   int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00169 
00171 
00173   
00175 
00179   void PrintTiming() const;
00180   
00182 
00185   void PrintStatus() const;
00186 
00188   void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
00189 
00191 
00193 
00194   
00195 #if 0
00196 
00197 
00205   int ComputeSchurComplement(bool flag,
00206            int NumSchurComplementRows, int * SchurComplementRows);
00207 
00209 
00214   Epetra_CrsMatrix * GetCrsSchurComplement();
00215 
00217 
00222   Epetra_SerialDenseMatrix * GetDenseSchurComplement();
00223 #endif
00224   
00226 
00233   int SetPrecscaling(double * ColSca, double * RowSca )
00234   {
00235     ColSca_ = ColSca;
00236     RowSca_ = RowSca;
00237     return 0;
00238   }
00239 
00241 
00246   int SetRowScaling(double * RowSca )
00247   {
00248     RowSca_ = RowSca;
00249     return 0;
00250   }
00251 
00253 
00258   int SetColScaling(double * ColSca )
00259   {
00260     ColSca_ = ColSca;
00261     return 0;
00262   }
00263 
00265 
00269   int SetOrdering(int * PermIn)
00270   {
00271     PermIn_ = PermIn;
00272     return 0;
00273   }
00274 
00276 
00280   double * GetRINFO() ;
00281 
00283 
00285   int * GetINFO() ;
00286 
00288 
00292   double * GetRINFOG() ;
00293 
00295 
00298   int * GetINFOG() ;
00299 
00301   void SetICNTL(int pos, int value);
00302 
00304   void SetCNTL(int pos, double value);
00305 
00307   
00308   bool MatrixShapeOK() const
00309   {
00310   bool OK = true;
00311 
00312   if ( GetProblem()->GetOperator()->OperatorRangeMap().NumGlobalPoints() != 
00313        GetProblem()->GetOperator()->OperatorDomainMap().NumGlobalPoints() ) OK = false;
00314   return OK; 
00315 }
00316 
00317   
00319   const Epetra_Comm & Comm() const {return(GetProblem()->GetOperator()->Comm());};
00320 
00322   const Epetra_LinearProblem * GetProblem() const { return(Problem_); };
00323 
00324 protected:
00325   
00327   Epetra_RowMatrix& Matrix();
00328 
00329   const Epetra_RowMatrix& Matrix() const;
00330 
00332   Epetra_Map& RedistrMap();
00333 
00335   Epetra_Import& RedistrImporter();
00336   
00338   Epetra_RowMatrix& RedistrMatrix(const bool ImportMatrix = false);
00339 
00341   Epetra_Map& SerialMap();
00342 
00344   Epetra_Import& SerialImporter();
00345 
00347   int ConvertToTriplet(const bool OnlyValues);     
00348 
00350   int CheckError();
00351 
00353   void CheckParameters();
00354   
00355   void SetICNTLandCNTL();
00356 
00358   bool IsConvertToTripletOK_;
00360   bool IsComputeSchurComplementOK_;
00361 
00362 
00363   bool NoDestroy_ ;  // Set true to prevent memory freeing
00364   
00366   std::vector <int> Row;
00368   std::vector<int> Col;
00370   std::vector<double> Val;
00371 
00373   int MaxProcs_;
00374   
00376   bool UseTranspose_;
00377 
00379   int MtxConvTime_, MtxRedistTime_, VecRedistTime_;
00380   int SymFactTime_, NumFactTime_, SolveTime_;  
00381 
00383   double * RowSca_, * ColSca_; 
00384 
00386   int * PermIn_;
00387 
00389   int NumSchurComplementRows_;
00391   int * SchurComplementRows_;
00392 
00394   RCP<Epetra_CrsMatrix> CrsSchurComplement_; 
00396   RCP<Epetra_SerialDenseMatrix> DenseSchurComplement_;
00397 
00398 #ifdef HAVE_MPI
00399 
00400   MPI_Comm MUMPSComm_;
00401 #endif
00402 
00404   const Epetra_LinearProblem* Problem_;
00405 
00407   RCP<Epetra_Map> RedistrMap_;
00409   RCP<Epetra_Import> RedistrImporter_;
00411   RCP<Epetra_CrsMatrix> RedistrMatrix_;
00413   RCP<Epetra_Map> SerialMap_;
00415   RCP<Epetra_Import> SerialImporter_;
00416   
00417   DMUMPS_STRUC_C MDS;
00418 
00419   std::map<int, int> ICNTL;
00420   std::map<int, double> CNTL;
00421 };  // class Amesos_Mumps
00422 
00423 #endif /* AMESOS_MUMPS_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines