Ifpack2 Templated Preconditioning Package Version 1.0
Ifpack2_LocalFilter_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_LOCALFILTER_DECL_HPP
00031 #define IFPACK2_LOCALFILTER_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 
00040 namespace Ifpack2 {
00042 
00077 template<class MatrixType>
00078 class  LocalFilter : virtual public Tpetra::RowMatrix<typename MatrixType::scalar_type,typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type> {
00079   
00080 public:
00081   typedef typename MatrixType::scalar_type Scalar;
00082   typedef typename MatrixType::local_ordinal_type LocalOrdinal;
00083   typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
00084   typedef typename MatrixType::node_type Node;
00085   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitudeType;
00086   
00087 
00088 public:
00090 
00091 
00093   explicit LocalFilter(const Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& Matrix);
00094   
00096   virtual ~LocalFilter();
00097 
00099 
00101 
00102 
00104   virtual const Teuchos::RCP<const Teuchos::Comm<int> > & getComm() const;
00105 
00107   virtual Teuchos::RCP<Node> getNode() const;
00108 
00110   virtual const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > & getRowMap() const;
00111 
00113   virtual const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > & getColMap() const;
00114 
00116   virtual const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > & getDomainMap() const;
00117 
00119   virtual const Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > & getRangeMap() const;
00120 
00122   virtual Teuchos::RCP<const Tpetra::RowGraph<LocalOrdinal,GlobalOrdinal,Node> > getGraph() const;
00123 
00125   virtual global_size_t getGlobalNumRows() const;
00126 
00128   virtual global_size_t getGlobalNumCols() const;
00129 
00131   virtual size_t getNodeNumRows() const;
00132 
00134   virtual size_t getNodeNumCols() const;
00135 
00137   virtual GlobalOrdinal getIndexBase() const;
00138 
00140   virtual global_size_t getGlobalNumEntries() const;
00141 
00143   virtual size_t getNodeNumEntries() const;
00144   
00146 
00147   virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const;
00148   
00150 
00151   virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const;
00152   
00154   virtual global_size_t getGlobalNumDiags() const;
00155   
00157   virtual size_t getNodeNumDiags() const;
00158   
00160   virtual size_t getGlobalMaxNumRowEntries() const;
00161   
00163   virtual size_t getNodeMaxNumRowEntries() const;
00164   
00166   virtual bool hasColMap() const;
00167   
00169   virtual bool isLowerTriangular() const;
00170   
00172   virtual bool isUpperTriangular() const;
00173   
00175   virtual bool isLocallyIndexed() const;
00176   
00178   virtual bool isGloballyIndexed() const;
00179   
00181   virtual bool isFillComplete() const;
00182 
00184   virtual bool supportsRowViews() const;  
00185 
00187   
00189 
00190   
00192 
00202   virtual void getGlobalRowCopy(GlobalOrdinal GlobalRow,
00203         const Teuchos::ArrayView<GlobalOrdinal> &Indices,
00204         const Teuchos::ArrayView<Scalar> &Values,
00205         size_t &NumEntries) const;
00206   
00208 
00218   virtual void getLocalRowCopy(LocalOrdinal LocalRow, 
00219              const Teuchos::ArrayView<LocalOrdinal> &Indices, 
00220              const Teuchos::ArrayView<Scalar> &Values,
00221              size_t &NumEntries) const ;
00222   
00224 
00233   virtual void getGlobalRowView(GlobalOrdinal GlobalRow, 
00234         Teuchos::ArrayView<const GlobalOrdinal> &indices, 
00235         Teuchos::ArrayView<const Scalar> &values) const;
00236   
00238 
00247   virtual void getLocalRowView(LocalOrdinal LocalRow, 
00248              Teuchos::ArrayView<const LocalOrdinal> &indices, 
00249              Teuchos::ArrayView<const Scalar> &values) const;
00250   
00252 
00254   virtual void getLocalDiagCopy(Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &diag) const;
00255   
00257   
00259 
00260   
00270   virtual void leftScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x);
00271   
00281   virtual void rightScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x);
00282   
00284 
00287   virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const;
00288 
00290 
00295   virtual void apply(const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X, 
00296          Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y, 
00297          Teuchos::ETransp mode = Teuchos::NO_TRANS, 
00298          Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
00299          Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const;
00300   
00302   virtual bool hasTransposeApply() const;
00303   
00305   
00307 
00308   
00310 
00319   TPETRA_DEPRECATED virtual void getGlobalRowView(GlobalOrdinal GlobalRow, 
00320               Teuchos::ArrayRCP<const GlobalOrdinal> &indices,
00321               Teuchos::ArrayRCP<const Scalar>        &values) const;
00322   
00324 
00333   TPETRA_DEPRECATED virtual void getLocalRowView(LocalOrdinal LocalRow,
00334              Teuchos::ArrayRCP<const LocalOrdinal> &indices,
00335              Teuchos::ArrayRCP<const Scalar>       &values) const;  
00337 
00338   
00339 private:
00340 
00342   Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > A_;
00344   Teuchos::RCP<const Teuchos::Comm<int> > LocalComm_;
00346   Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > LocalMap_;
00348   size_t NumRows_;
00350   size_t NumNonzeros_;
00352   size_t MaxNumEntries_;
00354   size_t MaxNumEntriesA_;
00356   std::vector<size_t> NumEntries_;
00358   mutable Teuchos::Array<LocalOrdinal> Indices_;
00360   mutable Teuchos::Array<Scalar> Values_;
00361 
00362 };// class LocalFilter
00363 
00364 }// namespace Ifpack2
00365 
00366 #endif /* IFPACK2_LOCALFILTER_DECL_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends