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_IC_H
00044 #define IFPACK_IC_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_RowMatrix.h"
00053 #include "Epetra_Time.h"
00054 #include "Teuchos_RefCountPtr.hpp"
00055
00056 class Epetra_Comm;
00057 class Epetra_Map;
00058 class Epetra_MultiVector;
00059 namespace Teuchos {
00060 class ParameterList;
00061 }
00062
00064
00080 class Ifpack_IC: public Ifpack_Preconditioner {
00081
00082 public:
00084
00091 Ifpack_IC(Epetra_RowMatrix* A);
00092
00094 virtual ~Ifpack_IC();
00095
00097 void SetAbsoluteThreshold( double Athresh) {Athresh_ = Athresh; return;}
00098
00100 void SetRelativeThreshold( double Rthresh) {Rthresh_ = Rthresh; return;}
00101
00103
00104
00105
00106
00107
00108
00109
00110 int SetParameters(Teuchos::ParameterList& parameterlis);
00111
00112 int SetParameter(const string Name, const int Value)
00113 {
00114 IFPACK_CHK_ERR(-98);
00115 }
00116 int SetParameter(const string Name, const double Value)
00117 {
00118 IFPACK_CHK_ERR(-98);
00119 }
00120
00121 const Epetra_RowMatrix& Matrix() const
00122 {
00123 return(*A_);
00124 }
00125
00126 Epetra_RowMatrix& Matrix()
00127 {
00128 return(*A_);
00129 }
00130
00131 bool IsInitialized() const
00132 {
00133 return(IsInitialized_);
00134 }
00135
00137
00143 int Initialize();
00144
00146
00154 int Compute();
00155 int ComputeSetup();
00156
00158 bool IsComputed() const {return(IsComputed_);};
00159
00160
00161
00163
00173 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00174
00175 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00176
00178
00186 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00187 const int MaxIters = 1550,
00188 const double Tol = 1e-9,
00189 Epetra_RowMatrix* Matrix_in = 0);
00190
00191 double Condest() const
00192 {
00193 return(Condest_);
00194 }
00195
00196
00197
00199 double GetAbsoluteThreshold() {return Athresh_;}
00200
00202 double GetRelativeThreshold() {return Rthresh_;}
00203
00205 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00206 int NumGlobalNonzeros() const {return(U().NumGlobalNonzeros()+D().GlobalLength());};
00207 #endif
00208 long long NumGlobalNonzeros64() const {return(U().NumGlobalNonzeros64()+D().GlobalLength64());};
00209
00211 int NumMyNonzeros() const {return(U().NumMyNonzeros()+D().MyLength());};
00213 const Epetra_Vector & D() const {return(*D_);};
00214
00216 const Epetra_CrsMatrix & U() const {return(*U_);};
00217
00219
00221
00230 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00231
00233 double NormInf() const {return(0.0);};
00234
00236 bool HasNormInf() const {return(false);};
00237
00239 bool UseTranspose() const {return(UseTranspose_);};
00240
00242 const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());};
00243
00245 const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());};
00246
00248 const Epetra_Comm & Comm() const{return(Comm_);};
00250
00251 const char* Label() const
00252 {
00253 return(Label_);
00254 }
00255
00256 int SetLabel(const char* Label_in)
00257 {
00258 strcpy(Label_,Label_in);
00259 return(0);
00260 }
00261
00263 virtual ostream& Print(std::ostream& os) const;
00264
00266 virtual int NumInitialize() const
00267 {
00268 return(NumInitialize_);
00269 }
00270
00272 virtual int NumCompute() const
00273 {
00274 return(NumCompute_);
00275 }
00276
00278 virtual int NumApplyInverse() const
00279 {
00280 return(NumApplyInverse_);
00281 }
00282
00284 virtual double InitializeTime() const
00285 {
00286 return(InitializeTime_);
00287 }
00288
00290 virtual double ComputeTime() const
00291 {
00292 return(ComputeTime_);
00293 }
00294
00296 virtual double ApplyInverseTime() const
00297 {
00298 return(ApplyInverseTime_);
00299 }
00300
00302 virtual double InitializeFlops() const
00303 {
00304 return(0.0);
00305 }
00306
00307 virtual double ComputeFlops() const
00308 {
00309 return(ComputeFlops_);
00310 }
00311
00312 virtual double ApplyInverseFlops() const
00313 {
00314 return(ApplyInverseFlops_);
00315 }
00316
00317
00318 private:
00319
00320 double LevelOfFill() const
00321 {
00322 return(Lfil_);
00323 }
00324
00325 double AbsoluteThreshold() const
00326 {
00327 return(Athresh_);
00328 }
00329
00330 double RelativeThreshold() const
00331 {
00332 return(Rthresh_);
00333 }
00334
00335 double DropTolerance() const
00336 {
00337 return(Droptol_);
00338 }
00339
00340 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
00341 const Epetra_Comm & Comm_;
00342 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00343 Teuchos::RefCountPtr<Epetra_Vector> D_;
00344 bool UseTranspose_;
00345
00346 double Condest_;
00347 double Athresh_;
00348 double Rthresh_;
00349 double Droptol_;
00350 double Lfil_;
00351
00352 void * Aict_;
00353 void * Lict_;
00354 double * Ldiag_;
00355 char Label_[160];
00356
00357 bool IsInitialized_;
00358 bool IsComputed_;
00359
00361 int NumInitialize_;
00363 int NumCompute_;
00365 mutable int NumApplyInverse_;
00366
00368 double InitializeTime_;
00370 double ComputeTime_;
00372 mutable double ApplyInverseTime_;
00374 mutable Epetra_Time Time_;
00375
00377 double ComputeFlops_;
00379 mutable double ApplyInverseFlops_;
00380
00381 };
00382
00383 #endif