Ifpack Package Browser (Single Doxygen Collection) Development
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_config.h"
00034 
00035 #include "Ifpack_ScalingType.h"
00036 #include "Ifpack_IlukGraph.h"
00037 #include "Epetra_CombineMode.h"
00038 #include "Epetra_CompObject.h"
00039 #include "Epetra_Operator.h"
00040 #include "Epetra_CrsMatrix.h"
00041 #include "Epetra_Object.h"
00042 #include "Epetra_MultiVector.h"
00043 #include "Epetra_Vector.h"
00044 
00045 #include "Teuchos_RefCountPtr.hpp"
00046 
00047 class Epetra_Comm;
00048 class Epetra_Map;
00049 
00050 namespace Teuchos {
00051   class ParameterList;
00052 }
00053 
00055 
00159 class IFPACK_DEPRECATED Ifpack_CrsIct: public Epetra_Object, public Epetra_CompObject, public virtual Epetra_Operator {
00160       
00161   // Give ostream << function some access to private and protected data/functions.
00162 
00163   friend ostream& operator << (ostream& os, const Ifpack_CrsIct& A);
00164 
00165  public:
00167 
00174   Ifpack_CrsIct(const Epetra_CrsMatrix &A, double Droptol = 1.0E-4, int Lfil = 20);
00175   
00177   Ifpack_CrsIct(const Ifpack_CrsIct & IctOperator);
00178 
00180   virtual ~Ifpack_CrsIct();
00181 
00183   void SetAbsoluteThreshold( double Athresh) {Athresh_ = Athresh; return;}
00184 
00186   void SetRelativeThreshold( double Rthresh) {Rthresh_ = Rthresh; return;}
00187 
00189   void SetOverlapMode( Epetra_CombineMode OverlapMode) {OverlapMode_ = OverlapMode; return;}
00190 
00192   /* This method is only available if the Teuchos package is enabled.
00193      This method recognizes five parameter names: level_fill, drop_tolerance,
00194      absolute_threshold, relative_threshold and overlap_mode. These names are
00195      case insensitive. For level_fill the ParameterEntry must have type int, the 
00196      threshold entries must have type double and overlap_mode must have type
00197      Epetra_CombineMode.
00198   */
00199   int SetParameters(const Teuchos::ParameterList& parameterlist,
00200                     bool cerr_warning_if_unused=false);
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   // Attribute 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_in) {UseTranspose_ = UseTranspose_in; 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   void SetFactored(bool Flag) {Factored_ = Flag;};
00360   void SetValuesInitialized(bool Flag) {ValuesInitialized_ = Flag;};
00361   bool Allocated() const {return(Allocated_);};
00362   int SetAllocated(bool Flag) {Allocated_ = Flag; return(0);};
00363   
00364  private:
00365   
00366   
00367   int Allocate();
00368     
00369   const Epetra_CrsMatrix &A_;
00370   const Epetra_Comm & Comm_;
00371   Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00372   Teuchos::RefCountPtr<Epetra_Vector> D_;
00373   bool UseTranspose_;
00374 
00375   
00376   bool Allocated_;
00377   bool ValuesInitialized_;
00378   bool Factored_;
00379   mutable double Condest_;
00380   double Athresh_;
00381   double Rthresh_;
00382   double Droptol_;
00383   int Lfil_;
00384 
00385   mutable Teuchos::RefCountPtr<Epetra_MultiVector> OverlapX_;
00386   mutable Teuchos::RefCountPtr<Epetra_MultiVector> OverlapY_;
00387   int LevelOverlap_;
00388   Epetra_CombineMode OverlapMode_;
00389 
00390   void * Aict_;
00391   void * Lict_;
00392   double * Ldiag_;
00393 
00394 };
00395 
00397 ostream& operator << (ostream& os, const Ifpack_CrsIct& A);
00398 
00399 #endif /* _IFPACK_CRSICT_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines