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
00039 #ifndef AMESOS_KLU_H
00040 #define AMESOS_KLU_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_Time.h"
00051 #include "Epetra_Import.h"
00052 #ifdef EPETRA_MPI
00053 #include "Epetra_MpiComm.h"
00054 #else
00055 #include "Epetra_Comm.h"
00056 #endif
00057 #include "Epetra_CrsGraph.h"
00058 #include "Epetra_CrsMatrix.h"
00059
00060
00061
00063
00101
00102
00103
00104
00105
00106 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00107 class Amesos_Klu_Pimpl ;
00108 class Amesos_StandardIndex ;
00109 #endif
00110
00111 class Amesos_Klu: public Amesos_BaseSolver,
00112 private Amesos_Time,
00113 private Amesos_NoCopiable,
00114 private Amesos_Utils,
00115 private Amesos_Control,
00116 private Amesos_Status {
00117
00118 public:
00119
00121
00122
00129 Amesos_Klu(const Epetra_LinearProblem& LinearProblem );
00130
00132 ~Amesos_Klu(void);
00133
00135
00136
00137 int SymbolicFactorization() ;
00138
00139 int NumericFactorization() ;
00140
00141 int Solve();
00142
00144
00145
00147 const Epetra_LinearProblem *GetProblem() const { return(Problem_); };
00148
00150
00153 bool MatrixShapeOK() const ;
00154
00156
00160 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00161
00162 bool UseTranspose() const {return(UseTranspose_);};
00163
00164 const Epetra_Comm & Comm() const {return(GetProblem()->GetOperator()->Comm());};
00165
00166 int SetParameters( Teuchos::ParameterList &ParameterList );
00167
00169 int NumSymbolicFact() const { return( Amesos_Status::NumSymbolicFact_ ); }
00170
00172 int NumNumericFact() const { return( Amesos_Status::NumNumericFact_ ); }
00173
00175 int NumSolve() const { return( Amesos_Status::NumSolve_ ); }
00176
00178 void PrintTiming() const;
00179
00181 void PrintStatus() const;
00182
00184 void GetTiming( Teuchos::ParameterList &TimingParameterList ) const { Amesos_Time::GetTiming( TimingParameterList ); }
00185
00186 private:
00187
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207 int CreateLocalMatrixAndExporters() ;
00208
00209
00210
00211
00212
00213
00214
00215
00216 int ExportToSerial() ;
00217
00218
00219
00220
00221
00222
00223
00224 int ConvertToKluCRS(bool firsttime);
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240 int PerformSymbolicFactorization();
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254 int PerformNumericFactorization();
00255
00256
00257
00258 int SerialXlda_ ;
00259
00260 #ifdef Bug_8212
00261 int *lose_this_;
00262 #endif
00263
00264
00265
00266
00267 Teuchos::RCP<Amesos_Klu_Pimpl> PrivateKluData_;
00268 Teuchos::RCP<Amesos_StandardIndex> StdIndex_;
00269 Teuchos::RCP<Amesos_StandardIndex> StdIndexRange_;
00270 Teuchos::RCP<Amesos_StandardIndex> StdIndexDomain_;
00271
00276 std::vector <int> Ap;
00277 std::vector <int> VecAi;
00278 std::vector <double> VecAval;
00279 double* Aval;
00280 int *Ai;
00281
00283 int UseDataInPlace_;
00285 int numentries_;
00287 int NumGlobalElements_;
00288
00290 Epetra_RowMatrix* RowMatrixA_;
00292 Epetra_CrsMatrix* CrsMatrixA_;
00293 #if 0
00295 Teuchos::RCP<EpetraExt::MultiVector_Reindex> VecTrans_;
00297 Teuchos::RCP<EpetraExt::CrsMatrix_Reindex> MatTrans_;
00299 Teuchos::RCP<Epetra_Map> ContiguousMap_;
00300 #endif
00302 Teuchos::RCP<Epetra_Map> SerialMap_;
00304 Teuchos::RCP<Epetra_CrsMatrix> SerialCrsMatrixA_;
00306 Epetra_RowMatrix* StdIndexMatrix_ ;
00307 Epetra_MultiVector* StdIndexDomainVector_ ;
00308 Epetra_MultiVector* StdIndexRangeVector_ ;
00310 Epetra_RowMatrix* SerialMatrix_ ;
00311
00313
00314
00315
00316 bool TrustMe_;
00318 int NumVectors_;
00320 double *SerialXBvalues_ ;
00321 double *SerialBvalues_ ;
00323 Epetra_MultiVector* SerialB_ ;
00324 Epetra_MultiVector* SerialX_ ;
00326 Teuchos::RCP<Epetra_MultiVector> SerialXextract_;
00327 Teuchos::RCP<Epetra_MultiVector> SerialBextract_;
00328
00330 bool UseTranspose_;
00332 const Epetra_LinearProblem * Problem_;
00333
00335 std::vector<int> ColIndicesV_;
00337 std::vector<double> RowValuesV_;
00339 Teuchos::RCP<Epetra_Import> ImportToSerial_;
00340 Teuchos::RCP<Epetra_Import> ImportRangeToSerial_;
00341 Teuchos::RCP<Epetra_Import> ImportDomainToSerial_;
00343 int MtxRedistTime_, MtxConvTime_, VecRedistTime_;
00344 int SymFactTime_, NumFactTime_, SolveTime_, OverheadTime_;
00345
00346 };
00347
00348 #endif