42 #ifndef TPETRA_IMPORTEXPORTDATA_DEF_HPP
43 #define TPETRA_IMPORTEXPORTDATA_DEF_HPP
45 #include "Tpetra_Map.hpp"
46 #include "Tpetra_Details_makeValidVerboseStream.hpp"
47 #include "Teuchos_FancyOStream.hpp"
48 #include "Teuchos_ParameterList.hpp"
52 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
53 ImportExportData<LocalOrdinal, GlobalOrdinal, Node>::
54 ImportExportData (
const Teuchos::RCP<const map_type>& source,
55 const Teuchos::RCP<const map_type>& target,
56 const Teuchos::RCP<Teuchos::FancyOStream>& out,
57 const Teuchos::RCP<Teuchos::ParameterList>& plist) :
60 out_ (::Tpetra::Details::makeValidVerboseStream (out)),
62 distributor_ (source->getComm (), out_, plist),
63 isLocallyComplete_ (true)
65 TEUCHOS_ASSERT( !
out_.is_null () );
68 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 const Teuchos::RCP<const map_type>& target) :
75 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
78 const Teuchos::RCP<const map_type>& target,
79 const Teuchos::RCP<Teuchos::FancyOStream>& out) :
83 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
86 const Teuchos::RCP<const map_type>& target,
87 const Teuchos::RCP<Teuchos::ParameterList>& plist) :
91 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
92 Teuchos::RCP<ImportExportData<LocalOrdinal, GlobalOrdinal, Node> >
96 using Teuchos::ArrayView;
99 auto tData = Teuchos::rcp (
new data_type (target_, source_, out_));
102 tData->numSameIDs_ = numSameIDs_;
105 tData->distributor_ = *distributor_.getReverse();
106 tData->permuteToLIDs_ = permuteFromLIDs_;
107 tData->permuteFromLIDs_ = permuteToLIDs_;
110 tData->exportLIDs_ = remoteLIDs_;
111 tData->remoteLIDs_ = exportLIDs_;
112 tData->exportPIDs_.resize (tData->exportLIDs_.extent (0));
115 const size_t NumReceives = distributor_.getNumReceives();
116 ArrayView<const int> ProcsFrom = distributor_.getProcsFrom();
117 ArrayView<const size_t> LengthsFrom = distributor_.getLengthsFrom();
122 bool isLocallyComplete =
true;
123 for (
size_t i = 0, j = 0; i < NumReceives; ++i) {
124 const int pid = ProcsFrom[i];
126 isLocallyComplete =
false;
128 for (
size_t k = 0; k < LengthsFrom[i]; ++k) {
129 tData->exportPIDs_[j] = pid;
133 tData->isLocallyComplete_ = isLocallyComplete;
147 #define TPETRA_IMPORTEXPORTDATA_INSTANT(LO, GO, NODE) \
148 template class ImportExportData< LO , GO , NODE >;
150 #endif // TPETRA_IMPORTEXPORTDATA_DEF_HPP
Implementation detail of Import and Export.
Teuchos::RCP< Teuchos::FancyOStream > out_
Output stream for verbose debugging output.
Teuchos::RCP< ImportExportData< LocalOrdinal, GlobalOrdinal, Node > > reverseClone()
Copy the data, but reverse the direction of the transfer as well as reversing the Distributor...