Tpetra Matrix/Vector Services  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Tpetra_RowMatrix_decl.hpp
00001 // @HEADER
00002 // ***********************************************************************
00003 //
00004 //          Tpetra: Templated Linear Algebra Services Package
00005 //                 Copyright (2008) Sandia Corporation
00006 //
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
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 #ifndef TPETRA_ROWMATRIX_DECL_HPP
00043 #define TPETRA_ROWMATRIX_DECL_HPP
00044 
00045 #include <Teuchos_Describable.hpp>
00046 #include <Kokkos_DefaultNode.hpp>
00047 
00048 #include "Tpetra_ConfigDefs.hpp"
00049 #include "Tpetra_Operator.hpp"
00050 #include "Tpetra_RowGraph.hpp"
00051 #include "Tpetra_Packable.hpp"
00052 #include "Tpetra_SrcDistObject.hpp"
00053 
00054 namespace Tpetra {
00055   //
00056   // Forward declarations.  The "doxygen" bit simply tells Doxygen
00057   // (our automatic documentation generation system) to skip forward
00058   // declarations.
00059   //
00060 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00061   template<class LocalOrdinal, class GlobalOrdinal, class Node>
00062   class Map;
00063 
00064   template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00065   class Vector;
00066 #endif // DOXYGEN_SHOULD_SKIP_THIS
00067 
00093   template<class Scalar =
00094              Operator<>::scalar_type,
00095            class LocalOrdinal =
00096              typename Operator<Scalar>::local_ordinal_type,
00097            class GlobalOrdinal =
00098              typename Operator<Scalar, LocalOrdinal>::global_ordinal_type,
00099            class Node =
00100              typename Operator<Scalar, LocalOrdinal, GlobalOrdinal>::node_type>
00101   class RowMatrix :
00102     virtual public Operator<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
00103     virtual public SrcDistObject,
00104     public Packable<char, LocalOrdinal> {
00105   public:
00107 
00108 
00110     typedef Scalar        scalar_type;
00112     typedef LocalOrdinal  local_ordinal_type;
00114     typedef GlobalOrdinal global_ordinal_type;
00116     typedef Node          node_type;
00117 
00119 
00120 
00121 
00123     virtual ~RowMatrix();
00124 
00126 
00127 
00128 
00130     virtual Teuchos::RCP<const Teuchos::Comm<int> > getComm() const = 0;
00131 
00133     virtual Teuchos::RCP<Node> getNode() const = 0;
00134 
00136     virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > getRowMap() const = 0;
00137 
00139     virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > getColMap() const = 0;
00140 
00142     virtual Teuchos::RCP<const RowGraph<LocalOrdinal,GlobalOrdinal,Node> > getGraph() const = 0;
00143 
00145     virtual global_size_t getGlobalNumRows() const = 0;
00146 
00148     virtual global_size_t getGlobalNumCols() const = 0;
00149 
00151     virtual size_t getNodeNumRows() const = 0;
00152 
00158     virtual size_t getNodeNumCols() const = 0;
00159 
00161     virtual GlobalOrdinal getIndexBase() const = 0;
00162 
00164     virtual global_size_t getGlobalNumEntries() const = 0;
00165 
00167     virtual size_t getNodeNumEntries() const = 0;
00168 
00178     virtual size_t getNumEntriesInGlobalRow (GlobalOrdinal globalRow) const = 0;
00179 
00189     virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const = 0;
00190 
00192     virtual global_size_t getGlobalNumDiags() const = 0;
00193 
00195     virtual size_t getNodeNumDiags() const = 0;
00196 
00198     virtual size_t getGlobalMaxNumRowEntries() const = 0;
00199 
00201     virtual size_t getNodeMaxNumRowEntries() const = 0;
00202 
00204     virtual bool hasColMap() const = 0;
00205 
00207     virtual bool isLowerTriangular() const = 0;
00208 
00210     virtual bool isUpperTriangular() const = 0;
00211 
00221     virtual bool isLocallyIndexed() const = 0;
00222 
00232     virtual bool isGloballyIndexed() const = 0;
00233 
00235     virtual bool isFillComplete() const = 0;
00236 
00238     virtual bool supportsRowViews() const = 0;
00239 
00241 
00242 
00243 
00264     virtual void
00265     getGlobalRowCopy (GlobalOrdinal GlobalRow,
00266                       const Teuchos::ArrayView<GlobalOrdinal> &Indices,
00267                       const Teuchos::ArrayView<Scalar> &Values,
00268                       size_t &NumEntries) const = 0;
00269 
00290     virtual void
00291     getLocalRowCopy (LocalOrdinal LocalRow,
00292                      const Teuchos::ArrayView<LocalOrdinal> &Indices,
00293                      const Teuchos::ArrayView<Scalar> &Values,
00294                      size_t &NumEntries) const = 0;
00295 
00320     virtual void
00321     getGlobalRowView (GlobalOrdinal GlobalRow,
00322                       ArrayView<const GlobalOrdinal> &indices,
00323                       ArrayView<const Scalar> &values) const = 0;
00324 
00349     virtual void
00350     getLocalRowView (LocalOrdinal LocalRow,
00351                      ArrayView<const LocalOrdinal> &indices,
00352                      ArrayView<const Scalar> &values) const = 0;
00353 
00365     virtual void getLocalDiagCopy (Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &diag) const = 0;
00366 
00368 
00369 
00370 
00376     virtual void leftScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) = 0;
00377 
00383     virtual void rightScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) = 0;
00384 
00393     virtual typename ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const = 0;
00394 
00446     virtual Teuchos::RCP<RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
00447     add (const Scalar& alpha,
00448          const RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
00449          const Scalar& beta,
00450          const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& domainMap=Teuchos::null,
00451          const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& rangeMap=Teuchos::null,
00452          const Teuchos::RCP<Teuchos::ParameterList>& params=Teuchos::null) const;
00454 
00455 
00456 
00465     virtual void
00466     pack (const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
00467           Teuchos::Array<char>& exports,
00468           const Teuchos::ArrayView<size_t>& numPacketsPerLID,
00469           size_t& constantNumPackets,
00470           Distributor& distor) const;
00472   }; // class RowMatrix
00473 } // namespace Tpetra
00474 
00475 #endif // TPETRA_ROWMATRIX_DECL_HPP
00476 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines