Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_RowGraph_decl.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Tpetra: Templated Linear Algebra Services Package
5 // Copyright (2008) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #ifndef TPETRA_ROWGRAPH_DECL_HPP
43 #define TPETRA_ROWGRAPH_DECL_HPP
44 
45 #include "Tpetra_RowGraph_fwd.hpp"
46 #include "Tpetra_Map.hpp"
47 #include "Tpetra_Import.hpp"
48 #include "Tpetra_Export.hpp"
49 #include "Tpetra_Packable.hpp"
50 #include "Teuchos_Describable.hpp"
51 
52 namespace Tpetra {
53 
66  template <class LocalOrdinal,
67  class GlobalOrdinal,
68  class Node>
69  class RowGraph :
70  virtual public Teuchos::Describable,
71  public Packable<GlobalOrdinal, LocalOrdinal> {
72  public:
74 
75  typedef LocalOrdinal local_ordinal_type;
78  typedef GlobalOrdinal global_ordinal_type;
80  typedef Node node_type;
82 
83  typedef typename
84  Kokkos::View<LocalOrdinal *, typename Node::device_type>::const_type
85  local_inds_device_view_type;
86  typedef typename local_inds_device_view_type::HostMirror::const_type
87  local_inds_host_view_type;
88  typedef typename local_inds_device_view_type::HostMirror
89  nonconst_local_inds_host_view_type;
90 
91 
92  typedef typename
93  Kokkos::View<GlobalOrdinal *, typename Node::device_type>::const_type
94  global_inds_device_view_type;
95  typedef typename global_inds_device_view_type::HostMirror::const_type
96  global_inds_host_view_type;
97  typedef typename global_inds_device_view_type::HostMirror
98  nonconst_global_inds_host_view_type;
99 
100  typedef typename
101  Kokkos::View<const size_t*, typename Node::device_type>::const_type
102  row_ptrs_device_view_type;
103  typedef typename row_ptrs_device_view_type::HostMirror::const_type
104  row_ptrs_host_view_type;
105 
107  virtual ~RowGraph() {};
108 
110 
111 
113  virtual Teuchos::RCP<const Teuchos::Comm<int> >
114  getComm () const = 0;
115 
116 
118  virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
119  getRowMap () const = 0;
120 
122  virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
123  getColMap () const = 0;
124 
126  virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
127  getDomainMap () const = 0;
128 
130  virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
131  getRangeMap () const = 0;
132 
134  virtual Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> >
135  getImporter () const = 0;
136 
138  virtual Teuchos::RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> >
139  getExporter () const = 0;
140 
142  virtual global_size_t getGlobalNumRows() const = 0;
143 
145  virtual global_size_t getGlobalNumCols() const = 0;
146 
148  virtual size_t getLocalNumRows() const = 0;
149 
151  virtual size_t getLocalNumCols() const = 0;
152 
154  virtual GlobalOrdinal getIndexBase() const = 0;
155 
157  virtual global_size_t getGlobalNumEntries() const = 0;
158 
160  virtual size_t getLocalNumEntries() const = 0;
161 
163 
164  virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const = 0;
165 
167 
168  virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const = 0;
169 
171  virtual size_t getGlobalMaxNumRowEntries() const = 0;
172 
174  virtual size_t getLocalMaxNumRowEntries() const = 0;
175 
177  virtual bool hasColMap() const = 0;
178 
180  virtual bool isLocallyIndexed() const = 0;
181 
183  virtual bool isGloballyIndexed() const = 0;
184 
186  virtual bool isFillComplete() const = 0;
187 
188 
190 
192 
208 
209  virtual void
210  getGlobalRowCopy (const GlobalOrdinal gblRow,
211  nonconst_global_inds_host_view_type& gblColInds,
212  size_t& numColInds) const = 0;
213 
230  virtual void
231  getLocalRowCopy (const LocalOrdinal lclRow,
232  nonconst_local_inds_host_view_type & lclColInds,
233  size_t& numColInds) const = 0;
234 
241  virtual bool supportsRowViews () const {
242  return false;
243  }
244 
272  virtual void
273  getLocalRowView (const LocalOrdinal lclRow,
274  local_inds_host_view_type & lclColInds) const = 0;
275 
291  virtual void
292  getGlobalRowView (const GlobalOrdinal gblRow,
293  global_inds_host_view_type& gblColInds) const = 0;
294 
296 
298 
300  virtual void
301  pack (const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
302  Teuchos::Array<GlobalOrdinal>& exports,
303  const Teuchos::ArrayView<size_t>& numPacketsPerLID,
304  size_t& constantNumPackets) const;
306  }; // class RowGraph
307 } // namespace Tpetra
308 
309 #endif // TPETRA_ROWGRAPH_DECL_HPP
virtual bool hasColMap() const =0
Whether the graph has a well-defined column Map.
virtual ~RowGraph()
Destructor (virtual for memory safety of derived classes).
virtual void pack(const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< GlobalOrdinal > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets) const
Pack this object&#39;s data for Import or Export.
virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const =0
Returns the current number of entries on this node in the specified local row.
An abstract interface for graphs accessed by rows.
virtual GlobalOrdinal getIndexBase() const =0
Returns the index base for global indices for this graph.
GlobalOrdinal global_ordinal_type
The type of global indices in the graph.
virtual size_t getLocalNumCols() const =0
Returns the number of columns connected to the locally owned rows of this graph.
virtual Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const =0
This graph&#39;s Import object.
virtual size_t getLocalNumEntries() const =0
Returns the local number of entries in the graph.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const =0
The Map that describes this graph&#39;s distribution of columns over processes.
virtual size_t getLocalMaxNumRowEntries() const =0
Returns the maximum number of entries across all rows/columns on this node.
virtual Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const =0
This graph&#39;s Export object.
virtual bool supportsRowViews() const
Whether this class implements getLocalRowView() and getGlobalRowView().
Forward declaration of Tpetra::RowGraph.
virtual bool isFillComplete() const =0
Whether fillComplete() has been called (without an intervening resumeFill()).
size_t global_size_t
Global size_t object.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const =0
The Map associated with the range of this graph.
virtual global_size_t getGlobalNumRows() const =0
Returns the number of global rows in the graph.
virtual size_t getGlobalMaxNumRowEntries() const =0
Returns the maximum number of entries across all rows/columns on all nodes.
virtual global_size_t getGlobalNumCols() const =0
Returns the number of global columns in the graph.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const =0
The Map that describes this graph&#39;s distribution of rows over processes.
virtual void getGlobalRowCopy(const GlobalOrdinal gblRow, nonconst_global_inds_host_view_type &gblColInds, size_t &numColInds) const =0
Get a copy of the global column indices in a given row of the graph.
virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const =0
Returns the current number of entries on this node in the specified global row.
virtual void getLocalRowCopy(const LocalOrdinal lclRow, nonconst_local_inds_host_view_type &lclColInds, size_t &numColInds) const =0
Get a copy of the local column indices in a given row of the graph.
virtual bool isGloballyIndexed() const =0
If graph indices are in the global range, this function returns true. Otherwise, this function return...
LocalOrdinal local_ordinal_type
The type of local indices in the graph.
virtual void getGlobalRowView(const GlobalOrdinal gblRow, global_inds_host_view_type &gblColInds) const =0
Get a const, non-persisting view of the given global row&#39;s global column indices, as a Teuchos::Array...
virtual void getLocalRowView(const LocalOrdinal lclRow, local_inds_host_view_type &lclColInds) const =0
Get a constant, nonpersisting, locally indexed view of the given row of the graph.
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const =0
The communicator over which this graph is distributed.
Node node_type
The Kokkos Node type.
virtual bool isLocallyIndexed() const =0
If graph indices are in the local range, this function returns true. Otherwise, this function returns...
virtual size_t getLocalNumRows() const =0
Returns the number of rows owned on the calling node.
Declaration of Tpetra::Packable.
Abstract base class for objects that can be the source of an Import or Export operation, and that also know how to pack their data to send to the target object.
virtual global_size_t getGlobalNumEntries() const =0
Returns the global number of entries in the graph.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const =0
The Map associated with the domain of this graph.