42 #ifndef TPETRA_ROWGRAPH_DEF_HPP
43 #define TPETRA_ROWGRAPH_DEF_HPP
46 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
49 pack (
const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
50 Teuchos::Array<GlobalOrdinal>& exports,
51 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
52 size_t& constantNumPackets)
const
55 typedef LocalOrdinal LO;
56 typedef GlobalOrdinal GO;
58 const char tfecfFuncName[] =
"packAndPrepare";
60 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(
61 exportLIDs.size() != numPacketsPerLID.size(), std::runtime_error,
62 ": exportLIDs and numPacketsPerLID must have the same size.");
64 const map_type& srcMap = * (this->getRowMap ());
65 constantNumPackets = 0;
72 size_t totalNumPackets = 0;
73 nonconst_global_inds_host_view_type row;
74 for (LO i = 0; i < exportLIDs.size (); ++i) {
75 const GO GID = srcMap.getGlobalElement (exportLIDs[i]);
76 size_t row_length = this->getNumEntriesInGlobalRow (GID);
77 numPacketsPerLID[i] = row_length;
78 totalNumPackets += row_length;
81 exports.resize (totalNumPackets);
85 size_t exportsOffset = 0;
86 for (LO i = 0; i < exportLIDs.size (); ++i) {
87 const GO GID = srcMap.getGlobalElement (exportLIDs[i]);
88 size_t row_length = this->getNumEntriesInGlobalRow (GID);
89 Kokkos::resize(row,row_length);
90 size_t check_row_length = 0;
91 this->getGlobalRowCopy (GID, row, check_row_length);
93 for (
size_t j=0; j<row_length; ++j) {
94 exports[exportsOffset+j] = row[j];
96 exportsOffset += row.extent(0);
100 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
101 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
105 Teuchos::ArrayView<const LocalOrdinal>& )
const
107 const char prefix[] =
"Tpetra::RowGraph::getLocalRowView: ";
113 TEUCHOS_TEST_FOR_EXCEPTION
114 (! this->supportsRowViews (), std::runtime_error,
115 prefix <<
"This object does not support row views.");
116 TEUCHOS_TEST_FOR_EXCEPTION
117 (this->supportsRowViews (), std::runtime_error,
118 prefix <<
"This object claims to support row views, "
119 "but this method is not implemented.");
122 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
126 Teuchos::ArrayView<const GlobalOrdinal>& )
const
128 const char prefix[] =
"Tpetra::RowGraph::getGlobalRowView: ";
134 TEUCHOS_TEST_FOR_EXCEPTION
135 (! this->supportsRowViews (), std::runtime_error,
136 prefix <<
"This object does not support row views.");
137 TEUCHOS_TEST_FOR_EXCEPTION
138 (this->supportsRowViews (), std::runtime_error,
139 prefix <<
"This object claims to support row views, "
140 "but this method is not implemented.");
152 #define TPETRA_ROWGRAPH_INSTANT(LO,GO,NODE) \
153 template class RowGraph< LO , GO , NODE >;
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's data for Import or Export.
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'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.
Namespace Tpetra contains the class and methods constituting the Tpetra library.