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_POINTRELAXATION_H
00031 #define IFPACK_POINTRELAXATION_H
00032
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Ifpack_Preconditioner.h"
00035
00036 #include "Epetra_Vector.h"
00037 #include "Epetra_Time.h"
00038 #include "Epetra_RowMatrix.h"
00039 #include "Epetra_Import.h"
00040
00041 #include "Teuchos_RefCountPtr.hpp"
00042
00043 namespace Teuchos {
00044 class ParameterList;
00045 }
00046 class Epetra_MultiVector;
00047 class Epetra_Vector;
00048 class Epetra_Map;
00049 class Epetra_Comm;
00050 class Epetra_CrsMatrix;
00051
00053
00117 class Ifpack_PointRelaxation : public Ifpack_Preconditioner {
00118
00119 public:
00120
00122
00123
00128 Ifpack_PointRelaxation(const Epetra_RowMatrix* Matrix);
00129
00131 virtual ~Ifpack_PointRelaxation() {}
00132
00134
00141 virtual inline int SetUseTranspose(bool UseTranspose_in)
00142 {
00143 UseTranspose_ = UseTranspose_in;
00144 return(0);
00145 }
00146
00148
00150
00152
00160 virtual inline int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
00161 {
00162 if (IsComputed() == false)
00163 IFPACK_CHK_ERR(-3);
00164
00165 if (X.NumVectors() != Y.NumVectors())
00166 IFPACK_CHK_ERR(-2);
00167
00168 IFPACK_CHK_ERR(Matrix_->Multiply(UseTranspose(),X,Y));
00169 return(0);
00170 }
00171
00173
00183 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00184
00186 virtual double NormInf() const
00187 {
00188 return(-1.0);
00189 }
00191
00193
00194 virtual const char * Label() const
00195 {
00196 return(Label_.c_str());
00197 }
00198
00200 virtual bool UseTranspose() const
00201 {
00202 return(UseTranspose_);
00203 }
00204
00206 virtual bool HasNormInf() const
00207 {
00208 return(false);
00209 }
00210
00212 virtual const Epetra_Comm & Comm() const;
00213
00215 virtual const Epetra_Map & OperatorDomainMap() const;
00216
00218 virtual const Epetra_Map & OperatorRangeMap() const;
00219
00220 virtual int Initialize();
00221
00222 virtual bool IsInitialized() const
00223 {
00224 return(IsInitialized_);
00225 }
00226
00228 virtual inline bool IsComputed() const
00229 {
00230 return(IsComputed_);
00231 }
00232
00234 virtual int Compute();
00235
00237
00239
00240 virtual const Epetra_RowMatrix& Matrix() const
00241 {
00242 return(*Matrix_);
00243 }
00244
00246 virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00247 const int MaxIters = 1550,
00248 const double Tol = 1e-9,
00249 Epetra_RowMatrix* Matrix = 0);
00250
00252 virtual double Condest() const
00253 {
00254 return(Condest_);
00255 }
00256
00258 virtual int SetParameters(Teuchos::ParameterList& List);
00259
00261 virtual ostream& Print(ostream & os) const;
00262
00264
00266
00268 virtual int NumInitialize() const
00269 {
00270 return(NumInitialize_);
00271 }
00272
00274 virtual int NumCompute() const
00275 {
00276 return(NumCompute_);
00277 }
00278
00280 virtual int NumApplyInverse() const
00281 {
00282 return(NumApplyInverse_);
00283 }
00284
00286 virtual double InitializeTime() const
00287 {
00288 return(InitializeTime_);
00289 }
00290
00292 virtual double ComputeTime() const
00293 {
00294 return(ComputeTime_);
00295 }
00296
00298 virtual double ApplyInverseTime() const
00299 {
00300 return(ApplyInverseTime_);
00301 }
00302
00304 virtual double InitializeFlops() const
00305 {
00306 return(0.0);
00307 }
00308
00310 virtual double ComputeFlops() const
00311 {
00312 return(ComputeFlops_);
00313 }
00314
00316 virtual double ApplyInverseFlops() const
00317 {
00318 return(ApplyInverseFlops_);
00319 }
00320
00321
00322
00323 private:
00324
00325
00326
00328 virtual int ApplyInverseJacobi(const Epetra_MultiVector& X,
00329 Epetra_MultiVector& Y) const;
00330
00332 virtual int ApplyInverseGS(const Epetra_MultiVector& X,
00333 Epetra_MultiVector& Y) const;
00334
00335 virtual int ApplyInverseGS_RowMatrix(const Epetra_MultiVector& X,
00336 Epetra_MultiVector& Y) const;
00337
00338 virtual int ApplyInverseGS_CrsMatrix(const Epetra_CrsMatrix* A,
00339 const Epetra_MultiVector& X,
00340 Epetra_MultiVector& Y) const;
00341
00342 virtual int ApplyInverseGS_FastCrsMatrix(const Epetra_CrsMatrix* A,
00343 const Epetra_MultiVector& X,
00344 Epetra_MultiVector& Y) const;
00345
00347 virtual int ApplyInverseSGS(const Epetra_MultiVector& X,
00348 Epetra_MultiVector& Y) const;
00349
00350 virtual int ApplyInverseSGS_RowMatrix(const Epetra_MultiVector& X,
00351 Epetra_MultiVector& Y) const;
00352
00353 virtual int ApplyInverseSGS_CrsMatrix(const Epetra_CrsMatrix* A,
00354 const Epetra_MultiVector& X,
00355 Epetra_MultiVector& Y) const;
00356
00357 virtual int ApplyInverseSGS_FastCrsMatrix(const Epetra_CrsMatrix* A,
00358 const Epetra_MultiVector& X,
00359 Epetra_MultiVector& Y) const;
00361
00362 private:
00363
00365 virtual void SetLabel();
00366
00368 Ifpack_PointRelaxation(const Ifpack_PointRelaxation& rhs)
00369 {}
00370
00372 Ifpack_PointRelaxation& operator=(const Ifpack_PointRelaxation& rhs)
00373 {
00374 return(*this);
00375 }
00376
00377
00379 bool IsInitialized_;
00381 bool IsComputed_;
00383 int NumInitialize_;
00385 int NumCompute_;
00387 mutable int NumApplyInverse_;
00389 double InitializeTime_;
00391 double ComputeTime_;
00393 mutable double ApplyInverseTime_;
00395 double ComputeFlops_;
00397 mutable double ApplyInverseFlops_;
00398
00399
00400
00402 int NumSweeps_;
00404 double DampingFactor_;
00406 bool UseTranspose_;
00408 double Condest_;
00410 bool ComputeCondest_;
00412 string Label_;
00413 int PrecType_;
00414 double MinDiagonalValue_;
00415
00416
00417
00419 int NumMyRows_;
00421 int NumMyNonzeros_;
00423 int NumGlobalRows_;
00425 int NumGlobalNonzeros_;
00427 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00429 Teuchos::RefCountPtr<Epetra_Import> Importer_;
00431 mutable Teuchos::RefCountPtr<Epetra_Vector> Diagonal_;
00433 Teuchos::RefCountPtr<Epetra_Time> Time_;
00435 bool IsParallel_;
00437 bool ZeroStartingSolution_;
00439 bool DoBackwardGS_;
00441 bool DoL1Method_;
00443 double L1Eta_;
00444
00445
00446
00447
00448 };
00449
00450 #endif // IFPACK_POINTRELAXATION_H