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
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef IFPACK_SILU_H
00044 #define IFPACK_SILU_H
00045
00046 #include "Ifpack_ConfigDefs.h"
00047
00048 #ifdef HAVE_IFPACK_SUPERLU
00049 #include "Ifpack_Preconditioner.h"
00050 #include "Ifpack_Condest.h"
00051 #include "Ifpack_ScalingType.h"
00052 #include "Ifpack_IlukGraph.h"
00053 #include "Epetra_CompObject.h"
00054 #include "Epetra_MultiVector.h"
00055 #include "Epetra_Vector.h"
00056 #include "Epetra_CrsGraph.h"
00057 #include "Epetra_CrsMatrix.h"
00058 #include "Epetra_BlockMap.h"
00059 #include "Epetra_Map.h"
00060 #include "Epetra_Object.h"
00061 #include "Epetra_Comm.h"
00062 #include "Epetra_RowMatrix.h"
00063 #include "Epetra_Time.h"
00064 #include "Teuchos_RefCountPtr.hpp"
00065
00066 namespace Teuchos {
00067 class ParameterList;
00068 }
00069
00070
00071 #include "slu_ddefs.h"
00072
00073
00083 class Ifpack_SILU: public Ifpack_Preconditioner {
00084
00085 public:
00087
00088
00089 Ifpack_SILU(Epetra_RowMatrix* A);
00090
00092 ~Ifpack_SILU()
00093 {
00094 Destroy();
00095 }
00096
00098
00099
00100
00102 int Initialize();
00103
00105 bool IsInitialized() const
00106 {
00107 return(IsInitialized_);
00108 }
00109
00111 int Compute();
00112
00114 bool IsComputed() const
00115 {
00116 return(IsComputed_);
00117 }
00118
00120
00121
00122
00123
00124
00125
00126
00127 int SetParameters(Teuchos::ParameterList& parameterlist);
00128
00130
00139 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00141
00143
00144
00145 int Apply(const Epetra_MultiVector& X,
00146 Epetra_MultiVector& Y) const
00147 {
00148 return(Multiply(false,X,Y));
00149 }
00150
00151 int Multiply(bool Trans, const Epetra_MultiVector& X,
00152 Epetra_MultiVector& Y) const;
00153
00155
00168 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00169
00171 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00172 const int MaxIters = 1550,
00173 const double Tol = 1e-9,
00174 Epetra_RowMatrix* Matrix_in = 0);
00175
00177 double Condest() const
00178 {
00179 return(Condest_);
00180 }
00181
00183
00185
00186
00188 const char* Label() const {return(Label_);}
00189
00191 int SetLabel(const char* Label_in)
00192 {
00193 strcpy(Label_,Label_in);
00194 return(0);
00195 }
00196
00198 double NormInf() const {return(0.0);};
00199
00201 bool HasNormInf() const {return(false);};
00202
00204 bool UseTranspose() const {return(UseTranspose_);};
00205
00207 const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());};
00208
00210 const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());};
00211
00213 const Epetra_Comm & Comm() const{return(Comm_);};
00214
00216 const Epetra_RowMatrix& Matrix() const
00217 {
00218 return(*A_);
00219 }
00220
00222 virtual ostream& Print(ostream& os) const;
00223
00225 virtual int NumInitialize() const
00226 {
00227 return(NumInitialize_);
00228 }
00229
00231 virtual int NumCompute() const
00232 {
00233 return(NumCompute_);
00234 }
00235
00237 virtual int NumApplyInverse() const
00238 {
00239 return(NumApplyInverse_);
00240 }
00241
00243 virtual double InitializeTime() const
00244 {
00245 return(InitializeTime_);
00246 }
00247
00249 virtual double ComputeTime() const
00250 {
00251 return(ComputeTime_);
00252 }
00253
00255 virtual double ApplyInverseTime() const
00256 {
00257 return(ApplyInverseTime_);
00258 }
00259
00260 virtual double InitializeFlops() const
00261 {
00262 return(0.0);
00263 }
00264
00265 virtual double ComputeFlops() const
00266 {
00267 return(0.0);
00268 }
00269
00270 virtual double ApplyInverseFlops() const
00271 {
00272 return(0.0);
00273 }
00274
00275 private:
00276
00278
00279
00280
00282 Ifpack_SILU(const Ifpack_SILU& RHS):
00283 Comm_(RHS.Comm()),
00284 Time_(RHS.Comm())
00285 {}
00286
00288 Ifpack_SILU& operator=(const Ifpack_SILU& RHS)
00289 {
00290 return(*this);
00291 }
00292
00294 void Destroy();
00295
00297
00307 int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00308
00309 int InitAllValues(const Epetra_RowMatrix & A, int MaxNumEntries);
00310
00312 double DropTol() const {return DropTol_;}
00313
00315 double FillTol() const{return FillTol_;}
00316
00318 double FillFactor() const{return FillFactor_;}
00319
00321 int DropRule() const{return DropRule_;}
00322
00323 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00324
00325 int NumGlobalRows() const {return(Graph().NumGlobalRows());};
00326
00328 int NumGlobalCols() const {return(Graph().NumGlobalCols());};
00329
00331 int NumGlobalNonzeros() const {return(Graph().NumGlobalNonzeros());};
00332
00334 virtual int NumGlobalBlockDiagonals() const {return(Graph().NumGlobalBlockDiagonals());};
00335 #endif
00336
00338 long long NumGlobalRows64() const {return(Graph().NumGlobalRows64());};
00339
00341 long long NumGlobalCols64() const {return(Graph().NumGlobalCols64());};
00342
00344 long long NumGlobalNonzeros64() const {return(Graph().NumGlobalNonzeros64());};
00345
00347 virtual long long NumGlobalBlockDiagonals64() const {return(Graph().NumGlobalBlockDiagonals64());};
00348
00350 int NumMyRows() const {return(Graph().NumMyRows());};
00351
00353 int NumMyCols() const {return(Graph().NumMyCols());};
00354
00356 int NumMyNonzeros() const {return(Graph().NumMyNonzeros());};
00357
00359 virtual int NumMyBlockDiagonals() const {return(Graph().NumMyBlockDiagonals());};
00360
00362 virtual int NumMyDiagonals() const {return(NumMyDiagonals_);};
00363
00364 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00365
00366 int IndexBase() const {return(Graph().IndexBase());};
00367 #endif
00368 long long IndexBase64() const {return(Graph().IndexBase64());};
00369
00371 const Epetra_CrsGraph & Graph() const {return(*Graph_);};
00372
00374 Epetra_RowMatrix& Matrix()
00375 {
00376 return(*A_);
00377 }
00378
00380
00382
00383
00385 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
00386 Teuchos::RefCountPtr<Epetra_CrsGraph> Graph_;
00387 Teuchos::RefCountPtr<Epetra_Map> IlukRowMap_;
00388 Teuchos::RefCountPtr<Epetra_Map> IlukDomainMap_;
00389 Teuchos::RefCountPtr<Epetra_Map> IlukRangeMap_;
00390 const Epetra_Comm & Comm_;
00392 Teuchos::RefCountPtr<Epetra_CrsMatrix> Aover_;
00393 bool UseTranspose_;
00394
00395 int NumMyDiagonals_;
00396 bool Allocated_;
00397 bool ValuesInitialized_;
00398 bool Factored_;
00399
00401 double DropTol_;
00403 double FillTol_;
00405 double FillFactor_;
00407 int DropRule_;
00408
00410 double Condest_;
00412 bool IsInitialized_;
00414 bool IsComputed_;
00416 char Label_[160];
00418 int NumInitialize_;
00420 int NumCompute_;
00422 mutable int NumApplyInverse_;
00424 double InitializeTime_;
00426 double ComputeTime_;
00428 mutable double ApplyInverseTime_;
00430 mutable Epetra_Time Time_;
00432 mutable SuperLUStat_t stat_;
00434 mutable superlu_options_t options_;
00436 mutable SuperMatrix SA_,SAc_,SL_,SU_,SY_;
00438 int *etree_,*perm_r_,*perm_c_;
00440
00441
00442 template<typename int_type>
00443 int TInitialize();
00444 };
00445
00446 #endif
00447 #endif