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_IC_H
00031 #define IFPACK_IC_H
00032
00033 #include "Ifpack_ConfigDefs.h"
00034 #ifdef HAVE_IFPACK_TEUCHOS
00035 #include "Ifpack_CondestType.h"
00036 #include "Ifpack_ScalingType.h"
00037 #include "Ifpack_Preconditioner.h"
00038 #include "Epetra_Vector.h"
00039 #include "Epetra_CrsMatrix.h"
00040 class Epetra_RowMatrix;
00041 class Epetra_Comm;
00042 class Epetra_Map;
00043 class Epetra_MultiVector;
00044 namespace Teuchos {
00045 class ParameterList;
00046 template<class T>
00047 class RefCountPtr;
00048 }
00049
00051
00068 class Ifpack_IC: public Ifpack_Preconditioner {
00069
00070 public:
00072
00079 Ifpack_IC(Epetra_RowMatrix* A);
00080
00082 virtual ~Ifpack_IC();
00083
00085 void SetAbsoluteThreshold( double Athresh) {Athresh_ = Athresh; return;}
00086
00088 void SetRelativeThreshold( double Rthresh) {Rthresh_ = Rthresh; return;}
00089
00090 #ifdef HAVE_IFPACK_TEUCHOS
00091
00092
00093
00094
00095
00096
00097
00098
00099 int SetParameters(Teuchos::ParameterList& parameterlis);
00100 #endif
00101 int SetParameter(const string Name, const int Value)
00102 {
00103 IFPACK_CHK_ERR(-98);
00104 }
00105 int SetParameter(const string Name, const double Value)
00106 {
00107 IFPACK_CHK_ERR(-98);
00108 }
00109
00110 const Epetra_RowMatrix& Matrix() const
00111 {
00112 return(A_);
00113 }
00114
00115 Epetra_RowMatrix& Matrix()
00116 {
00117 return(A_);
00118 }
00119
00120 bool IsInitialized() const
00121 {
00122 return(IsInitialized_);
00123 }
00124
00126
00132 int Initialize();
00133
00135
00143 int Compute();
00144 int ComputeSetup();
00145
00147 bool IsComputed() const {return(IsComputed_);};
00148
00149
00150
00152
00162 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00163
00164 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00165
00167
00175 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00176 const int MaxIters = 1550,
00177 const double Tol = 1e-9,
00178 Epetra_RowMatrix* Matrix = 0);
00179
00180 double Condest() const
00181 {
00182 return(Condest_);
00183 }
00184
00185
00186
00188 double GetAbsoluteThreshold() {return Athresh_;}
00189
00191 double GetRelativeThreshold() {return Rthresh_;}
00192
00194 int NumGlobalNonzeros() const {return(U().NumGlobalNonzeros()+D().GlobalLength());};
00195
00197 int NumMyNonzeros() const {return(U().NumMyNonzeros()+D().MyLength());};
00199 const Epetra_Vector & D() const {return(*D_);};
00200
00202 const Epetra_CrsMatrix & U() const {return(*U_);};
00203
00205
00207
00216 int SetUseTranspose(bool UseTranspose) {UseTranspose_ = UseTranspose; return(0);};
00217
00219 double NormInf() const {return(0.0);};
00220
00222 bool HasNormInf() const {return(false);};
00223
00225 bool UseTranspose() const {return(UseTranspose_);};
00226
00228 const Epetra_Map & OperatorDomainMap() const {return(A_.OperatorDomainMap());};
00229
00231 const Epetra_Map & OperatorRangeMap() const{return(A_.OperatorRangeMap());};
00232
00234 const Epetra_Comm & Comm() const{return(Comm_);};
00236
00237 const char* Label() const
00238 {
00239 return(Label_);
00240 }
00241
00242 int SetLabel(const char* Label)
00243 {
00244 strcpy(Label_,Label);
00245 return(0);
00246 }
00247
00249 virtual ostream& Print(std::ostream& os) const;
00250
00252 virtual int NumInitialize() const
00253 {
00254 return(NumInitialize_);
00255 }
00256
00258 virtual int NumCompute() const
00259 {
00260 return(NumCompute_);
00261 }
00262
00264 virtual int NumApplyInverse() const
00265 {
00266 return(NumApplyInverse_);
00267 }
00268
00270 virtual double InitializeTime() const
00271 {
00272 return(InitializeTime_);
00273 }
00274
00276 virtual double ComputeTime() const
00277 {
00278 return(ComputeTime_);
00279 }
00280
00282 virtual double ApplyInverseTime() const
00283 {
00284 return(ApplyInverseTime_);
00285 }
00286
00288 virtual double InitializeFlops() const
00289 {
00290 return(0.0);
00291 }
00292
00293 virtual double ComputeFlops() const
00294 {
00295 return(ComputeFlops_);
00296 }
00297
00298 virtual double ApplyInverseFlops() const
00299 {
00300 return(ApplyInverseFlops_);
00301 }
00302
00303
00304 private:
00305
00306 double LevelOfFill() const
00307 {
00308 return(Lfil_);
00309 }
00310
00311 double AbsoluteThreshold() const
00312 {
00313 return(Athresh_);
00314 }
00315
00316 double RelativeThreshold() const
00317 {
00318 return(Rthresh_);
00319 }
00320
00321 double DropTolerance() const
00322 {
00323 return(Droptol_);
00324 }
00325
00326 Epetra_RowMatrix &A_;
00327 const Epetra_Comm & Comm_;
00328 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00329 Teuchos::RefCountPtr<Epetra_Vector> D_;
00330 bool UseTranspose_;
00331
00332 double Condest_;
00333 double Athresh_;
00334 double Rthresh_;
00335 double Droptol_;
00336 int Lfil_;
00337
00338 void * Aict_;
00339 void * Lict_;
00340 double * Ldiag_;
00341 char Label_[160];
00342
00343 bool IsInitialized_;
00344 bool IsComputed_;
00345
00347 int NumInitialize_;
00349 int NumCompute_;
00351 mutable int NumApplyInverse_;
00352
00354 double InitializeTime_;
00356 double ComputeTime_;
00358 mutable double ApplyInverseTime_;
00359
00361 double ComputeFlops_;
00363 mutable double ApplyInverseFlops_;
00364
00365 };
00366
00367 #endif // HAVE_IFPACK_TEUCHOS
00368 #endif