42 #ifndef TPETRA_ROWGRAPH_DEF_HPP 43 #define TPETRA_ROWGRAPH_DEF_HPP 45 #include <Tpetra_RowGraph_decl.hpp> 46 #include <Tpetra_Distributor.hpp> 49 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
52 pack (
const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
53 Teuchos::Array<GlobalOrdinal>& exports,
54 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
55 size_t& constantNumPackets,
59 typedef LocalOrdinal LO;
60 typedef GlobalOrdinal GO;
62 const char tfecfFuncName[] =
"packAndPrepare";
65 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(
66 exportLIDs.size() != numPacketsPerLID.size(), std::runtime_error,
67 ": exportLIDs and numPacketsPerLID must have the same size.");
69 const map_type& srcMap = * (this->getRowMap ());
70 constantNumPackets = 0;
77 size_t totalNumPackets = 0;
79 for (LO i = 0; i < exportLIDs.size (); ++i) {
80 const GO GID = srcMap.getGlobalElement (exportLIDs[i]);
81 size_t row_length = this->getNumEntriesInGlobalRow (GID);
82 numPacketsPerLID[i] = row_length;
83 totalNumPackets += row_length;
86 exports.resize (totalNumPackets);
90 size_t exportsOffset = 0;
91 for (LO i = 0; i < exportLIDs.size (); ++i) {
92 const GO GID = srcMap.getGlobalElement (exportLIDs[i]);
93 size_t row_length = this->getNumEntriesInGlobalRow (GID);
94 row.resize (row_length);
95 size_t check_row_length = 0;
96 this->getGlobalRowCopy (GID, row (), check_row_length);
97 typename Array<GO>::const_iterator row_iter = row.begin();
98 typename Array<GO>::const_iterator row_end = row.end();
100 for (; row_iter != row_end; ++row_iter, ++j) {
101 exports[exportsOffset+j] = *row_iter;
103 exportsOffset += row.size ();
107 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
111 Teuchos::ArrayView<const LocalOrdinal>& )
const 113 const char prefix[] =
"Tpetra::RowGraph::getLocalRowView: ";
119 TEUCHOS_TEST_FOR_EXCEPTION
120 (! this->supportsRowViews (), std::runtime_error,
121 prefix <<
"This object does not support row views.");
122 TEUCHOS_TEST_FOR_EXCEPTION
123 (this->supportsRowViews (), std::runtime_error,
124 prefix <<
"This object claims to support row views, " 125 "but this method is not implemented.");
128 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
132 Teuchos::ArrayView<const GlobalOrdinal>& )
const 134 const char prefix[] =
"Tpetra::RowGraph::getGlobalRowView: ";
140 TEUCHOS_TEST_FOR_EXCEPTION
141 (! this->supportsRowViews (), std::runtime_error,
142 prefix <<
"This object does not support row views.");
143 TEUCHOS_TEST_FOR_EXCEPTION
144 (this->supportsRowViews (), std::runtime_error,
145 prefix <<
"This object claims to support row views, " 146 "but this method is not implemented.");
157 #define TPETRA_ROWGRAPH_INSTANT(LO,GO,NODE) \ 159 template class RowGraph< LO , GO , NODE >; \ 161 #endif // TPETRA_ROWGRAPH_DEF_HPP Namespace Tpetra contains the class and methods constituting the Tpetra library.
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 getLocalRowView(const LocalOrdinal lclRow, Teuchos::ArrayView< const LocalOrdinal > &lclColInds) const
Get a constant, nonpersisting, locally indexed view of the given row of the graph.
Sets up and executes a communication plan for a Tpetra DistObject.
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.