|
IFPACK Development
|
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_SPARSKIT_H 00031 #define IFPACK_SPARSKIT_H 00032 00033 #include "Ifpack_ConfigDefs.h" 00034 #ifdef HAVE_IFPACK_SPARSKIT 00035 #include "Ifpack_CondestType.h" 00036 #include "Ifpack_ScalingType.h" 00037 #include "Ifpack_Preconditioner.h" 00038 #include "Epetra_Vector.h" 00039 #include "Epetra_RowMatrix.h" 00040 class Epetra_Comm; 00041 class Epetra_Map; 00042 class Epetra_MultiVector; 00043 namespace Teuchos { 00044 class ParameterList; 00045 } 00046 00048 00049 class Ifpack_SPARSKIT: public Ifpack_Preconditioner { 00050 00051 public: 00053 Ifpack_SPARSKIT(Epetra_RowMatrix* A); 00054 00056 virtual ~Ifpack_SPARSKIT(); 00057 00059 /* This method is only available if the Teuchos package is enabled. 00060 This method recognizes five parameter names: level_fill, drop_tolerance, 00061 absolute_threshold, relative_threshold and overlap_mode. These names are 00062 case insensitive. For level_fill the ParameterEntry must have type int, the 00063 threshold entries must have type double and overlap_mode must have type 00064 Epetra_CombineMode. 00065 */ 00066 int SetParameters(Teuchos::ParameterList& parameterlis); 00067 00068 int SetParameter(const string Name, const int Value) 00069 { 00070 IFPACK_CHK_ERR(-98); 00071 } 00072 int SetParameter(const string Name, const double Value) 00073 { 00074 IFPACK_CHK_ERR(-98); 00075 } 00076 00077 const Epetra_RowMatrix& Matrix() const 00078 { 00079 return(A_); 00080 } 00081 00082 Epetra_RowMatrix& Matrix() 00083 { 00084 return(A_); 00085 } 00086 00087 bool IsInitialized() const 00088 { 00089 return(IsInitialized_); 00090 } 00091 00093 int Initialize(); 00094 00096 int Compute(); 00097 00099 bool IsComputed() const 00100 { 00101 return(IsComputed_); 00102 } 00103 00104 // Mathematical functions. 00105 00107 00117 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00118 00119 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const 00120 { 00121 IFPACK_CHK_ERR(-1); 00122 } 00123 00125 00133 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap, 00134 const int MaxIters = 1550, 00135 const double Tol = 1e-9, 00136 Epetra_RowMatrix* Matrix = 0); 00137 00138 double Condest() const 00139 { 00140 return(Condest_); 00141 } 00142 00143 // Attribute access functions 00144 00146 00148 00157 int SetUseTranspose(bool UseTranspose) {UseTranspose_ = UseTranspose; return(0);}; 00158 00160 double NormInf() const {return(0.0);}; 00161 00163 bool HasNormInf() const {return(false);}; 00164 00166 bool UseTranspose() const {return(UseTranspose_);}; 00167 00169 const Epetra_Map & OperatorDomainMap() const {return(A_.OperatorDomainMap());}; 00170 00172 const Epetra_Map & OperatorRangeMap() const{return(A_.OperatorRangeMap());}; 00173 00175 const Epetra_Comm & Comm() const{return(Comm_);}; 00177 00178 const char* Label() const 00179 { 00180 return(Label_.c_str()); 00181 } 00182 00183 int SetLabel(const char* Label) 00184 { 00185 Label_ = Label; 00186 return(0); 00187 } 00188 00190 virtual ostream& Print(std::ostream& os) const; 00191 00193 virtual int NumInitialize() const 00194 { 00195 return(NumInitialize_); 00196 } 00197 00199 virtual int NumCompute() const 00200 { 00201 return(NumCompute_); 00202 } 00203 00205 virtual int NumApplyInverse() const 00206 { 00207 return(NumApplyInverse_); 00208 } 00209 00211 virtual double InitializeTime() const 00212 { 00213 return(InitializeTime_); 00214 } 00215 00217 virtual double ComputeTime() const 00218 { 00219 return(ComputeTime_); 00220 } 00221 00223 virtual double ApplyInverseTime() const 00224 { 00225 return(ApplyInverseTime_); 00226 } 00227 00229 virtual double InitializeFlops() const 00230 { 00231 return(0.0); 00232 } 00233 00234 virtual double ComputeFlops() const 00235 { 00236 return(0.0); 00237 } 00238 00239 virtual double ApplyInverseFlops() const 00240 { 00241 return(0.0); 00242 } 00243 00244 private: 00245 Epetra_RowMatrix& A_; 00246 const Epetra_Comm& Comm_; 00247 bool UseTranspose_; 00248 int lfil_; 00249 double droptol_; 00250 double tol_; 00251 double permtol_; 00252 double alph_; 00253 int mbloc_; 00254 string Type_; 00255 00256 // Factorization in MSR format. 00257 std::vector<double> alu_; 00258 std::vector<int> jlu_; 00259 std::vector<int> ju_; 00260 00261 string Label_; 00262 // Permutation vector if required by ILUTP and ILUDP. 00263 std::vector<int> iperm_; 00264 00265 double Condest_; 00266 00267 bool IsInitialized_; 00268 bool IsComputed_; 00269 00271 int NumInitialize_; 00273 int NumCompute_; 00275 mutable int NumApplyInverse_; 00276 00278 double InitializeTime_; 00280 double ComputeTime_; 00282 mutable double ApplyInverseTime_; 00283 00285 double ComputeFlops_; 00287 mutable double ApplyInverseFlops_; 00288 00289 }; 00290 00291 #endif // HAVE_IFPACK_SPARSKIT 00292 #endif /* IFPACK_SPARSKIT_H */
1.7.4