IFPACK Development
Ifpack_ICT.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_ICT_H
00031 #define IFPACK_ICT_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 
00070 class Ifpack_ICT: public Ifpack_Preconditioner {
00071       
00072  public:
00074 
00081   Ifpack_ICT(const Epetra_RowMatrix* A);
00082   
00084   virtual ~Ifpack_ICT();
00085 
00087   /* This method is only available if the Teuchos package is enabled.
00088      This method recognizes five parameter names: level_fill, drop_tolerance,
00089      absolute_threshold, relative_threshold and overlap_mode. These names are
00090      case insensitive. For level_fill the ParameterEntry must have type int, the 
00091      threshold entries must have type double and overlap_mode must have type
00092      Epetra_CombineMode.
00093   */
00094   int SetParameters(Teuchos::ParameterList& parameterlis);
00095 
00097   const Epetra_RowMatrix& Matrix() const
00098   {
00099     return(A_);
00100   }
00101 
00103   bool IsInitialized() const
00104   {
00105     return(IsInitialized_);
00106   }
00107 
00109 
00115   int Initialize();
00116 
00118 
00126   int Compute();
00127 
00129   bool IsComputed() const {return(IsComputed_);};
00130 
00131   // Mathematical functions.
00132   
00134 
00144   int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00145 
00146   int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00147 
00149 
00157   double Condest(const Ifpack_CondestType CT = Ifpack_Cheap, 
00158                  const int MaxIters = 1550,
00159                  const double Tol = 1e-9,
00160          Epetra_RowMatrix* Matrix_in = 0);
00161 
00162   double Condest() const
00163   {
00164     return(Condest_);
00165   }
00166 
00167   // Atribute access functions
00168     
00170   int NumGlobalNonzeros() const {return(H().NumGlobalNonzeros());};
00171  
00173   int NumMyNonzeros() const {return(H().NumMyNonzeros());};
00174 
00176   const Epetra_CrsMatrix& H() const {return(*H_);};
00177     
00179 
00181 
00190   int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00191 
00193   double NormInf() const {return(0.0);};
00194 
00196   bool HasNormInf() const {return(false);};
00197 
00199   bool UseTranspose() const {return(UseTranspose_);};
00200 
00202   const Epetra_Map& OperatorDomainMap() const {return(A_.OperatorDomainMap());};
00203 
00205   const Epetra_Map& OperatorRangeMap() const{return(A_.OperatorRangeMap());};
00206 
00208   const Epetra_Comm& Comm() const{return(Comm_);};
00210 
00211   const char* Label() const
00212   {
00213     return(Label_.c_str());
00214   }
00215 
00216   int SetLabel(const char* Label_in)
00217   {
00218     Label_ = Label_in;
00219     return(0);
00220   }
00221  
00223   virtual ostream& Print(std::ostream& os) const;
00224 
00226   virtual int NumInitialize() const
00227   {
00228     return(NumInitialize_);
00229   }
00230 
00232   virtual int NumCompute() const
00233   {
00234     return(NumCompute_);
00235   }
00236 
00238   virtual int NumApplyInverse() const
00239   {
00240     return(NumApplyInverse_);
00241   }
00242 
00244   virtual double InitializeTime() const
00245   {
00246     return(InitializeTime_);
00247   }
00248 
00250   virtual double ComputeTime() const
00251   {
00252     return(ComputeTime_);
00253   }
00254 
00256   virtual double ApplyInverseTime() const
00257   {
00258     return(ApplyInverseTime_);
00259   }
00260 
00262   virtual double InitializeFlops() const
00263   {
00264     return(0.0);
00265   }
00266 
00268   virtual double ComputeFlops() const
00269   {
00270     return(ComputeFlops_);
00271   }
00272 
00274   virtual double ApplyInverseFlops() const
00275   {
00276     return(ApplyInverseFlops_);
00277   }
00278 
00280 
00283   inline double LevelOfFill() const
00284   {
00285     return(LevelOfFill_);
00286   }
00287 
00289   inline double AbsoluteThreshold() const
00290   {
00291     return(Athresh_);
00292   }
00293 
00295   inline double RelativeThreshold() const
00296   {
00297     return(Rthresh_);
00298   }
00299 
00301   inline double RelaxValue() const
00302   {
00303     return(Relax_);
00304   }
00305 
00307   inline double DropTolerance() const
00308   {
00309     return(DropTolerance_);
00310   }
00311 
00312 private:
00313   
00315   Ifpack_ICT(const Ifpack_ICT& rhs) :
00316     A_(rhs.Matrix()),
00317     Comm_(Comm()),
00318     Time_(Comm())
00319   {}
00320 
00322   Ifpack_ICT& operator=(const Ifpack_ICT& rhs)
00323   {
00324     return(*this);
00325   }
00326 
00328   void Destroy();
00329 
00331   const Epetra_RowMatrix& A_;
00333   const Epetra_Comm& Comm_;
00335   Teuchos::RefCountPtr<Epetra_CrsMatrix> H_;
00337   double Condest_;
00339   double Athresh_;
00341   double Rthresh_;
00343   double LevelOfFill_;
00345   double DropTolerance_;
00347   double Relax_;
00349   string Label_;
00351   bool IsInitialized_;
00353   bool IsComputed_;
00355   bool UseTranspose_;
00357   int NumMyRows_;
00359   int NumInitialize_;
00361   int NumCompute_;
00363   mutable int NumApplyInverse_;
00365   double InitializeTime_;
00367   double ComputeTime_;
00369   mutable double ApplyInverseTime_;
00371   double ComputeFlops_;
00373   mutable double ApplyInverseFlops_;
00375   mutable Epetra_Time Time_;
00377   int GlobalNonzeros_;
00378   Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
00379   Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
00380 };
00381 
00382 #endif /* IFPACK_ICT_H */
 All Classes Files Functions Variables Enumerations Friends