|
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_HIPS_H 00031 #define IFPACK_HIPS_H 00032 00033 #include "Ifpack_ConfigDefs.h" 00034 #ifdef HAVE_IFPACK_HIPS 00035 00036 00037 #include "Ifpack_Preconditioner.h" 00038 #include "Ifpack_Condest.h" 00039 #include "Ifpack_ScalingType.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_CrsMatrix.h" 00050 #include "Epetra_Time.h" 00051 #include "Teuchos_RefCountPtr.hpp" 00052 00053 00054 namespace Teuchos { 00055 class ParameterList; 00056 } 00057 00059 00067 class Ifpack_HIPS: public Ifpack_Preconditioner { 00068 00069 public: 00070 // @{ Constructors and destructors. 00072 Ifpack_HIPS(Epetra_RowMatrix* A); 00073 00075 ~Ifpack_HIPS() 00076 { 00077 Destroy(); 00078 } 00079 00080 // @} 00081 // @{ Construction methods 00082 00084 int Initialize(); 00085 00087 bool IsInitialized() const 00088 { 00089 return(IsInitialized_); 00090 } 00091 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{return A_->Multiply(Trans,X,Y);} 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 00178 00180 double NormInf() const {return(0.0);}; 00181 00183 bool HasNormInf() const {return(false);}; 00184 00186 bool UseTranspose() const {return(UseTranspose_);}; 00187 00189 const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());}; 00190 00192 const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());}; 00193 00195 const Epetra_Comm & Comm() const{return(A_->Comm());}; 00196 00198 const Epetra_RowMatrix& Matrix() const 00199 { 00200 return(*A_); 00201 } 00202 00204 virtual ostream& Print(ostream& os) const; 00205 00207 virtual int NumInitialize() const 00208 { 00209 return(NumInitialize_); 00210 } 00211 00213 virtual int NumCompute() const 00214 { 00215 return(NumCompute_); 00216 } 00217 00219 virtual int NumApplyInverse() const 00220 { 00221 return(NumApplyInverse_); 00222 } 00223 00225 virtual double InitializeTime() const 00226 { 00227 return(InitializeTime_); 00228 } 00229 00231 virtual double ComputeTime() const 00232 { 00233 return(ComputeTime_); 00234 } 00235 00237 virtual double ApplyInverseTime() const 00238 { 00239 return(ApplyInverseTime_); 00240 } 00241 00243 virtual double InitializeFlops() const 00244 { 00245 return(0.0); 00246 } 00247 00248 virtual double ComputeFlops() const 00249 { 00250 return(ComputeFlops_); 00251 } 00252 00253 virtual double ApplyInverseFlops() const 00254 { 00255 return(ApplyInverseFlops_); 00256 } 00257 00258 private: 00259 00260 // @} 00261 // @{ Private methods 00262 00264 Ifpack_HIPS(const Ifpack_HIPS& RHS) : 00265 Time_(RHS.Comm()) 00266 {} 00267 00269 Ifpack_HIPS& operator=(const Ifpack_HIPS& RHS) 00270 { 00271 return(*this); 00272 } 00273 00275 void Destroy(); 00276 00278 00288 int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00289 00290 00292 int NumGlobalRows() const {return(A_->NumGlobalRows());}; 00293 00295 int NumGlobalCols() const {return(A_->NumGlobalCols());}; 00296 00298 int NumMyRows() const {return(A_->NumMyRows());}; 00299 00301 int NumMyCols() const {return(A_->NumMyCols());}; 00302 00304 /* Epetra_RowMatrix& Matrix() 00305 { 00306 return(*A_); 00307 }*/ 00308 00309 // @} 00310 // @{ Internal data 00311 00313 Teuchos::RefCountPtr<Epetra_RowMatrix> A_; 00314 Teuchos::ParameterList List_; 00315 Teuchos::RefCountPtr<Epetra_Map> RowMap0_; 00316 Teuchos::RefCountPtr<Epetra_Map> ColMap0_; 00317 00318 00319 int HIPS_id; 00320 00321 bool UseTranspose_; 00322 bool Allocated_; 00323 bool ValuesInitialized_; 00324 bool Factored_; 00325 00326 double Condest_; 00327 00328 bool IsParallel_; 00330 bool IsInitialized_; 00332 bool IsComputed_; 00334 char Label_[160]; 00336 int NumInitialize_; 00338 int NumCompute_; 00339 00341 mutable int NumApplyInverse_; 00343 double InitializeTime_; 00345 double ComputeTime_; 00347 mutable double ApplyInverseTime_; 00349 double ComputeFlops_; 00351 mutable double ApplyInverseFlops_; 00353 mutable Epetra_Time Time_; 00354 00355 }; 00356 00357 #endif 00358 #endif /* IFPACK_HIPS_H */
1.7.4