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_ILU_H
00044 #define IFPACK_ILU_H
00045
00046 #include "Ifpack_ConfigDefs.h"
00047 #include "Ifpack_Preconditioner.h"
00048 #include "Ifpack_Condest.h"
00049 #include "Ifpack_ScalingType.h"
00050 #include "Ifpack_IlukGraph.h"
00051 #include "Epetra_CompObject.h"
00052 #include "Epetra_MultiVector.h"
00053 #include "Epetra_Vector.h"
00054 #include "Epetra_CrsGraph.h"
00055 #include "Epetra_CrsMatrix.h"
00056 #include "Epetra_BlockMap.h"
00057 #include "Epetra_Map.h"
00058 #include "Epetra_Object.h"
00059 #include "Epetra_Comm.h"
00060 #include "Epetra_RowMatrix.h"
00061 #include "Epetra_Time.h"
00062 #include "Teuchos_RefCountPtr.hpp"
00063
00064 namespace Teuchos {
00065 class ParameterList;
00066 }
00067
00069
00083 class Ifpack_ILU: public Ifpack_Preconditioner {
00084
00085 public:
00086
00088 Ifpack_ILU(Epetra_RowMatrix* A);
00089
00091 ~Ifpack_ILU()
00092 {
00093 Destroy();
00094 }
00095
00096
00097
00098
00100 int Initialize();
00101
00103 bool IsInitialized() const
00104 {
00105 return(IsInitialized_);
00106 }
00107
00109
00117 int Compute();
00118
00120 bool IsComputed() const
00121 {
00122 return(IsComputed_);
00123 }
00124
00126
00127
00128
00129
00130
00131
00132
00133 int SetParameters(Teuchos::ParameterList& parameterlist);
00134
00136
00145 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00146
00147
00148
00149
00150 int Apply(const Epetra_MultiVector& X,
00151 Epetra_MultiVector& Y) const
00152 {
00153 return(Multiply(false,X,Y));
00154 }
00155
00156 int Multiply(bool Trans, const Epetra_MultiVector& X,
00157 Epetra_MultiVector& Y) const;
00158
00160
00173 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00174
00176 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00177 const int MaxIters = 1550,
00178 const double Tol = 1e-9,
00179 Epetra_RowMatrix* Matrix_in = 0);
00180
00182 double Condest() const
00183 {
00184 return(Condest_);
00185 }
00186
00187
00188
00189
00191 const Epetra_CrsMatrix & L() const {return(*L_);};
00192
00194 const Epetra_Vector & D() const {return(*D_);};
00195
00197 const Epetra_CrsMatrix & U() const {return(*U_);};
00198
00200 const char* Label() const {return(Label_);}
00201
00203 int SetLabel(const char* Label_in)
00204 {
00205 strcpy(Label_,Label_in);
00206 return(0);
00207 }
00208
00210 double NormInf() const {return(0.0);};
00211
00213 bool HasNormInf() const {return(false);};
00214
00216 bool UseTranspose() const {return(UseTranspose_);};
00217
00219 const Epetra_Map & OperatorDomainMap() const {return(U_->OperatorDomainMap());};
00220
00222 const Epetra_Map & OperatorRangeMap() const{return(L_->OperatorRangeMap());};
00223
00225 const Epetra_Comm & Comm() const{return(Comm_);};
00226
00228 const Epetra_RowMatrix& Matrix() const
00229 {
00230 return(*A_);
00231 }
00232
00234 virtual ostream& Print(ostream& os) const;
00235
00237 virtual int NumInitialize() const
00238 {
00239 return(NumInitialize_);
00240 }
00241
00243 virtual int NumCompute() const
00244 {
00245 return(NumCompute_);
00246 }
00247
00249 virtual int NumApplyInverse() const
00250 {
00251 return(NumApplyInverse_);
00252 }
00253
00255 virtual double InitializeTime() const
00256 {
00257 return(InitializeTime_);
00258 }
00259
00261 virtual double ComputeTime() const
00262 {
00263 return(ComputeTime_);
00264 }
00265
00267 virtual double ApplyInverseTime() const
00268 {
00269 return(ApplyInverseTime_);
00270 }
00271
00273 virtual double InitializeFlops() const
00274 {
00275 return(0.0);
00276 }
00277
00278 virtual double ComputeFlops() const
00279 {
00280 return(ComputeFlops_);
00281 }
00282
00283 virtual double ApplyInverseFlops() const
00284 {
00285 return(ApplyInverseFlops_);
00286 }
00287
00288 private:
00289
00290
00291
00292
00294 Ifpack_ILU(const Ifpack_ILU& RHS) :
00295 Comm_(RHS.Comm()),
00296 Time_(RHS.Comm())
00297 {}
00298
00300 Ifpack_ILU& operator=(const Ifpack_ILU& RHS)
00301 {
00302 return(*this);
00303 }
00304
00306 void Destroy();
00307
00309
00319 int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00320
00321 int ComputeSetup();
00322 int InitAllValues(const Epetra_RowMatrix & A, int MaxNumEntries);
00323
00325 int LevelOfFill() const {return LevelOfFill_;}
00326
00328 double RelaxValue() const {return RelaxValue_;}
00329
00331 double AbsoluteThreshold() const {return Athresh_;}
00332
00334 double RelativeThreshold() const {return Rthresh_;}
00335
00336 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00337
00338 int NumGlobalRows() const {return(Graph().NumGlobalRows());};
00339
00341 int NumGlobalCols() const {return(Graph().NumGlobalCols());};
00342
00344 int NumGlobalNonzeros() const {return(L().NumGlobalNonzeros()+U().NumGlobalNonzeros());};
00345
00347 virtual int NumGlobalBlockDiagonals() const {return(Graph().NumGlobalBlockDiagonals());};
00348 #endif
00349
00350 long long NumGlobalRows64() const {return(Graph().NumGlobalRows64());};
00351
00352 long long NumGlobalCols64() const {return(Graph().NumGlobalCols64());};
00353
00354 long long NumGlobalNonzeros64() const {return(L().NumGlobalNonzeros64()+U().NumGlobalNonzeros64());};
00355
00356 virtual long long NumGlobalBlockDiagonals64() const {return(Graph().NumGlobalBlockDiagonals64());};
00357
00359 int NumMyRows() const {return(Graph().NumMyRows());};
00360
00362 int NumMyCols() const {return(Graph().NumMyCols());};
00363
00365 int NumMyNonzeros() const {return(L().NumMyNonzeros()+U().NumMyNonzeros());};
00366
00368 virtual int NumMyBlockDiagonals() const {return(Graph().NumMyBlockDiagonals());};
00369
00371 virtual int NumMyDiagonals() const {return(NumMyDiagonals_);};
00372
00374 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00375 int IndexBase() const {return(Graph().IndexBase());};
00376 #endif
00377 long long IndexBase64() const {return(Graph().IndexBase64());};
00378
00380 const Ifpack_IlukGraph & Graph() const {return(*Graph_);};
00381
00383 Epetra_RowMatrix& Matrix()
00384 {
00385 return(*A_);
00386 }
00387
00388
00389
00390
00392 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
00393 Teuchos::RefCountPtr<Ifpack_IlukGraph> Graph_;
00394 Teuchos::RefCountPtr<Epetra_CrsGraph> CrsGraph_;
00395 Teuchos::RefCountPtr<Epetra_Map> IlukRowMap_;
00396 Teuchos::RefCountPtr<Epetra_Map> IlukDomainMap_;
00397 Teuchos::RefCountPtr<Epetra_Map> IlukRangeMap_;
00398 const Epetra_Map * U_DomainMap_;
00399 const Epetra_Map * L_RangeMap_;
00400 const Epetra_Comm & Comm_;
00402 Teuchos::RefCountPtr<Epetra_CrsMatrix> L_;
00404 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00405 Teuchos::RefCountPtr<Epetra_CrsGraph> L_Graph_;
00406 Teuchos::RefCountPtr<Epetra_CrsGraph> U_Graph_;
00408 Teuchos::RefCountPtr<Epetra_Vector> D_;
00409 bool UseTranspose_;
00410
00411 int NumMyDiagonals_;
00412 bool Allocated_;
00413 bool ValuesInitialized_;
00414 bool Factored_;
00416 double RelaxValue_;
00418 double Athresh_;
00420 double Rthresh_;
00422 double Condest_;
00424 int LevelOfFill_;
00426 bool IsInitialized_;
00428 bool IsComputed_;
00430 char Label_[160];
00432 int NumInitialize_;
00434 int NumCompute_;
00436 mutable int NumApplyInverse_;
00438 double InitializeTime_;
00440 double ComputeTime_;
00442 mutable double ApplyInverseTime_;
00444 double ComputeFlops_;
00446 mutable double ApplyInverseFlops_;
00448 mutable Epetra_Time Time_;
00449
00450 };
00451
00452 #endif