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 #ifndef IFPACK_ILUT_H
00031 #define IFPACK_ILUT_H
00032
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Ifpack_CondestType.h"
00035 #include "Ifpack_ScalingType.h"
00036 #include "Ifpack_Preconditioner.h"
00037 #include "Epetra_Vector.h"
00038 #include "Epetra_CrsMatrix.h"
00039 #include "Epetra_Time.h"
00040 #include "Teuchos_RefCountPtr.hpp"
00041
00042 class Epetra_RowMatrix;
00043 class Epetra_SerialComm;
00044 class Epetra_Comm;
00045 class Epetra_Map;
00046 class Epetra_MultiVector;
00047
00048 namespace Teuchos {
00049 class ParameterList;
00050 }
00051
00053
00068 class Ifpack_ILUT: public Ifpack_Preconditioner {
00069
00070 public:
00071
00073 Ifpack_ILUT(const Epetra_RowMatrix* A);
00074
00076 virtual ~Ifpack_ILUT();
00077
00078
00079
00081
00082
00083
00084
00085
00086
00087
00088 int SetParameters(Teuchos::ParameterList& parameterlis);
00089
00091
00097 int Initialize();
00098
00100 bool IsInitialized() const
00101 {
00102 return(IsInitialized_);
00103 }
00104
00106
00114 int Compute();
00115
00117 bool IsComputed() const {return(IsComputed_);};
00118
00119
00120
00122
00130 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00131
00132 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00133
00135 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00136 const int MaxIters = 1550,
00137 const double Tol = 1e-9,
00138 Epetra_RowMatrix* Matrix_in = 0);
00139
00141 double Condest() const
00142 {
00143 return(Condest_);
00144 }
00145
00147
00156 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00157
00159 double NormInf() const {return(0.0);};
00160
00162 bool HasNormInf() const {return(false);};
00163
00165 bool UseTranspose() const {return(UseTranspose_);};
00166
00168 const Epetra_Map & OperatorDomainMap() const {return(A_.OperatorDomainMap());};
00169
00171 const Epetra_Map & OperatorRangeMap() const{return(A_.OperatorRangeMap());};
00172
00174 const Epetra_Comm & Comm() const{return(Comm_);};
00175
00177 const Epetra_RowMatrix& Matrix() const
00178 {
00179 return(A_);
00180 }
00181
00183 const Epetra_CrsMatrix & L() const {return(*L_);};
00184
00186 const Epetra_CrsMatrix & U() const {return(*U_);};
00187
00189 const char* Label() const
00190 {
00191 return(Label_.c_str());
00192 }
00193
00195 int SetLabel(const char* Label_in)
00196 {
00197 Label_ = Label_in;
00198 return(0);
00199 }
00200
00202 virtual ostream& Print(std::ostream& os) const;
00203
00205 virtual int NumInitialize() const
00206 {
00207 return(NumInitialize_);
00208 }
00209
00211 virtual int NumCompute() const
00212 {
00213 return(NumCompute_);
00214 }
00215
00217 virtual int NumApplyInverse() const
00218 {
00219 return(NumApplyInverse_);
00220 }
00221
00223 virtual double InitializeTime() const
00224 {
00225 return(InitializeTime_);
00226 }
00227
00229 virtual double ComputeTime() const
00230 {
00231 return(ComputeTime_);
00232 }
00233
00235 virtual double ApplyInverseTime() const
00236 {
00237 return(ApplyInverseTime_);
00238 }
00239
00241 virtual double InitializeFlops() const
00242 {
00243 return(0.0);
00244 }
00245
00246 virtual double ComputeFlops() const
00247 {
00248 return(ComputeFlops_);
00249 }
00250
00251 virtual double ApplyInverseFlops() const
00252 {
00253 return(ApplyInverseFlops_);
00254 }
00255
00256 inline double LevelOfFill() const {
00257 return(LevelOfFill_);
00258 }
00259
00261 inline double RelaxValue() const {
00262 return(Relax_);
00263 }
00264
00266 inline double AbsoluteThreshold() const
00267 {
00268 return(Athresh_);
00269 }
00270
00272 inline double RelativeThreshold() const
00273 {
00274 return(Rthresh_);
00275 }
00276
00278 inline double DropTolerance() const
00279 {
00280 return(DropTolerance_);
00281 }
00282
00284 int NumGlobalNonzeros() const {
00285
00286 return(L().NumGlobalNonzeros() + U().NumGlobalNonzeros() - L().NumGlobalRows());
00287 }
00288
00290 int NumMyNonzeros() const {
00291 return(L().NumMyNonzeros() + U().NumMyNonzeros());
00292 }
00293
00294 private:
00295
00296
00297
00298
00300 Ifpack_ILUT(const Ifpack_ILUT& RHS) :
00301 A_(RHS.Matrix()),
00302 Comm_(RHS.Comm()),
00303 Time_(Comm())
00304 {};
00305
00307 Ifpack_ILUT& operator=(const Ifpack_ILUT& RHS)
00308 {
00309 return(*this);
00310 }
00311
00313 void Destroy();
00314
00315
00316
00317
00319 const Epetra_RowMatrix& A_;
00321 const Epetra_Comm& Comm_;
00323 Teuchos::RefCountPtr<Epetra_CrsMatrix> L_;
00325 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00327 double Condest_;
00329 double Relax_;
00331 double Athresh_;
00333 double Rthresh_;
00335 double LevelOfFill_;
00337 double DropTolerance_;
00339 string Label_;
00341 bool IsInitialized_;
00343 bool IsComputed_;
00345 bool UseTranspose_;
00347 int NumMyRows_;
00349 int NumInitialize_;
00351 int NumCompute_;
00353 mutable int NumApplyInverse_;
00355 double InitializeTime_;
00357 double ComputeTime_;
00359 mutable double ApplyInverseTime_;
00361 double ComputeFlops_;
00363 mutable double ApplyInverseFlops_;
00365 mutable Epetra_Time Time_;
00367 int GlobalNonzeros_;
00368 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
00369 Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
00370 };
00371
00372 #endif