00001 #ifndef IFPACK_DIAG_PRECONDITIONER_H 00002 #define IFPACK_DIAG_PRECONDITIONER_H 00003 00004 #include "Ifpack_ConfigDefs.h" 00005 #include "Epetra_Operator.h" 00006 #include "Epetra_Vector.h" 00007 class Epetra_BlockMap; 00008 class Epetra_Map; 00009 class Epetra_MultiVector; 00010 class Epetra_Comm; 00011 00012 using namespace std; 00013 00015 /* 00016 Ifpack_DiagPreconditioner: a class to wrap a vector as diagonal preconditioner. The preconditioner is simply defined by 00017 \f[ 00018 z_i = D_i r_i, 00019 \f] 00020 where \f$r,z\f$ are the vector to be preconditioned and the preconditioned vector, and \f$D_i\f$ is the i-th element of the scaling vector. 00021 00022 \author Marzio Sala, ETHZ/D-INFK 00023 00024 \date Last updated on 17-Apr-06 00025 00026 */ 00027 class Ifpack_DiagPreconditioner : public Epetra_Operator 00028 { 00029 public: 00030 00032 Ifpack_DiagPreconditioner(const Epetra_Map& DomainMap, 00033 const Epetra_Map& RangeMap, 00034 const Epetra_Vector& diag); 00035 00037 ~Ifpack_DiagPreconditioner(); 00038 00039 int SetUseTranspose(bool UseTranspose) 00040 { 00041 UseTranspose_ = UseTranspose; 00042 return(0); 00043 } 00044 00045 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00046 00047 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00048 00049 double NormInf() const 00050 { 00051 return(-1.0); 00052 } 00053 00054 const char* Label() const 00055 { 00056 return("Ifpack_DiagPreconditioner"); 00057 } 00058 00059 bool UseTranspose() const 00060 { 00061 return(UseTranspose_); 00062 } 00063 00064 bool HasNormInf() const 00065 { 00066 return(false); 00067 } 00068 00069 const Epetra_Comm& Comm() const 00070 { 00071 return(diag_.Comm()); 00072 } 00073 00074 const Epetra_Map& OperatorDomainMap() const 00075 { 00076 return(RangeMap_); 00077 } 00078 00079 const Epetra_Map& OperatorRangeMap() const 00080 { 00081 return(DomainMap_); 00082 } 00083 00084 const Epetra_BlockMap& Map() const 00085 { 00086 return(diag_.Map()); 00087 } 00088 00089 private: 00090 bool UseTranspose_; 00091 const Epetra_Map& DomainMap_; 00092 const Epetra_Map& RangeMap_; 00093 const Epetra_Vector& diag_; 00094 }; 00095 00096 #endif
1.3.9.1