Ifpack2 Templated Preconditioning Package Version 1.0
Ifpack2_ILUT_decl.hpp
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   // \name Typedefs
00079 
00081   typedef typename MatrixType::scalar_type scalar_type;
00082 
00084   TEUCHOS_DEPRECATED typedef typename MatrixType::scalar_type Scalar;
00085 
00086 
00088   typedef typename MatrixType::local_ordinal_type local_ordinal_type;
00089 
00091   TEUCHOS_DEPRECATED typedef typename MatrixType::local_ordinal_type LocalOrdinal;
00092 
00093 
00095   typedef typename MatrixType::global_ordinal_type global_ordinal_type;
00096 
00098   TEUCHOS_DEPRECATED typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
00099 
00100 
00102   typedef typename MatrixType::node_type node_type;
00103 
00105   TEUCHOS_DEPRECATED typedef typename MatrixType::node_type Node;
00106 
00107 
00109   typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
00110 
00112   TEUCHOS_DEPRECATED typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitudeType;
00113 
00115   // \name Constructors and Destructors
00117 
00119   explicit ILUT(const Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > &A);
00120 
00122   virtual ~ILUT();
00123 
00125 
00126 
00127 
00136   void setParameters(const Teuchos::ParameterList& params);
00137 
00139 
00141   void initialize();
00142 
00144   inline bool isInitialized() const {
00145     return(IsInitialized_);
00146   }
00147 
00149 
00156   void compute();
00157 
00159   inline bool isComputed() const {
00160     return(IsComputed_);
00161   }
00162 
00164 
00166 
00167 
00169 
00175   void apply(
00176       const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
00177             Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
00178             Teuchos::ETransp mode = Teuchos::NO_TRANS,
00179                scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
00180                scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero()) const;
00181 
00183   const Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >& getDomainMap() const;
00184 
00186   const Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >& getRangeMap() const;
00187 
00189   bool hasTransposeApply() const;
00190 
00192 
00194 
00195 
00197   magnitude_type computeCondEst(CondestType CT = Cheap,
00198                                local_ordinal_type MaxIters = 1550,
00199                                magnitude_type Tol = 1e-9,
00200                                const Teuchos::Ptr<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > &Matrix_in = Teuchos::null);
00201 
00203   magnitude_type getCondEst() const { return Condest_; }
00204 
00206   const Teuchos::RCP<const Teuchos::Comm<int> > & getComm() const;
00207 
00209   Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > getMatrix() const;
00210 
00212   const Teuchos::RCP<const MatrixType> getL() const { return L_; }
00213 
00215   const Teuchos::RCP<const MatrixType> getU() const { return U_; }
00216 
00218   int getNumInitialize() const;
00219 
00221   int getNumCompute() const;
00222 
00224   int getNumApply() const;
00225 
00227   double getInitializeTime() const;
00228 
00230   double getComputeTime() const;
00231 
00233   double getApplyTime() const;
00234 
00236   inline magnitude_type getLevelOfFill() const {
00237     return(LevelOfFill_);
00238   }
00239 
00241   inline magnitude_type getAbsoluteThreshold() const {
00242     return(Athresh_);
00243   }
00244 
00246   inline magnitude_type getRelativeThreshold() const {
00247     return(Rthresh_);
00248   }
00249 
00251   inline magnitude_type getRelaxValue() const {
00252     return(RelaxValue_);
00253   }
00254 
00256   inline magnitude_type getDropTolerance() const {
00257     return(DropTolerance_);
00258   }
00259 
00261   global_size_t getGlobalNumEntries() const;
00262 
00264   size_t getNodeNumEntries() const;
00265 
00266   // @}
00267 
00269 
00270 
00272   std::string description() const;
00273 
00275   void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
00276 
00278 
00279 private:
00280 
00281   // @{ Internal methods
00282 
00284   ILUT(const ILUT<MatrixType>& RHS);
00285 
00287   ILUT<MatrixType>& operator=(const ILUT<MatrixType>& RHS);
00288 
00290 
00291   // @{ Internal data and parameters
00292 
00294   const Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > A_;
00296   const Teuchos::RCP<const Teuchos::Comm<int> > Comm_;
00298   Teuchos::RCP<MatrixType> L_;
00300   Teuchos::RCP<MatrixType> U_;
00302   magnitude_type Athresh_;
00304   magnitude_type Rthresh_;
00305   magnitude_type RelaxValue_;
00307   magnitude_type LevelOfFill_;
00309   magnitude_type DropTolerance_;
00311   magnitude_type Condest_;
00313   bool IsInitialized_;
00315   bool IsComputed_;
00317   int NumInitialize_;
00319   int NumCompute_;
00321   mutable int NumApply_;
00323   double InitializeTime_;
00325   double ComputeTime_;
00327   mutable double ApplyTime_;
00329   mutable Teuchos::Time Time_;
00331   local_ordinal_type NumMyRows_;
00333   global_size_t NumGlobalNonzeros_;
00334 
00336 
00337 }; // class ILUT
00338 
00339 }//namespace Ifpack2
00340 
00341 #endif /* IFPACK2_ILUT_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends