Ifpack_CrsIct.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_CRSICT_H_
00031 #define _IFPACK_CRSICT_H_
00032 
00033 #include "Ifpack_ScalingType.h"
00034 #include "Ifpack_IlukGraph.h"
00035 #include "Epetra_CombineMode.h"
00036 #include "Epetra_CompObject.h"
00037 #include "Epetra_Operator.h"
00038 #include "Epetra_CrsMatrix.h"
00039 #include "Epetra_Object.h"
00040 #include "Epetra_Vector.h"
00041 class Epetra_Comm;
00042 class Epetra_Map;
00043 class Epetra_CrsMatrix;
00044 class Epetra_MultiVector;
00045 
00046 #ifdef HAVE_IFPACK_TEUCHOS
00047 namespace Teuchos {
00048   class ParameterList;
00049 }
00050 #endif
00051 
00053 
00157 class Ifpack_CrsIct: public Epetra_Object, public Epetra_CompObject, public virtual Epetra_Operator {
00158       
00159   // Give ostream << function some access to private and protected data/functions.
00160 
00161   friend ostream& operator << (ostream& os, const Ifpack_CrsIct& A);
00162 
00163  public:
00165 
00172   Ifpack_CrsIct(const Epetra_CrsMatrix &A, double Droptol = 1.0E-4, int Lfil = 20);
00173   
00175   Ifpack_CrsIct(const Ifpack_CrsIct & IctOperator);
00176 
00178   virtual ~Ifpack_CrsIct();
00179 
00181   void SetAbsoluteThreshold( double Athresh) {Athresh_ = Athresh; return;}
00182 
00184   void SetRelativeThreshold( double Rthresh) {Rthresh_ = Rthresh; return;}
00185 
00187   void SetOverlapMode( Epetra_CombineMode OverlapMode) {OverlapMode_ = OverlapMode; return;}
00188 
00189 #ifdef HAVE_IFPACK_TEUCHOS
00190 
00191   /* This method is only available if the Teuchos package is enabled.
00192      This method recognizes five parameter names: level_fill, drop_tolerance,
00193      absolute_threshold, relative_threshold and overlap_mode. These names are
00194      case insensitive. For level_fill the ParameterEntry must have type int, the 
00195      threshold entries must have type double and overlap_mode must have type
00196      Epetra_CombineMode.
00197   */
00198   int SetParameters(const Teuchos::ParameterList& parameterlist,
00199                     bool cerr_warning_if_unused=false);
00200 #endif
00201 
00203 
00209   int InitValues(const Epetra_CrsMatrix &A);
00210 
00212   bool ValuesInitialized() const {return(ValuesInitialized_);};
00213 
00215 
00223   int Factor();
00224 
00226   bool Factored() const {return(Factored_);};
00227   
00228 
00229   // Mathematical functions.
00230   
00231   
00233 
00243   int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00244 
00246 
00256   int Multiply(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00257 
00259 
00267   int Condest(bool Trans, double & ConditionNumberEstimate) const;
00268   // Atribute access functions
00269   
00271   double GetAbsoluteThreshold() {return Athresh_;}
00272 
00274   double GetRelativeThreshold() {return Rthresh_;}
00275     
00277   Epetra_CombineMode GetOverlapMode() {return OverlapMode_;}
00278 
00280   int NumGlobalNonzeros() const {return(U().NumGlobalNonzeros()+D().GlobalLength());};
00281  
00283   int NumMyNonzeros() const {return(U().NumMyNonzeros()+D().MyLength());};
00285   const Epetra_Vector & D() const {return(*D_);};
00286     
00288   const Epetra_CrsMatrix & U() const {return(*U_);};
00289 
00291 
00293     const char * Label() const {return(Epetra_Object::Label());};
00294     
00296 
00305   int SetUseTranspose(bool UseTranspose) {UseTranspose_ = UseTranspose; return(0);};
00306 
00308 
00319   int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const {
00320     return(Multiply(Ifpack_CrsIct::UseTranspose(), X, Y));};
00321 
00323 
00336   int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const {
00337     return(Solve(Ifpack_CrsIct::UseTranspose(), X, Y));};
00338 
00340     double NormInf() const {return(0.0);};
00341 
00343     bool HasNormInf() const {return(false);};
00344 
00346     bool UseTranspose() const {return(UseTranspose_);};
00347 
00349     const Epetra_Map & OperatorDomainMap() const {return(A_.DomainMap());};
00350 
00352     const Epetra_Map & OperatorRangeMap() const{return(A_.RangeMap());};
00353 
00355     const Epetra_Comm & Comm() const{return(Comm_);};
00357 
00358  protected:
00359  protected:
00360   void SetFactored(bool Flag) {Factored_ = Flag;};
00361   void SetValuesInitialized(bool Flag) {ValuesInitialized_ = Flag;};
00362   bool Allocated() const {return(Allocated_);};
00363   int SetAllocated(bool Flag) {Allocated_ = Flag; return(0);};
00364   
00365  private:
00366   
00367   
00368   int Allocate();
00369     
00370   const Epetra_CrsMatrix &A_;
00371   const Epetra_Comm & Comm_;
00372   Epetra_CrsMatrix * U_;
00373   Epetra_Vector * D_;
00374   bool UseTranspose_;
00375 
00376   
00377   bool Allocated_;
00378   bool ValuesInitialized_;
00379   bool Factored_;
00380   mutable double Condest_;
00381   double Athresh_;
00382   double Rthresh_;
00383   double Droptol_;
00384   int Lfil_;
00385 
00386   mutable Epetra_MultiVector * OverlapX_;
00387   mutable Epetra_MultiVector * OverlapY_;
00388   int LevelOverlap_;
00389   Epetra_CombineMode OverlapMode_;
00390 
00391   void * Aict_;
00392   void * Lict_;
00393   double * Ldiag_;
00394 
00395 };
00396 
00398 ostream& operator << (ostream& os, const Ifpack_CrsIct& A);
00399 
00400 #endif /* _IFPACK_CRSICT_H_ */

Generated on Thu Sep 18 12:37:21 2008 for Ifpack Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1