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_ILUT_H
00044 #define IFPACK_ILUT_H
00045
00046 #include "Ifpack_ConfigDefs.h"
00047 #include "Ifpack_CondestType.h"
00048 #include "Ifpack_ScalingType.h"
00049 #include "Ifpack_Preconditioner.h"
00050 #include "Epetra_Vector.h"
00051 #include "Epetra_CrsMatrix.h"
00052 #include "Epetra_Time.h"
00053 #include "Teuchos_RefCountPtr.hpp"
00054
00055 class Epetra_RowMatrix;
00056 class Epetra_SerialComm;
00057 class Epetra_Comm;
00058 class Epetra_Map;
00059 class Epetra_MultiVector;
00060
00061 namespace Teuchos {
00062 class ParameterList;
00063 }
00064
00066
00081 class Ifpack_ILUT: public Ifpack_Preconditioner {
00082
00083 public:
00084
00086 Ifpack_ILUT(const Epetra_RowMatrix* A);
00087
00089 virtual ~Ifpack_ILUT();
00090
00091
00092
00094
00095
00096
00097
00098
00099
00100
00101 int SetParameters(Teuchos::ParameterList& parameterlis);
00102
00104
00110 int Initialize();
00111
00113 bool IsInitialized() const
00114 {
00115 return(IsInitialized_);
00116 }
00117
00119
00127 int Compute();
00128
00130 bool IsComputed() const {return(IsComputed_);};
00131
00132
00133
00135
00143 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00144
00145 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00146
00148 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00149 const int MaxIters = 1550,
00150 const double Tol = 1e-9,
00151 Epetra_RowMatrix* Matrix_in = 0);
00152
00154 double Condest() const
00155 {
00156 return(Condest_);
00157 }
00158
00160
00169 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00170
00172 double NormInf() const {return(0.0);};
00173
00175 bool HasNormInf() const {return(false);};
00176
00178 bool UseTranspose() const {return(UseTranspose_);};
00179
00181 const Epetra_Map & OperatorDomainMap() const {return(A_.OperatorDomainMap());};
00182
00184 const Epetra_Map & OperatorRangeMap() const{return(A_.OperatorRangeMap());};
00185
00187 const Epetra_Comm & Comm() const{return(Comm_);};
00188
00190 const Epetra_RowMatrix& Matrix() const
00191 {
00192 return(A_);
00193 }
00194
00196 const Epetra_CrsMatrix & L() const {return(*L_);};
00197
00199 const Epetra_CrsMatrix & U() const {return(*U_);};
00200
00202 const char* Label() const
00203 {
00204 return(Label_.c_str());
00205 }
00206
00208 int SetLabel(const char* Label_in)
00209 {
00210 Label_ = Label_in;
00211 return(0);
00212 }
00213
00215 virtual ostream& Print(std::ostream& os) const;
00216
00218 virtual int NumInitialize() const
00219 {
00220 return(NumInitialize_);
00221 }
00222
00224 virtual int NumCompute() const
00225 {
00226 return(NumCompute_);
00227 }
00228
00230 virtual int NumApplyInverse() const
00231 {
00232 return(NumApplyInverse_);
00233 }
00234
00236 virtual double InitializeTime() const
00237 {
00238 return(InitializeTime_);
00239 }
00240
00242 virtual double ComputeTime() const
00243 {
00244 return(ComputeTime_);
00245 }
00246
00248 virtual double ApplyInverseTime() const
00249 {
00250 return(ApplyInverseTime_);
00251 }
00252
00254 virtual double InitializeFlops() const
00255 {
00256 return(0.0);
00257 }
00258
00259 virtual double ComputeFlops() const
00260 {
00261 return(ComputeFlops_);
00262 }
00263
00264 virtual double ApplyInverseFlops() const
00265 {
00266 return(ApplyInverseFlops_);
00267 }
00268
00269 inline double LevelOfFill() const {
00270 return(LevelOfFill_);
00271 }
00272
00274 inline double RelaxValue() const {
00275 return(Relax_);
00276 }
00277
00279 inline double AbsoluteThreshold() const
00280 {
00281 return(Athresh_);
00282 }
00283
00285 inline double RelativeThreshold() const
00286 {
00287 return(Rthresh_);
00288 }
00289
00291 inline double DropTolerance() const
00292 {
00293 return(DropTolerance_);
00294 }
00295
00297 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00298 int NumGlobalNonzeros() const {
00299
00300 return(L().NumGlobalNonzeros() + U().NumGlobalNonzeros() - L().NumGlobalRows());
00301 }
00302 #endif
00303 long long NumGlobalNonzeros64() const {
00304
00305 return(L().NumGlobalNonzeros64() + U().NumGlobalNonzeros64() - L().NumGlobalRows64());
00306 }
00307
00309 int NumMyNonzeros() const {
00310 return(L().NumMyNonzeros() + U().NumMyNonzeros());
00311 }
00312
00313 private:
00314
00315
00316
00317
00319 Ifpack_ILUT(const Ifpack_ILUT& RHS) :
00320 A_(RHS.Matrix()),
00321 Comm_(RHS.Comm()),
00322 Time_(Comm())
00323 {};
00324
00326 Ifpack_ILUT& operator=(const Ifpack_ILUT& RHS)
00327 {
00328 return(*this);
00329 }
00330
00331 template<typename int_type>
00332 int TCompute();
00333
00335 void Destroy();
00336
00337
00338
00339
00341 const Epetra_RowMatrix& A_;
00343 const Epetra_Comm& Comm_;
00345 Teuchos::RefCountPtr<Epetra_CrsMatrix> L_;
00347 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00349 double Condest_;
00351 double Relax_;
00353 double Athresh_;
00355 double Rthresh_;
00357 double LevelOfFill_;
00359 double DropTolerance_;
00361 string Label_;
00363 bool IsInitialized_;
00365 bool IsComputed_;
00367 bool UseTranspose_;
00369 int NumMyRows_;
00371 int NumInitialize_;
00373 int NumCompute_;
00375 mutable int NumApplyInverse_;
00377 double InitializeTime_;
00379 double ComputeTime_;
00381 mutable double ApplyInverseTime_;
00383 double ComputeFlops_;
00385 mutable double ApplyInverseFlops_;
00387 mutable Epetra_Time Time_;
00389 long long GlobalNonzeros_;
00390 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
00391 Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
00392 };
00393
00394 #endif