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_Map.hpp"
00050 #include "Tpetra_Operator.hpp"
00051 #include "Tpetra_RowGraph.hpp"
00052 #include "Tpetra_Vector.hpp"
00053 
00054 namespace Tpetra {
00055 
00057 
00063   template <class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = Kokkos::DefaultNode::DefaultNodeType>
00064   class RowMatrix : virtual public Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> {
00065     public:
00066       typedef Scalar        scalar_type;
00067       typedef LocalOrdinal  local_ordinal_type;
00068       typedef GlobalOrdinal global_ordinal_type;
00069       typedef Node          node_type;
00070 
00072 
00073 
00075       virtual ~RowMatrix();
00076 
00078 
00080 
00081 
00083       virtual const Teuchos::RCP<const Teuchos::Comm<int> > & getComm() const = 0;
00084 
00086       virtual Teuchos::RCP<Node> getNode() const = 0;
00087 
00089       virtual const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & getRowMap() const = 0;
00090 
00092       virtual const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & getColMap() const = 0;
00093 
00095       virtual Teuchos::RCP<const RowGraph<LocalOrdinal,GlobalOrdinal,Node> > getGraph() const = 0;
00096 
00098       virtual global_size_t getGlobalNumRows() const = 0;
00099 
00101       virtual global_size_t getGlobalNumCols() const = 0;
00102 
00104       virtual size_t getNodeNumRows() const = 0;
00105 
00107       virtual size_t getNodeNumCols() const = 0;
00108 
00110       virtual GlobalOrdinal getIndexBase() const = 0;
00111 
00113       virtual global_size_t getGlobalNumEntries() const = 0;
00114 
00116       virtual size_t getNodeNumEntries() const = 0;
00117 
00119 
00120       virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const = 0;
00121 
00123 
00124       virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const = 0;
00125 
00127       virtual global_size_t getGlobalNumDiags() const = 0;
00128 
00130       virtual size_t getNodeNumDiags() const = 0;
00131 
00133       virtual size_t getGlobalMaxNumRowEntries() const = 0;
00134 
00136       virtual size_t getNodeMaxNumRowEntries() const = 0;
00137 
00139       virtual bool hasColMap() const = 0;
00140 
00142       virtual bool isLowerTriangular() const = 0;
00143 
00145       virtual bool isUpperTriangular() const = 0;
00146 
00148       virtual bool isLocallyIndexed() const = 0;
00149 
00151       virtual bool isGloballyIndexed() const = 0;
00152 
00154       virtual bool isFillComplete() const = 0;
00155 
00157       virtual bool supportsRowViews() const = 0; 
00159 
00161 
00162 
00164 
00174       virtual void getGlobalRowCopy(GlobalOrdinal GlobalRow,
00175                                     const Teuchos::ArrayView<GlobalOrdinal> &Indices,
00176                                     const Teuchos::ArrayView<Scalar> &Values,
00177                                     size_t &NumEntries) const = 0;
00178 
00180 
00190       virtual void getLocalRowCopy(LocalOrdinal LocalRow, 
00191                                    const Teuchos::ArrayView<LocalOrdinal> &Indices, 
00192                                    const Teuchos::ArrayView<Scalar> &Values,
00193                                    size_t &NumEntries) const  = 0;
00194 
00196 
00205       virtual void getGlobalRowView(GlobalOrdinal GlobalRow, 
00206                                     ArrayView<const GlobalOrdinal> &indices, 
00207                                     ArrayView<const Scalar> &values) const = 0;
00208 
00210 
00219       virtual void getLocalRowView(LocalOrdinal LocalRow, 
00220                                    ArrayView<const LocalOrdinal> &indices, 
00221                                    ArrayView<const Scalar> &values) const = 0;
00222 
00224 
00226       virtual void getLocalDiagCopy(Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &diag) const = 0;
00227 
00229       
00231 
00232 
00242       virtual void leftScale(const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) =0;
00243 
00253       virtual void rightScale(const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) =0;
00254 
00256 
00259       virtual typename ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const = 0;
00260 
00262 
00263   }; // class RowMatrix
00264 
00265   template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00266   RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::~RowMatrix() {
00267   }
00268 
00269 } // namespace Tpetra
00270 
00271 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines