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 #ifndef IFPACK_IHSS_H
00031 #define IFPACK_IHSS_H
00032
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Ifpack_Preconditioner.h"
00035
00036 #ifdef HAVE_IFPACK_EPETRAEXT
00037 #include "Ifpack_Condest.h"
00038 #include "Ifpack_ScalingType.h"
00039 #include "Epetra_CompObject.h"
00040 #include "Epetra_MultiVector.h"
00041 #include "Epetra_Vector.h"
00042 #include "Epetra_CrsGraph.h"
00043 #include "Epetra_CrsMatrix.h"
00044 #include "Epetra_BlockMap.h"
00045 #include "Epetra_Map.h"
00046 #include "Epetra_Object.h"
00047 #include "Epetra_Comm.h"
00048 #include "Epetra_CrsMatrix.h"
00049 #include "Epetra_Time.h"
00050 #include "Teuchos_RefCountPtr.hpp"
00051
00052
00053 namespace Teuchos {
00054 class ParameterList;
00055 }
00056
00058
00066 class Ifpack_IHSS: public Ifpack_Preconditioner {
00067
00068 public:
00069
00071
00073 Ifpack_IHSS(Epetra_RowMatrix* A);
00074
00076 ~Ifpack_IHSS()
00077 {
00078 Destroy();
00079 }
00080
00081
00082
00083
00085 int Initialize();
00086
00088 bool IsInitialized() const
00089 {
00090 return(IsInitialized_);
00091 }
00092
00094
00096 int Compute();
00097
00099 bool IsComputed() const
00100 {
00101 return(IsComputed_);
00102 }
00103
00105
00106
00107
00108
00109
00110
00111
00112 int SetParameters(Teuchos::ParameterList& parameterlist);
00113
00115
00124 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00125
00126
00127
00128
00129 int Apply(const Epetra_MultiVector& X,
00130 Epetra_MultiVector& Y) const
00131 {
00132 return(Multiply(false,X,Y));
00133 }
00134
00135 int Multiply(bool Trans, const Epetra_MultiVector& X,
00136 Epetra_MultiVector& Y) const{return A_->Multiply(Trans,X,Y);}
00137
00139
00152 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00153
00155 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00156 const int MaxIters = 1550,
00157 const double Tol = 1e-9,
00158 Epetra_RowMatrix* Matrix_in = 0);
00159
00161 double Condest() const
00162 {
00163 return(Condest_);
00164 }
00165
00166
00167
00168
00170 const char* Label() const {return(Label_);}
00171
00173 int SetLabel(const char* Label_in)
00174 {
00175 strcpy(Label_,Label_in);
00176 return(0);
00177 }
00178
00180 double NormInf() const {return(0.0);};
00181
00183 bool HasNormInf() const {return(false);};
00184
00186 bool UseTranspose() const {return(UseTranspose_);};
00187
00189 const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());};
00190
00192 const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());};
00193
00195 const Epetra_Comm & Comm() const{return(A_->Comm());};
00196
00198 const Epetra_RowMatrix& Matrix() const
00199 {
00200 return(*A_);
00201 }
00202
00204 virtual ostream& Print(ostream& os) const;
00205
00207 virtual int NumInitialize() const
00208 {
00209 return(NumInitialize_);
00210 }
00211
00213 virtual int NumCompute() const
00214 {
00215 return(NumCompute_);
00216 }
00217
00219 virtual int NumApplyInverse() const
00220 {
00221 return(NumApplyInverse_);
00222 }
00223
00225 virtual double InitializeTime() const
00226 {
00227 return(InitializeTime_);
00228 }
00229
00231 virtual double ComputeTime() const
00232 {
00233 return(ComputeTime_);
00234 }
00235
00237 virtual double ApplyInverseTime() const
00238 {
00239 return(ApplyInverseTime_);
00240 }
00241
00243 virtual double InitializeFlops() const
00244 {
00245 return(0.0);
00246 }
00247
00248 virtual double ComputeFlops() const
00249 {
00250 return(ComputeFlops_);
00251 }
00252
00253 virtual double ApplyInverseFlops() const
00254 {
00255 return(ApplyInverseFlops_);
00256 }
00257
00258 private:
00259
00260
00261
00262
00264 Ifpack_IHSS(const Ifpack_IHSS& RHS) :
00265 Time_(RHS.Comm())
00266 {}
00267
00269 Ifpack_IHSS& operator=(const Ifpack_IHSS& RHS)
00270 {
00271 return(*this);
00272 }
00273
00275 void Destroy();
00276
00278
00288 int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00289
00290
00292 int NumGlobalRows() const {return(A_->NumGlobalRows());};
00293
00295 int NumGlobalCols() const {return(A_->NumGlobalCols());};
00296
00298 int NumMyRows() const {return(A_->NumMyRows());};
00299
00301 int NumMyCols() const {return(A_->NumMyCols());};
00302
00304 int PowerMethod(Epetra_Operator * Op,const int MaximumIterations, double& lambda_max);
00305
00307
00308
00309
00310
00311
00312
00313
00314
00316 Teuchos::RefCountPtr<Epetra_CrsMatrix> A_;
00317 Teuchos::RefCountPtr<Epetra_RowMatrix> Aherm_;
00318 Teuchos::RefCountPtr<Epetra_RowMatrix> Askew_;
00319 Teuchos::RefCountPtr<Ifpack_Preconditioner> Pherm_;
00320 Teuchos::RefCountPtr<Ifpack_Preconditioner> Pskew_;
00321
00322 Teuchos::ParameterList List_;
00323
00324 bool UseTranspose_;
00325 double Condest_;
00326
00327
00329 bool IsInitialized_;
00331 bool IsComputed_;
00333 char Label_[160];
00335 int NumInitialize_;
00337 int NumCompute_;
00338
00340 int EigMaxIters_;
00342 double EigRatio_;
00344 double LambdaMax_;
00346 double Alpha_;
00348 int NumSweeps_;
00349
00350
00351
00353 mutable int NumApplyInverse_;
00355 double InitializeTime_;
00357 double ComputeTime_;
00359 mutable double ApplyInverseTime_;
00361 double ComputeFlops_;
00363 mutable double ApplyInverseFlops_;
00365 mutable Epetra_Time Time_;
00366
00367 };
00368 #else
00369 #warning "No EpetraEXT"
00370
00371 #endif
00372 #endif