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_POINTRELAXATION_H
00044 #define IFPACK_POINTRELAXATION_H
00045
00046 #include "Ifpack_ConfigDefs.h"
00047 #include "Ifpack_Preconditioner.h"
00048
00049 #include "Epetra_Vector.h"
00050 #include "Epetra_Time.h"
00051 #include "Epetra_RowMatrix.h"
00052 #include "Epetra_Import.h"
00053
00054 #include "Teuchos_RefCountPtr.hpp"
00055
00056 namespace Teuchos {
00057 class ParameterList;
00058 }
00059 class Epetra_MultiVector;
00060 class Epetra_Vector;
00061 class Epetra_Map;
00062 class Epetra_Comm;
00063 class Epetra_CrsMatrix;
00064
00066
00130 class Ifpack_PointRelaxation : public Ifpack_Preconditioner {
00131
00132 public:
00133
00135
00136
00141 Ifpack_PointRelaxation(const Epetra_RowMatrix* Matrix);
00142
00144 virtual ~Ifpack_PointRelaxation() {}
00145
00147
00154 virtual inline int SetUseTranspose(bool UseTranspose_in)
00155 {
00156 UseTranspose_ = UseTranspose_in;
00157 return(0);
00158 }
00159
00161
00163
00165
00173 virtual inline int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
00174 {
00175 if (IsComputed() == false)
00176 IFPACK_CHK_ERR(-3);
00177
00178 if (X.NumVectors() != Y.NumVectors())
00179 IFPACK_CHK_ERR(-2);
00180
00181 IFPACK_CHK_ERR(Matrix_->Multiply(UseTranspose(),X,Y));
00182 return(0);
00183 }
00184
00186
00196 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00197
00199 virtual double NormInf() const
00200 {
00201 return(-1.0);
00202 }
00204
00206
00207 virtual const char * Label() const
00208 {
00209 return(Label_.c_str());
00210 }
00211
00213 virtual bool UseTranspose() const
00214 {
00215 return(UseTranspose_);
00216 }
00217
00219 virtual bool HasNormInf() const
00220 {
00221 return(false);
00222 }
00223
00225 virtual const Epetra_Comm & Comm() const;
00226
00228 virtual const Epetra_Map & OperatorDomainMap() const;
00229
00231 virtual const Epetra_Map & OperatorRangeMap() const;
00232
00233 virtual int Initialize();
00234
00235 virtual bool IsInitialized() const
00236 {
00237 return(IsInitialized_);
00238 }
00239
00241 virtual inline bool IsComputed() const
00242 {
00243 return(IsComputed_);
00244 }
00245
00247 virtual int Compute();
00248
00250
00252
00253 virtual const Epetra_RowMatrix& Matrix() const
00254 {
00255 return(*Matrix_);
00256 }
00257
00259 virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00260 const int MaxIters = 1550,
00261 const double Tol = 1e-9,
00262 Epetra_RowMatrix* Matrix = 0);
00263
00265 virtual double Condest() const
00266 {
00267 return(Condest_);
00268 }
00269
00271 virtual int SetParameters(Teuchos::ParameterList& List);
00272
00274 virtual ostream& Print(ostream & os) const;
00275
00277
00279
00281 virtual int NumInitialize() const
00282 {
00283 return(NumInitialize_);
00284 }
00285
00287 virtual int NumCompute() const
00288 {
00289 return(NumCompute_);
00290 }
00291
00293 virtual int NumApplyInverse() const
00294 {
00295 return(NumApplyInverse_);
00296 }
00297
00299 virtual double InitializeTime() const
00300 {
00301 return(InitializeTime_);
00302 }
00303
00305 virtual double ComputeTime() const
00306 {
00307 return(ComputeTime_);
00308 }
00309
00311 virtual double ApplyInverseTime() const
00312 {
00313 return(ApplyInverseTime_);
00314 }
00315
00317 virtual double InitializeFlops() const
00318 {
00319 return(0.0);
00320 }
00321
00323 virtual double ComputeFlops() const
00324 {
00325 return(ComputeFlops_);
00326 }
00327
00329 virtual double ApplyInverseFlops() const
00330 {
00331 return(ApplyInverseFlops_);
00332 }
00333
00334
00335
00336 private:
00337
00338
00339
00341 virtual int ApplyInverseJacobi(const Epetra_MultiVector& X,
00342 Epetra_MultiVector& Y) const;
00343
00345 virtual int ApplyInverseGS(const Epetra_MultiVector& X,
00346 Epetra_MultiVector& Y) const;
00347
00348 virtual int ApplyInverseGS_RowMatrix(const Epetra_MultiVector& X,
00349 Epetra_MultiVector& Y) const;
00350
00351 virtual int ApplyInverseGS_CrsMatrix(const Epetra_CrsMatrix* A,
00352 const Epetra_MultiVector& X,
00353 Epetra_MultiVector& Y) const;
00354
00355 virtual int ApplyInverseGS_FastCrsMatrix(const Epetra_CrsMatrix* A,
00356 const Epetra_MultiVector& X,
00357 Epetra_MultiVector& Y) const;
00358 virtual int ApplyInverseGS_LocalFastCrsMatrix(const Epetra_CrsMatrix* A,
00359 const Epetra_MultiVector& X,
00360 Epetra_MultiVector& Y) const;
00361
00363 virtual int ApplyInverseSGS(const Epetra_MultiVector& X,
00364 Epetra_MultiVector& Y) const;
00365
00366 virtual int ApplyInverseSGS_RowMatrix(const Epetra_MultiVector& X,
00367 Epetra_MultiVector& Y) const;
00368
00369 virtual int ApplyInverseSGS_CrsMatrix(const Epetra_CrsMatrix* A,
00370 const Epetra_MultiVector& X,
00371 Epetra_MultiVector& Y) const;
00372
00373 virtual int ApplyInverseSGS_FastCrsMatrix(const Epetra_CrsMatrix* A,
00374 const Epetra_MultiVector& X,
00375 Epetra_MultiVector& Y) const;
00376
00377 virtual int ApplyInverseSGS_LocalFastCrsMatrix(const Epetra_CrsMatrix* A,
00378 const Epetra_MultiVector& X,
00379 Epetra_MultiVector& Y) const;
00380
00381
00383
00384 private:
00385
00387 virtual void SetLabel();
00388
00390 Ifpack_PointRelaxation(const Ifpack_PointRelaxation& rhs)
00391 {}
00392
00394 Ifpack_PointRelaxation& operator=(const Ifpack_PointRelaxation& rhs)
00395 {
00396 return(*this);
00397 }
00398
00399
00401 bool IsInitialized_;
00403 bool IsComputed_;
00405 int NumInitialize_;
00407 int NumCompute_;
00409 mutable int NumApplyInverse_;
00411 double InitializeTime_;
00413 double ComputeTime_;
00415 mutable double ApplyInverseTime_;
00417 double ComputeFlops_;
00419 mutable double ApplyInverseFlops_;
00420
00421
00422
00424 int NumSweeps_;
00426 double DampingFactor_;
00428 bool UseTranspose_;
00430 double Condest_;
00432 bool ComputeCondest_;
00434 string Label_;
00435 int PrecType_;
00436 double MinDiagonalValue_;
00437
00438
00439
00441 int NumMyRows_;
00443 int NumMyNonzeros_;
00445 long long NumGlobalRows_;
00447 long long NumGlobalNonzeros_;
00449 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00451 Teuchos::RefCountPtr<Epetra_Import> Importer_;
00453 mutable Teuchos::RefCountPtr<Epetra_Vector> Diagonal_;
00455 Teuchos::RefCountPtr<Epetra_Time> Time_;
00457 bool IsParallel_;
00459 bool ZeroStartingSolution_;
00461 bool DoBackwardGS_;
00463 bool DoL1Method_;
00465 double L1Eta_;
00466
00468 int NumLocalSmoothingIndices_;
00470 int * LocalSmoothingIndices_;
00471
00472
00473
00474
00475
00476 };
00477
00478 #endif // IFPACK_POINTRELAXATION_H