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_MultiVector.h"
00041 #include "Epetra_Vector.h"
00042 
00043 #include "Teuchos_RefCountPtr.hpp"
00044 
00045 class Epetra_Comm;
00046 class Epetra_Map;
00047 
00048 namespace Teuchos {
00049   class ParameterList;
00050 }
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 
00190   /* This method is only available if the Teuchos package is enabled.
00191      This method recognizes five parameter names: level_fill, drop_tolerance,
00192      absolute_threshold, relative_threshold and overlap_mode. These names are
00193      case insensitive. For level_fill the ParameterEntry must have type int, the 
00194      threshold entries must have type double and overlap_mode must have type
00195      Epetra_CombineMode.
00196   */
00197   int SetParameters(const Teuchos::ParameterList& parameterlist,
00198                     bool cerr_warning_if_unused=false);
00199 
00201 
00207   int InitValues(const Epetra_CrsMatrix &A);
00208 
00210   bool ValuesInitialized() const {return(ValuesInitialized_);};
00211 
00213 
00221   int Factor();
00222 
00224   bool Factored() const {return(Factored_);};
00225   
00226 
00227   // Mathematical functions.
00228   
00229   
00231 
00241   int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00242 
00244 
00254   int Multiply(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00255 
00257 
00265   int Condest(bool Trans, double & ConditionNumberEstimate) const;
00266   // Atribute access functions
00267   
00269   double GetAbsoluteThreshold() {return Athresh_;}
00270 
00272   double GetRelativeThreshold() {return Rthresh_;}
00273     
00275   Epetra_CombineMode GetOverlapMode() {return OverlapMode_;}
00276 
00278   int NumGlobalNonzeros() const {return(U().NumGlobalNonzeros()+D().GlobalLength());};
00279  
00281   int NumMyNonzeros() const {return(U().NumMyNonzeros()+D().MyLength());};
00283   const Epetra_Vector & D() const {return(*D_);};
00284     
00286   const Epetra_CrsMatrix & U() const {return(*U_);};
00287 
00289 
00291     const char * Label() const {return(Epetra_Object::Label());};
00292     
00294 
00303   int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00304 
00306 
00317   int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const {
00318     return(Multiply(Ifpack_CrsIct::UseTranspose(), X, Y));};
00319 
00321 
00334   int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const {
00335     return(Solve(Ifpack_CrsIct::UseTranspose(), X, Y));};
00336 
00338     double NormInf() const {return(0.0);};
00339 
00341     bool HasNormInf() const {return(false);};
00342 
00344     bool UseTranspose() const {return(UseTranspose_);};
00345 
00347     const Epetra_Map & OperatorDomainMap() const {return(A_.DomainMap());};
00348 
00350     const Epetra_Map & OperatorRangeMap() const{return(A_.RangeMap());};
00351 
00353     const Epetra_Comm & Comm() const{return(Comm_);};
00355 
00356  protected:
00357   void SetFactored(bool Flag) {Factored_ = Flag;};
00358   void SetValuesInitialized(bool Flag) {ValuesInitialized_ = Flag;};
00359   bool Allocated() const {return(Allocated_);};
00360   int SetAllocated(bool Flag) {Allocated_ = Flag; return(0);};
00361   
00362  private:
00363   
00364   
00365   int Allocate();
00366     
00367   const Epetra_CrsMatrix &A_;
00368   const Epetra_Comm & Comm_;
00369   Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00370   Teuchos::RefCountPtr<Epetra_Vector> D_;
00371   bool UseTranspose_;
00372 
00373   
00374   bool Allocated_;
00375   bool ValuesInitialized_;
00376   bool Factored_;
00377   mutable double Condest_;
00378   double Athresh_;
00379   double Rthresh_;
00380   double Droptol_;
00381   int Lfil_;
00382 
00383   mutable Teuchos::RefCountPtr<Epetra_MultiVector> OverlapX_;
00384   mutable Teuchos::RefCountPtr<Epetra_MultiVector> OverlapY_;
00385   int LevelOverlap_;
00386   Epetra_CombineMode OverlapMode_;
00387 
00388   void * Aict_;
00389   void * Lict_;
00390   double * Ldiag_;
00391 
00392 };
00393 
00395 ostream& operator << (ostream& os, const Ifpack_CrsIct& A);
00396 
00397 #endif /* _IFPACK_CRSICT_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