Ifpack2 Templated Preconditioning Package Version 1.0
Ifpack2_DropFilter_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 // 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 
00043 #ifndef IFPACK2_DROPFILTER_DECL_HPP
00044 #define IFPACK2_DROPFILTER_DECL_HPP
00045 
00046 #include "Ifpack2_ConfigDefs.hpp"
00047 #include "Tpetra_ConfigDefs.hpp"
00048 #include "Tpetra_RowMatrix.hpp"
00049 #include "Teuchos_RefCountPtr.hpp"
00050 #include "Teuchos_ScalarTraits.hpp"
00051 
00052 
00053 namespace Ifpack2 {
00055 
00079 template<class MatrixType>
00080 class DropFilter : 
00081     virtual public Tpetra::RowMatrix<typename MatrixType::scalar_type,
00082              typename MatrixType::local_ordinal_type,
00083              typename MatrixType::global_ordinal_type,
00084              typename MatrixType::node_type> {
00085 public:
00086   typedef typename MatrixType::scalar_type Scalar;
00087   typedef typename MatrixType::local_ordinal_type LocalOrdinal;
00088   typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
00089   typedef typename MatrixType::node_type Node;
00090   typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType magnitudeType;
00091   
00093 
00094 
00096   explicit DropFilter(const Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& Matrix,
00097           magnitudeType DropTol);
00099   virtual ~DropFilter();
00100 
00102 
00104 
00105 
00107   virtual Teuchos::RCP<const Teuchos::Comm<int> > getComm() const;
00108 
00110   virtual Teuchos::RCP<Node> getNode() const;
00111 
00113   virtual Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > getRowMap() const;
00114 
00116   virtual Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > getColMap() const;
00117 
00119   virtual Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > getDomainMap() const;
00120 
00122   virtual Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > getRangeMap() const;
00123 
00125   virtual Teuchos::RCP<const Tpetra::RowGraph<LocalOrdinal,GlobalOrdinal,Node> > getGraph() const;
00126 
00128   virtual global_size_t getGlobalNumRows() const;
00129 
00131   virtual global_size_t getGlobalNumCols() const;
00132 
00134   virtual size_t getNodeNumRows() const;
00135 
00137   virtual size_t getNodeNumCols() const;
00138 
00140   virtual GlobalOrdinal getIndexBase() const;
00141 
00143   virtual global_size_t getGlobalNumEntries() const;
00144 
00146   virtual size_t getNodeNumEntries() const;
00147   
00149 
00150   virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const;
00151   
00153 
00154   virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const;
00155   
00157   virtual global_size_t getGlobalNumDiags() const;
00158   
00160   virtual size_t getNodeNumDiags() const;
00161   
00163   virtual size_t getGlobalMaxNumRowEntries() const;
00164   
00166   virtual size_t getNodeMaxNumRowEntries() const;
00167   
00169   virtual bool hasColMap() const;
00170   
00172   virtual bool isLowerTriangular() const;
00173   
00175   virtual bool isUpperTriangular() const;
00176   
00178   virtual bool isLocallyIndexed() const;
00179   
00181   virtual bool isGloballyIndexed() const;
00182   
00184   virtual bool isFillComplete() const;
00185 
00187   virtual bool supportsRowViews() const;  
00188  
00190   
00192 
00193   
00195 
00205   virtual void getGlobalRowCopy(GlobalOrdinal GlobalRow,
00206         const Teuchos::ArrayView<GlobalOrdinal> &Indices,
00207         const Teuchos::ArrayView<Scalar> &Values,
00208         size_t &NumEntries) const;
00209   
00211 
00221   virtual void getLocalRowCopy(LocalOrdinal DropRow, 
00222              const Teuchos::ArrayView<LocalOrdinal> &Indices, 
00223              const Teuchos::ArrayView<Scalar> &Values,
00224              size_t &NumEntries) const ;
00225   
00227 
00236   virtual void getGlobalRowView(GlobalOrdinal GlobalRow, 
00237         Teuchos::ArrayView<const GlobalOrdinal> &indices, 
00238         Teuchos::ArrayView<const Scalar> &values) const;
00239   
00241 
00250   virtual void getLocalRowView(LocalOrdinal DropRow, 
00251              Teuchos::ArrayView<const LocalOrdinal> &indices, 
00252              Teuchos::ArrayView<const Scalar> &values) const;
00253   
00255 
00257   virtual void getLocalDiagCopy(Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &diag) const;
00258   
00260   
00262 
00263   
00273   virtual void leftScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x);
00274   
00284   virtual void rightScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x);
00285   
00287 
00290   virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const;
00291 
00293 
00298   virtual void apply(const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X, 
00299          Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y, 
00300          Teuchos::ETransp mode = Teuchos::NO_TRANS, 
00301          Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
00302          Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const;
00303   
00305   virtual bool hasTransposeApply() const;
00306   
00308   
00310 
00311   
00313 
00322   TPETRA_DEPRECATED virtual void getGlobalRowView(GlobalOrdinal GlobalRow, 
00323               Teuchos::ArrayRCP<const GlobalOrdinal> &indices,
00324               Teuchos::ArrayRCP<const Scalar>        &values) const;
00325   
00327 
00336   TPETRA_DEPRECATED virtual void getLocalRowView(LocalOrdinal DropRow,
00337              Teuchos::ArrayRCP<const LocalOrdinal> &indices,
00338              Teuchos::ArrayRCP<const Scalar>       &values) const;  
00340 
00341   
00342 private:
00343 
00345   Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> > A_;
00347   magnitudeType DropTol_;
00349   size_t NumRows_;
00351   size_t NumNonzeros_;
00353   size_t MaxNumEntries_;
00355   size_t MaxNumEntriesA_;
00357   std::vector<size_t> NumEntries_;
00359   mutable Teuchos::Array<LocalOrdinal> Indices_;
00361   mutable Teuchos::Array<Scalar> Values_;
00362 
00363 };// class DropFilter
00364 
00365 }// namespace Ifpack2
00366 
00367 #endif /* IFPACK2_DROPFILTER_DECL_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends