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_ICT_H
00031 #define IFPACK_ICT_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 #include "Epetra_Time.h"
00041 class Epetra_RowMatrix;
00042 class Epetra_SerialComm;
00043 class Epetra_Comm;
00044 class Epetra_Map;
00045 class Epetra_MultiVector;
00046
00047 namespace Teuchos {
00048 class ParameterList;
00049 template<class T>
00050 class RefCountPtr;
00051 }
00052
00054
00071 class Ifpack_ICT: public Ifpack_Preconditioner {
00072
00073 public:
00075
00082 Ifpack_ICT(const Epetra_RowMatrix* A);
00083
00085 virtual ~Ifpack_ICT();
00086
00088
00089
00090
00091
00092
00093
00094
00095 int SetParameters(Teuchos::ParameterList& parameterlis);
00096
00098 const Epetra_RowMatrix& Matrix() const
00099 {
00100 return(A_);
00101 }
00102
00104 bool IsInitialized() const
00105 {
00106 return(IsInitialized_);
00107 }
00108
00110
00116 int Initialize();
00117
00119
00127 int Compute();
00128
00130 bool IsComputed() const {return(IsComputed_);};
00131
00132
00133
00135
00145 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00146
00147 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00148
00150
00158 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00159 const int MaxIters = 1550,
00160 const double Tol = 1e-9,
00161 Epetra_RowMatrix* Matrix = 0);
00162
00163 double Condest() const
00164 {
00165 return(Condest_);
00166 }
00167
00168
00169
00171 int NumGlobalNonzeros() const {return(H().NumGlobalNonzeros());};
00172
00174 int NumMyNonzeros() const {return(H().NumMyNonzeros());};
00175
00177 const Epetra_CrsMatrix& H() const {return(*H_);};
00178
00180
00182
00191 int SetUseTranspose(bool UseTranspose) {UseTranspose_ = UseTranspose; return(0);};
00192
00194 double NormInf() const {return(0.0);};
00195
00197 bool HasNormInf() const {return(false);};
00198
00200 bool UseTranspose() const {return(UseTranspose_);};
00201
00203 const Epetra_Map& OperatorDomainMap() const {return(A_.OperatorDomainMap());};
00204
00206 const Epetra_Map& OperatorRangeMap() const{return(A_.OperatorRangeMap());};
00207
00209 const Epetra_Comm& Comm() const{return(Comm_);};
00211
00212 const char* Label() const
00213 {
00214 return(Label_.c_str());
00215 }
00216
00217 int SetLabel(const char* Label)
00218 {
00219 Label_ = Label;
00220 return(0);
00221 }
00222
00224 virtual ostream& Print(std::ostream& os) const;
00225
00227 virtual int NumInitialize() const
00228 {
00229 return(NumInitialize_);
00230 }
00231
00233 virtual int NumCompute() const
00234 {
00235 return(NumCompute_);
00236 }
00237
00239 virtual int NumApplyInverse() const
00240 {
00241 return(NumApplyInverse_);
00242 }
00243
00245 virtual double InitializeTime() const
00246 {
00247 return(InitializeTime_);
00248 }
00249
00251 virtual double ComputeTime() const
00252 {
00253 return(ComputeTime_);
00254 }
00255
00257 virtual double ApplyInverseTime() const
00258 {
00259 return(ApplyInverseTime_);
00260 }
00261
00263 virtual double InitializeFlops() const
00264 {
00265 return(0.0);
00266 }
00267
00269 virtual double ComputeFlops() const
00270 {
00271 return(ComputeFlops_);
00272 }
00273
00275 virtual double ApplyInverseFlops() const
00276 {
00277 return(ApplyInverseFlops_);
00278 }
00279
00281
00284 inline double LevelOfFill() const
00285 {
00286 return(LevelOfFill_);
00287 }
00288
00290 inline double AbsoluteThreshold() const
00291 {
00292 return(Athresh_);
00293 }
00294
00296 inline double RelativeThreshold() const
00297 {
00298 return(Rthresh_);
00299 }
00300
00302 inline double RelaxValue() const
00303 {
00304 return(Relax_);
00305 }
00306
00308 inline double DropTolerance() const
00309 {
00310 return(DropTolerance_);
00311 }
00312
00313 private:
00314
00316 Ifpack_ICT(const Ifpack_ICT& rhs) :
00317 A_(rhs.Matrix()),
00318 Comm_(Comm()),
00319 Time_(Comm())
00320 {}
00321
00323 Ifpack_ICT& operator=(const Ifpack_ICT& rhs)
00324 {
00325 return(*this);
00326 }
00327
00329 void Destroy();
00330
00332 const Epetra_RowMatrix& A_;
00334 const Epetra_Comm& Comm_;
00336 Teuchos::RefCountPtr<Epetra_CrsMatrix> H_;
00338 double Condest_;
00340 double Athresh_;
00342 double Rthresh_;
00344 double LevelOfFill_;
00346 double DropTolerance_;
00348 double Relax_;
00350 string Label_;
00352 bool IsInitialized_;
00354 bool IsComputed_;
00356 bool UseTranspose_;
00358 int NumMyRows_;
00360 int NumInitialize_;
00362 int NumCompute_;
00364 mutable int NumApplyInverse_;
00366 double InitializeTime_;
00368 double ComputeTime_;
00370 mutable double ApplyInverseTime_;
00372 double ComputeFlops_;
00374 mutable double ApplyInverseFlops_;
00376 mutable Epetra_Time Time_;
00378 int GlobalNonzeros_;
00379 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
00380 Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
00381 };
00382
00383 #endif // IFPACK_TEUCHOS
00384 #endif