|
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_POINTRELAXATION_H 00031 #define IFPACK_POINTRELAXATION_H 00032 00033 #include "Ifpack_ConfigDefs.h" 00034 #include "Ifpack_Preconditioner.h" 00035 00036 #include "Epetra_Vector.h" 00037 #include "Epetra_Time.h" 00038 #include "Epetra_RowMatrix.h" 00039 #include "Epetra_Import.h" 00040 00041 #include "Teuchos_RefCountPtr.hpp" 00042 00043 namespace Teuchos { 00044 class ParameterList; 00045 } 00046 class Epetra_MultiVector; 00047 class Epetra_Vector; 00048 class Epetra_Map; 00049 class Epetra_Comm; 00050 class Epetra_CrsMatrix; 00051 00053 00117 class Ifpack_PointRelaxation : public Ifpack_Preconditioner { 00118 00119 public: 00120 00122 00123 00128 Ifpack_PointRelaxation(const Epetra_RowMatrix* Matrix); 00129 00131 virtual ~Ifpack_PointRelaxation() {} 00132 00134 00141 virtual inline int SetUseTranspose(bool UseTranspose_in) 00142 { 00143 UseTranspose_ = UseTranspose_in; 00144 return(0); 00145 } 00146 00148 00150 00152 00160 virtual inline int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const 00161 { 00162 if (IsComputed() == false) 00163 IFPACK_CHK_ERR(-3); 00164 00165 if (X.NumVectors() != Y.NumVectors()) 00166 IFPACK_CHK_ERR(-2); 00167 00168 IFPACK_CHK_ERR(Matrix_->Multiply(UseTranspose(),X,Y)); 00169 return(0); 00170 } 00171 00173 00183 virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; 00184 00186 virtual double NormInf() const 00187 { 00188 return(-1.0); 00189 } 00191 00193 00194 virtual const char * Label() const 00195 { 00196 return(Label_.c_str()); 00197 } 00198 00200 virtual bool UseTranspose() const 00201 { 00202 return(UseTranspose_); 00203 } 00204 00206 virtual bool HasNormInf() const 00207 { 00208 return(false); 00209 } 00210 00212 virtual const Epetra_Comm & Comm() const; 00213 00215 virtual const Epetra_Map & OperatorDomainMap() const; 00216 00218 virtual const Epetra_Map & OperatorRangeMap() const; 00219 00220 virtual int Initialize(); 00221 00222 virtual bool IsInitialized() const 00223 { 00224 return(IsInitialized_); 00225 } 00226 00228 virtual inline bool IsComputed() const 00229 { 00230 return(IsComputed_); 00231 } 00232 00234 virtual int Compute(); 00235 00237 00239 00240 virtual const Epetra_RowMatrix& Matrix() const 00241 { 00242 return(*Matrix_); 00243 } 00244 00246 virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap, 00247 const int MaxIters = 1550, 00248 const double Tol = 1e-9, 00249 Epetra_RowMatrix* Matrix = 0); 00250 00252 virtual double Condest() const 00253 { 00254 return(Condest_); 00255 } 00256 00258 virtual int SetParameters(Teuchos::ParameterList& List); 00259 00261 virtual ostream& Print(ostream & os) const; 00262 00264 00266 00268 virtual int NumInitialize() const 00269 { 00270 return(NumInitialize_); 00271 } 00272 00274 virtual int NumCompute() const 00275 { 00276 return(NumCompute_); 00277 } 00278 00280 virtual int NumApplyInverse() const 00281 { 00282 return(NumApplyInverse_); 00283 } 00284 00286 virtual double InitializeTime() const 00287 { 00288 return(InitializeTime_); 00289 } 00290 00292 virtual double ComputeTime() const 00293 { 00294 return(ComputeTime_); 00295 } 00296 00298 virtual double ApplyInverseTime() const 00299 { 00300 return(ApplyInverseTime_); 00301 } 00302 00304 virtual double InitializeFlops() const 00305 { 00306 return(0.0); 00307 } 00308 00310 virtual double ComputeFlops() const 00311 { 00312 return(ComputeFlops_); 00313 } 00314 00316 virtual double ApplyInverseFlops() const 00317 { 00318 return(ApplyInverseFlops_); 00319 } 00320 00321 // @} 00322 00323 private: 00324 00325 // @{ Application of the preconditioner 00326 00328 virtual int ApplyInverseJacobi(const Epetra_MultiVector& X, 00329 Epetra_MultiVector& Y) const; 00330 00332 virtual int ApplyInverseGS(const Epetra_MultiVector& X, 00333 Epetra_MultiVector& Y) const; 00334 00335 virtual int ApplyInverseGS_RowMatrix(const Epetra_MultiVector& X, 00336 Epetra_MultiVector& Y) const; 00337 00338 virtual int ApplyInverseGS_CrsMatrix(const Epetra_CrsMatrix* A, 00339 const Epetra_MultiVector& X, 00340 Epetra_MultiVector& Y) const; 00341 00342 virtual int ApplyInverseGS_FastCrsMatrix(const Epetra_CrsMatrix* A, 00343 const Epetra_MultiVector& X, 00344 Epetra_MultiVector& Y) const; 00345 00347 virtual int ApplyInverseSGS(const Epetra_MultiVector& X, 00348 Epetra_MultiVector& Y) const; 00349 00350 virtual int ApplyInverseSGS_RowMatrix(const Epetra_MultiVector& X, 00351 Epetra_MultiVector& Y) const; 00352 00353 virtual int ApplyInverseSGS_CrsMatrix(const Epetra_CrsMatrix* A, 00354 const Epetra_MultiVector& X, 00355 Epetra_MultiVector& Y) const; 00356 00357 virtual int ApplyInverseSGS_FastCrsMatrix(const Epetra_CrsMatrix* A, 00358 const Epetra_MultiVector& X, 00359 Epetra_MultiVector& Y) const; 00361 00362 private: 00363 00365 virtual void SetLabel(); 00366 00368 Ifpack_PointRelaxation(const Ifpack_PointRelaxation& rhs) 00369 {} 00370 00372 Ifpack_PointRelaxation& operator=(const Ifpack_PointRelaxation& rhs) 00373 { 00374 return(*this); 00375 } 00376 00377 // @{ Initializations, timing and flops 00379 bool IsInitialized_; 00381 bool IsComputed_; 00383 int NumInitialize_; 00385 int NumCompute_; 00387 mutable int NumApplyInverse_; 00389 double InitializeTime_; 00391 double ComputeTime_; 00393 mutable double ApplyInverseTime_; 00395 double ComputeFlops_; 00397 mutable double ApplyInverseFlops_; 00398 // @} 00399 00400 // @{ Settings 00402 int NumSweeps_; 00404 double DampingFactor_; 00406 bool UseTranspose_; 00408 double Condest_; 00410 bool ComputeCondest_; 00412 string Label_; 00413 int PrecType_; 00414 double MinDiagonalValue_; 00415 // @} 00416 00417 // @{ Other data 00419 int NumMyRows_; 00421 int NumMyNonzeros_; 00423 int NumGlobalRows_; 00425 int NumGlobalNonzeros_; 00427 Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_; 00429 Teuchos::RefCountPtr<Epetra_Import> Importer_; 00431 mutable Teuchos::RefCountPtr<Epetra_Vector> Diagonal_; 00433 Teuchos::RefCountPtr<Epetra_Time> Time_; 00435 bool IsParallel_; 00437 bool ZeroStartingSolution_; 00439 bool DoBackwardGS_; 00440 // @} 00441 00442 00443 00444 }; 00445 00446 #endif // IFPACK_POINTRELAXATION_H
1.7.4