Ifpack_PointRelaxation.h

00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2002) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
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 
00163 
00173   virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00174 
00176   virtual double NormInf() const
00177   {
00178     return(-1.0);
00179   }
00181 
00183 
00184   virtual const char * Label() const
00185   {
00186     return(Label_.c_str());
00187   }
00188 
00190   virtual bool UseTranspose() const
00191   {
00192     return(UseTranspose_);
00193   }
00194 
00196   virtual bool HasNormInf() const
00197   {
00198     return(false);
00199   }
00200 
00202   virtual const Epetra_Comm & Comm() const;
00203 
00205   virtual const Epetra_Map & OperatorDomainMap() const;
00206 
00208   virtual const Epetra_Map & OperatorRangeMap() const;
00209 
00210   virtual int Initialize();
00211   
00212   virtual bool IsInitialized() const
00213   {
00214     return(IsInitialized_);
00215   }
00216 
00218   virtual inline bool IsComputed() const
00219   {
00220     return(IsComputed_);
00221   }
00222 
00224   virtual int Compute();
00225 
00227  
00229 
00230   virtual const Epetra_RowMatrix& Matrix() const 
00231   {
00232     return(*Matrix_);
00233   }
00234 
00236   virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00237                          const int MaxIters = 1550,
00238                          const double Tol = 1e-9,
00239              Epetra_RowMatrix* Matrix = 0);
00240 
00242   virtual double Condest() const
00243   {
00244     return(Condest_);
00245   }
00246 
00248   virtual int SetParameters(Teuchos::ParameterList& List);
00249 
00251   virtual ostream& Print(ostream & os) const;
00252 
00254 
00256 
00258   virtual int NumInitialize() const
00259   {
00260     return(NumInitialize_);
00261   }
00262 
00264   virtual int NumCompute() const
00265   {
00266     return(NumCompute_);
00267   }
00268 
00270   virtual int NumApplyInverse() const
00271   {
00272     return(NumApplyInverse_);
00273   }
00274 
00276   virtual double InitializeTime() const
00277   {
00278     return(InitializeTime_);
00279   }
00280 
00282   virtual double ComputeTime() const
00283   {
00284     return(ComputeTime_);
00285   }
00286 
00288   virtual double ApplyInverseTime() const
00289   {
00290     return(ApplyInverseTime_);
00291   }
00292 
00294   virtual double InitializeFlops() const
00295   {
00296     return(0.0);
00297   }
00298 
00300   virtual double ComputeFlops() const
00301   {
00302     return(ComputeFlops_);
00303   }
00304 
00306   virtual double ApplyInverseFlops() const
00307   {
00308     return(ApplyInverseFlops_);
00309   }
00310 
00311   // @}
00312 
00313 private:
00314  
00315   // @{ Application of the preconditioner
00316   
00318   virtual int ApplyInverseJacobi(const Epetra_MultiVector& X, 
00319                                  Epetra_MultiVector& Y) const;
00320 
00322   virtual int ApplyInverseGS(const Epetra_MultiVector& X, 
00323                               Epetra_MultiVector& Y) const;
00324 
00325   virtual int ApplyInverseGS_RowMatrix(const Epetra_MultiVector& X, 
00326                                         Epetra_MultiVector& Y) const;
00327 
00328   virtual int ApplyInverseGS_CrsMatrix(const Epetra_CrsMatrix* A,
00329                                         const Epetra_MultiVector& X, 
00330                                         Epetra_MultiVector& Y) const;
00331 
00332   virtual int ApplyInverseGS_FastCrsMatrix(const Epetra_CrsMatrix* A,
00333                                             const Epetra_MultiVector& X, 
00334                                             Epetra_MultiVector& Y) const;
00335 
00337   virtual int ApplyInverseSGS(const Epetra_MultiVector& X, 
00338                               Epetra_MultiVector& Y) const;
00339 
00340   virtual int ApplyInverseSGS_RowMatrix(const Epetra_MultiVector& X, 
00341                                         Epetra_MultiVector& Y) const;
00342 
00343   virtual int ApplyInverseSGS_CrsMatrix(const Epetra_CrsMatrix* A,
00344                                         const Epetra_MultiVector& X, 
00345                                         Epetra_MultiVector& Y) const;
00346 
00347   virtual int ApplyInverseSGS_FastCrsMatrix(const Epetra_CrsMatrix* A,
00348                                             const Epetra_MultiVector& X, 
00349                                             Epetra_MultiVector& Y) const;
00351 
00352 private:
00353   
00355   virtual void SetLabel();
00356 
00358   Ifpack_PointRelaxation(const Ifpack_PointRelaxation& rhs)
00359   {}
00360   
00362   Ifpack_PointRelaxation& operator=(const Ifpack_PointRelaxation& rhs)
00363   {
00364     return(*this);
00365   }
00366 
00367   // @{ Initializations, timing and flops
00369   bool IsInitialized_;
00371   bool IsComputed_;
00373   int NumInitialize_;
00375   int NumCompute_;
00377   mutable int NumApplyInverse_;
00379   double InitializeTime_;
00381   double ComputeTime_;
00383   mutable double ApplyInverseTime_;
00385   double ComputeFlops_;
00387   mutable double ApplyInverseFlops_;
00388   // @}
00389 
00390   // @{ Settings
00392   int NumSweeps_;
00394   double DampingFactor_;
00396   bool UseTranspose_;
00398   double Condest_;
00400   bool ComputeCondest_;
00402   string Label_;
00403   int PrecType_;
00404   double MinDiagonalValue_;
00405   // @}
00406 
00407   // @{ Other data
00409   int NumMyRows_;
00411   int NumMyNonzeros_;
00413   int NumGlobalRows_;
00415   int NumGlobalNonzeros_;
00417   Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00419   Teuchos::RefCountPtr<Epetra_Import> Importer_;
00421   mutable Teuchos::RefCountPtr<Epetra_Vector> Diagonal_;
00423   Teuchos::RefCountPtr<Epetra_Time> Time_;
00425   bool IsParallel_;
00427   bool ZeroStartingSolution_;
00429   bool DoBackwardGS_;
00430   // @}
00431 
00432   
00433 
00434 };
00435 
00436 #endif // IFPACK_POINTRELAXATION_H

Generated on Wed May 12 21:30:18 2010 for IFPACK by  doxygen 1.4.7