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_IKLU_H
00044 #define IFPACK_IKLU_H
00045
00046 #include "Ifpack_ConfigDefs.h"
00047 #include "Ifpack_CondestType.h"
00048 #include "Ifpack_ScalingType.h"
00049 #include "Ifpack_Preconditioner.h"
00050 #include "Ifpack_IKLU_Utils.h"
00051 #include "Epetra_Vector.h"
00052 #include "Epetra_CrsMatrix.h"
00053 #include "Epetra_Time.h"
00054 #include "Teuchos_RefCountPtr.hpp"
00055
00056 class Epetra_RowMatrix;
00057 class Epetra_SerialComm;
00058 class Epetra_Comm;
00059 class Epetra_Map;
00060 class Epetra_MultiVector;
00061
00062 namespace Teuchos {
00063 class ParameterList;
00064 }
00065
00067
00079 class Ifpack_IKLU: public Ifpack_Preconditioner {
00080
00081 public:
00082
00084 Ifpack_IKLU(const Epetra_RowMatrix* A);
00085
00087 virtual ~Ifpack_IKLU();
00088
00089
00090
00092
00093
00094
00095
00096
00097
00098
00099 int SetParameters(Teuchos::ParameterList& parameterlis);
00100
00102
00108 int Initialize();
00109
00111 bool IsInitialized() const
00112 {
00113 return(IsInitialized_);
00114 }
00115
00117
00125 int Compute();
00126
00128 bool IsComputed() const {return(IsComputed_);};
00129
00130
00131
00133
00141 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00142
00143 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00144
00146 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00147 const int MaxIters = 1550,
00148 const double Tol = 1e-9,
00149 Epetra_RowMatrix* Matrix_in = 0);
00150
00152 double Condest() const
00153 {
00154 return(Condest_);
00155 }
00156
00158
00167 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00168
00170 double NormInf() const {return(0.0);};
00171
00173 bool HasNormInf() const {return(false);};
00174
00176 bool UseTranspose() const {return(UseTranspose_);};
00177
00179 const Epetra_Map & OperatorDomainMap() const {return(A_.OperatorDomainMap());};
00180
00182 const Epetra_Map & OperatorRangeMap() const{return(A_.OperatorRangeMap());};
00183
00185 const Epetra_Comm & Comm() const{return(Comm_);};
00186
00188 const Epetra_RowMatrix& Matrix() const
00189 {
00190 return(A_);
00191 }
00192
00194 const Epetra_CrsMatrix & L() const {return(*L_);};
00195
00197 const Epetra_CrsMatrix & U() const {return(*U_);};
00198
00200 const char* Label() const
00201 {
00202 return(Label_.c_str());
00203 }
00204
00206 int SetLabel(const char* Label_in)
00207 {
00208 Label_ = Label_in;
00209 return(0);
00210 }
00211
00213 virtual ostream& Print(std::ostream& os) const;
00214
00216 virtual int NumInitialize() const
00217 {
00218 return(NumInitialize_);
00219 }
00220
00222 virtual int NumCompute() const
00223 {
00224 return(NumCompute_);
00225 }
00226
00228 virtual int NumApplyInverse() const
00229 {
00230 return(NumApplyInverse_);
00231 }
00232
00234 virtual double InitializeTime() const
00235 {
00236 return(InitializeTime_);
00237 }
00238
00240 virtual double ComputeTime() const
00241 {
00242 return(ComputeTime_);
00243 }
00244
00246 virtual double ApplyInverseTime() const
00247 {
00248 return(ApplyInverseTime_);
00249 }
00250
00252 virtual double InitializeFlops() const
00253 {
00254 return(0.0);
00255 }
00256
00257 virtual double ComputeFlops() const
00258 {
00259 return(ComputeFlops_);
00260 }
00261
00262 virtual double ApplyInverseFlops() const
00263 {
00264 return(ApplyInverseFlops_);
00265 }
00266
00267 inline double LevelOfFill() const {
00268 return(LevelOfFill_);
00269 }
00270
00272 inline double RelaxValue() const {
00273 return(Relax_);
00274 }
00275
00277 inline double AbsoluteThreshold() const
00278 {
00279 return(Athresh_);
00280 }
00281
00283 inline double RelativeThreshold() const
00284 {
00285 return(Rthresh_);
00286 }
00287
00289 inline double DropTolerance() const
00290 {
00291 return(DropTolerance_);
00292 }
00293
00295 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00296 int NumGlobalNonzeros() const {
00297
00298 return(L().NumGlobalNonzeros() + U().NumGlobalNonzeros() - L().NumGlobalRows());
00299 }
00300 #endif
00301 long long NumGlobalNonzeros64() const {
00302
00303 return(L().NumGlobalNonzeros64() + U().NumGlobalNonzeros64() - L().NumGlobalRows64());
00304 }
00305
00307 int NumMyNonzeros() const {
00308 return(L().NumMyNonzeros() + U().NumMyNonzeros());
00309 }
00310
00311 private:
00312
00313
00314
00315
00317 Ifpack_IKLU(const Ifpack_IKLU& RHS) :
00318 A_(RHS.Matrix()),
00319 Comm_(RHS.Comm()),
00320 Time_(Comm())
00321 {};
00322
00324 Ifpack_IKLU& operator=(const Ifpack_IKLU& RHS)
00325 {
00326 return(*this);
00327 }
00328
00330 void Destroy();
00331
00332
00333
00334
00336 const Epetra_RowMatrix& A_;
00338 const Epetra_Comm& Comm_;
00340 Teuchos::RefCountPtr<Epetra_CrsMatrix> L_;
00342 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_;
00344 double Condest_;
00346 double Relax_;
00348 double Athresh_;
00350 double Rthresh_;
00352 double LevelOfFill_;
00354 double DropTolerance_;
00356 string Label_;
00358 bool IsInitialized_;
00360 bool IsComputed_;
00362 bool UseTranspose_;
00364 int NumMyRows_;
00366 int NumMyNonzeros_;
00368 int NumInitialize_;
00370 int NumCompute_;
00372 mutable int NumApplyInverse_;
00374 double InitializeTime_;
00376 double ComputeTime_;
00378 mutable double ApplyInverseTime_;
00380 double ComputeFlops_;
00382 mutable double ApplyInverseFlops_;
00384 mutable Epetra_Time Time_;
00386 long long GlobalNonzeros_;
00387 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_;
00388 Teuchos::RefCountPtr<Epetra_Map> SerialMap_;
00389
00391 csr* csrA_;
00392 css* cssS_;
00394 csrn* csrnN_;
00395
00396 };
00397
00398 #endif