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 #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_RowMatrix.h"
00040 #include "Teuchos_RefCountPtr.hpp"
00041
00042 class Epetra_Comm;
00043 class Epetra_Map;
00044 class Epetra_MultiVector;
00045 namespace Teuchos {
00046 class ParameterList;
00047 }
00048
00050
00067 class Ifpack_IC: public Ifpack_Preconditioner {
00068
00069 public:
00071
00078 Ifpack_IC(Epetra_RowMatrix* A);
00079
00081 virtual ~Ifpack_IC();
00082
00084 void SetAbsoluteThreshold( double Athresh) {Athresh_ = Athresh; return;}
00085
00087 void SetRelativeThreshold( double Rthresh) {Rthresh_ = Rthresh; return;}
00088
00090
00091
00092
00093
00094
00095
00096
00097 int SetParameters(Teuchos::ParameterList& parameterlis);
00098
00099 int SetParameter(const string Name, const int Value)
00100 {
00101 IFPACK_CHK_ERR(-98);
00102 }
00103 int SetParameter(const string Name, const double Value)
00104 {
00105 IFPACK_CHK_ERR(-98);
00106 }
00107
00108 const Epetra_RowMatrix& Matrix() const
00109 {
00110 return(*A_);
00111 }
00112
00113 Epetra_RowMatrix& Matrix()
00114 {
00115 return(*A_);
00116 }
00117
00118 bool IsInitialized() const
00119 {
00120 return(IsInitialized_);
00121 }
00122
00124
00130 int Initialize();
00131
00133
00141 int Compute();
00142 int ComputeSetup();
00143
00145 bool IsComputed() const {return(IsComputed_);};
00146
00147
00148
00150
00160 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00161
00162 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00163
00165
00173 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00174 const int MaxIters = 1550,
00175 const double Tol = 1e-9,
00176 Epetra_RowMatrix* Matrix_in = 0);
00177
00178 double Condest() const
00179 {
00180 return(Condest_);
00181 }
00182
00183
00184
00186 double GetAbsoluteThreshold() {return Athresh_;}
00187
00189 double GetRelativeThreshold() {return Rthresh_;}
00190
00192 int NumGlobalNonzeros() const {return(U().NumGlobalNonzeros()+D().GlobalLength());};
00193
00195 int NumMyNonzeros() const {return(U().NumMyNonzeros()+D().MyLength());};
00197 const Epetra_Vector & D() const {return(*D_);};
00198
00200 const Epetra_CrsMatrix & U() const {return(*U_);};
00201
00203
00205
00214 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00215
00217 double NormInf() const {return(0.0);};
00218
00220 bool HasNormInf() const {return(false);};
00221
00223 bool UseTranspose() const {return(UseTranspose_);};
00224
00226 const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());};
00227
00229 const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());};
00230
00232 const Epetra_Comm & Comm() const{return(Comm_);};
00234
00235 const char* Label() const
00236 {
00237 return(Label_);
00238 }
00239
00240 int SetLabel(const char* Label_in)
00241 {
00242 strcpy(Label_,Label_in);
00243 return(0);
00244 }
00245
00247 virtual ostream& Print(std::ostream& os) const;
00248
00250 virtual int NumInitialize() const
00251 {
00252 return(NumInitialize_);
00253 }
00254
00256 virtual int NumCompute() const
00257 {
00258 return(NumCompute_);
00259 }
00260
00262 virtual int NumApplyInverse() const
00263 {
00264 return(NumApplyInverse_);
00265 }
00266
00268 virtual double InitializeTime() const
00269 {
00270 return(InitializeTime_);
00271 }
00272
00274 virtual double ComputeTime() const
00275 {
00276 return(ComputeTime_);
00277 }
00278
00280 virtual double ApplyInverseTime() const
00281 {
00282 return(ApplyInverseTime_);
00283 }
00284
00286 virtual double InitializeFlops() const
00287 {
00288 return(0.0);
00289 }
00290
00291 virtual double ComputeFlops() const
00292 {
00293 return(ComputeFlops_);
00294 }
00295
00296 virtual double ApplyInverseFlops() const
00297 {
00298 return(ApplyInverseFlops_);
00299 }
00300
00301
00302 private:
00303
00304 double LevelOfFill() const
00305 {
00306 return(Lfil_);
00307 }
00308
00309 double AbsoluteThreshold() const
00310 {
00311 return(Athresh_);
00312 }
00313
00314 double RelativeThreshold() const
00315 {
00316 return(Rthresh_);
00317 }
00318
00319 double DropTolerance() const
00320 {
00321 return(Droptol_);
00322 }
00323
00324 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
00325 const Epetra_Comm & Comm_;
00326 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00327 Teuchos::RefCountPtr<Epetra_Vector> D_;
00328 bool UseTranspose_;
00329
00330 double Condest_;
00331 double Athresh_;
00332 double Rthresh_;
00333 double Droptol_;
00334 int Lfil_;
00335
00336 void * Aict_;
00337 void * Lict_;
00338 double * Ldiag_;
00339 char Label_[160];
00340
00341 bool IsInitialized_;
00342 bool IsComputed_;
00343
00345 int NumInitialize_;
00347 int NumCompute_;
00349 mutable int NumApplyInverse_;
00350
00352 double InitializeTime_;
00354 double ComputeTime_;
00356 mutable double ApplyInverseTime_;
00357
00359 double ComputeFlops_;
00361 mutable double ApplyInverseFlops_;
00362
00363 };
00364
00365 #endif