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_HIPS_H
00031 #define IFPACK_HIPS_H
00032
00033 #include "Ifpack_ConfigDefs.h"
00034 #ifdef HAVE_IFPACK_HIPS
00035
00036
00037 #include "Ifpack_Preconditioner.h"
00038 #include "Ifpack_Condest.h"
00039 #include "Ifpack_ScalingType.h"
00040 #include "Epetra_CompObject.h"
00041 #include "Epetra_MultiVector.h"
00042 #include "Epetra_Vector.h"
00043 #include "Epetra_CrsGraph.h"
00044 #include "Epetra_CrsMatrix.h"
00045 #include "Epetra_BlockMap.h"
00046 #include "Epetra_Map.h"
00047 #include "Epetra_Object.h"
00048 #include "Epetra_Comm.h"
00049 #include "Epetra_CrsMatrix.h"
00050 #include "Epetra_Time.h"
00051 #include "Teuchos_RefCountPtr.hpp"
00052
00053
00054 namespace Teuchos {
00055 class ParameterList;
00056 }
00057
00059
00067 class Ifpack_HIPS: public Ifpack_Preconditioner {
00068
00069 public:
00070
00072 Ifpack_HIPS(Epetra_RowMatrix* A);
00073
00075 ~Ifpack_HIPS()
00076 {
00077 Destroy();
00078 }
00079
00080
00081
00082
00084 int Initialize();
00085
00087 bool IsInitialized() const
00088 {
00089 return(IsInitialized_);
00090 }
00091
00093
00095 int Compute();
00096
00098 bool IsComputed() const
00099 {
00100 return(IsComputed_);
00101 }
00102
00104
00105
00106
00107
00108
00109
00110
00111 int SetParameters(Teuchos::ParameterList& parameterlist);
00112
00114
00123 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00124
00125
00126
00127
00128 int Apply(const Epetra_MultiVector& X,
00129 Epetra_MultiVector& Y) const
00130 {
00131 return(Multiply(false,X,Y));
00132 }
00133
00134 int Multiply(bool Trans, const Epetra_MultiVector& X,
00135 Epetra_MultiVector& Y) const{return A_->Multiply(Trans,X,Y);}
00136
00138
00151 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00152
00154 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00155 const int MaxIters = 1550,
00156 const double Tol = 1e-9,
00157 Epetra_RowMatrix* Matrix_in = 0);
00158
00160 double Condest() const
00161 {
00162 return(Condest_);
00163 }
00164
00165
00166
00167
00169 const char* Label() const {return(Label_);}
00170
00172 int SetLabel(const char* Label_in)
00173 {
00174 strcpy(Label_,Label_in);
00175 return(0);
00176 }
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_HIPS(const Ifpack_HIPS& RHS) :
00265 Time_(RHS.Comm())
00266 {}
00267
00269 Ifpack_HIPS& operator=(const Ifpack_HIPS& 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
00305
00306
00307
00308
00309
00310
00311
00313 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
00314 Teuchos::ParameterList List_;
00315 Teuchos::RefCountPtr<Epetra_Map> RowMap0_;
00316 Teuchos::RefCountPtr<Epetra_Map> ColMap0_;
00317
00318
00319 int HIPS_id;
00320
00321 bool UseTranspose_;
00322 bool Allocated_;
00323 bool ValuesInitialized_;
00324 bool Factored_;
00325
00326 double Condest_;
00327
00328 bool IsParallel_;
00330 bool IsInitialized_;
00332 bool IsComputed_;
00334 char Label_[160];
00336 int NumInitialize_;
00338 int NumCompute_;
00339
00341 mutable int NumApplyInverse_;
00343 double InitializeTime_;
00345 double ComputeTime_;
00347 mutable double ApplyInverseTime_;
00349 double ComputeFlops_;
00351 mutable double ApplyInverseFlops_;
00353 mutable Epetra_Time Time_;
00354
00355 };
00356
00357 #endif
00358 #endif