00001 /*@HEADER 00002 // *********************************************************************** 00003 // 00004 // Ifpack: Object-Oriented Algebraic Preconditioner Package 00005 // Copyright (2002) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 //@HEADER 00028 */ 00029 00030 #ifndef IFPACK_ILUT_H 00031 #define IFPACK_ILUT_H 00032 00033 #include "Ifpack_ConfigDefs.h" 00034 #include "Ifpack_CondestType.h" 00035 #include "Ifpack_ScalingType.h" 00036 #include "Ifpack_Preconditioner.h" 00037 #include "Epetra_Vector.h" 00038 #include "Epetra_CrsMatrix.h" 00039 #include "Epetra_Time.h" 00040 #include "Teuchos_RefCountPtr.hpp" 00041 00042 class Epetra_RowMatrix; 00043 class Epetra_SerialComm; 00044 class Epetra_Comm; 00045 class Epetra_Map; 00046 class Epetra_MultiVector; 00047 00048 namespace Teuchos { 00049 class ParameterList; 00050 } 00051 00053 00065 class Ifpack_ILUT: public Ifpack_Preconditioner { 00066 00067 public: 00068 // @{ Constructors and Destructors 00070 Ifpack_ILUT(const Epetra_RowMatrix* A); 00071 00073 virtual ~Ifpack_ILUT(); 00074 00075 // @} 00076 // @{ Construction methods 00078 /* This method is only available if the Teuchos package is enabled. 00079 This method recognizes five parameter names: level_fill, drop_tolerance, 00080 absolute_threshold, relative_threshold and overlap_mode. These names are 00081 case insensitive. For level_fill the ParameterEntry must have type int, the 00082 threshold entries must have type double and overlap_mode must have type 00083 Epetra_CombineMode. 00084 */ 00085 int SetParameters(Teuchos::ParameterList& parameterlis); 00086 00088 00094 int Initialize(); 00095 00097 bool IsInitialized() const 00098 { 00099 return(IsInitialized_); 00100 } 00101 00103 00111 int Compute(); 00112 00114 bool IsComputed() const {return(IsComputed_);}; 00115 00116 // Mathematical functions. 00117 00119 00127 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00128 00129 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00130 00132 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap, 00133 const int MaxIters = 1550, 00134 const double Tol = 1e-9, 00135 Epetra_RowMatrix* Matrix_in = 0); 00136 00138 double Condest() const 00139 { 00140 return(Condest_); 00141 } 00142 00144 00153 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);}; 00154 00156 double NormInf() const {return(0.0);}; 00157 00159 bool HasNormInf() const {return(false);}; 00160 00162 bool UseTranspose() const {return(UseTranspose_);}; 00163 00165 const Epetra_Map & OperatorDomainMap() const {return(A_.OperatorDomainMap());}; 00166 00168 const Epetra_Map & OperatorRangeMap() const{return(A_.OperatorRangeMap());}; 00169 00171 const Epetra_Comm & Comm() const{return(Comm_);}; 00172 00174 const Epetra_RowMatrix& Matrix() const 00175 { 00176 return(A_); 00177 } 00178 00180 const Epetra_CrsMatrix & L() const {return(*L_);}; 00181 00183 const Epetra_CrsMatrix & U() const {return(*U_);}; 00184 00186 const char* Label() const 00187 { 00188 return(Label_.c_str()); 00189 } 00190 00192 int SetLabel(const char* Label_in) 00193 { 00194 Label_ = Label_in; 00195 return(0); 00196 } 00197 00199 virtual ostream& Print(std::ostream& os) const; 00200 00202 virtual int NumInitialize() const 00203 { 00204 return(NumInitialize_); 00205 } 00206 00208 virtual int NumCompute() const 00209 { 00210 return(NumCompute_); 00211 } 00212 00214 virtual int NumApplyInverse() const 00215 { 00216 return(NumApplyInverse_); 00217 } 00218 00220 virtual double InitializeTime() const 00221 { 00222 return(InitializeTime_); 00223 } 00224 00226 virtual double ComputeTime() const 00227 { 00228 return(ComputeTime_); 00229 } 00230 00232 virtual double ApplyInverseTime() const 00233 { 00234 return(ApplyInverseTime_); 00235 } 00236 00238 virtual double InitializeFlops() const 00239 { 00240 return(0.0); 00241 } 00242 00243 virtual double ComputeFlops() const 00244 { 00245 return(ComputeFlops_); 00246 } 00247 00248 virtual double ApplyInverseFlops() const 00249 { 00250 return(ApplyInverseFlops_); 00251 } 00252 00253 inline double LevelOfFill() const { 00254 return(LevelOfFill_); 00255 } 00256 00258 inline double RelaxValue() const { 00259 return(Relax_); 00260 } 00261 00263 inline double AbsoluteThreshold() const 00264 { 00265 return(Athresh_); 00266 } 00267 00269 inline double RelativeThreshold() const 00270 { 00271 return(Rthresh_); 00272 } 00273 00275 inline double DropTolerance() const 00276 { 00277 return(DropTolerance_); 00278 } 00279 00281 int NumGlobalNonzeros() const { 00282 // FIXME: diagonal of L_ should not be stored 00283 return(L().NumGlobalNonzeros() + U().NumGlobalNonzeros() - L().NumGlobalRows()); 00284 } 00285 00287 int NumMyNonzeros() const { 00288 return(L().NumMyNonzeros() + U().NumMyNonzeros()); 00289 } 00290 00291 private: 00292 00293 // @} 00294 // @{ Internal methods 00295 00297 Ifpack_ILUT(const Ifpack_ILUT& RHS) : 00298 A_(RHS.Matrix()), 00299 Comm_(RHS.Comm()), 00300 Time_(Comm()) 00301 {}; 00302 00304 Ifpack_ILUT& operator=(const Ifpack_ILUT& RHS) 00305 { 00306 return(*this); 00307 } 00308 00310 void Destroy(); 00311 00312 // @} 00313 // @{ Internal data 00314 00316 const Epetra_RowMatrix& A_; 00318 const Epetra_Comm& Comm_; 00320 Teuchos::RefCountPtr<Epetra_CrsMatrix> L_; 00322 Teuchos::RefCountPtr<Epetra_CrsMatrix> U_; 00324 double Condest_; 00326 double Relax_; 00328 double Athresh_; 00330 double Rthresh_; 00332 double LevelOfFill_; 00334 double DropTolerance_; 00336 string Label_; 00338 bool IsInitialized_; 00340 bool IsComputed_; 00342 bool UseTranspose_; 00344 int NumMyRows_; 00346 int NumInitialize_; 00348 int NumCompute_; 00350 mutable int NumApplyInverse_; 00352 double InitializeTime_; 00354 double ComputeTime_; 00356 mutable double ApplyInverseTime_; 00358 double ComputeFlops_; 00360 mutable double ApplyInverseFlops_; 00362 mutable Epetra_Time Time_; 00364 int GlobalNonzeros_; 00365 Teuchos::RefCountPtr<Epetra_SerialComm> SerialComm_; 00366 Teuchos::RefCountPtr<Epetra_Map> SerialMap_; 00367 }; // Ifpack_ILUT 00368 00369 #endif /* IFPACK_ILUT_H */
1.4.7