10 #ifndef TPETRA_IMPORTEXPORTDATA_DEF_HPP
11 #define TPETRA_IMPORTEXPORTDATA_DEF_HPP
13 #include "Tpetra_Map.hpp"
14 #include "Tpetra_Details_makeValidVerboseStream.hpp"
15 #include "Teuchos_FancyOStream.hpp"
16 #include "Teuchos_ParameterList.hpp"
20 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
21 ImportExportData<LocalOrdinal, GlobalOrdinal, Node>::
22 ImportExportData (
const Teuchos::RCP<const map_type>& source,
23 const Teuchos::RCP<const map_type>& target,
24 const Teuchos::RCP<Teuchos::FancyOStream>& out,
25 const Teuchos::RCP<Teuchos::ParameterList>& plist) :
28 out_ (::Tpetra::Details::makeValidVerboseStream (out)),
30 distributor_ (source->getComm (), out_, plist),
31 isLocallyComplete_ (true)
33 TEUCHOS_ASSERT( !
out_.is_null () );
36 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
39 const Teuchos::RCP<const map_type>& target) :
43 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
46 const Teuchos::RCP<const map_type>& target,
47 const Teuchos::RCP<Teuchos::FancyOStream>& out) :
51 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
54 const Teuchos::RCP<const map_type>& target,
55 const Teuchos::RCP<Teuchos::ParameterList>& plist) :
59 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
60 Teuchos::RCP<ImportExportData<LocalOrdinal, GlobalOrdinal, Node> >
64 using Teuchos::ArrayView;
67 auto tData = Teuchos::rcp (
new data_type (target_, source_, out_));
70 tData->numSameIDs_ = numSameIDs_;
73 tData->distributor_ = *distributor_.getReverse();
74 tData->permuteToLIDs_ = permuteFromLIDs_;
75 tData->permuteFromLIDs_ = permuteToLIDs_;
78 tData->exportLIDs_ = remoteLIDs_;
79 tData->remoteLIDs_ = exportLIDs_;
80 tData->exportPIDs_.resize (tData->exportLIDs_.extent (0));
83 const size_t NumReceives = distributor_.getNumReceives();
84 ArrayView<const int> ProcsFrom = distributor_.getProcsFrom();
85 ArrayView<const size_t> LengthsFrom = distributor_.getLengthsFrom();
90 bool isLocallyComplete =
true;
91 for (
size_t i = 0, j = 0; i < NumReceives; ++i) {
92 const int pid = ProcsFrom[i];
94 isLocallyComplete =
false;
96 for (
size_t k = 0; k < LengthsFrom[i]; ++k) {
97 tData->exportPIDs_[j] = pid;
101 tData->isLocallyComplete_ = isLocallyComplete;
115 #define TPETRA_IMPORTEXPORTDATA_INSTANT(LO, GO, NODE) \
116 template class ImportExportData< LO , GO , NODE >;
118 #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...