Ifpack_ILUT.h

Go to the documentation of this file.
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_ILUT_H
00031 #define IFPACK_ILUT_H
00032 
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Ifpack_CondestType.h"
00035 #include "Ifpack_ScalingType.h"
00036 #include "Ifpack_Preconditioner.h"
00037 #include "Epetra_Vector.h"
00038 #include "Epetra_CrsMatrix.h"
00039 #include "Epetra_Time.h"
00040 #include "Teuchos_RefCountPtr.hpp"
00041 
00042 class Epetra_RowMatrix;
00043 class Epetra_SerialComm;
00044 class Epetra_Comm;
00045 class Epetra_Map;
00046 class Epetra_MultiVector;
00047 
00048 namespace Teuchos {
00049   class ParameterList;
00050 }
00051 
00053 
00068 class Ifpack_ILUT: public Ifpack_Preconditioner {
00069       
00070 public:
00071   // @{ Constructors and Destructors
00073   Ifpack_ILUT(const Epetra_RowMatrix* A);
00074   
00076   virtual ~Ifpack_ILUT();
00077 
00078   // @}
00079   // @{ Construction methods
00081   /* This method is only available if the Teuchos package is enabled.
00082      This method recognizes five parameter names: level_fill, drop_tolerance,
00083      absolute_threshold, relative_threshold and overlap_mode. These names are
00084      case insensitive. For level_fill the ParameterEntry must have type int, the 
00085      threshold entries must have type double and overlap_mode must have type
00086      Epetra_CombineMode.
00087   */
00088   int SetParameters(Teuchos::ParameterList& parameterlis);
00089 
00091 
00097   int Initialize();
00098 
00100   bool IsInitialized() const
00101   {
00102     return(IsInitialized_);
00103   }
00104 
00106 
00114   int Compute();
00115 
00117   bool IsComputed() const {return(IsComputed_);};
00118 
00119   // Mathematical functions.
00120   
00122 
00130   int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00131 
00132   int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00133 
00135   double Condest(const Ifpack_CondestType CT = Ifpack_Cheap, 
00136                  const int MaxIters = 1550,
00137                  const double Tol = 1e-9,
00138      Epetra_RowMatrix* Matrix_in = 0);
00139 
00141   double Condest() const
00142   {
00143     return(Condest_);
00144   }
00145 
00147 
00156   int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00157 
00159   double NormInf() const {return(0.0);};
00160 
00162   bool HasNormInf() const {return(false);};
00163 
00165   bool UseTranspose() const {return(UseTranspose_);};
00166 
00168   const Epetra_Map & OperatorDomainMap() const {return(A_.OperatorDomainMap());};
00169 
00171   const Epetra_Map & OperatorRangeMap() const{return(A_.OperatorRangeMap());};
00172 
00174   const Epetra_Comm & Comm() const{return(Comm_);};
00175 
00177   const Epetra_RowMatrix& Matrix() const
00178   {
00179     return(A_);
00180   }
00181 
00183   const Epetra_CrsMatrix & L() const {return(*L_);};
00184   
00186   const Epetra_CrsMatrix & U() const {return(*U_);};
00187     
00189   const char* Label() const
00190   {
00191     return(Label_.c_str());
00192   }
00193 
00195   int SetLabel(const char* Label_in)
00196   {
00197     Label_ = Label_in;
00198     return(0);
00199   }
00200  
00202   virtual ostream& Print(std::ostream& os) const;
00203 
00205   virtual int NumInitialize() const
00206   {
00207     return(NumInitialize_);
00208   }
00209 
00211   virtual int NumCompute() const
00212   {
00213     return(NumCompute_);
00214   }
00215 
00217   virtual int NumApplyInverse() const
00218   {
00219     return(NumApplyInverse_);
00220   }
00221 
00223   virtual double InitializeTime() const
00224   {
00225     return(InitializeTime_);
00226   }
00227 
00229   virtual double ComputeTime() const
00230   {
00231     return(ComputeTime_);
00232   }
00233 
00235   virtual double ApplyInverseTime() const
00236   {
00237     return(ApplyInverseTime_);
00238   }
00239 
00241   virtual double InitializeFlops() const
00242   {
00243     return(0.0);
00244   }
00245 
00246   virtual double ComputeFlops() const
00247   {
00248     return(ComputeFlops_);
00249   }
00250 
00251   virtual double ApplyInverseFlops() const
00252   {
00253     return(ApplyInverseFlops_);
00254   }
00255 
00256   inline double LevelOfFill() const {
00257     return(LevelOfFill_);
00258   }
00259 
00261   inline double RelaxValue() const {
00262     return(Relax_);
00263   }
00264 
00266   inline double AbsoluteThreshold() const
00267   {
00268     return(Athresh_);
00269   }
00270 
00272   inline double RelativeThreshold() const
00273   {
00274     return(Rthresh_);
00275   }
00276     
00278   inline double DropTolerance() const
00279   {
00280     return(DropTolerance_);
00281   }
00282     
00284   int NumGlobalNonzeros() const {
00285     // FIXME: diagonal of L_ should not be stored
00286     return(L().NumGlobalNonzeros() + U().NumGlobalNonzeros() - L().NumGlobalRows());
00287   }
00288  
00290   int NumMyNonzeros() const {
00291     return(L().NumMyNonzeros() + U().NumMyNonzeros());
00292   }
00293 
00294 private:
00295   
00296   // @}
00297   // @{ Internal methods
00298 
00300   Ifpack_ILUT(const Ifpack_ILUT& RHS) :
00301     A_(RHS.Matrix()),
00302     Comm_(RHS.Comm()),
00303     Time_(Comm())
00304   {};
00305 
00307   Ifpack_ILUT& operator=(const Ifpack_ILUT& RHS)
00308   {
00309     return(*this);
00310   }
00311 
00313   void Destroy();
00314 
00315   // @}
00316   // @{ Internal data
00317 
00319   const Epetra_RowMatrix& A_;
00321   const Epetra_Comm& Comm_;
00323   Teuchos::RefCountPtr<Epetra_CrsMatrix> L_;
00325   Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00327   double Condest_;
00329   double Relax_;
00331   double Athresh_;
00333   double Rthresh_;
00335   double LevelOfFill_;
00337   double DropTolerance_;
00339   string Label_;
00341   bool IsInitialized_;
00343   bool IsComputed_;
00345   bool UseTranspose_;
00347   int NumMyRows_;
00349   int NumInitialize_;
00351   int NumCompute_;
00353   mutable int NumApplyInverse_;
00355   double InitializeTime_;
00357   double ComputeTime_;
00359   mutable double ApplyInverseTime_;
00361   double ComputeFlops_;
00363   mutable double ApplyInverseFlops_;
00365   mutable Epetra_Time Time_;
00367   int GlobalNonzeros_;
00368   Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
00369   Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
00370 }; // Ifpack_ILUT
00371 
00372 #endif /* IFPACK_ILUT_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:05:34 2011 for Ifpack Package Browser (Single Doxygen Collection) by  doxygen 1.6.3