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_ICT_H
00044 #define IFPACK_ICT_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_Time.h"
00053 #include "Teuchos_RefCountPtr.hpp"
00054
00055 class Epetra_RowMatrix;
00056 class Epetra_SerialComm;
00057 class Epetra_Comm;
00058 class Epetra_Map;
00059 class Epetra_MultiVector;
00060
00061 namespace Teuchos {
00062 class ParameterList;
00063 }
00064
00066
00083 class Ifpack_ICT: public Ifpack_Preconditioner {
00084
00085 public:
00087
00094 Ifpack_ICT(const Epetra_RowMatrix* A);
00095
00097 virtual ~Ifpack_ICT();
00098
00100
00101
00102
00103
00104
00105
00106
00107 int SetParameters(Teuchos::ParameterList& parameterlis);
00108
00110 const Epetra_RowMatrix& Matrix() const
00111 {
00112 return(A_);
00113 }
00114
00116 bool IsInitialized() const
00117 {
00118 return(IsInitialized_);
00119 }
00120
00122
00128 int Initialize();
00129
00131
00139 int Compute();
00140
00142 bool IsComputed() const {return(IsComputed_);};
00143
00144
00145
00147
00157 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00158
00159 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00160
00162
00170 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00171 const int MaxIters = 1550,
00172 const double Tol = 1e-9,
00173 Epetra_RowMatrix* Matrix_in = 0);
00174
00175 double Condest() const
00176 {
00177 return(Condest_);
00178 }
00179
00180
00181
00183 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00184 int NumGlobalNonzeros() const {return(H().NumGlobalNonzeros());};
00185 #endif
00186 long long NumGlobalNonzeros64() const {return(H().NumGlobalNonzeros64());};
00187
00189 int NumMyNonzeros() const {return(H().NumMyNonzeros());};
00190
00192 const Epetra_CrsMatrix& H() const {return(*H_);};
00193
00195
00197
00206 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00207
00209 double NormInf() const {return(0.0);};
00210
00212 bool HasNormInf() const {return(false);};
00213
00215 bool UseTranspose() const {return(UseTranspose_);};
00216
00218 const Epetra_Map& OperatorDomainMap() const {return(A_.OperatorDomainMap());};
00219
00221 const Epetra_Map& OperatorRangeMap() const{return(A_.OperatorRangeMap());};
00222
00224 const Epetra_Comm& Comm() const{return(Comm_);};
00226
00227 const char* Label() const
00228 {
00229 return(Label_.c_str());
00230 }
00231
00232 int SetLabel(const char* Label_in)
00233 {
00234 Label_ = Label_in;
00235 return(0);
00236 }
00237
00239 virtual ostream& Print(std::ostream& os) const;
00240
00242 virtual int NumInitialize() const
00243 {
00244 return(NumInitialize_);
00245 }
00246
00248 virtual int NumCompute() const
00249 {
00250 return(NumCompute_);
00251 }
00252
00254 virtual int NumApplyInverse() const
00255 {
00256 return(NumApplyInverse_);
00257 }
00258
00260 virtual double InitializeTime() const
00261 {
00262 return(InitializeTime_);
00263 }
00264
00266 virtual double ComputeTime() const
00267 {
00268 return(ComputeTime_);
00269 }
00270
00272 virtual double ApplyInverseTime() const
00273 {
00274 return(ApplyInverseTime_);
00275 }
00276
00278 virtual double InitializeFlops() const
00279 {
00280 return(0.0);
00281 }
00282
00284 virtual double ComputeFlops() const
00285 {
00286 return(ComputeFlops_);
00287 }
00288
00290 virtual double ApplyInverseFlops() const
00291 {
00292 return(ApplyInverseFlops_);
00293 }
00294
00296
00299 inline double LevelOfFill() const
00300 {
00301 return(LevelOfFill_);
00302 }
00303
00305 inline double AbsoluteThreshold() const
00306 {
00307 return(Athresh_);
00308 }
00309
00311 inline double RelativeThreshold() const
00312 {
00313 return(Rthresh_);
00314 }
00315
00317 inline double RelaxValue() const
00318 {
00319 return(Relax_);
00320 }
00321
00323 inline double DropTolerance() const
00324 {
00325 return(DropTolerance_);
00326 }
00327
00328 private:
00329
00331 Ifpack_ICT(const Ifpack_ICT& rhs) :
00332 A_(rhs.Matrix()),
00333 Comm_(Comm()),
00334 Time_(Comm())
00335 {}
00336
00338 Ifpack_ICT& operator=(const Ifpack_ICT& rhs)
00339 {
00340 return(*this);
00341 }
00342
00344 void Destroy();
00345
00347 const Epetra_RowMatrix& A_;
00349 const Epetra_Comm& Comm_;
00351 Teuchos::RefCountPtr<Epetra_CrsMatrix> H_;
00353 double Condest_;
00355 double Athresh_;
00357 double Rthresh_;
00359 double LevelOfFill_;
00361 double DropTolerance_;
00363 double Relax_;
00365 string Label_;
00367 bool IsInitialized_;
00369 bool IsComputed_;
00371 bool UseTranspose_;
00373 int NumMyRows_;
00375 int NumInitialize_;
00377 int NumCompute_;
00379 mutable int NumApplyInverse_;
00381 double InitializeTime_;
00383 double ComputeTime_;
00385 mutable double ApplyInverseTime_;
00387 double ComputeFlops_;
00389 mutable double ApplyInverseFlops_;
00391 mutable Epetra_Time Time_;
00393 long long GlobalNonzeros_;
00394 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
00395 Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
00396
00397 template<typename int_type>
00398 int TCompute();
00399 };
00400
00401 #endif