42 #ifndef TPETRA_ROWGRAPH_DEF_HPP
43 #define TPETRA_ROWGRAPH_DEF_HPP
45 #include "Tpetra_Distributor.hpp"
48 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
51 pack (
const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
52 Teuchos::Array<GlobalOrdinal>& exports,
53 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
54 size_t& constantNumPackets,
58 typedef LocalOrdinal LO;
59 typedef GlobalOrdinal GO;
61 const char tfecfFuncName[] =
"packAndPrepare";
64 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(
65 exportLIDs.size() != numPacketsPerLID.size(), std::runtime_error,
66 ": exportLIDs and numPacketsPerLID must have the same size.");
68 const map_type& srcMap = * (this->getRowMap ());
69 constantNumPackets = 0;
76 size_t totalNumPackets = 0;
78 for (LO i = 0; i < exportLIDs.size (); ++i) {
79 const GO GID = srcMap.getGlobalElement (exportLIDs[i]);
80 size_t row_length = this->getNumEntriesInGlobalRow (GID);
81 numPacketsPerLID[i] = row_length;
82 totalNumPackets += row_length;
85 exports.resize (totalNumPackets);
89 size_t exportsOffset = 0;
90 for (LO i = 0; i < exportLIDs.size (); ++i) {
91 const GO GID = srcMap.getGlobalElement (exportLIDs[i]);
92 size_t row_length = this->getNumEntriesInGlobalRow (GID);
93 row.resize (row_length);
94 size_t check_row_length = 0;
95 this->getGlobalRowCopy (GID, row (), check_row_length);
96 typename Array<GO>::const_iterator row_iter = row.begin();
97 typename Array<GO>::const_iterator row_end = row.end();
99 for (; row_iter != row_end; ++row_iter, ++j) {
100 exports[exportsOffset+j] = *row_iter;
102 exportsOffset += row.size ();
106 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
110 Teuchos::ArrayView<const LocalOrdinal>& )
const
112 const char prefix[] =
"Tpetra::RowGraph::getLocalRowView: ";
118 TEUCHOS_TEST_FOR_EXCEPTION
119 (! this->supportsRowViews (), std::runtime_error,
120 prefix <<
"This object does not support row views.");
121 TEUCHOS_TEST_FOR_EXCEPTION
122 (this->supportsRowViews (), std::runtime_error,
123 prefix <<
"This object claims to support row views, "
124 "but this method is not implemented.");
127 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
131 Teuchos::ArrayView<const GlobalOrdinal>& )
const
133 const char prefix[] =
"Tpetra::RowGraph::getGlobalRowView: ";
139 TEUCHOS_TEST_FOR_EXCEPTION
140 (! this->supportsRowViews (), std::runtime_error,
141 prefix <<
"This object does not support row views.");
142 TEUCHOS_TEST_FOR_EXCEPTION
143 (this->supportsRowViews (), std::runtime_error,
144 prefix <<
"This object claims to support row views, "
145 "but this method is not implemented.");
155 #define TPETRA_ROWGRAPH_INSTANT(LO,GO,NODE) \
156 template class RowGraph< LO , GO , NODE >;
158 #endif // TPETRA_ROWGRAPH_DEF_HPP
virtual void getGlobalRowView(const GlobalOrdinal gblRow, Teuchos::ArrayView< const GlobalOrdinal > &gblColInds) const
Get a const, non-persisting view of the given global row's global column indices, as a Teuchos::Array...
virtual void pack(const Teuchos::ArrayView< const LocalOrdinal > &exportLIDs, Teuchos::Array< GlobalOrdinal > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Distributor &distor) const
Pack this object's data for Import or Export.
Sets up and executes a communication plan for a Tpetra DistObject.
virtual void getLocalRowView(const LocalOrdinal lclRow, Teuchos::ArrayView< const LocalOrdinal > &lclColInds) const
Get a constant, nonpersisting, locally indexed view of the given row of the graph.