Tpetra Matrix/Vector Services Version of the Day
Tpetra_RowMatrix.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_HPP
00043 #define TPETRA_ROWMATRIX_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 
00052 namespace Tpetra {
00053   //
00054   // Forward declarations.  The "doxygen" bit simply tells Doxygen
00055   // (our automatic documentation generation system) to skip forward
00056   // declarations.
00057   //
00058 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00059   template<class LocalOrdinal, class GlobalOrdinal, class Node>
00060   class Map;
00061 
00062   template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00063   class Vector;
00064 #endif // DOXYGEN_SHOULD_SKIP_THIS
00065 
00067 
00073   template <class Scalar,
00074             class LocalOrdinal = int,
00075             class GlobalOrdinal = LocalOrdinal,
00076             class Node = Kokkos::DefaultNode::DefaultNodeType>
00077   class RowMatrix :
00078     virtual public Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> {
00079   public:
00081 
00082 
00084     typedef Scalar        scalar_type;
00086     typedef LocalOrdinal  local_ordinal_type;
00088     typedef GlobalOrdinal global_ordinal_type;
00090     typedef Node          node_type;
00091 
00093 
00094 
00095 
00097     virtual ~RowMatrix();
00098 
00100 
00101 
00102 
00104     virtual const Teuchos::RCP<const Teuchos::Comm<int> > & getComm() const = 0;
00105 
00107     virtual Teuchos::RCP<Node> getNode() const = 0;
00108 
00110     virtual const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & getRowMap() const = 0;
00111 
00113     virtual const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & getColMap() const = 0;
00114 
00116     virtual Teuchos::RCP<const RowGraph<LocalOrdinal,GlobalOrdinal,Node> > getGraph() const = 0;
00117 
00119     virtual global_size_t getGlobalNumRows() const = 0;
00120 
00122     virtual global_size_t getGlobalNumCols() const = 0;
00123 
00125     virtual size_t getNodeNumRows() const = 0;
00126 
00132     virtual size_t getNodeNumCols() const = 0;
00133 
00135     virtual GlobalOrdinal getIndexBase() const = 0;
00136 
00138     virtual global_size_t getGlobalNumEntries() const = 0;
00139 
00141     virtual size_t getNodeNumEntries() const = 0;
00142 
00152     virtual size_t getNumEntriesInGlobalRow (GlobalOrdinal globalRow) const = 0;
00153 
00163     virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const = 0;
00164 
00166     virtual global_size_t getGlobalNumDiags() const = 0;
00167 
00169     virtual size_t getNodeNumDiags() const = 0;
00170 
00172     virtual size_t getGlobalMaxNumRowEntries() const = 0;
00173 
00175     virtual size_t getNodeMaxNumRowEntries() const = 0;
00176 
00178     virtual bool hasColMap() const = 0;
00179 
00181     virtual bool isLowerTriangular() const = 0;
00182 
00184     virtual bool isUpperTriangular() const = 0;
00185 
00195     virtual bool isLocallyIndexed() const = 0;
00196 
00206     virtual bool isGloballyIndexed() const = 0;
00207 
00209     virtual bool isFillComplete() const = 0;
00210 
00212     virtual bool supportsRowViews() const = 0;
00213 
00215 
00216 
00217 
00238     virtual void
00239     getGlobalRowCopy (GlobalOrdinal GlobalRow,
00240                       const Teuchos::ArrayView<GlobalOrdinal> &Indices,
00241                       const Teuchos::ArrayView<Scalar> &Values,
00242                       size_t &NumEntries) const = 0;
00243 
00264     virtual void
00265     getLocalRowCopy (LocalOrdinal LocalRow,
00266                      const Teuchos::ArrayView<LocalOrdinal> &Indices,
00267                      const Teuchos::ArrayView<Scalar> &Values,
00268                      size_t &NumEntries) const = 0;
00269 
00294     virtual void
00295     getGlobalRowView (GlobalOrdinal GlobalRow,
00296                       ArrayView<const GlobalOrdinal> &indices,
00297                       ArrayView<const Scalar> &values) const = 0;
00298 
00323     virtual void
00324     getLocalRowView (LocalOrdinal LocalRow,
00325                      ArrayView<const LocalOrdinal> &indices,
00326                      ArrayView<const Scalar> &values) const = 0;
00327 
00339     virtual void getLocalDiagCopy (Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &diag) const = 0;
00340 
00342 
00343 
00344 
00350     virtual void leftScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) = 0;
00351 
00357     virtual void rightScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) = 0;
00358 
00367     virtual typename ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const = 0;
00369   }; // class RowMatrix
00370 
00371   template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00372   RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::~RowMatrix() {
00373   }
00374 
00375 } // namespace Tpetra
00376 
00377 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines