Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Ifpack2_ILUT_decl.hpp
Go to the documentation of this file.
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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00038 //
00039 // ***********************************************************************
00040 //@HEADER
00041 */
00042 
00045 
00046 #ifndef IFPACK2_ILUT_DECL_HPP
00047 #define IFPACK2_ILUT_DECL_HPP
00048 
00049 #include <Ifpack2_ConfigDefs.hpp>
00050 #include <Ifpack2_Preconditioner.hpp>
00051 #include <Ifpack2_Details_CanChangeMatrix.hpp>
00052 #include <Tpetra_CrsMatrix_decl.hpp>
00053 
00054 #include <string>
00055 #include <sstream>
00056 #include <iostream>
00057 #include <cmath>
00058 
00059 
00060 namespace Teuchos {
00061   class ParameterList; // forward declaration
00062 }
00063 
00064 namespace Ifpack2 {
00065 
00091 template<class MatrixType>
00092 class ILUT :
00093     virtual public Ifpack2::Preconditioner<typename MatrixType::scalar_type,
00094                                            typename MatrixType::local_ordinal_type,
00095                                            typename MatrixType::global_ordinal_type,
00096                                            typename MatrixType::node_type>,
00097     virtual public Ifpack2::Details::CanChangeMatrix<Tpetra::RowMatrix<typename MatrixType::scalar_type,
00098                                                                        typename MatrixType::local_ordinal_type,
00099                                                                        typename MatrixType::global_ordinal_type,
00100                                                                        typename MatrixType::node_type> >
00101 {
00102 public:
00104 
00105 
00107   typedef typename MatrixType::scalar_type scalar_type;
00108 
00110   TEUCHOS_DEPRECATED typedef typename MatrixType::scalar_type Scalar;
00111 
00112 
00114   typedef typename MatrixType::local_ordinal_type local_ordinal_type;
00115 
00117   TEUCHOS_DEPRECATED typedef typename MatrixType::local_ordinal_type LocalOrdinal;
00118 
00119 
00121   typedef typename MatrixType::global_ordinal_type global_ordinal_type;
00122 
00124   TEUCHOS_DEPRECATED typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
00125 
00126 
00128   typedef typename MatrixType::node_type node_type;
00129 
00131   TEUCHOS_DEPRECATED typedef typename MatrixType::node_type Node;
00132 
00133 
00135   typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
00136 
00138   TEUCHOS_DEPRECATED typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitudeType;
00139 
00141   typedef Tpetra::RowMatrix<scalar_type,
00142                             local_ordinal_type,
00143                             global_ordinal_type,
00144                             node_type> row_matrix_type;
00145 
00147   typedef Tpetra::CrsMatrix<scalar_type,
00148                             local_ordinal_type,
00149                             global_ordinal_type,
00150                             node_type> crs_matrix_type;
00151 
00153   typedef Tpetra::Map<local_ordinal_type,
00154                       global_ordinal_type,
00155                       node_type> map_type;
00157 
00158 
00159 
00169   explicit ILUT (const Teuchos::RCP<const row_matrix_type>& A);
00170 
00172   virtual ~ILUT();
00173 
00175 
00176 
00177 
00206   void setParameters (const Teuchos::ParameterList& params);
00207 
00215   void initialize ();
00216 
00218   inline bool isInitialized() const {
00219     return IsInitialized_;
00220   }
00221 
00223 
00230   void compute();
00231 
00233   inline bool isComputed() const {
00234     return IsComputed_;
00235   }
00236 
00238 
00239 
00240 
00263   virtual void
00264   setMatrix (const Teuchos::RCP<const row_matrix_type>& A);
00265 
00267 
00268 
00269 
00274   void
00275   apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
00276          Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
00277          Teuchos::ETransp mode = Teuchos::NO_TRANS,
00278          scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
00279          scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero()) const;
00280 
00282   Teuchos::RCP<const map_type> getDomainMap() const;
00283 
00285   Teuchos::RCP<const map_type> getRangeMap() const;
00286 
00288   bool hasTransposeApply() const;
00289 
00291 
00292 
00293 
00303   virtual magnitude_type TEUCHOS_DEPRECATED
00304   computeCondEst (CondestType CT = Cheap,
00305                   local_ordinal_type MaxIters = 1550,
00306                   magnitude_type Tol = 1e-9,
00307                   const Teuchos::Ptr<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > &Matrix_in = Teuchos::null);
00308 
00312   virtual magnitude_type TEUCHOS_DEPRECATED getCondEst() const {
00313     return Condest_;
00314   }
00315 
00317   Teuchos::RCP<const Teuchos::Comm<int> > getComm() const;
00318 
00320   Teuchos::RCP<const row_matrix_type> getMatrix () const;
00321 
00323   Teuchos::RCP<const crs_matrix_type> getL () const { return L_; }
00324 
00326   Teuchos::RCP<const crs_matrix_type> getU () const { return U_; }
00327 
00329   int getNumInitialize() const;
00330 
00332   int getNumCompute() const;
00333 
00335   int getNumApply() const;
00336 
00338   double getInitializeTime() const;
00339 
00341   double getComputeTime() const;
00342 
00344   double getApplyTime() const;
00345 
00353   inline int getLevelOfFill() const {
00354     return LevelOfFill_;
00355   }
00356 
00358   inline magnitude_type getAbsoluteThreshold() const {
00359     return(Athresh_);
00360   }
00361 
00363   inline magnitude_type getRelativeThreshold() const {
00364     return(Rthresh_);
00365   }
00366 
00368   inline magnitude_type getRelaxValue() const {
00369     return(RelaxValue_);
00370   }
00371 
00373   inline magnitude_type getDropTolerance() const {
00374     return(DropTolerance_);
00375   }
00376 
00378   global_size_t getGlobalNumEntries() const;
00379 
00381   size_t getNodeNumEntries() const;
00382 
00384 
00385 
00386 
00388   std::string description() const;
00389 
00391   void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
00392 
00394 
00395 private:
00396   typedef Teuchos::ScalarTraits<scalar_type> STS;
00397   typedef Teuchos::ScalarTraits<magnitude_type> STM;
00398   typedef typename Teuchos::Array<local_ordinal_type>::size_type size_type;
00399 
00401   ILUT (const ILUT<MatrixType>& RHS);
00402 
00404   ILUT<MatrixType>& operator= (const ILUT<MatrixType>& RHS);
00405 
00416   static Teuchos::RCP<const row_matrix_type>
00417   makeLocalFilter (const Teuchos::RCP<const row_matrix_type>& A);
00418 
00419   // \name The matrix and its incomplete LU factors
00421 
00423   Teuchos::RCP<const row_matrix_type> A_;
00425   Teuchos::RCP<const row_matrix_type> A_local_;
00427   Teuchos::RCP<crs_matrix_type> L_;
00429   Teuchos::RCP<crs_matrix_type> U_;
00430 
00432   // \name Parameters (set by setParameters())
00434 
00435   magnitude_type Athresh_; 
00436   magnitude_type Rthresh_; 
00437   magnitude_type RelaxValue_; 
00438   int LevelOfFill_; 
00439 
00440   magnitude_type DropTolerance_;
00442   magnitude_type Condest_;
00443 
00445   // \name Other internal data
00447 
00449   double InitializeTime_;
00451   double ComputeTime_;
00453   mutable double ApplyTime_;
00455   int NumInitialize_;
00457   int NumCompute_;
00459   mutable int NumApply_;
00461   bool IsInitialized_;
00463   bool IsComputed_;
00465 }; // class ILUT
00466 
00467 } // namespace Ifpack2
00468 
00469 #endif /* IFPACK2_ILUT_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends