43 #ifndef IFPACK2_OVERLAPPINGROWGRAPH_DEF_HPP
44 #define IFPACK2_OVERLAPPINGROWGRAPH_DEF_HPP
46 #include <Ifpack2_Details_OverlappingRowGraph_decl.hpp>
47 #include <Tpetra_Import.hpp>
48 #include <Tpetra_Export.hpp>
54 template<
class GraphType>
60 const Tpetra::global_size_t numGlobalRows,
61 const Tpetra::global_size_t numGlobalCols,
62 const Tpetra::global_size_t numGlobalNonzeros,
63 const size_t maxNumEntries,
66 nonoverlappingGraph_ (nonoverlappingGraph),
67 overlappingGraph_ (overlappingGraph),
70 numGlobalRows_ (numGlobalRows),
71 numGlobalCols_ (numGlobalCols),
72 numGlobalNonzeros_ (numGlobalNonzeros),
73 maxNumEntries_ (maxNumEntries),
74 nonoverlappingImporter_ (nonoverlappingImporter),
75 overlappingImporter_ (overlappingImporter)
79 template<
class GraphType>
83 template<
class GraphType>
87 return nonoverlappingGraph_->getComm ();
91 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
92 template<
class GraphType>
99 #endif // TPETRA_ENABLE_DEPRECATED_CODE
102 template<
class GraphType>
110 template<
class GraphType>
118 template<
class GraphType>
122 return nonoverlappingGraph_->getDomainMap ();
126 template<
class GraphType>
130 return nonoverlappingGraph_->getRangeMap ();
134 template<
class GraphType>
142 template<
class GraphType>
150 template<
class GraphType>
153 return numGlobalRows_;
157 template<
class GraphType>
160 return numGlobalCols_;
164 template<
class GraphType>
167 return nonoverlappingGraph_->getNodeNumRows () +
168 overlappingGraph_->getNodeNumRows ();
172 template<
class GraphType>
175 return this->getNodeNumRows ();
179 template<
class GraphType>
180 typename GraphType::global_ordinal_type
183 return nonoverlappingGraph_->getIndexBase ();
187 template<
class GraphType>
190 return numGlobalNonzeros_;
194 template<
class GraphType>
197 return nonoverlappingGraph_->getNodeNumEntries () +
198 overlappingGraph_->getNodeNumEntries ();
202 template<
class GraphType>
207 const local_ordinal_type localRow = rowMap_->getLocalElement (globalRow);
211 return getNumEntriesInLocalRow (localRow);
216 template<
class GraphType>
222 const size_t numMyRowsA = nonoverlappingGraph_->getNodeNumRows ();
223 if (as<size_t> (localRow) < numMyRowsA) {
224 return nonoverlappingGraph_->getNumEntriesInLocalRow (localRow);
226 return overlappingGraph_->getNumEntriesInLocalRow (as<local_ordinal_type> (localRow - numMyRowsA));
231 template<
class GraphType>
234 throw std::runtime_error(
"Ifpack2::OverlappingRowGraph::getGlobalMaxNumRowEntries() not supported.");
238 template<
class GraphType>
241 return maxNumEntries_;
245 template<
class GraphType>
252 template<
class GraphType>
259 template<
class GraphType>
266 template<
class GraphType>
273 template<
class GraphType>
278 size_t& numIndices)
const
280 const local_ordinal_type localRow = rowMap_->getLocalElement (globalRow);
284 if (Teuchos::as<size_t> (localRow) < nonoverlappingGraph_->getNodeNumRows ()) {
285 nonoverlappingGraph_->getGlobalRowCopy (globalRow, indices, numIndices);
287 overlappingGraph_->getGlobalRowCopy (globalRow, indices, numIndices);
293 template<
class GraphType>
298 size_t& numIndices)
const
301 const size_t numMyRowsA = nonoverlappingGraph_->getNodeNumRows ();
302 if (as<size_t> (localRow) < numMyRowsA) {
303 nonoverlappingGraph_->getLocalRowCopy (localRow, indices, numIndices);
305 const local_ordinal_type localRowOffset =
306 localRow - as<local_ordinal_type> (numMyRowsA);
307 overlappingGraph_->getLocalRowCopy (localRowOffset, indices, numIndices);
314 #define IFPACK2_DETAILS_OVERLAPPINGROWGRAPH_INSTANT(LO,GO,N) \
315 template class Ifpack2::Details::OverlappingRowGraph<Tpetra::CrsGraph< LO, GO, N > >; \
316 template class Ifpack2::Details::OverlappingRowGraph<Tpetra::RowGraph< LO, GO, N > >;
318 #endif // IFPACK2_OVERLAPPINGROWGRAPH_DEF_HPP
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:56
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries in any row on any process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:232
virtual Teuchos::RCP< const map_type > getRowMap() const
The Map that describes the distribution of rows over processes.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:104
virtual size_t getNodeMaxNumRowEntries() const
The maximum number of entries in any row on the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:239
virtual bool isGloballyIndexed() const
Whether this graph is globally indexed.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:260
virtual bool hasColMap() const
Whether this graph has a column Map.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:246
virtual Teuchos::RCP< const export_type > getExporter() const
Export object (from row Map to range Map).
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:144
virtual size_t getNodeNumRows() const
The number of rows owned by the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:165
virtual global_ordinal_type getIndexBase() const
The index base for global indices for this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:181
virtual size_t getNodeNumEntries() const
The number of entries in this graph owned by the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:195
virtual Teuchos::RCP< const map_type > getDomainMap() const
The Map that describes the domain of this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:120
Sparse graph (Tpetra::RowGraph subclass) with ghost rows.
Definition: Ifpack2_Details_OverlappingRowGraph_decl.hpp:65
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the graph is distributed.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:85
virtual ~OverlappingRowGraph()
Destructor.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:80
virtual bool isLocallyIndexed() const
Whether this graph is locally indexed.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:253
virtual void getGlobalRowCopy(global_ordinal_type globalRow, const Teuchos::ArrayView< global_ordinal_type > &indices, 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:276
virtual bool isFillComplete() const
true if fillComplete() has been called, else false.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:267
virtual global_size_t getGlobalNumCols() const
The global number of columns in this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:158
virtual size_t getNodeNumCols() const
The number of columns owned by the calling process.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:173
virtual void getLocalRowCopy(local_ordinal_type localRow, const Teuchos::ArrayView< local_ordinal_type > &indices, 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:296
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:219
TypeTo as(const TypeFrom &t)
virtual Teuchos::RCP< const import_type > getImporter() const
Import object (from domain Map to column Map).
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:136
virtual Teuchos::RCP< const map_type > getColMap() const
The Map that describes the distribution of columns over processes.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:112
virtual global_size_t getGlobalNumRows() const
The global number of rows in this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:151
virtual Teuchos::RCP< const map_type > getRangeMap() const
The Map that describes the range of this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:128
virtual global_size_t getGlobalNumEntries() const
The global number of entries in this graph.
Definition: Ifpack2_Details_OverlappingRowGraph_def.hpp:188
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:205