Ifpack_Chebyshev.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_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   // @{ \name Utility methods
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   // @{ \name Private methods
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   // @{ Initializations, timing and flops
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   // @{ Settings
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   // @{ Other data
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

Generated on Wed May 12 21:46:03 2010 for IFPACK by  doxygen 1.4.7