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_KRYLOV_H
00044 #define IFPACK_KRYLOV_H
00045
00046 #include "Ifpack_ConfigDefs.h"
00047 #include "Ifpack_Preconditioner.h"
00048 #include "Teuchos_RefCountPtr.hpp"
00049 #include "Ifpack_PointRelaxation.h"
00050 #include "Ifpack_BlockRelaxation.h"
00051 #include "Ifpack_SparseContainer.h"
00052 #include "Ifpack_DenseContainer.h"
00053 #include "Ifpack_Amesos.h"
00054 #ifdef HAVE_IFPACK_AZTECOO
00055 #include "AztecOO.h"
00056 #endif
00057
00058 namespace Teuchos {
00059 class ParameterList;
00060 }
00061
00062 class Epetra_MultiVector;
00063 class Epetra_Vector;
00064 class Epetra_Map;
00065 class Epetra_Comm;
00066 class Epetra_Time;
00067 class Epetra_Vector;
00068 class Epetra_Operator;
00069 class Epetra_RowMatrix;
00070 #ifdef HAVE_IFPACK_AZTECOO
00071 class AztecOO;
00072 #endif
00073
00074
00075 #ifdef HAVE_IFPACK_EPETRAEXT
00076 class EpetraExt_PointToBlockDiagPermute;
00077 #endif
00078
00080
00081 class Ifpack_Krylov : public Ifpack_Preconditioner {
00082
00083 typedef double SC;
00084 typedef Epetra_MultiVector MV;
00085 typedef Epetra_Operator OP;
00086 typedef Epetra_RowMatrix RM;
00087
00088 public:
00089
00091 Ifpack_Krylov(Epetra_Operator* Matrix);
00092
00094 Ifpack_Krylov(Epetra_RowMatrix* Matrix);
00095
00097 virtual ~Ifpack_Krylov() {};
00098
00100
00107 virtual inline int SetUseTranspose(bool UseTranspose_in)
00108 {
00109 UseTranspose_ = UseTranspose_in;
00110 return(0);
00111 }
00112
00114
00116
00118
00126 virtual inline int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00127
00129
00139 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00140
00142 virtual double NormInf() const
00143 {
00144 return(-1.0);
00145 }
00147
00149
00150 virtual const char * Label() const
00151 {
00152 return(Label_.c_str());
00153 }
00154
00156 virtual bool UseTranspose() const
00157 {
00158 return(UseTranspose_);
00159 }
00160
00162 virtual bool HasNormInf() const
00163 {
00164 return(false);
00165 }
00166
00168 virtual const Epetra_Comm & Comm() const;
00169
00171 virtual const Epetra_Map & OperatorDomainMap() const;
00172
00174 virtual const Epetra_Map & OperatorRangeMap() const;
00175
00176 virtual int Initialize();
00177
00178 virtual bool IsInitialized() const
00179 {
00180 return(IsInitialized_);
00181 }
00182
00184 virtual inline bool IsComputed() const
00185 {
00186 return(IsComputed_);
00187 }
00188
00190 virtual int Compute();
00191
00192 virtual const Epetra_RowMatrix& Matrix() const
00193 {
00194 return(*Matrix_);
00195 }
00196
00198 virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00199 const int MaxIters = 1550,
00200 const double Tol = 1e-9,
00201 Epetra_RowMatrix* Matrix_in = 0);
00202
00204 virtual double Condest() const
00205 {
00206 return(Condest_);
00207 }
00208
00210 virtual int SetParameters(Teuchos::ParameterList& List);
00211
00213 virtual ostream& Print(ostream & os) const;
00214
00216
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
00262 virtual double ComputeFlops() const
00263 {
00264 return(ComputeFlops_);
00265 }
00266
00268 virtual double ApplyInverseFlops() const
00269 {
00270 return(ApplyInverseFlops_);
00271 }
00272
00273 private:
00274
00275
00276
00277
00279 virtual void SetLabel();
00280
00282 Ifpack_Krylov(const Ifpack_Krylov& rhs)
00283 {}
00284
00286 Ifpack_Krylov& operator=(const Ifpack_Krylov& rhs)
00287 {
00288 return(*this);
00289 }
00290
00291
00293 bool IsInitialized_;
00295 bool IsComputed_;
00297 int NumInitialize_;
00299 int NumCompute_;
00301 mutable int NumApplyInverse_;
00303 double InitializeTime_;
00305 double ComputeTime_;
00307 mutable double ApplyInverseTime_;
00309 double ComputeFlops_;
00311 mutable double ApplyInverseFlops_;
00312
00313
00314
00316 int Iterations_;
00318 double Tolerance_;
00320 int SolverType_;
00322 int PreconditionerType_;
00324 int NumSweeps_;
00326 int BlockSize_;
00328 double DampingParameter_;
00330 bool UseTranspose_;
00332 double Condest_;
00334 bool ComputeCondest_;
00336 string Label_;
00337
00338
00340 int NumMyRows_;
00342 int NumMyNonzeros_;
00344 long long NumGlobalRows_;
00346 long long NumGlobalNonzeros_;
00348 Teuchos::RefCountPtr<Epetra_Operator> Operator_;
00350 Teuchos::RefCountPtr<Epetra_RowMatrix> Matrix_;
00351
00353 bool IsRowMatrix_;
00355 Teuchos::RefCountPtr<Epetra_Time> Time_;
00357 bool ZeroStartingSolution_;
00358
00359
00360 #ifdef HAVE_IFPACK_AZTECOO
00361 Teuchos::RCP<AztecOO> AztecSolver_;
00362 #endif
00363
00364
00365 Teuchos::RCP<Ifpack_Preconditioner> IfpackPrec_;
00366
00367 };
00368
00369
00370 #endif // IFPACK_KRYLOV_H