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 // Tpetra: Templated Linear Algebra Services Package
4 //
5 // Copyright 2008 NTESS and the Tpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TPETRA_ROWGRAPH_DECL_HPP
11 #define TPETRA_ROWGRAPH_DECL_HPP
12 
13 #include "Tpetra_RowGraph_fwd.hpp"
14 #include "Tpetra_Map.hpp"
15 #include "Tpetra_Import.hpp"
16 #include "Tpetra_Export.hpp"
17 #include "Tpetra_Packable.hpp"
18 #include "Teuchos_Describable.hpp"
19 
20 namespace Tpetra {
21 
34  template <class LocalOrdinal,
35  class GlobalOrdinal,
36  class Node>
37  class RowGraph :
38  virtual public Teuchos::Describable,
39  public Packable<GlobalOrdinal, LocalOrdinal> {
40  public:
42 
43  typedef LocalOrdinal local_ordinal_type;
46  typedef GlobalOrdinal global_ordinal_type;
48  typedef Node node_type;
50 
51  typedef typename
52  Kokkos::View<LocalOrdinal *, typename Node::device_type>::const_type
53  local_inds_device_view_type;
54  typedef typename local_inds_device_view_type::HostMirror::const_type
55  local_inds_host_view_type;
56  typedef typename local_inds_device_view_type::HostMirror
57  nonconst_local_inds_host_view_type;
58 
59 
60  typedef typename
61  Kokkos::View<GlobalOrdinal *, typename Node::device_type>::const_type
62  global_inds_device_view_type;
63  typedef typename global_inds_device_view_type::HostMirror::const_type
64  global_inds_host_view_type;
65  typedef typename global_inds_device_view_type::HostMirror
66  nonconst_global_inds_host_view_type;
67 
68  typedef typename
69  Kokkos::View<const size_t*, typename Node::device_type>::const_type
70  row_ptrs_device_view_type;
71  typedef typename row_ptrs_device_view_type::HostMirror::const_type
72  row_ptrs_host_view_type;
73 
75  virtual ~RowGraph() {};
76 
78 
79 
81  virtual Teuchos::RCP<const Teuchos::Comm<int> >
82  getComm () const = 0;
83 
84 
86  virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
87  getRowMap () const = 0;
88 
90  virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
91  getColMap () const = 0;
92 
94  virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
95  getDomainMap () const = 0;
96 
98  virtual Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
99  getRangeMap () const = 0;
100 
102  virtual Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> >
103  getImporter () const = 0;
104 
106  virtual Teuchos::RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> >
107  getExporter () const = 0;
108 
110  virtual global_size_t getGlobalNumRows() const = 0;
111 
113  virtual global_size_t getGlobalNumCols() const = 0;
114 
116  virtual size_t getLocalNumRows() const = 0;
117 
119  virtual size_t getLocalNumCols() const = 0;
120 
122  virtual GlobalOrdinal getIndexBase() const = 0;
123 
125  virtual global_size_t getGlobalNumEntries() const = 0;
126 
128  virtual size_t getLocalNumEntries() const = 0;
129 
131 
132  virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const = 0;
133 
135 
136  virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const = 0;
137 
139  virtual size_t getGlobalMaxNumRowEntries() const = 0;
140 
142  virtual size_t getLocalMaxNumRowEntries() const = 0;
143 
145  virtual bool hasColMap() const = 0;
146 
148  virtual bool isLocallyIndexed() const = 0;
149 
151  virtual bool isGloballyIndexed() const = 0;
152 
154  virtual bool isFillComplete() const = 0;
155 
156 
158 
160 
176 
177  virtual void
178  getGlobalRowCopy (const GlobalOrdinal gblRow,
179  nonconst_global_inds_host_view_type& gblColInds,
180  size_t& numColInds) const = 0;
181 
198  virtual void
199  getLocalRowCopy (const LocalOrdinal lclRow,
200  nonconst_local_inds_host_view_type & lclColInds,
201  size_t& numColInds) const = 0;
202 
209  virtual bool supportsRowViews () const {
210  return false;
211  }
212 
240  virtual void
241  getLocalRowView (const LocalOrdinal lclRow,
242  local_inds_host_view_type & lclColInds) const = 0;
243 
259  virtual void
260  getGlobalRowView (const GlobalOrdinal gblRow,
261  global_inds_host_view_type& gblColInds) const = 0;
262 
264 
266 
268  virtual void
269  pack (const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
270  Teuchos::Array<GlobalOrdinal>& exports,
271  const Teuchos::ArrayView<size_t>& numPacketsPerLID,
272  size_t& constantNumPackets) const;
274  }; // class RowGraph
275 } // namespace Tpetra
276 
277 #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.