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_CHEBYSHEV_H
00044 #define IFPACK_CHEBYSHEV_H
00045
00046 #include "Ifpack_ConfigDefs.h"
00047 #include "Ifpack_Preconditioner.h"
00048 #include "Teuchos_RefCountPtr.hpp"
00049
00050 namespace Teuchos {
00051 class ParameterList;
00052 }
00053
00054 class Epetra_MultiVector;
00055 class Epetra_Vector;
00056 class Epetra_Map;
00057 class Epetra_Comm;
00058 class Epetra_Time;
00059 class Epetra_Vector;
00060 class Epetra_Operator;
00061 class Epetra_RowMatrix;
00062
00063 #ifdef HAVE_IFPACK_EPETRAEXT
00064 class EpetraExt_PointToBlockDiagPermute;
00065 #endif
00066
00068
00104 class Ifpack_Chebyshev : public Ifpack_Preconditioner {
00105
00106 public:
00107
00109
00110
00115 Ifpack_Chebyshev(const Epetra_Operator* Matrix);
00116
00118
00123 Ifpack_Chebyshev(const Epetra_RowMatrix* Matrix);
00124
00126 virtual ~Ifpack_Chebyshev() {};
00127
00129
00136 virtual inline int SetUseTranspose(bool UseTranspose_in)
00137 {
00138 UseTranspose_ = UseTranspose_in;
00139 return(0);
00140 }
00141
00143
00145
00147
00155 virtual inline int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00156
00158
00168 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00169
00171 virtual double NormInf() const
00172 {
00173 return(-1.0);
00174 }
00176
00178
00179 virtual const char * Label() const
00180 {
00181 return(Label_.c_str());
00182 }
00183
00185 virtual bool UseTranspose() const
00186 {
00187 return(UseTranspose_);
00188 }
00189
00191 virtual bool HasNormInf() const
00192 {
00193 return(false);
00194 }
00195
00197 virtual const Epetra_Comm & Comm() const;
00198
00200 virtual const Epetra_Map & OperatorDomainMap() const;
00201
00203 virtual const Epetra_Map & OperatorRangeMap() const;
00204
00205 virtual int Initialize();
00206
00207 virtual bool IsInitialized() const
00208 {
00209 return(IsInitialized_);
00210 }
00211
00213 virtual inline bool IsComputed() const
00214 {
00215 return(IsComputed_);
00216 }
00217
00219 virtual int Compute();
00220
00222 virtual double GetLambdaMax(){return LambdaMax_;}
00223
00225 virtual double GetLambdaMin(){return LambdaMin_;}
00226
00228
00230
00231 virtual const Epetra_RowMatrix& Matrix() const
00232 {
00233 return(*Matrix_);
00234 }
00235
00237 virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00238 const int MaxIters = 1550,
00239 const double Tol = 1e-9,
00240 Epetra_RowMatrix* Matrix_in = 0);
00241
00243 virtual double Condest() const
00244 {
00245 return(Condest_);
00246 }
00247
00249 virtual int SetParameters(Teuchos::ParameterList& List);
00250
00252 virtual ostream& Print(ostream & os) const;
00253
00255
00257
00259 virtual int NumInitialize() const
00260 {
00261 return(NumInitialize_);
00262 }
00263
00265 virtual int NumCompute() const
00266 {
00267 return(NumCompute_);
00268 }
00269
00271 virtual int NumApplyInverse() const
00272 {
00273 return(NumApplyInverse_);
00274 }
00275
00277 virtual double InitializeTime() const
00278 {
00279 return(InitializeTime_);
00280 }
00281
00283 virtual double ComputeTime() const
00284 {
00285 return(ComputeTime_);
00286 }
00287
00289 virtual double ApplyInverseTime() const
00290 {
00291 return(ApplyInverseTime_);
00292 }
00293
00295 virtual double InitializeFlops() const
00296 {
00297 return(0.0);
00298 }
00299
00301 virtual double ComputeFlops() const
00302 {
00303 return(ComputeFlops_);
00304 }
00305
00307 virtual double ApplyInverseFlops() const
00308 {
00309 return(ApplyInverseFlops_);
00310 }
00311
00312
00313
00314
00316 static int PowerMethod(const Epetra_Operator& Operator,
00317 const Epetra_Vector& InvPointDiagonal,
00318 const int MaximumIterations,
00319 double& LambdaMax);
00320
00322 static int CG(const Epetra_Operator& Operator,
00323 const Epetra_Vector& InvPointDiagonal,
00324 const int MaximumIterations,
00325 double& lambda_min, double& lambda_max);
00326
00327 #ifdef HAVE_IFPACK_EPETRAEXT
00328
00329
00330 int CG(const int MaximumIterations,
00331 double& lambda_min, double& lambda_max);
00333
00334 int PowerMethod(const int MaximumIterations,double& lambda_max);
00335 #endif
00336 private:
00337
00338
00339
00340
00342 virtual void SetLabel();
00343
00345 Ifpack_Chebyshev(const Ifpack_Chebyshev& rhs)
00346 {}
00347
00349 Ifpack_Chebyshev& operator=(const Ifpack_Chebyshev& rhs)
00350 {
00351 return(*this);
00352 }
00353
00354
00356 bool IsInitialized_;
00358 bool IsComputed_;
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_;
00375
00376
00377
00379 int PolyDegree_;
00381 bool UseTranspose_;
00383 double Condest_;
00385 bool ComputeCondest_;
00388 double EigRatio_;
00390 int EigMaxIters_;
00392 string Label_;
00394 double LambdaMin_;
00396 double LambdaMax_;
00398 double MinDiagonalValue_;
00399
00400
00401
00403 int NumMyRows_;
00405 int NumMyNonzeros_;
00407 long long NumGlobalRows_;
00409 long long NumGlobalNonzeros_;
00411 Teuchos::RefCountPtr<const Epetra_Operator> Operator_;
00413 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00415 mutable Teuchos::RefCountPtr<Epetra_Vector> InvDiagonal_;
00417 bool UseBlockMode_;
00418 #ifdef HAVE_IFPACK_EPETRAEXT
00419
00420 Teuchos::ParameterList BlockList_;
00421 Teuchos::RefCountPtr<EpetraExt_PointToBlockDiagPermute> InvBlockDiagonal_;
00422 #endif
00423
00425 bool SolveNormalEquations_;
00426
00428 bool IsRowMatrix_;
00430 Teuchos::RefCountPtr<Epetra_Time> Time_;
00432 bool ZeroStartingSolution_;
00433
00434
00435
00436 };
00437
00438
00439 #endif // IFPACK_CHEBYSHEV_H