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_SORA_H
00044 #define IFPACK_SORA_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 #include "EpetraExt_Transpose_RowMatrix.h"
00065
00066
00067 namespace Teuchos {
00068 class ParameterList;
00069 }
00070
00072
00080 class Ifpack_SORa: public Ifpack_Preconditioner {
00081
00082 public:
00083
00085
00087 Ifpack_SORa(Epetra_RowMatrix* A);
00088
00090 ~Ifpack_SORa()
00091 {
00092 Destroy();
00093 }
00094
00095
00096
00097
00099 int Initialize();
00100
00102 bool IsInitialized() const
00103 {
00104 return(IsInitialized_);
00105 }
00106
00108
00110 int Compute();
00111
00113 bool IsComputed() const
00114 {
00115 return(IsComputed_);
00116 }
00117
00119
00120
00121
00122
00123
00124
00125
00126 int SetParameters(Teuchos::ParameterList& parameterlist);
00127
00129
00138 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00139
00140
00141
00142
00143 int Apply(const Epetra_MultiVector& X,
00144 Epetra_MultiVector& Y) const
00145 {
00146 return(Multiply(false,X,Y));
00147 }
00148
00149 int Multiply(bool Trans, const Epetra_MultiVector& X,
00150 Epetra_MultiVector& Y) const{return A_->Multiply(Trans,X,Y);}
00151
00153
00166 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00167
00169 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00170 const int MaxIters = 1550,
00171 const double Tol = 1e-9,
00172 Epetra_RowMatrix* Matrix_in = 0);
00173
00175 double Condest() const
00176 {
00177 return(Condest_);
00178 }
00179
00180
00181
00182
00184 const char* Label() const {return(Label_);}
00185
00187 int SetLabel(const char* Label_in)
00188 {
00189 strcpy(Label_,Label_in);
00190 return(0);
00191 }
00192
00194 double NormInf() const {return(0.0);};
00195
00197 bool HasNormInf() const {return(false);};
00198
00200 bool UseTranspose() const {return(UseTranspose_);};
00201
00203 const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());};
00204
00206 const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());};
00207
00209 const Epetra_Comm & Comm() const{return(A_->Comm());};
00210
00212 const Epetra_RowMatrix& Matrix() const
00213 {
00214 return(*A_);
00215 }
00216
00218 virtual double GetLambdaMax() const{return LambdaMax_;}
00219
00221 virtual double GetOmega() const{if(UseGlobalDamping_) return 12.0/(11.0*LambdaMax_); else return 1.0;}
00222
00224 virtual ostream& Print(ostream& os) const;
00225
00227 virtual int NumInitialize() const
00228 {
00229 return(NumInitialize_);
00230 }
00231
00233 virtual int NumCompute() const
00234 {
00235 return(NumCompute_);
00236 }
00237
00239 virtual int NumApplyInverse() const
00240 {
00241 return(NumApplyInverse_);
00242 }
00243
00245 virtual double InitializeTime() const
00246 {
00247 return(InitializeTime_);
00248 }
00249
00251 virtual double ComputeTime() const
00252 {
00253 return(ComputeTime_);
00254 }
00255
00257 virtual double ApplyInverseTime() const
00258 {
00259 return(ApplyInverseTime_);
00260 }
00261
00263 virtual double InitializeFlops() const
00264 {
00265 return(0.0);
00266 }
00267
00268 virtual double ComputeFlops() const
00269 {
00270 return(ComputeFlops_);
00271 }
00272
00273 virtual double ApplyInverseFlops() const
00274 {
00275 return(ApplyInverseFlops_);
00276 }
00277
00278 private:
00279
00280
00281
00282
00284 Ifpack_SORa(const Ifpack_SORa& RHS) :
00285 Time_(RHS.Comm())
00286 {}
00287
00289 Ifpack_SORa& operator=(const Ifpack_SORa& RHS)
00290 {
00291 return(*this);
00292 }
00293
00295 void Destroy();
00296
00298
00308 int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00309
00310
00311 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00312
00313 int NumGlobalRows() const {return(A_->NumGlobalRows());};
00314
00316 int NumGlobalCols() const {return(A_->NumGlobalCols());};
00317 #endif
00318 long long NumGlobalRows64() const {return(A_->NumGlobalRows64());};
00319 long long NumGlobalCols64() const {return(A_->NumGlobalCols64());};
00320
00322 int NumMyRows() const {return(A_->NumMyRows());};
00323
00325 int NumMyCols() const {return(A_->NumMyCols());};
00326
00328 int PowerMethod(const int MaximumIterations, double& lambda_max);
00329
00330
00332
00333
00334
00335
00336 template<typename int_type>
00337 int TCompute();
00338
00339
00340
00341
00343 Teuchos::RefCountPtr<Epetra_CrsMatrix> Acrs_;
00344 Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
00345 Teuchos::RefCountPtr<Epetra_CrsMatrix> W_;
00346 Teuchos::RefCountPtr<Epetra_Vector> Wdiag_;
00347 Teuchos::ParameterList List_;
00348
00349 bool UseTranspose_;
00350 double Condest_;
00351
00352
00354 bool IsInitialized_;
00356 bool IsComputed_;
00358 char Label_[160];
00360 int NumInitialize_;
00362 int NumCompute_;
00363
00365 double Alpha_;
00367 double Gamma_;
00369 int NumSweeps_;
00371 bool IsParallel_;
00373 bool HaveOAZBoundaries_;
00375 bool UseInterprocDamping_;
00377 bool UseGlobalDamping_;
00379 double LambdaMax_;
00380
00382 mutable int NumApplyInverse_;
00384 double InitializeTime_;
00386 double ComputeTime_;
00388 mutable double ApplyInverseTime_;
00390 double ComputeFlops_;
00392 mutable double ApplyInverseFlops_;
00394 mutable Epetra_Time Time_;
00395
00396 };
00397 #else
00398 #endif
00399 #endif