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_SORA_H
00031 #define IFPACK_SORA_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 #include "EpetraExt_Transpose_RowMatrix.h"
00052
00053
00054 namespace Teuchos {
00055 class ParameterList;
00056 }
00057
00059
00067 class Ifpack_SORa: public Ifpack_Preconditioner {
00068
00069 public:
00070
00072
00074 Ifpack_SORa(Epetra_RowMatrix* A);
00075
00077 ~Ifpack_SORa()
00078 {
00079 Destroy();
00080 }
00081
00082
00083
00084
00086 int Initialize();
00087
00089 bool IsInitialized() const
00090 {
00091 return(IsInitialized_);
00092 }
00093
00095
00097 int Compute();
00098
00100 bool IsComputed() const
00101 {
00102 return(IsComputed_);
00103 }
00104
00106
00107
00108
00109
00110
00111
00112
00113 int SetParameters(Teuchos::ParameterList& parameterlist);
00114
00116
00125 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00126
00127
00128
00129
00130 int Apply(const Epetra_MultiVector& X,
00131 Epetra_MultiVector& Y) const
00132 {
00133 return(Multiply(false,X,Y));
00134 }
00135
00136 int Multiply(bool Trans, const Epetra_MultiVector& X,
00137 Epetra_MultiVector& Y) const{return A_->Multiply(Trans,X,Y);}
00138
00140
00153 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00154
00156 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00157 const int MaxIters = 1550,
00158 const double Tol = 1e-9,
00159 Epetra_RowMatrix* Matrix_in = 0);
00160
00162 double Condest() const
00163 {
00164 return(Condest_);
00165 }
00166
00167
00168
00169
00171 const char* Label() const {return(Label_);}
00172
00174 int SetLabel(const char* Label_in)
00175 {
00176 strcpy(Label_,Label_in);
00177 return(0);
00178 }
00179
00181 double NormInf() const {return(0.0);};
00182
00184 bool HasNormInf() const {return(false);};
00185
00187 bool UseTranspose() const {return(UseTranspose_);};
00188
00190 const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());};
00191
00193 const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());};
00194
00196 const Epetra_Comm & Comm() const{return(A_->Comm());};
00197
00199 const Epetra_RowMatrix& Matrix() const
00200 {
00201 return(*A_);
00202 }
00203
00205 virtual double GetLambdaMax() const{return LambdaMax_;}
00206
00208 virtual double GetOmega() const{if(UseGlobalDamping_) return 12.0/(11.0*LambdaMax_); else return 1.0;}
00209
00211 virtual ostream& Print(ostream& os) const;
00212
00214 virtual int NumInitialize() const
00215 {
00216 return(NumInitialize_);
00217 }
00218
00220 virtual int NumCompute() const
00221 {
00222 return(NumCompute_);
00223 }
00224
00226 virtual int NumApplyInverse() const
00227 {
00228 return(NumApplyInverse_);
00229 }
00230
00232 virtual double InitializeTime() const
00233 {
00234 return(InitializeTime_);
00235 }
00236
00238 virtual double ComputeTime() const
00239 {
00240 return(ComputeTime_);
00241 }
00242
00244 virtual double ApplyInverseTime() const
00245 {
00246 return(ApplyInverseTime_);
00247 }
00248
00250 virtual double InitializeFlops() const
00251 {
00252 return(0.0);
00253 }
00254
00255 virtual double ComputeFlops() const
00256 {
00257 return(ComputeFlops_);
00258 }
00259
00260 virtual double ApplyInverseFlops() const
00261 {
00262 return(ApplyInverseFlops_);
00263 }
00264
00265 private:
00266
00267
00268
00269
00271 Ifpack_SORa(const Ifpack_SORa& RHS) :
00272 Time_(RHS.Comm())
00273 {}
00274
00276 Ifpack_SORa& operator=(const Ifpack_SORa& RHS)
00277 {
00278 return(*this);
00279 }
00280
00282 void Destroy();
00283
00285
00295 int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00296
00297
00299 int NumGlobalRows() const {return(A_->NumGlobalRows());};
00300
00302 int NumGlobalCols() const {return(A_->NumGlobalCols());};
00303
00305 int NumMyRows() const {return(A_->NumMyRows());};
00306
00308 int NumMyCols() const {return(A_->NumMyCols());};
00309
00311 int PowerMethod(const int MaximumIterations, double& lambda_max);
00312
00313
00315
00316
00317
00318
00319
00320
00321
00322
00324 Teuchos::RefCountPtr<Epetra_CrsMatrix> Acrs_;
00325 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
00326 Teuchos::RefCountPtr<Epetra_CrsMatrix> W_;
00327 Teuchos::RefCountPtr<Epetra_Vector> Wdiag_;
00328 Teuchos::ParameterList List_;
00329
00330 bool UseTranspose_;
00331 double Condest_;
00332
00333
00335 bool IsInitialized_;
00337 bool IsComputed_;
00339 char Label_[160];
00341 int NumInitialize_;
00343 int NumCompute_;
00344
00346 double Alpha_;
00348 double Gamma_;
00350 int NumSweeps_;
00352 bool IsParallel_;
00354 bool HaveOAZBoundaries_;
00356 bool UseInterprocDamping_;
00358 bool UseGlobalDamping_;
00360 double LambdaMax_;
00361
00363 mutable int NumApplyInverse_;
00365 double InitializeTime_;
00367 double ComputeTime_;
00369 mutable double ApplyInverseTime_;
00371 double ComputeFlops_;
00373 mutable double ApplyInverseFlops_;
00375 mutable Epetra_Time Time_;
00376
00377 };
00378 #else
00379 #endif
00380 #endif