Ifpack2 Templated Preconditioning Package Version 1.0
Ifpack2_DiagonalFilter_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 #ifndef IFPACK2_DIAGONALFILTER_DECL_HPP
00031 #define IFPACK2_DIAGONALFILTER_DECL_HPP
00032 
00033 #include "Ifpack2_ConfigDefs.hpp"
00034 #include "Tpetra_ConfigDefs.hpp"
00035 #include "Tpetra_RowMatrix.hpp"
00036 #include "Teuchos_RefCountPtr.hpp"
00037 #include "Teuchos_ScalarTraits.hpp"
00038 
00039 namespace Ifpack2 {
00040 
00042 
00064 template<class MatrixType>
00065 class  DiagonalFilter : virtual public Tpetra::RowMatrix<typename MatrixType::scalar_type,typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type> {
00066   
00067 public:
00068   typedef typename MatrixType::scalar_type Scalar;
00069   typedef typename MatrixType::local_ordinal_type LocalOrdinal;
00070   typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
00071   typedef typename MatrixType::node_type Node;
00072   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitudeType;
00073   
00074 
00075 public:
00077 
00078 
00080   explicit DiagonalFilter(const Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& Matrix,
00081         magnitudeType AbsoluteThreshold,
00082         magnitudeType RelativeThreshold);
00083   
00085   virtual ~DiagonalFilter();
00086 
00088 
00090 
00091 
00093   virtual const Teuchos::RCP<const Teuchos::Comm<int> > & getComm() const;
00094 
00096   virtual Teuchos::RCP<Node> getNode() const;
00097 
00099   virtual const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > & getRowMap() const;
00100 
00102   virtual const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > & getColMap() const;
00103 
00105   virtual const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > & getDomainMap() const;
00106 
00108   virtual const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > & getRangeMap() const;
00109 
00111   virtual Teuchos::RCP<const Tpetra::RowGraph<LocalOrdinal,GlobalOrdinal,Node> > getGraph() const;
00112 
00114   virtual global_size_t getGlobalNumRows() const;
00115 
00117   virtual global_size_t getGlobalNumCols() const;
00118 
00120   virtual size_t getNodeNumRows() const;
00121 
00123   virtual size_t getNodeNumCols() const;
00124 
00126   virtual GlobalOrdinal getIndexBase() const;
00127 
00129   virtual global_size_t getGlobalNumEntries() const;
00130 
00132   virtual size_t getNodeNumEntries() const;
00133   
00135 
00136   virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const;
00137   
00139 
00140   virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const;
00141   
00143   virtual global_size_t getGlobalNumDiags() const;
00144   
00146   virtual size_t getNodeNumDiags() const;
00147   
00149   virtual size_t getGlobalMaxNumRowEntries() const;
00150   
00152   virtual size_t getNodeMaxNumRowEntries() const;
00153   
00155   virtual bool hasColMap() const;
00156   
00158   virtual bool isLowerTriangular() const;
00159   
00161   virtual bool isUpperTriangular() const;
00162   
00164   virtual bool isLocallyIndexed() const;
00165   
00167   virtual bool isGloballyIndexed() const;
00168   
00170   virtual bool isFillComplete() const;
00171 
00173   virtual bool supportsRowViews() const;  
00174  
00176   
00178 
00179   
00181 
00191   virtual void getGlobalRowCopy(GlobalOrdinal GlobalRow,
00192         const Teuchos::ArrayView<GlobalOrdinal> &Indices,
00193         const Teuchos::ArrayView<Scalar> &Values,
00194         size_t &NumEntries) const;
00195   
00197 
00207   virtual void getLocalRowCopy(LocalOrdinal LocalRow, 
00208              const Teuchos::ArrayView<LocalOrdinal> &Indices, 
00209              const Teuchos::ArrayView<Scalar> &Values,
00210              size_t &NumEntries) const ;
00211   
00213 
00222   virtual void getGlobalRowView(GlobalOrdinal GlobalRow, 
00223         Teuchos::ArrayView<const GlobalOrdinal> &indices, 
00224         Teuchos::ArrayView<const Scalar> &values) const;
00225   
00227 
00236   virtual void getLocalRowView(LocalOrdinal LocalRow, 
00237              Teuchos::ArrayView<const LocalOrdinal> &indices, 
00238              Teuchos::ArrayView<const Scalar> &values) const;
00239   
00241 
00243   virtual void getLocalDiagCopy(Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &diag) const;
00244   
00246   
00248 
00249   
00259   virtual void leftScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x);
00260   
00270   virtual void rightScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x);
00271   
00273 
00276   virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const;
00277 
00279 
00286   virtual void apply(const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X, 
00287          Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y, 
00288          Teuchos::ETransp mode = Teuchos::NO_TRANS, 
00289          Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
00290          Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const;
00291   
00293   virtual bool hasTransposeApply() const;
00294   
00296   
00298 
00299   
00301 
00310   TPETRA_DEPRECATED virtual void getGlobalRowView(GlobalOrdinal GlobalRow, 
00311               Teuchos::ArrayRCP<const GlobalOrdinal> &indices,
00312               Teuchos::ArrayRCP<const Scalar>        &values) const;
00313   
00315 
00324   TPETRA_DEPRECATED virtual void getLocalRowView(LocalOrdinal LocalRow,
00325              Teuchos::ArrayRCP<const LocalOrdinal> &indices,
00326              Teuchos::ArrayRCP<const Scalar>       &values) const;  
00328 
00329   
00330 private:
00331 
00333   Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > A_;
00335   magnitudeType  AbsoluteThreshold_;
00337   magnitudeType RelativeThreshold_;
00339   std::vector<LocalOrdinal> pos_;
00341   Teuchos::RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > val_;
00342 
00343 };// class DiagonalFilter
00344 
00345 }// namespace Ifpack2
00346 
00347 #endif /* IFPACK2_DIAGONALFILTER_DECL_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends