10#ifndef IFPACK2_OVERLAPPINGROWGRAPH_DEF_HPP
11#define IFPACK2_OVERLAPPINGROWGRAPH_DEF_HPP
13#include <Ifpack2_Details_OverlappingRowGraph_decl.hpp>
14#include <Tpetra_Import.hpp>
15#include <Tpetra_Export.hpp>
21template<
class GraphType>
24 const Teuchos::RCP<const row_graph_type>& overlappingGraph,
25 const Teuchos::RCP<const map_type>& rowMap,
26 const Teuchos::RCP<const map_type>& colMap,
27 const Tpetra::global_size_t numGlobalRows,
28 const Tpetra::global_size_t numGlobalCols,
29 const Tpetra::global_size_t numGlobalNonzeros,
30 const size_t maxNumEntries,
31 const Teuchos::RCP<const import_type>& nonoverlappingImporter,
32 const Teuchos::RCP<const import_type>& overlappingImporter) :
33 nonoverlappingGraph_ (nonoverlappingGraph),
34 overlappingGraph_ (overlappingGraph),
37 numGlobalRows_ (numGlobalRows),
38 numGlobalCols_ (numGlobalCols),
39 numGlobalNonzeros_ (numGlobalNonzeros),
40 maxNumEntries_ (maxNumEntries),
41 nonoverlappingImporter_ (nonoverlappingImporter),
42 overlappingImporter_ (overlappingImporter)
46template<
class GraphType>
50template<
class GraphType>
51Teuchos::RCP<const Teuchos::Comm<int> >
54 return nonoverlappingGraph_->getComm ();
60template<
class GraphType>
61Teuchos::RCP<const Tpetra::Map<typename GraphType::local_ordinal_type, typename GraphType::global_ordinal_type, typename GraphType::node_type> >
68template<
class GraphType>
69Teuchos::RCP<const Tpetra::Map<typename GraphType::local_ordinal_type, typename GraphType::global_ordinal_type, typename GraphType::node_type> >
76template<
class GraphType>
77Teuchos::RCP<const Tpetra::Map<typename GraphType::local_ordinal_type, typename GraphType::global_ordinal_type, typename GraphType::node_type> >
80 return nonoverlappingGraph_->getDomainMap ();
84template<
class GraphType>
85Teuchos::RCP<const Tpetra::Map<typename GraphType::local_ordinal_type, typename GraphType::global_ordinal_type, typename GraphType::node_type> >
88 return nonoverlappingGraph_->getRangeMap ();
92template<
class GraphType>
93Teuchos::RCP<const Tpetra::Import<typename GraphType::local_ordinal_type, typename GraphType::global_ordinal_type, typename GraphType::node_type> >
96 return nonoverlappingImporter_;
100template<
class GraphType>
101Teuchos::RCP<const Tpetra::Export<typename GraphType::local_ordinal_type, typename GraphType::global_ordinal_type, typename GraphType::node_type> >
104 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"Not implemented");
108template<
class GraphType>
111 return numGlobalRows_;
115template<
class GraphType>
118 return numGlobalCols_;
122template<
class GraphType>
125 return nonoverlappingGraph_->getLocalNumRows () +
126 overlappingGraph_->getLocalNumRows ();
130template<
class GraphType>
137template<
class GraphType>
138typename GraphType::global_ordinal_type
141 return nonoverlappingGraph_->getIndexBase ();
145template<
class GraphType>
148 return numGlobalNonzeros_;
152template<
class GraphType>
155 return nonoverlappingGraph_->getLocalNumEntries () +
156 overlappingGraph_->getLocalNumEntries ();
160template<
class GraphType>
165 const local_ordinal_type localRow = rowMap_->getLocalElement (globalRow);
166 if (localRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
167 return Teuchos::OrdinalTraits<size_t>::invalid();
174template<
class GraphType>
180 const size_t numMyRowsA = nonoverlappingGraph_->getLocalNumRows ();
181 if (as<size_t> (localRow) < numMyRowsA) {
182 return nonoverlappingGraph_->getNumEntriesInLocalRow (localRow);
184 return overlappingGraph_->getNumEntriesInLocalRow (as<local_ordinal_type> (localRow - numMyRowsA));
189template<
class GraphType>
192 throw std::runtime_error(
"Ifpack2::OverlappingRowGraph::getGlobalMaxNumRowEntries() not supported.");
196template<
class GraphType>
199 return maxNumEntries_;
203template<
class GraphType>
210template<
class GraphType>
217template<
class GraphType>
224template<
class GraphType>
230template<
class GraphType>
234 nonconst_global_inds_host_view_type& indices,
235 size_t& numIndices)
const
237 const local_ordinal_type localRow = rowMap_->getLocalElement (globalRow);
238 if (localRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
239 numIndices = Teuchos::OrdinalTraits<size_t>::invalid ();
241 if (Teuchos::as<size_t> (localRow) < nonoverlappingGraph_->getLocalNumRows ()) {
242 nonoverlappingGraph_->getGlobalRowCopy (globalRow, indices, numIndices);
244 overlappingGraph_->getGlobalRowCopy (globalRow, indices, numIndices);
250template<
class GraphType>
254 nonconst_local_inds_host_view_type& indices,
255 size_t& numIndices)
const
258 const size_t numMyRowsA = nonoverlappingGraph_->getLocalNumRows ();
259 if (as<size_t> (localRow) < numMyRowsA) {
260 nonoverlappingGraph_->getLocalRowCopy (localRow, indices, numIndices);
262 const local_ordinal_type localRowOffset =
263 localRow - as<local_ordinal_type> (numMyRowsA);
264 overlappingGraph_->getLocalRowCopy (localRowOffset, indices, numIndices);
269template<
class GraphType>
273 global_inds_host_view_type &indices)
const {
274 const local_ordinal_type LocalRow = rowMap_->getLocalElement (GlobalRow);
275 if (LocalRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid()) {
276 indices = global_inds_host_view_type();
278 if (Teuchos::as<size_t> (LocalRow) < nonoverlappingGraph_->getLocalNumRows ()) {
279 nonoverlappingGraph_->getGlobalRowView (GlobalRow, indices);
281 overlappingGraph_->getGlobalRowView (GlobalRow, indices);
287template<
class GraphType>
291 local_inds_host_view_type & indices)
const {
293 const size_t numMyRowsA = nonoverlappingGraph_->getLocalNumRows ();
294 if (as<size_t> (LocalRow) < numMyRowsA) {
295 nonoverlappingGraph_->getLocalRowView (LocalRow, indices);
297 overlappingGraph_->getLocalRowView (LocalRow - as<local_ordinal_type> (numMyRowsA),
307#define IFPACK2_DETAILS_OVERLAPPINGROWGRAPH_INSTANT(LO,GO,N) \
308 template class Ifpack2::Details::OverlappingRowGraph<Tpetra::CrsGraph< LO, GO, N > >; \
309 template class Ifpack2::Details::OverlappingRowGraph<Tpetra::RowGraph< LO, GO, N > >;
virtual size_t getLocalMaxNumRowEntries() const
The maximum number of entries in any row on the calling process.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:197
virtual Teuchos::RCP< const map_type > getRangeMap() const
The Map that describes the range of this graph.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:86
virtual bool isLocallyIndexed() const
Whether this graph is locally indexed.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:211
virtual size_t getNumEntriesInLocalRow(local_ordinal_type localRow) const
The number of entries in the given local row that are owned by the calling process.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:177
virtual bool isGloballyIndexed() const
Whether this graph is globally indexed.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:218
virtual global_size_t getGlobalNumEntries() const
The global number of entries in this graph.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:146
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries in any row on any process.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:190
virtual void getGlobalRowCopy(global_ordinal_type globalRow, nonconst_global_inds_host_view_type &gblColInds, size_t &numIndices) const
Copy out a list of column indices in the given global row that are owned by the calling process.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:233
virtual void getLocalRowView(const local_ordinal_type lclRow, local_inds_host_view_type &lclColInds) const
Get a constant, nonpersisting, locally indexed view of the given row of the graph.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:290
virtual bool isFillComplete() const
true if fillComplete() has been called, else false.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:225
virtual bool hasColMap() const
Whether this graph has a column Map.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:204
virtual Teuchos::RCP< const map_type > getRowMap() const
The Map that describes the distribution of rows over processes.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:62
virtual Teuchos::RCP< const import_type > getImporter() const
Import object (from domain Map to column Map).
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:94
virtual global_size_t getGlobalNumRows() const
The global number of rows in this graph.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:109
virtual Teuchos::RCP< const map_type > getColMap() const
The Map that describes the distribution of columns over processes.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:70
virtual size_t getLocalNumEntries() const
The number of entries in this graph owned by the calling process.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:153
virtual size_t getLocalNumCols() const
The number of columns owned by the calling process.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:131
virtual global_size_t getGlobalNumCols() const
The global number of columns in this graph.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:116
virtual size_t getLocalNumRows() const
The number of rows owned by the calling process.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:123
virtual void getGlobalRowView(const global_ordinal_type gblRow, global_inds_host_view_type &gblColInds) const
Get a const, non-persisting view of the given global row's global column indices, as a Teuchos::Array...
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:272
virtual Teuchos::RCP< const map_type > getDomainMap() const
The Map that describes the domain of this graph.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:78
virtual ~OverlappingRowGraph()
Destructor.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:47
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the graph is distributed.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:52
virtual Teuchos::RCP< const export_type > getExporter() const
Export object (from row Map to range Map).
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:102
virtual global_ordinal_type getIndexBase() const
The index base for global indices for this graph.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:139
OverlappingRowGraph(const Teuchos::RCP< const row_graph_type > &nonoverlappingGraph, const Teuchos::RCP< const row_graph_type > &overlappingGraph, const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Tpetra::global_size_t numGlobalRows, const Tpetra::global_size_t numGlobalCols, const Tpetra::global_size_t numGlobalNonzeros, const size_t maxNumEntries, const Teuchos::RCP< const import_type > &nonoverlappingImporter, const Teuchos::RCP< const import_type > &overlappingImporter)
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:23
virtual size_t getNumEntriesInGlobalRow(global_ordinal_type globalRow) const
The number of entries in the given global row that are owned by the calling process.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:163
virtual void getLocalRowCopy(local_ordinal_type localRow, nonconst_local_inds_host_view_type &gblColInds, size_t &numIndices) const
Copy out a list of local column indices in the given local row that are owned by the calling process.
Definition Ifpack2_Details_OverlappingRowGraph_def.hpp:253
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:41