Ifpack2 Templated Preconditioning Package Version 1.0
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 
00087 template<class MatrixType>
00088 class ILUT :
00089     virtual public Ifpack2::Preconditioner<typename MatrixType::scalar_type,
00090                                            typename MatrixType::local_ordinal_type,
00091                                            typename MatrixType::global_ordinal_type,
00092                                            typename MatrixType::node_type>,
00093     virtual public Ifpack2::Details::CanChangeMatrix<Tpetra::RowMatrix<typename MatrixType::scalar_type,
00094                                                                        typename MatrixType::local_ordinal_type,
00095                                                                        typename MatrixType::global_ordinal_type,
00096                                                                        typename MatrixType::node_type> >
00097 {
00098 public:
00100 
00101 
00103   typedef typename MatrixType::scalar_type scalar_type;
00104 
00106   TEUCHOS_DEPRECATED typedef typename MatrixType::scalar_type Scalar;
00107 
00108 
00110   typedef typename MatrixType::local_ordinal_type local_ordinal_type;
00111 
00113   TEUCHOS_DEPRECATED typedef typename MatrixType::local_ordinal_type LocalOrdinal;
00114 
00115 
00117   typedef typename MatrixType::global_ordinal_type global_ordinal_type;
00118 
00120   TEUCHOS_DEPRECATED typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
00121 
00122 
00124   typedef typename MatrixType::node_type node_type;
00125 
00127   TEUCHOS_DEPRECATED typedef typename MatrixType::node_type Node;
00128 
00129 
00131   typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
00132 
00134   TEUCHOS_DEPRECATED typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitudeType;
00135 
00137   typedef Tpetra::RowMatrix<scalar_type,
00138                             local_ordinal_type,
00139                             global_ordinal_type,
00140                             node_type> row_matrix_type;
00141 
00143   typedef Tpetra::CrsMatrix<scalar_type,
00144                             local_ordinal_type,
00145                             global_ordinal_type,
00146                             node_type> crs_matrix_type;
00147 
00149   typedef Tpetra::Map<local_ordinal_type,
00150                       global_ordinal_type,
00151                       node_type> map_type;
00153 
00154 
00155 
00165   explicit ILUT (const Teuchos::RCP<const row_matrix_type>& A);
00166 
00168   virtual ~ILUT();
00169 
00171 
00172 
00173 
00199   void setParameters (const Teuchos::ParameterList& params);
00200 
00208   void initialize ();
00209 
00211   inline bool isInitialized() const {
00212     return IsInitialized_;
00213   }
00214 
00216 
00223   void compute();
00224 
00226   inline bool isComputed() const {
00227     return IsComputed_;
00228   }
00229 
00231 
00232 
00233 
00256   virtual void
00257   setMatrix (const Teuchos::RCP<const row_matrix_type>& A);
00258 
00260 
00261 
00262 
00267   void
00268   apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
00269          Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
00270          Teuchos::ETransp mode = Teuchos::NO_TRANS,
00271          scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
00272          scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero()) const;
00273 
00275   Teuchos::RCP<const map_type> getDomainMap() const;
00276 
00278   Teuchos::RCP<const map_type> getRangeMap() const;
00279 
00281   bool hasTransposeApply() const;
00282 
00284 
00285 
00286 
00296   virtual magnitude_type TEUCHOS_DEPRECATED
00297   computeCondEst (CondestType CT = Cheap,
00298                   local_ordinal_type MaxIters = 1550,
00299                   magnitude_type Tol = 1e-9,
00300                   const Teuchos::Ptr<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > &Matrix_in = Teuchos::null);
00301 
00305   virtual magnitude_type TEUCHOS_DEPRECATED getCondEst() const {
00306     return Condest_;
00307   }
00308 
00310   Teuchos::RCP<const Teuchos::Comm<int> > getComm() const;
00311 
00313   Teuchos::RCP<const row_matrix_type> getMatrix () const;
00314 
00316   Teuchos::RCP<const crs_matrix_type> getL () const { return L_; }
00317 
00319   Teuchos::RCP<const crs_matrix_type> getU () const { return U_; }
00320 
00322   int getNumInitialize() const;
00323 
00325   int getNumCompute() const;
00326 
00328   int getNumApply() const;
00329 
00331   double getInitializeTime() const;
00332 
00334   double getComputeTime() const;
00335 
00337   double getApplyTime() const;
00338 
00346   inline int getLevelOfFill() const {
00347     return LevelOfFill_;
00348   }
00349 
00351   inline magnitude_type getAbsoluteThreshold() const {
00352     return(Athresh_);
00353   }
00354 
00356   inline magnitude_type getRelativeThreshold() const {
00357     return(Rthresh_);
00358   }
00359 
00361   inline magnitude_type getRelaxValue() const {
00362     return(RelaxValue_);
00363   }
00364 
00366   inline magnitude_type getDropTolerance() const {
00367     return(DropTolerance_);
00368   }
00369 
00371   global_size_t getGlobalNumEntries() const;
00372 
00374   size_t getNodeNumEntries() const;
00375 
00377 
00378 
00379 
00381   std::string description() const;
00382 
00384   void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
00385 
00387 
00388 private:
00389   typedef Teuchos::ScalarTraits<scalar_type> STS;
00390   typedef Teuchos::ScalarTraits<magnitude_type> STM;
00391   typedef typename Teuchos::Array<local_ordinal_type>::size_type size_type;
00392 
00394   ILUT (const ILUT<MatrixType>& RHS);
00395 
00397   ILUT<MatrixType>& operator= (const ILUT<MatrixType>& RHS);
00398 
00409   static Teuchos::RCP<const row_matrix_type>
00410   makeLocalFilter (const Teuchos::RCP<const row_matrix_type>& A);
00411 
00412   // \name The matrix and its incomplete LU factors
00414 
00416   Teuchos::RCP<const row_matrix_type> A_;
00418   Teuchos::RCP<const row_matrix_type> A_local_;
00420   Teuchos::RCP<crs_matrix_type> L_;
00422   Teuchos::RCP<crs_matrix_type> U_;
00423 
00425   // \name Parameters (set by setParameters())
00427 
00428   magnitude_type Athresh_; 
00429   magnitude_type Rthresh_; 
00430   magnitude_type RelaxValue_; 
00431   int LevelOfFill_; 
00432 
00433   magnitude_type DropTolerance_;
00435   magnitude_type Condest_;
00436 
00438   // \name Other internal data
00440 
00442   double InitializeTime_;
00444   double ComputeTime_;
00446   mutable double ApplyTime_;
00448   int NumInitialize_;
00450   int NumCompute_;
00452   mutable int NumApply_;
00454   bool IsInitialized_;
00456   bool IsComputed_;
00458 }; // class ILUT
00459 
00460 } // namespace Ifpack2
00461 
00462 #endif /* IFPACK2_ILUT_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends