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_HIPS_H
00044 #define IFPACK_HIPS_H
00045
00046 #include "Ifpack_ConfigDefs.h"
00047 #ifdef HAVE_IFPACK_HIPS
00048
00049
00050 #include "Ifpack_Preconditioner.h"
00051 #include "Ifpack_Condest.h"
00052 #include "Ifpack_ScalingType.h"
00053 #include "Epetra_CompObject.h"
00054 #include "Epetra_MultiVector.h"
00055 #include "Epetra_Vector.h"
00056 #include "Epetra_CrsGraph.h"
00057 #include "Epetra_CrsMatrix.h"
00058 #include "Epetra_BlockMap.h"
00059 #include "Epetra_Map.h"
00060 #include "Epetra_Object.h"
00061 #include "Epetra_Comm.h"
00062 #include "Epetra_CrsMatrix.h"
00063 #include "Epetra_Time.h"
00064 #include "Teuchos_RefCountPtr.hpp"
00065
00066
00067 namespace Teuchos {
00068 class ParameterList;
00069 }
00070
00072
00080 class Ifpack_HIPS: public Ifpack_Preconditioner {
00081
00082 public:
00083
00085 Ifpack_HIPS(Epetra_RowMatrix* A);
00086
00088 ~Ifpack_HIPS()
00089 {
00090 Destroy();
00091 }
00092
00093
00094
00095
00097 int Initialize();
00098
00100 bool IsInitialized() const
00101 {
00102 return(IsInitialized_);
00103 }
00104
00106
00108 int Compute();
00109
00111 bool IsComputed() const
00112 {
00113 return(IsComputed_);
00114 }
00115
00117
00118
00119
00120
00121
00122
00123
00124 int SetParameters(Teuchos::ParameterList& parameterlist);
00125
00127
00136 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00137
00138
00139
00140
00141 int Apply(const Epetra_MultiVector& X,
00142 Epetra_MultiVector& Y) const
00143 {
00144 return(Multiply(false,X,Y));
00145 }
00146
00147 int Multiply(bool Trans, const Epetra_MultiVector& X,
00148 Epetra_MultiVector& Y) const{return A_->Multiply(Trans,X,Y);}
00149
00151
00164 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00165
00167 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00168 const int MaxIters = 1550,
00169 const double Tol = 1e-9,
00170 Epetra_RowMatrix* Matrix_in = 0);
00171
00173 double Condest() const
00174 {
00175 return(Condest_);
00176 }
00177
00178
00179
00180
00182 const char* Label() const {return(Label_);}
00183
00185 int SetLabel(const char* Label_in)
00186 {
00187 strcpy(Label_,Label_in);
00188 return(0);
00189 }
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_HIPS(const Ifpack_HIPS& RHS) :
00278 Time_(RHS.Comm())
00279 {}
00280
00282 Ifpack_HIPS& operator=(const Ifpack_HIPS& 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
00305 int NumGlobalRows() const {return(A_->NumGlobalRows());};
00306
00308 int NumGlobalCols() const {return(A_->NumGlobalCols());};
00309
00311 int NumMyRows() const {return(A_->NumMyRows());};
00312
00314 int NumMyCols() const {return(A_->NumMyCols());};
00315
00317
00318
00319
00320
00321
00322
00323
00324
00326 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
00327 Teuchos::ParameterList List_;
00328 Teuchos::RefCountPtr<Epetra_Map> RowMap0_;
00329 Teuchos::RefCountPtr<Epetra_Map> ColMap0_;
00330
00331
00332 int HIPS_id;
00333
00334 bool UseTranspose_;
00335 bool Allocated_;
00336 bool ValuesInitialized_;
00337 bool Factored_;
00338
00339 double Condest_;
00340
00341 bool IsParallel_;
00343 bool IsInitialized_;
00345 bool IsComputed_;
00347 char Label_[160];
00349 int NumInitialize_;
00351 int NumCompute_;
00352
00354 mutable int NumApplyInverse_;
00356 double InitializeTime_;
00358 double ComputeTime_;
00360 mutable double ApplyInverseTime_;
00362 double ComputeFlops_;
00364 mutable double ApplyInverseFlops_;
00366 mutable Epetra_Time Time_;
00367
00368 };
00369
00370 #endif
00371 #endif