00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef IFPACK_IHSS_H
00044 #define IFPACK_IHSS_H
00045
00046 #include "Ifpack_ConfigDefs.h"
00047 #include "Ifpack_Preconditioner.h"
00048
00049 #ifdef HAVE_IFPACK_EPETRAEXT
00050 #include "Ifpack_Condest.h"
00051 #include "Ifpack_ScalingType.h"
00052 #include "Epetra_CompObject.h"
00053 #include "Epetra_MultiVector.h"
00054 #include "Epetra_Vector.h"
00055 #include "Epetra_CrsGraph.h"
00056 #include "Epetra_CrsMatrix.h"
00057 #include "Epetra_BlockMap.h"
00058 #include "Epetra_Map.h"
00059 #include "Epetra_Object.h"
00060 #include "Epetra_Comm.h"
00061 #include "Epetra_CrsMatrix.h"
00062 #include "Epetra_Time.h"
00063 #include "Teuchos_RefCountPtr.hpp"
00064
00065
00066 namespace Teuchos {
00067 class ParameterList;
00068 }
00069
00071
00079 class Ifpack_IHSS: public Ifpack_Preconditioner {
00080
00081 public:
00082
00084
00086 Ifpack_IHSS(Epetra_RowMatrix* A);
00087
00089 ~Ifpack_IHSS()
00090 {
00091 Destroy();
00092 }
00093
00094
00095
00096
00098 int Initialize();
00099
00101 bool IsInitialized() const
00102 {
00103 return(IsInitialized_);
00104 }
00105
00107
00109 int Compute();
00110
00112 bool IsComputed() const
00113 {
00114 return(IsComputed_);
00115 }
00116
00118
00119
00120
00121
00122
00123
00124
00125 int SetParameters(Teuchos::ParameterList& parameterlist);
00126
00128
00137 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00138
00139
00140
00141
00142 int Apply(const Epetra_MultiVector& X,
00143 Epetra_MultiVector& Y) const
00144 {
00145 return(Multiply(false,X,Y));
00146 }
00147
00148 int Multiply(bool Trans, const Epetra_MultiVector& X,
00149 Epetra_MultiVector& Y) const{return A_->Multiply(Trans,X,Y);}
00150
00152
00165 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00166
00168 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00169 const int MaxIters = 1550,
00170 const double Tol = 1e-9,
00171 Epetra_RowMatrix* Matrix_in = 0);
00172
00174 double Condest() const
00175 {
00176 return(Condest_);
00177 }
00178
00179
00180
00181
00183 const char* Label() const {return(Label_);}
00184
00186 int SetLabel(const char* Label_in)
00187 {
00188 strcpy(Label_,Label_in);
00189 return(0);
00190 }
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(A_->Comm());};
00209
00211 const Epetra_RowMatrix& Matrix() const
00212 {
00213 return(*A_);
00214 }
00215
00217 virtual ostream& Print(ostream& os) const;
00218
00220 virtual int NumInitialize() const
00221 {
00222 return(NumInitialize_);
00223 }
00224
00226 virtual int NumCompute() const
00227 {
00228 return(NumCompute_);
00229 }
00230
00232 virtual int NumApplyInverse() const
00233 {
00234 return(NumApplyInverse_);
00235 }
00236
00238 virtual double InitializeTime() const
00239 {
00240 return(InitializeTime_);
00241 }
00242
00244 virtual double ComputeTime() const
00245 {
00246 return(ComputeTime_);
00247 }
00248
00250 virtual double ApplyInverseTime() const
00251 {
00252 return(ApplyInverseTime_);
00253 }
00254
00256 virtual double InitializeFlops() const
00257 {
00258 return(0.0);
00259 }
00260
00261 virtual double ComputeFlops() const
00262 {
00263 return(ComputeFlops_);
00264 }
00265
00266 virtual double ApplyInverseFlops() const
00267 {
00268 return(ApplyInverseFlops_);
00269 }
00270
00271 private:
00272
00273
00274
00275
00277 Ifpack_IHSS(const Ifpack_IHSS& RHS) :
00278 Time_(RHS.Comm())
00279 {}
00280
00282 Ifpack_IHSS& operator=(const Ifpack_IHSS& RHS)
00283 {
00284 return(*this);
00285 }
00286
00288 void Destroy();
00289
00291
00301 int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00302
00303
00304 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00305
00306 int NumGlobalRows() const {return(A_->NumGlobalRows());};
00307
00309 int NumGlobalCols() const {return(A_->NumGlobalCols());};
00310 #endif
00311 long long NumGlobalRows64() const {return(A_->NumGlobalRows64());};
00312 long long NumGlobalCols64() const {return(A_->NumGlobalCols64());};
00313
00315 int NumMyRows() const {return(A_->NumMyRows());};
00316
00318 int NumMyCols() const {return(A_->NumMyCols());};
00319
00321 int PowerMethod(Epetra_Operator * Op,const int MaximumIterations, double& lambda_max);
00322
00324
00325
00326
00327
00328
00329
00330
00331
00333 Teuchos::RefCountPtr<Epetra_CrsMatrix> A_;
00334 Teuchos::RefCountPtr<Epetra_RowMatrix> Aherm_;
00335 Teuchos::RefCountPtr<Epetra_RowMatrix> Askew_;
00336 Teuchos::RefCountPtr<Ifpack_Preconditioner> Pherm_;
00337 Teuchos::RefCountPtr<Ifpack_Preconditioner> Pskew_;
00338
00339 Teuchos::ParameterList List_;
00340
00341 bool UseTranspose_;
00342 double Condest_;
00343
00344
00346 bool IsInitialized_;
00348 bool IsComputed_;
00350 char Label_[160];
00352 int NumInitialize_;
00354 int NumCompute_;
00355
00357 int EigMaxIters_;
00359 double EigRatio_;
00361 double LambdaMax_;
00363 double Alpha_;
00365 int NumSweeps_;
00366
00367
00368
00370 mutable int NumApplyInverse_;
00372 double InitializeTime_;
00374 double ComputeTime_;
00376 mutable double ApplyInverseTime_;
00378 double ComputeFlops_;
00380 mutable double ApplyInverseFlops_;
00382 mutable Epetra_Time Time_;
00383
00384 };
00385 #else
00386
00387 #ifdef _MSC_VER
00388 #pragma message("No EpetraEXT")
00389 #else
00390 #warning "No EpetraEXT"
00391 #endif
00392
00393 #endif
00394 #endif