42 #ifndef __Tpetra_DirectoryImpl_def_hpp
43 #define __Tpetra_DirectoryImpl_def_hpp
45 #ifdef DOXYGEN_USE_ONLY
46 # include <Tpetra_DirectoryImpl_decl.hpp>
48 #include <Tpetra_Distributor.hpp>
49 #include <Tpetra_Map.hpp>
51 #ifdef HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
52 # include <Tpetra_Details_FixedHashTable.hpp>
53 #endif // HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
65 template<
class LO,
class GO,
class NT>
67 Directory (
const Teuchos::RCP<
const typename Directory<LO, GO, NT>::map_type>& map) :
71 template<
class LO,
class GO,
class NT>
74 getEntries (
const Teuchos::ArrayView<const GO> &globalIDs,
75 const Teuchos::ArrayView<int> &nodeIDs,
76 const Teuchos::ArrayView<LO> &localIDs,
77 const bool computeLIDs)
const
81 TEUCHOS_TEST_FOR_EXCEPTION(nodeIDs.size() != globalIDs.size(),
82 std::invalid_argument, Teuchos::typeName(*
this) <<
"::getEntries(): "
83 "Output arrays do not have the right sizes. nodeIDs.size() = "
84 << nodeIDs.size() <<
" != globalIDs.size() = " << globalIDs.size()
86 TEUCHOS_TEST_FOR_EXCEPTION(
87 computeLIDs && localIDs.size() != globalIDs.size(),
88 std::invalid_argument, Teuchos::typeName(*
this) <<
"::getEntries(): "
89 "Output array do not have the right sizes. localIDs.size() = "
90 << localIDs.size() <<
" != globalIDs.size() = " << globalIDs.size()
98 std::fill (nodeIDs.begin(), nodeIDs.end(), -1);
100 std::fill (localIDs.begin(), localIDs.end(),
101 Teuchos::OrdinalTraits<LO>::invalid ());
104 return this->getEntriesImpl (globalIDs, nodeIDs, localIDs, computeLIDs);
107 template<
class LO,
class GO,
class NT>
113 template<
class LO,
class GO,
class NT>
117 std::ostringstream os;
118 os <<
"ReplicatedDirectory"
119 <<
"<" << Teuchos::TypeNameTraits<LO>::name ()
120 <<
", " << Teuchos::TypeNameTraits<GO>::name ()
121 <<
", " << Teuchos::TypeNameTraits<NT>::name () <<
">";
126 template<
class LO,
class GO,
class NT>
131 TEUCHOS_TEST_FOR_EXCEPTION(! map->isContiguous (), std::invalid_argument,
132 Teuchos::typeName (*
this) <<
" constructor: Map is not contiguous.");
133 TEUCHOS_TEST_FOR_EXCEPTION(! map->isUniform (), std::invalid_argument,
134 Teuchos::typeName (*
this) <<
" constructor: Map is not uniform.");
138 template<
class LO,
class GO,
class NT>
142 std::ostringstream os;
143 os <<
"ContiguousUniformDirectory"
144 <<
"<" << Teuchos::TypeNameTraits<LO>::name ()
145 <<
", " << Teuchos::TypeNameTraits<GO>::name ()
146 <<
", " << Teuchos::TypeNameTraits<NT>::name () <<
">";
151 template<
class LO,
class GO,
class NT>
155 const Teuchos::ArrayView<int> &nodeIDs,
156 const Teuchos::ArrayView<LO> &localIDs,
157 const bool computeLIDs)
const
162 typedef typename Teuchos::ArrayView<const GO>::size_type size_type;
163 const LO invalidLid = Teuchos::OrdinalTraits<LO>::invalid ();
166 RCP<const map_type> map = this->getMap ();
167 RCP<const Comm<int> > comm = map->getComm ();
168 const GO g_min = map->getMinAllGlobalIndex ();
191 const size_type N_G = as<size_type> (map->getGlobalNumElements ());
192 const size_type P = as<size_type> (comm->getSize ());
193 const size_type N_L = N_G / P;
194 const size_type R = N_G - N_L * P;
195 const size_type N_R = R * (N_L + 1);
197 #ifdef HAVE_TPETRA_DEBUG
198 TEUCHOS_TEST_FOR_EXCEPTION(
199 N_G != P*N_L + R, std::logic_error,
200 "Tpetra::ContiguousUniformDirectory::getEntriesImpl: "
201 "N_G = " << N_G <<
" != P*N_L + R = " << P <<
"*" << N_L <<
" + " << R
202 <<
" = " << P*N_L + R <<
". "
203 "Please report this bug to the Tpetra developers.");
204 #endif // HAVE_TPETRA_DEBUG
206 const size_type numGids = globalIDs.size ();
208 for (size_type k = 0; k < numGids; ++k) {
209 const GO g_0 = globalIDs[k] - g_min;
214 if (g_0 + 1 < 1 || g_0 >= N_G) {
216 localIDs[k] = invalidLid;
219 else if (g_0 < as<GO> (N_R)) {
221 nodeIDs[k] = as<int> (g_0 / (N_L + 1));
222 localIDs[k] = g_0 % (N_L + 1);
224 else if (g_0 >= as<GO> (N_R)) {
226 const GO g_R = g_0 - N_R;
227 nodeIDs[k] = as<int> (R + g_R / N_L);
228 localIDs[k] = as<int> (g_R % N_L);
230 #ifdef HAVE_TPETRA_DEBUG
232 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
233 "Tpetra::ContiguousUniformDirectory::getEntriesImpl: "
234 "should never get here. "
235 "Please report this bug to the Tpetra developers.");
237 #endif // HAVE_TPETRA_DEBUG
241 for (size_type k = 0; k < numGids; ++k) {
242 const GO g_0 = globalIDs[k] - g_min;
247 if (g_0 + 1 < 1 || g_0 >= N_G) {
251 else if (g_0 < as<GO> (N_R)) {
253 nodeIDs[k] = as<int> (g_0 / (N_L + 1));
255 else if (g_0 >= as<GO> (N_R)) {
257 const GO g_R = g_0 - N_R;
258 nodeIDs[k] = as<int> (R + g_R / N_L);
260 #ifdef HAVE_TPETRA_DEBUG
262 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
263 "Tpetra::ContiguousUniformDirectory::getEntriesImpl: "
264 "should never get here. "
265 "Please report this bug to the Tpetra developers.");
267 #endif // HAVE_TPETRA_DEBUG
274 template<
class LO,
class GO,
class NT>
279 using Teuchos::gatherAll;
282 RCP<const Teuchos::Comm<int> > comm = map->getComm ();
284 TEUCHOS_TEST_FOR_EXCEPTION(! map->isDistributed (), std::invalid_argument,
285 Teuchos::typeName (*
this) <<
" constructor: Map is not distributed.");
286 TEUCHOS_TEST_FOR_EXCEPTION(! map->isContiguous (), std::invalid_argument,
287 Teuchos::typeName (*
this) <<
" constructor: Map is not contiguous.");
289 const int numProcs = comm->getSize ();
293 allMinGIDs_ = arcp<GO> (numProcs + 1);
295 GO minMyGID = map->getMinGlobalIndex ();
307 MPI_Datatype rawMpiType = MPI_INT;
308 bool useRawMpi =
true;
309 if (
typeid (GO) ==
typeid (
int)) {
310 rawMpiType = MPI_INT;
311 }
else if (
typeid (GO) ==
typeid (
long)) {
312 rawMpiType = MPI_LONG;
317 using Teuchos::rcp_dynamic_cast;
318 using Teuchos::MpiComm;
319 RCP<const MpiComm<int> > mpiComm =
320 rcp_dynamic_cast<
const MpiComm<int> > (comm);
323 if (! comm.is_null ()) {
324 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
326 MPI_Allgather (&minMyGID, 1, rawMpiType,
327 allMinGIDs_.getRawPtr (), 1, rawMpiType,
329 TEUCHOS_TEST_FOR_EXCEPTION(err != MPI_SUCCESS, std::runtime_error,
330 "Tpetra::DistributedContiguousDirectory: MPI_Allgather failed");
332 gatherAll<int, GO> (*comm, 1, &minMyGID, numProcs, allMinGIDs_.getRawPtr ());
335 gatherAll<int, GO> (*comm, 1, &minMyGID, numProcs, allMinGIDs_.getRawPtr ());
337 #else // NOT HAVE_MPI
338 gatherAll<int, GO> (*comm, 1, &minMyGID, numProcs, allMinGIDs_.getRawPtr ());
346 allMinGIDs_[numProcs] = map->getMaxAllGlobalIndex ()
347 + Teuchos::OrdinalTraits<GO>::one ();
350 template<
class LO,
class GO,
class NT>
354 std::ostringstream os;
355 os <<
"DistributedContiguousDirectory"
356 <<
"<" << Teuchos::TypeNameTraits<LO>::name ()
357 <<
", " << Teuchos::TypeNameTraits<GO>::name ()
358 <<
", " << Teuchos::TypeNameTraits<NT>::name () <<
">";
362 template<
class LO,
class GO,
class NT>
366 const Teuchos::ArrayView<int> &nodeIDs,
367 const Teuchos::ArrayView<LO> &localIDs,
368 const bool computeLIDs)
const
370 using Teuchos::Array;
371 using Teuchos::ArrayRCP;
372 using Teuchos::ArrayView;
378 RCP<const map_type> map = this->getMap ();
379 RCP<const Teuchos::Comm<int> > comm = map->getComm ();
380 const int myRank = comm->getRank ();
383 typename ArrayView<int>::iterator procIter = nodeIDs.begin();
384 typename ArrayView<LO>::iterator lidIter = localIDs.begin();
385 typename ArrayView<const GO>::iterator gidIter;
386 for (gidIter = globalIDs.begin(); gidIter != globalIDs.end(); ++gidIter) {
387 if (map->isNodeGlobalElement (*gidIter)) {
388 *procIter++ = myRank;
390 *lidIter++ = map->getLocalElement (*gidIter);
405 template<
class LO,
class GO,
class NT>
409 const Teuchos::ArrayView<int> &nodeIDs,
410 const Teuchos::ArrayView<LO> &localIDs,
411 const bool computeLIDs)
const
413 using Teuchos::Array;
414 using Teuchos::ArrayRCP;
415 using Teuchos::ArrayView;
420 const LO LINVALID = Teuchos::OrdinalTraits<LO>::invalid();
423 RCP<const map_type> map = this->getMap ();
424 RCP<const Teuchos::Comm<int> > comm = map->getComm ();
425 const int numProcs = comm->getSize ();
426 const global_size_t nOverP = map->getGlobalNumElements () / numProcs;
429 typename ArrayView<int>::iterator procIter = nodeIDs.begin();
430 typename ArrayView<LO>::iterator lidIter = localIDs.begin();
431 typename ArrayView<const GO>::iterator gidIter;
432 for (gidIter = globalIDs.begin(); gidIter != globalIDs.end(); ++gidIter) {
442 const GO one = as<GO> (1);
443 const GO two = as<GO> (2);
444 const GO nOverP_GID = as<GO> (nOverP);
445 const GO lowerBound = GID / std::max(nOverP_GID, one) + two;
446 curRank = as<int>(std::min(lowerBound, as<GO>(numProcs - 1)));
449 while (curRank >= 0 && curRank < numProcs) {
450 if (allMinGIDs_[curRank] <= GID) {
451 if (GID < allMinGIDs_[curRank + 1]) {
465 LID = as<LO> (GID - allMinGIDs_[image]);
478 template<
class LO,
class GO,
class NT>
482 useHashTables_ (false)
484 using Teuchos::Array;
485 using Teuchos::ArrayView;
489 using Teuchos::typeName;
490 using Teuchos::TypeNameTraits;
500 TEUCHOS_TEST_FOR_EXCEPTION(
sizeof(
global_size_t) <
sizeof(GO),
501 std::logic_error, typeName (*
this) <<
": sizeof(Tpetra::"
502 "global_size_t) = " <<
sizeof(
global_size_t) <<
" < sizeof(Global"
503 "Ordinal = " << TypeNameTraits<LO>::name () <<
") = " <<
sizeof(GO)
505 TEUCHOS_TEST_FOR_EXCEPTION(
sizeof(
global_size_t) <
sizeof(
int),
506 std::logic_error, typeName (*
this) <<
": sizeof(Tpetra::"
507 "global_size_t) = " <<
sizeof(
global_size_t) <<
" < sizeof(int) = "
508 <<
sizeof(
int) <<
".");
509 TEUCHOS_TEST_FOR_EXCEPTION(
sizeof(
global_size_t) <
sizeof(LO),
510 std::logic_error, typeName (*
this) <<
": sizeof(Tpetra::"
511 "global_size_t) = " <<
sizeof(
global_size_t) <<
" < sizeof(Local"
512 "Ordinal = " << TypeNameTraits<LO>::name () <<
") = " <<
sizeof(LO)
515 RCP<const Teuchos::Comm<int> > comm = map->getComm ();
516 const LO LINVALID = Teuchos::OrdinalTraits<LO>::invalid ();
517 const GO minAllGID = map->getMinAllGlobalIndex ();
518 const GO maxAllGID = map->getMaxAllGlobalIndex ();
525 const global_size_t numGlobalEntries = maxAllGID - minAllGID + 1;
535 directoryMap_ = rcp (
new map_type (numGlobalEntries, minAllGID, comm,
538 const size_t dir_numMyEntries = directoryMap_->getNodeNumElements ();
554 #ifdef HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
562 const size_t inverseSparsityThreshold = 10;
564 dir_numMyEntries >= inverseSparsityThreshold * map->getNodeNumElements ();
565 #endif // HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
570 const int myRank = comm->getRank ();
571 const size_t numMyEntries = map->getNodeNumElements ();
572 Array<int> sendImageIDs (numMyEntries);
573 ArrayView<const GO> myGlobalEntries = map->getNodeElementList ();
577 TEUCHOS_TEST_FOR_EXCEPTION(
578 directoryMap_->getRemoteIndexList (myGlobalEntries, sendImageIDs) ==
IDNotPresent,
579 std::logic_error, Teuchos::typeName(*
this) <<
" constructor: the "
580 "Directory Map could not find out where one or more of my Map's "
581 "elements should go. This probably means there is a bug in Map or "
582 "Directory. Please report this bug to the Tpetra developers.");
590 const size_t numReceives = distor.createFromSends (sendImageIDs);
599 const int packetSize = 3;
600 Array<GO> exportEntries (packetSize * numMyEntries);
602 typename Array<GO>::iterator iter = exportEntries.begin();
603 for (
size_t i=0; i < numMyEntries; ++i) {
604 *iter++ = myGlobalEntries[i];
605 *iter++ = as<GO> (myRank);
606 *iter++ = as<GO> (i);
612 Array<GO> importElements (packetSize * distor.getTotalReceiveLength ());
615 distor.doPostsAndWaits (exportEntries ().getConst (), packetSize, importElements ());
617 #ifdef HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
623 if (useHashTables_) {
638 LO* tableKeysRaw = NULL;
639 LO* tableLidsRaw = NULL;
640 int* tablePidsRaw = NULL;
642 tableKeysRaw =
new LO [numReceives];
643 tableLidsRaw =
new LO [numReceives];
644 tablePidsRaw =
new int [numReceives];
646 if (tableKeysRaw != NULL) {
647 delete [] tableKeysRaw;
649 if (tableLidsRaw != NULL) {
650 delete [] tableLidsRaw;
652 if (tablePidsRaw != NULL) {
653 delete [] tablePidsRaw;
657 ArrayRCP<LO> tableKeys (tableKeysRaw, 0, numReceives,
true);
658 ArrayRCP<LO> tableLids (tableLidsRaw, 0, numReceives,
true);
659 ArrayRCP<int> tablePids (tablePidsRaw, 0, numReceives,
true);
662 typename Array<GO>::const_iterator iter = importElements.begin ();
663 for (
size_t i = 0; i < numReceives; ++i) {
664 const GO curGID = *iter++;
665 const LO curLID = directoryMap_->getLocalElement (curGID);
666 TEUCHOS_TEST_FOR_EXCEPTION(curLID == LINVALID, std::logic_error,
667 Teuchos::typeName(*
this) <<
" constructor: Incoming global index "
668 << curGID <<
" does not have a corresponding local index in the "
669 "Directory Map. Please report this bug to the Tpetra developers.");
670 tableKeys[i] = curLID;
671 tablePids[i] = *iter++;
672 tableLids[i] = *iter++;
676 rcp (
new Details::FixedHashTable<LO, int> (tableKeys (),
679 rcp (
new Details::FixedHashTable<LO, LO> (tableKeys (),
687 PIDs_ = arcp<int> (dir_numMyEntries);
688 std::fill (PIDs_.begin (), PIDs_.end (), -1);
689 LIDs_ = arcp<LO> (dir_numMyEntries);
690 std::fill (LIDs_.begin (), LIDs_.end (), LINVALID);
692 typename Array<GO>::const_iterator iter = importElements.begin ();
693 for (
size_t i = 0; i < numReceives; ++i) {
694 const GO curGID = *iter++;
695 const LO curLID = directoryMap_->getLocalElement (curGID);
696 TEUCHOS_TEST_FOR_EXCEPTION(curLID == LINVALID, std::logic_error,
697 Teuchos::typeName(*
this) <<
" constructor: Incoming global index "
698 << curGID <<
" does not have a corresponding local index in the "
699 "Directory Map. Please report this bug to the Tpetra developers.");
700 PIDs_[curLID] = *iter++;
701 LIDs_[curLID] = *iter++;
704 #else // NOT HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
705 if (! useHashTables_) {
710 PIDs_ = arcp<int> (dir_numMyEntries);
711 std::fill (PIDs_.begin (), PIDs_.end (), -1);
712 LIDs_ = arcp<LO> (dir_numMyEntries);
713 std::fill (LIDs_.begin (), LIDs_.end (), LINVALID);
715 typename Array<GO>::iterator iter = importElements.begin();
716 for (
size_t i = 0; i < numReceives; ++i) {
717 const GO curGID = *iter++;
718 const LO curLID = directoryMap_->getLocalElement (curGID);
719 TEUCHOS_TEST_FOR_EXCEPTION(curLID == LINVALID, std::logic_error,
720 Teuchos::typeName(*
this) <<
" constructor: Incoming global index "
721 << curGID <<
" does not have a corresponding local index in the "
722 "Directory Map. Please report this bug to the Tpetra developers.");
723 PIDs_[curLID] = *iter++;
724 LIDs_[curLID] = *iter++;
727 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
"Should never get here!");
729 #endif // HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
732 template<
class LO,
class GO,
class NT>
736 std::ostringstream os;
737 os <<
"DistributedNoncontiguousDirectory"
738 <<
"<" << Teuchos::TypeNameTraits<LO>::name ()
739 <<
", " << Teuchos::TypeNameTraits<GO>::name ()
740 <<
", " << Teuchos::TypeNameTraits<NT>::name () <<
">";
744 template<
class LO,
class GO,
class NT>
748 const Teuchos::ArrayView<int> &nodeIDs,
749 const Teuchos::ArrayView<LO> &localIDs,
750 const bool computeLIDs)
const
752 using Teuchos::Array;
753 using Teuchos::ArrayRCP;
754 using Teuchos::ArrayView;
758 const LO LINVALID = Teuchos::OrdinalTraits<LO>::invalid();
761 RCP<const map_type> map = this->getMap ();
762 RCP<const Teuchos::Comm<int> > comm = map->getComm ();
763 const size_t numEntries = globalIDs.size ();
771 const int packetSize = computeLIDs ? 3 : 2;
777 Array<int> dirImages (numEntries);
778 res = directoryMap_->getRemoteIndexList (globalIDs, dirImages ());
780 size_t numMissing = 0;
782 for (
size_t i=0; i < numEntries; ++i) {
783 if (dirImages[i] == -1) {
786 localIDs[i] = LINVALID;
794 Array<int> sendImages;
795 distor.
createFromRecvs (globalIDs, dirImages (), sendGIDs, sendImages);
796 const size_t numSends = sendGIDs.size ();
829 Array<global_size_t> exports (packetSize * numSends);
836 typename Array<global_size_t>::iterator exportsIter = exports.begin();
837 typename Array<GO>::const_iterator gidIter = sendGIDs.begin();
839 #ifdef HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
840 if (useHashTables_) {
841 for ( ; gidIter != sendGIDs.end(); ++gidIter) {
842 const GO curGID = *gidIter;
845 const LO curLID = directoryMap_->getLocalElement (curGID);
846 TEUCHOS_TEST_FOR_EXCEPTION(curLID == LINVALID, std::logic_error,
847 Teuchos::typeName (*
this) <<
"::getEntriesImpl(): The Directory "
848 "Map's global index " << curGID <<
" does not have a corresponding "
849 "local index. Please report this bug to the Tpetra developers.");
851 *exportsIter++ =
static_cast<global_size_t> (lidToPidTable_->get (curLID));
854 *exportsIter++ =
static_cast<global_size_t> (lidToLidTable_->get (curLID));
858 for ( ; gidIter != sendGIDs.end(); ++gidIter) {
859 const GO curGID = *gidIter;
862 const LO curLID = directoryMap_->getLocalElement (curGID);
863 TEUCHOS_TEST_FOR_EXCEPTION(curLID == LINVALID, std::logic_error,
864 Teuchos::typeName (*
this) <<
"::getEntriesImpl(): The Directory "
865 "Map's global index " << curGID <<
" does not have a corresponding "
866 "local index. Please report this bug to the Tpetra developers.");
875 #else // NOT HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
876 for ( ; gidIter != sendGIDs.end (); ++gidIter) {
877 const GO curGID = *gidIter;
880 const LO curLID = directoryMap_->getLocalElement (curGID);
881 TEUCHOS_TEST_FOR_EXCEPTION(curLID == LINVALID, std::logic_error,
882 Teuchos::typeName (*
this) <<
"::getEntriesImpl(): The Directory "
883 "Map's global index " << curGID <<
" does not have a corresponding "
884 "local index. Please report this bug to the Tpetra developers.");
892 #endif // HAVE_TPETRA_DIRECTORY_SPARSE_MAP_FIX
896 distor.
doPostsAndWaits (exports ().getConst (), packetSize, imports ());
902 typename Array<global_size_t>::iterator ptr = imports.begin();
903 const size_t numRecv = numEntries - numMissing;
905 Array<GO> sortedIDs (globalIDs);
906 ArrayRCP<GO> offset = arcp<GO> (numEntries);
908 for (
typename ArrayRCP<GO>::iterator oo = offset.begin();
909 oo != offset.end(); ++oo, ++ii) {
912 sort2 (sortedIDs.begin(), sortedIDs.begin() + numEntries, offset.begin());
914 typedef typename Array<GO>::iterator IT;
916 for (
size_t i = 0; i < numRecv; ++i) {
918 const GO curGID =
static_cast<GO
> (*ptr++);
919 std::pair<IT, IT> p1 = std::equal_range (sortedIDs.begin(), sortedIDs.end(), curGID);
920 if (p1.first != p1.second) {
921 const size_t j = p1.first - sortedIDs.begin();
923 nodeIDs[offset[j]] =
static_cast<int> (*ptr++);
926 localIDs[offset[j]] =
static_cast<LO
> (*ptr++);
928 if (nodeIDs[offset[j]] == -1) {
943 #define TPETRA_DIRECTORY_IMPL_INSTANT(LO,GO,NODE) \
944 template class Directory< LO , GO , NODE >; \
945 template class ReplicatedDirectory< LO , GO , NODE >; \
946 template class DistributedContiguousDirectory< LO , GO , NODE >; \
947 template class DistributedNoncontiguousDirectory< LO , GO , NODE >; \
950 #endif // __Tpetra_DirectoryImpl_def_hpp
LookupStatus getEntries(const Teuchos::ArrayView< const GlobalOrdinal > &globalIDs, const Teuchos::ArrayView< int > &nodeIDs, const Teuchos::ArrayView< LocalOrdinal > &localIDs, const bool computeLIDs) const
std::string description() const
A one-line human-readable description of this object.
Implementation of Directory for a distributed noncontiguous Map.
Implementation of Directory for a distributed contiguous Map.
size_t global_size_t
Global size_t object.
void doPostsAndWaits(const ArrayView< const Packet > &exports, size_t numPackets, const ArrayView< Packet > &imports)
Execute the (forward) communication plan.
LookupStatus getEntriesImpl(const Teuchos::ArrayView< const GlobalOrdinal > &globalIDs, const Teuchos::ArrayView< int > &nodeIDs, const Teuchos::ArrayView< LocalOrdinal > &localIDs, const bool computeLIDs) const
Find process IDs and (optionally) local IDs for the given global IDs.
Sets up and executes a communication plan for a Tpetra DistObject.
size_t getTotalReceiveLength() const
Total number of values this process will receive from other processes.
Directory()
Empty constructor for post-constructor initialization.
LookupStatus getEntriesImpl(const Teuchos::ArrayView< const GlobalOrdinal > &globalIDs, const Teuchos::ArrayView< int > &nodeIDs, const Teuchos::ArrayView< LocalOrdinal > &localIDs, const bool computeLIDs) const
Find process IDs and (optionally) local IDs for the given global IDs.
LookupStatus getEntriesImpl(const Teuchos::ArrayView< const GlobalOrdinal > &globalIDs, const Teuchos::ArrayView< int > &nodeIDs, const Teuchos::ArrayView< LocalOrdinal > &localIDs, const bool computeLIDs) const
Find process IDs and (optionally) local IDs for the given global IDs.
std::string description() const
A one-line human-readable description of this object.
void sort2(const IT1 &first1, const IT1 &last1, const IT2 &first2)
Sort the first array, and apply the resulting permutation to the second array.
Describes a parallel distribution of objects over processes.
Computes the local ID and process ID corresponding to given global IDs.
std::string description() const
A one-line human-readable description of this object.
void createFromRecvs(const ArrayView< const Ordinal > &remoteIDs, const ArrayView< const int > &remoteNodeIDs, Array< Ordinal > &exportIDs, Array< int > &exportNodeIDs)
Set up Distributor using list of process ranks from which to receive.
ReplicatedDirectory(const Teuchos::RCP< const map_type > &map)
Constructor.