Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Ifpack2_Hiptmair_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 
00046 
00047 #ifndef IFPACK2_HIPTMAIR_DECL_HPP
00048 #define IFPACK2_HIPTMAIR_DECL_HPP
00049 
00050 #include "Ifpack2_ConfigDefs.hpp"
00051 #include "Ifpack2_Preconditioner.hpp"
00052 #include "Ifpack2_Condest.hpp"
00053 #include "Ifpack2_Heap.hpp"
00054 #include "Ifpack2_Parameters.hpp"
00055 
00056 #include <Teuchos_Assert.hpp>
00057 #include <Teuchos_RCP.hpp>
00058 #include <Teuchos_Time.hpp>
00059 #include <Teuchos_TypeNameTraits.hpp>
00060 #include <Teuchos_ScalarTraits.hpp>
00061 
00062 #include <iostream>
00063 #include <string>
00064 #include <sstream>
00065 #include <cmath>
00066 
00067 namespace Teuchos {
00068   class ParameterList; // forward declaration
00069 }
00070 
00071 namespace Ifpack2 {
00072 
00082   template<class MatrixType>
00083   class Hiptmair :
00084     virtual public Ifpack2::Preconditioner<typename MatrixType::scalar_type,
00085                                            typename MatrixType::local_ordinal_type,
00086                                            typename MatrixType::global_ordinal_type,
00087                                            typename MatrixType::node_type>
00088   {
00089   public:
00090     // \name Public typedefs
00092 
00094     typedef typename MatrixType::scalar_type scalar_type;
00095 
00097     TEUCHOS_DEPRECATED typedef typename MatrixType::scalar_type Scalar;
00098 
00099 
00101     typedef typename MatrixType::local_ordinal_type local_ordinal_type;
00102 
00104     TEUCHOS_DEPRECATED typedef typename MatrixType::local_ordinal_type LocalOrdinal;
00105 
00106 
00108     typedef typename MatrixType::global_ordinal_type global_ordinal_type;
00109 
00111     TEUCHOS_DEPRECATED typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
00112 
00113 
00115     typedef typename MatrixType::node_type node_type;
00116 
00118     TEUCHOS_DEPRECATED typedef typename MatrixType::node_type Node;
00119 
00120 
00122     typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitude_type;
00123 
00125     TEUCHOS_DEPRECATED typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType magnitudeType;
00126 
00128     typedef Tpetra::RowMatrix<scalar_type,
00129                               local_ordinal_type,
00130                               global_ordinal_type,
00131                               node_type> row_matrix_type;
00132 
00134     typedef Ifpack2::Preconditioner<scalar_type,
00135                                     local_ordinal_type,
00136                                     global_ordinal_type,
00137                                     node_type> prec_type;
00138 
00140     // \name Constructors and Destructors
00142 
00144     explicit Hiptmair (const Teuchos::RCP<const row_matrix_type>& A,
00145            const Teuchos::RCP<const row_matrix_type>& PtAP,
00146            const Teuchos::RCP<const row_matrix_type>& P);
00147 
00149     virtual ~Hiptmair ();
00150 
00152 
00153 
00154 
00164     void setParameters (const Teuchos::ParameterList& params);
00165 
00167     void initialize ();
00168 
00170     inline bool isInitialized () const {
00171       return IsInitialized_;
00172     }
00173 
00175     void compute ();
00176 
00178     inline bool isComputed() const {
00179       return IsComputed_;
00180     }
00181 
00183 
00184 
00185 
00187     void
00188     apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
00189            Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
00190            Teuchos::ETransp mode = Teuchos::NO_TRANS,
00191            scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
00192            scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero()) const;
00193 
00194     void
00195     applyHiptmairSmoother(const Tpetra::MultiVector<typename MatrixType::scalar_type,
00196         typename MatrixType::local_ordinal_type,
00197         typename MatrixType::global_ordinal_type,
00198         typename MatrixType::node_type>& X,
00199         Tpetra::MultiVector<typename MatrixType::scalar_type,
00200         typename MatrixType::local_ordinal_type,
00201         typename MatrixType::global_ordinal_type,
00202         typename MatrixType::node_type>& Y) const;
00203     
00205     Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> > getDomainMap() const;
00206 
00208     Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> > getRangeMap() const;
00209 
00211     bool hasTransposeApply() const;
00212 
00216     virtual magnitude_type TEUCHOS_DEPRECATED getCondEst() const {
00217       return Condest_;
00218     }
00219 
00221 
00222 
00223 
00225     Teuchos::RCP<const Teuchos::Comm<int> > getComm() const;
00226 
00228     Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > getMatrix() const;
00229 
00231     int getNumInitialize() const;
00232 
00234     int getNumCompute() const;
00235 
00237     int getNumApply() const;
00238 
00240     double getInitializeTime() const;
00241 
00243     double getComputeTime() const;
00244 
00246     double getApplyTime() const;
00247 
00257     virtual magnitude_type TEUCHOS_DEPRECATED
00258     computeCondEst (CondestType CT = Cheap,
00259                     local_ordinal_type MaxIters = 1550,
00260                     magnitude_type Tol = 1e-9,
00261                     const Teuchos::Ptr<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > &Matrix_in = Teuchos::null);
00262 
00264 
00265 
00267     std::string description() const;
00268 
00270     void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
00271 
00273 
00274   private:
00275     typedef Teuchos::ScalarTraits<scalar_type> STS;
00276     typedef Teuchos::ScalarTraits<magnitude_type> STM;
00277 
00279     Hiptmair (const Hiptmair<MatrixType>& RHS);
00280 
00282     Hiptmair<MatrixType>& operator= (const Hiptmair<MatrixType>& RHS);
00283 
00285     //  A - matrix in primary space
00286     //  PtAP - matrix in auxiliary space
00287     //  P  - prolongator matrix
00288     Teuchos::RCP<const row_matrix_type> A_, PtAP_, P_;
00289 
00291     std::string precType1_, precType2_, preOrPost_;
00292 
00294     bool ZeroStartingSolution_;
00295 
00297     Teuchos::ParameterList precList1_, precList2_;
00298 
00300     magnitude_type Condest_;
00302     bool IsInitialized_;
00304     bool IsComputed_;
00306     int NumInitialize_;
00308     int NumCompute_;
00310     mutable int NumApply_;
00312     double InitializeTime_;
00314     double ComputeTime_;
00316     mutable double ApplyTime_;
00318     Teuchos::RCP<prec_type> ifpack2_prec1_, ifpack2_prec2_;
00319   };
00320 
00321 } // namespace Ifpack2
00322 
00323 #endif // IFPACK2_HIPTMAIR_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends