|
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_SILU_H 00031 #define IFPACK_SILU_H 00032 00033 #include "Ifpack_ConfigDefs.h" 00034 00035 #ifdef HAVE_IFPACK_SUPERLU 00036 #include "Ifpack_Preconditioner.h" 00037 #include "Ifpack_Condest.h" 00038 #include "Ifpack_ScalingType.h" 00039 #include "Ifpack_IlukGraph.h" 00040 #include "Epetra_CompObject.h" 00041 #include "Epetra_MultiVector.h" 00042 #include "Epetra_Vector.h" 00043 #include "Epetra_CrsGraph.h" 00044 #include "Epetra_CrsMatrix.h" 00045 #include "Epetra_BlockMap.h" 00046 #include "Epetra_Map.h" 00047 #include "Epetra_Object.h" 00048 #include "Epetra_Comm.h" 00049 #include "Epetra_RowMatrix.h" 00050 #include "Epetra_Time.h" 00051 #include "Teuchos_RefCountPtr.hpp" 00052 00053 namespace Teuchos { 00054 class ParameterList; 00055 } 00056 00057 // SuperLU includes 00058 #include "slu_ddefs.h" 00059 00060 00062 00069 class Ifpack_SILU: public Ifpack_Preconditioner { 00070 00071 public: 00072 // @{ Constructors and destructors. 00074 Ifpack_SILU(Epetra_RowMatrix* A); 00075 00077 ~Ifpack_SILU() 00078 { 00079 Destroy(); 00080 } 00081 00082 // @} 00083 // @{ Construction methods 00084 00086 int Initialize(); 00087 00089 bool IsInitialized() const 00090 { 00091 return(IsInitialized_); 00092 } 00093 00095 int Compute(); 00096 00098 bool IsComputed() const 00099 { 00100 return(IsComputed_); 00101 } 00102 00104 /* This method is only available if the Teuchos package is enabled. 00105 This method recognizes four parameter names: relax_value, 00106 absolute_threshold, relative_threshold and overlap_mode. These names are 00107 case insensitive, and in each case except overlap_mode, the ParameterEntry 00108 must have type double. For overlap_mode, the ParameterEntry must have 00109 type Epetra_CombineMode. 00110 */ 00111 int SetParameters(Teuchos::ParameterList& parameterlist); 00112 00114 00123 int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);}; 00124 // @} 00125 00126 // @{ Mathematical functions. 00127 // Applies the matrix to X, returns the result in Y. 00128 int Apply(const Epetra_MultiVector& X, 00129 Epetra_MultiVector& Y) const 00130 { 00131 return(Multiply(false,X,Y)); 00132 } 00133 00134 int Multiply(bool Trans, const Epetra_MultiVector& X, 00135 Epetra_MultiVector& Y) const; 00136 00138 00151 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00152 00154 double Condest(const Ifpack_CondestType CT = Ifpack_Cheap, 00155 const int MaxIters = 1550, 00156 const double Tol = 1e-9, 00157 Epetra_RowMatrix* Matrix_in = 0); 00158 00160 double Condest() const 00161 { 00162 return(Condest_); 00163 } 00164 00165 // @} 00166 // @{ Query methods 00167 00169 const char* Label() const {return(Label_);} 00170 00172 int SetLabel(const char* Label_in) 00173 { 00174 strcpy(Label_,Label_in); 00175 return(0); 00176 } 00177 00179 double NormInf() const {return(0.0);}; 00180 00182 bool HasNormInf() const {return(false);}; 00183 00185 bool UseTranspose() const {return(UseTranspose_);}; 00186 00188 const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());}; 00189 00191 const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());}; 00192 00194 const Epetra_Comm & Comm() const{return(Comm_);}; 00195 00197 const Epetra_RowMatrix& Matrix() const 00198 { 00199 return(*A_); 00200 } 00201 00203 virtual ostream& Print(ostream& os) const; 00204 00206 virtual int NumInitialize() const 00207 { 00208 return(NumInitialize_); 00209 } 00210 00212 virtual int NumCompute() const 00213 { 00214 return(NumCompute_); 00215 } 00216 00218 virtual int NumApplyInverse() const 00219 { 00220 return(NumApplyInverse_); 00221 } 00222 00224 virtual double InitializeTime() const 00225 { 00226 return(InitializeTime_); 00227 } 00228 00230 virtual double ComputeTime() const 00231 { 00232 return(ComputeTime_); 00233 } 00234 00236 virtual double ApplyInverseTime() const 00237 { 00238 return(ApplyInverseTime_); 00239 } 00240 00241 virtual double InitializeFlops() const 00242 { 00243 return(0.0); 00244 } 00245 00246 virtual double ComputeFlops() const 00247 { 00248 return(0.0); 00249 } 00250 00251 virtual double ApplyInverseFlops() const 00252 { 00253 return(0.0); 00254 } 00255 00256 private: 00257 00258 // @} 00259 // @{ Private methods 00260 00262 Ifpack_SILU(const Ifpack_SILU& RHS): 00263 Comm_(RHS.Comm()), 00264 Time_(RHS.Comm()) 00265 {} 00266 00268 Ifpack_SILU& operator=(const Ifpack_SILU& RHS) 00269 { 00270 return(*this); 00271 } 00272 00274 void Destroy(); 00275 00277 00287 int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00288 00289 int InitAllValues(const Epetra_RowMatrix & A, int MaxNumEntries); 00290 00292 double DropTol() const {return DropTol_;} 00293 00295 double FillTol() const{return FillTol_;} 00296 00298 double FillFactor() const{return FillFactor_;} 00299 00301 int DropRule() const{return DropRule_;} 00302 00304 int NumGlobalRows() const {return(Graph().NumGlobalRows());}; 00305 00307 int NumGlobalCols() const {return(Graph().NumGlobalCols());}; 00308 00310 int NumGlobalNonzeros() const {return(Graph().NumGlobalNonzeros());}; 00311 00313 virtual int NumGlobalBlockDiagonals() const {return(Graph().NumGlobalBlockDiagonals());}; 00314 00316 int NumMyRows() const {return(Graph().NumMyRows());}; 00317 00319 int NumMyCols() const {return(Graph().NumMyCols());}; 00320 00322 int NumMyNonzeros() const {return(Graph().NumMyNonzeros());}; 00323 00325 virtual int NumMyBlockDiagonals() const {return(Graph().NumMyBlockDiagonals());}; 00326 00328 virtual int NumMyDiagonals() const {return(NumMyDiagonals_);}; 00329 00331 int IndexBase() const {return(Graph().IndexBase());}; 00332 00334 const Epetra_CrsGraph & Graph() const {return(*Graph_);}; 00335 00337 Epetra_RowMatrix& Matrix() 00338 { 00339 return(*A_); 00340 } 00341 00342 // @} 00343 // @{ Internal data 00344 00346 Teuchos::RefCountPtr<Epetra_RowMatrix> A_; 00347 Teuchos::RefCountPtr<Epetra_CrsGraph> Graph_; 00348 Teuchos::RefCountPtr<Epetra_Map> IlukRowMap_; 00349 Teuchos::RefCountPtr<Epetra_Map> IlukDomainMap_; 00350 Teuchos::RefCountPtr<Epetra_Map> IlukRangeMap_; 00351 const Epetra_Comm & Comm_; 00353 Teuchos::RefCountPtr<Epetra_CrsMatrix> Aover_; 00354 bool UseTranspose_; 00355 00356 int NumMyDiagonals_; 00357 bool Allocated_; 00358 bool ValuesInitialized_; 00359 bool Factored_; 00360 00362 double DropTol_; 00364 double FillTol_; 00366 double FillFactor_; 00368 int DropRule_; 00369 00371 double Condest_; 00373 bool IsInitialized_; 00375 bool IsComputed_; 00377 char Label_[160]; 00379 int NumInitialize_; 00381 int NumCompute_; 00383 mutable int NumApplyInverse_; 00385 double InitializeTime_; 00387 double ComputeTime_; 00389 mutable double ApplyInverseTime_; 00391 mutable Epetra_Time Time_; 00393 mutable SuperLUStat_t stat_; 00395 mutable superlu_options_t options_; 00397 mutable SuperMatrix SA_,SAc_,SL_,SU_,SY_; 00399 int *etree_,*perm_r_,*perm_c_; 00400 00401 }; 00402 00403 #endif /* HAVE_IFPACK_SUPERLU */ 00404 #endif /* IFPACK_ILU_H */
1.7.4