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_CHEBYSHEV_H
00031 #define IFPACK_CHEBYSHEV_H
00032
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Ifpack_Preconditioner.h"
00035 #include "Teuchos_RefCountPtr.hpp"
00036
00037 namespace Teuchos {
00038 class ParameterList;
00039 }
00040
00041 class Epetra_MultiVector;
00042 class Epetra_Vector;
00043 class Epetra_Map;
00044 class Epetra_Comm;
00045 class Epetra_Time;
00046 class Epetra_Vector;
00047 class Epetra_Operator;
00048 class Epetra_RowMatrix;
00049
00051
00087 class Ifpack_Chebyshev : public Ifpack_Preconditioner {
00088
00089 public:
00090
00092
00093
00098 Ifpack_Chebyshev(const Epetra_Operator* Matrix);
00099
00101
00106 Ifpack_Chebyshev(const Epetra_RowMatrix* Matrix);
00107
00109 virtual ~Ifpack_Chebyshev() {};
00110
00112
00119 virtual inline int SetUseTranspose(bool UseTranspose_in)
00120 {
00121 UseTranspose_ = UseTranspose_in;
00122 return(0);
00123 }
00124
00126
00128
00130
00138 virtual inline int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00139
00141
00151 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00152
00154 virtual double NormInf() const
00155 {
00156 return(-1.0);
00157 }
00159
00161
00162 virtual const char * Label() const
00163 {
00164 return(Label_.c_str());
00165 }
00166
00168 virtual bool UseTranspose() const
00169 {
00170 return(UseTranspose_);
00171 }
00172
00174 virtual bool HasNormInf() const
00175 {
00176 return(false);
00177 }
00178
00180 virtual const Epetra_Comm & Comm() const;
00181
00183 virtual const Epetra_Map & OperatorDomainMap() const;
00184
00186 virtual const Epetra_Map & OperatorRangeMap() const;
00187
00188 virtual int Initialize();
00189
00190 virtual bool IsInitialized() const
00191 {
00192 return(IsInitialized_);
00193 }
00194
00196 virtual inline bool IsComputed() const
00197 {
00198 return(IsComputed_);
00199 }
00200
00202 virtual int Compute();
00203
00205
00207
00208 virtual const Epetra_RowMatrix& Matrix() const
00209 {
00210 return(*Matrix_);
00211 }
00212
00214 virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00215 const int MaxIters = 1550,
00216 const double Tol = 1e-9,
00217 Epetra_RowMatrix* Matrix_in = 0);
00218
00220 virtual double Condest() const
00221 {
00222 return(Condest_);
00223 }
00224
00226 virtual int SetParameters(Teuchos::ParameterList& List);
00227
00229 virtual ostream& Print(ostream & os) const;
00230
00232
00234
00236 virtual int NumInitialize() const
00237 {
00238 return(NumInitialize_);
00239 }
00240
00242 virtual int NumCompute() const
00243 {
00244 return(NumCompute_);
00245 }
00246
00248 virtual int NumApplyInverse() const
00249 {
00250 return(NumApplyInverse_);
00251 }
00252
00254 virtual double InitializeTime() const
00255 {
00256 return(InitializeTime_);
00257 }
00258
00260 virtual double ComputeTime() const
00261 {
00262 return(ComputeTime_);
00263 }
00264
00266 virtual double ApplyInverseTime() const
00267 {
00268 return(ApplyInverseTime_);
00269 }
00270
00272 virtual double InitializeFlops() const
00273 {
00274 return(0.0);
00275 }
00276
00278 virtual double ComputeFlops() const
00279 {
00280 return(ComputeFlops_);
00281 }
00282
00284 virtual double ApplyInverseFlops() const
00285 {
00286 return(ApplyInverseFlops_);
00287 }
00288
00289
00290
00291
00293 static int PowerMethod(const Epetra_Operator& Operator,
00294 const Epetra_Vector& InvPointDiagonal,
00295 const int MaximumIterations,
00296 double& LambdaMax);
00297
00299 static int CG(const Epetra_Operator& Operator,
00300 const Epetra_Vector& InvPointDiagonal,
00301 const int MaximumIterations,
00302 double& lambda_min, double& lambda_max);
00303
00304 private:
00305
00306
00307
00308
00310 virtual void SetLabel();
00311
00313 Ifpack_Chebyshev(const Ifpack_Chebyshev& rhs)
00314 {}
00315
00317 Ifpack_Chebyshev& operator=(const Ifpack_Chebyshev& rhs)
00318 {
00319 return(*this);
00320 }
00321
00322
00324 bool IsInitialized_;
00326 bool IsComputed_;
00328 int NumInitialize_;
00330 int NumCompute_;
00332 mutable int NumApplyInverse_;
00334 double InitializeTime_;
00336 double ComputeTime_;
00338 mutable double ApplyInverseTime_;
00340 double ComputeFlops_;
00342 mutable double ApplyInverseFlops_;
00343
00344
00345
00347 int PolyDegree_;
00349 bool UseTranspose_;
00351 double Condest_;
00353 bool ComputeCondest_;
00356 double EigRatio_;
00358 string Label_;
00360 double LambdaMin_;
00362 double LambdaMax_;
00364 double MinDiagonalValue_;
00365
00366
00367
00369 int NumMyRows_;
00371 int NumMyNonzeros_;
00373 int NumGlobalRows_;
00375 int NumGlobalNonzeros_;
00377 Teuchos::RefCountPtr<const Epetra_Operator> Operator_;
00379 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00381 mutable Teuchos::RefCountPtr<Epetra_Vector> InvDiagonal_;
00383 bool IsRowMatrix_;
00385 Teuchos::RefCountPtr<Epetra_Time> Time_;
00387 bool ZeroStartingSolution_;
00388
00389
00390 };
00391
00392
00393 #endif // IFPACK_CHEBYSHEV_H