|
Ifpack2 Templated Preconditioning Package
Version 1.0
|
00001 /*@HEADER 00002 // *********************************************************************** 00003 // 00004 // Ifpack2: Tempated Object-Oriented Algebraic Preconditioner Package 00005 // Copyright (2009) 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 //----------------------------------------------------- 00031 // Ifpack2::ILUT is a translation of the Aztec ILUT 00032 // implementation. The Aztec ILUT implementation was 00033 // written by Ray Tuminaro. 00034 // See notes in the Ifpack2::ILUT::Compute method. 00035 // ABW. 00036 //------------------------------------------------------ 00037 00038 #ifndef IFPACK2_ILUT_DECL_HPP 00039 #define IFPACK2_ILUT_DECL_HPP 00040 00041 #include "Ifpack2_ConfigDefs.hpp" 00042 #include "Ifpack2_Preconditioner.hpp" 00043 #include "Ifpack2_Condest.hpp" 00044 #include "Ifpack2_Heap.hpp" 00045 #include "Ifpack2_Parameters.hpp" 00046 00047 #include <Teuchos_Assert.hpp> 00048 #include <Teuchos_RCP.hpp> 00049 #include <Teuchos_Time.hpp> 00050 #include <Teuchos_TypeNameTraits.hpp> 00051 #include <Teuchos_ScalarTraits.hpp> 00052 00053 #include <string> 00054 #include <sstream> 00055 #include <iostream> 00056 #include <cmath> 00057 00058 namespace Teuchos { 00059 // forward declaration 00060 class ParameterList; 00061 } 00062 00063 namespace Ifpack2 { 00064 00066 // of a given Tpetra::RowMatrix. 00067 00073 template<class MatrixType> 00074 class ILUT: virtual public Ifpack2::Preconditioner<typename MatrixType::scalar_type,typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type> { 00075 00076 public: 00077 typedef typename MatrixType::scalar_type Scalar; 00078 typedef typename MatrixType::local_ordinal_type LocalOrdinal; 00079 typedef typename MatrixType::global_ordinal_type GlobalOrdinal; 00080 typedef typename MatrixType::node_type Node; 00081 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitudeType; 00082 00083 // \name Constructors and Destructors 00085 00087 explicit ILUT(const Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &A); 00088 00090 virtual ~ILUT(); 00091 00093 00094 00095 00104 void setParameters(const Teuchos::ParameterList& params); 00105 00107 00109 void initialize(); 00110 00112 inline bool isInitialized() const { 00113 return(IsInitialized_); 00114 } 00115 00117 00124 void compute(); 00125 00127 inline bool isComputed() const { 00128 return(IsComputed_); 00129 } 00130 00132 00134 00135 00137 00145 void apply( 00146 const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& X, 00147 Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& Y, 00148 Teuchos::ETransp mode = Teuchos::NO_TRANS, 00149 Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(), 00150 Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const; 00151 00153 const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& getDomainMap() const; 00154 00156 const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >& getRangeMap() const; 00157 00158 bool hasTransposeApply() const; 00159 00161 00163 00164 00166 magnitudeType computeCondEst(CondestType CT = Cheap, 00167 LocalOrdinal MaxIters = 1550, 00168 magnitudeType Tol = 1e-9, 00169 const Teuchos::Ptr<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &Matrix_in = Teuchos::null); 00170 00172 magnitudeType getCondEst() const { return Condest_; } 00173 00175 const Teuchos::RCP<const Teuchos::Comm<int> > & getComm() const; 00176 00178 Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > getMatrix() const; 00179 00181 const Teuchos::RCP<const MatrixType> getL() const { return L_; } 00182 00184 const Teuchos::RCP<const MatrixType> getU() const { return U_; } 00185 00187 int getNumInitialize() const; 00188 00190 int getNumCompute() const; 00191 00193 int getNumApply() const; 00194 00196 double getInitializeTime() const; 00197 00199 double getComputeTime() const; 00200 00202 double getApplyTime() const; 00203 00204 inline double getLevelOfFill() const { 00205 return(LevelOfFill_); 00206 } 00207 00209 inline double getAbsoluteThreshold() const { 00210 return(Athresh_); 00211 } 00212 00214 inline double getRelativeThreshold() const { 00215 return(Rthresh_); 00216 } 00217 00219 inline magnitudeType getRelaxValue() const { 00220 return(RelaxValue_); 00221 } 00222 00224 inline magnitudeType getDropTolerance() const { 00225 return(DropTolerance_); 00226 } 00227 00229 global_size_t getGlobalNumEntries() const; 00230 00232 size_t getNodeNumEntries() const; 00233 00234 // @} 00235 00237 00238 00240 std::string description() const; 00241 00243 void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const; 00244 00246 00247 private: 00248 00249 // @{ Internal methods 00250 00252 ILUT(const ILUT<MatrixType>& RHS); 00253 00255 ILUT<MatrixType>& operator=(const ILUT<MatrixType>& RHS); 00256 00258 00259 // @{ Internal data and parameters 00260 00262 const Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > A_; 00264 const Teuchos::RCP<const Teuchos::Comm<int> > Comm_; 00266 Teuchos::RCP<MatrixType> L_; 00268 Teuchos::RCP<MatrixType> U_; 00270 double Athresh_; 00272 double Rthresh_; 00273 magnitudeType RelaxValue_; 00275 double LevelOfFill_; 00277 magnitudeType DropTolerance_; 00279 magnitudeType Condest_; 00281 bool IsInitialized_; 00283 bool IsComputed_; 00285 int NumInitialize_; 00287 int NumCompute_; 00289 mutable int NumApply_; 00291 double InitializeTime_; 00293 double ComputeTime_; 00295 mutable double ApplyTime_; 00297 mutable Teuchos::Time Time_; 00299 LocalOrdinal NumMyRows_; 00301 global_size_t NumGlobalNonzeros_; 00302 00304 00305 }; // class ILUT 00306 00307 }//namespace Ifpack2 00308 00309 #endif /* IFPACK2_ILUT_HPP */
1.7.6.1