10 #ifndef TPETRA_ROWGRAPH_DEF_HPP
11 #define TPETRA_ROWGRAPH_DEF_HPP
14 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
17 pack (
const Teuchos::ArrayView<const LocalOrdinal>& exportLIDs,
18 Teuchos::Array<GlobalOrdinal>& exports,
19 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
20 size_t& constantNumPackets)
const
23 typedef LocalOrdinal LO;
24 typedef GlobalOrdinal GO;
26 const char tfecfFuncName[] =
"packAndPrepare";
28 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(
29 exportLIDs.size() != numPacketsPerLID.size(), std::runtime_error,
30 ": exportLIDs and numPacketsPerLID must have the same size.");
32 const map_type& srcMap = * (this->getRowMap ());
33 constantNumPackets = 0;
40 size_t totalNumPackets = 0;
41 nonconst_global_inds_host_view_type row;
42 for (LO i = 0; i < exportLIDs.size (); ++i) {
44 size_t row_length = this->getNumEntriesInGlobalRow (GID);
45 numPacketsPerLID[i] = row_length;
46 totalNumPackets += row_length;
49 exports.resize (totalNumPackets);
53 size_t exportsOffset = 0;
54 for (LO i = 0; i < exportLIDs.size (); ++i) {
55 const GO GID = srcMap.getGlobalElement (exportLIDs[i]);
56 size_t row_length = this->getNumEntriesInGlobalRow (GID);
57 Kokkos::resize(row,row_length);
58 size_t check_row_length = 0;
59 this->getGlobalRowCopy (GID, row, check_row_length);
61 for (
size_t j=0; j<row_length; ++j) {
62 exports[exportsOffset+j] = row[j];
64 exportsOffset += row.extent(0);
76 #define TPETRA_ROWGRAPH_INSTANT(LO,GO,NODE) \
77 template class RowGraph< LO , GO , NODE >;
79 #endif // TPETRA_ROWGRAPH_DEF_HPP
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.
global_ordinal_type getGlobalElement(local_ordinal_type localIndex) const
The global index corresponding to the given local index.