00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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) {UseTranspose_ = UseTranspose; return(0);};
00146
00147 bool UseTranspose() const {return(UseTranspose_);};
00148
00149 int SetParameters( Teuchos::ParameterList &ParameterList );
00150
00152
00154
00156 int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00157
00159 int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00160
00162 int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00163
00165
00167
00169
00173 void PrintTiming() const;
00174
00176
00179 void PrintStatus() const;
00180
00182 void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming(TimingParameterList); }
00183
00185
00187
00188
00189 #if 0
00191
00199 int ComputeSchurComplement(bool flag,
00200 int NumSchurComplementRows, int * SchurComplementRows);
00201
00203
00208 Epetra_CrsMatrix * GetCrsSchurComplement();
00209
00211
00216 Epetra_SerialDenseMatrix * GetDenseSchurComplement();
00217 #endif
00218
00220
00227 int SetPrecscaling(double * ColSca, double * RowSca )
00228 {
00229 ColSca_ = ColSca;
00230 RowSca_ = RowSca;
00231 return 0;
00232 }
00233
00235
00240 int SetRowScaling(double * RowSca )
00241 {
00242 RowSca_ = RowSca;
00243 return 0;
00244 }
00245
00247
00252 int SetColScaling(double * ColSca )
00253 {
00254 ColSca_ = ColSca;
00255 return 0;
00256 }
00257
00259
00263 int SetOrdering(int * PermIn)
00264 {
00265 PermIn_ = PermIn;
00266 return 0;
00267 }
00268
00270
00274 double * GetRINFO() ;
00275
00277
00279 int * GetINFO() ;
00280
00282
00286 double * GetRINFOG() ;
00287
00289
00292 int * GetINFOG() ;
00293
00295 void SetICNTL(int pos, int value);
00296
00298 void SetCNTL(int pos, double value);
00299
00301
00302 bool MatrixShapeOK() const
00303 {
00304 bool OK = true;
00305
00306 if ( GetProblem()->GetOperator()->OperatorRangeMap().NumGlobalPoints() !=
00307 GetProblem()->GetOperator()->OperatorDomainMap().NumGlobalPoints() ) OK = false;
00308 return OK;
00309 }
00310
00311
00313 const Epetra_Comm & Comm() const {return(GetProblem()->GetOperator()->Comm());};
00314
00316 const Epetra_LinearProblem * GetProblem() const { return(Problem_); };
00317
00318 protected:
00319
00321 Epetra_RowMatrix& Matrix();
00322
00323 const Epetra_RowMatrix& Matrix() const;
00324
00326 Epetra_Map& RedistrMap();
00327
00329 Epetra_Import& RedistrImporter();
00330
00332 Epetra_RowMatrix& RedistrMatrix(const bool ImportMatrix = false);
00333
00335 Epetra_Map& SerialMap();
00336
00338 Epetra_Import& SerialImporter();
00339
00341 int ConvertToTriplet(const bool OnlyValues);
00342
00344 int CheckError();
00345
00347 void CheckParameters();
00348
00349 void SetICNTLandCNTL();
00350
00352 bool IsConvertToTripletOK_;
00354 bool IsComputeSchurComplementOK_;
00355
00356
00357 bool NoDestroy_ ;
00358
00360 std::vector <int> Row;
00362 std::vector<int> Col;
00364 std::vector<double> Val;
00365
00367 int MaxProcs_;
00368
00370 bool UseTranspose_;
00371
00373 int MtxConvTime_, MtxRedistTime_, VecRedistTime_;
00374 int SymFactTime_, NumFactTime_, SolveTime_;
00375
00377 double * RowSca_, * ColSca_;
00378
00380 int * PermIn_;
00381
00383 int NumSchurComplementRows_;
00385 int * SchurComplementRows_;
00386
00388 RCP<Epetra_CrsMatrix> CrsSchurComplement_;
00390 RCP<Epetra_SerialDenseMatrix> DenseSchurComplement_;
00391
00393 const Epetra_LinearProblem* Problem_;
00394
00396 RCP<Epetra_Map> RedistrMap_;
00398 RCP<Epetra_Import> RedistrImporter_;
00400 RCP<Epetra_CrsMatrix> RedistrMatrix_;
00402 RCP<Epetra_Map> SerialMap_;
00404 RCP<Epetra_Import> SerialImporter_;
00405
00406 #ifdef HAVE_MPI
00408 MPI_Comm MUMPSComm_;
00409 #endif
00410
00411 DMUMPS_STRUC_C MDS;
00412
00413 std::map<int, int> ICNTL;
00414 std::map<int, double> CNTL;
00415 };
00416
00417 #endif