47 #ifndef TPETRA_MAP_DEF_HPP 48 #define TPETRA_MAP_DEF_HPP 50 #include "Tpetra_Directory.hpp" 51 #include "Tpetra_Details_FixedHashTable.hpp" 53 #include "Teuchos_as.hpp" 57 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
60 comm_ (new
Teuchos::SerialComm<int> ()),
61 node_ (KokkosClassic::
Details::getNode<Node> ()),
63 numGlobalElements_ (0),
64 numLocalElements_ (0),
65 minMyGID_ (
Tpetra::
Details::OrdinalTraits<GlobalOrdinal>::invalid ()),
66 maxMyGID_ (
Tpetra::
Details::OrdinalTraits<GlobalOrdinal>::invalid ()),
67 minAllGID_ (
Tpetra::
Details::OrdinalTraits<GlobalOrdinal>::invalid ()),
68 maxAllGID_ (
Tpetra::
Details::OrdinalTraits<GlobalOrdinal>::invalid ()),
69 firstContiguousGID_ (
Tpetra::
Details::OrdinalTraits<GlobalOrdinal>::invalid ()),
70 lastContiguousGID_ (
Tpetra::
Details::OrdinalTraits<GlobalOrdinal>::invalid ()),
74 directory_ (new
Directory<LocalOrdinal, GlobalOrdinal, Node> ())
77 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
80 GlobalOrdinal indexBase,
81 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
83 const Teuchos::RCP<Node> &node) :
87 directory_ (new
Directory<LocalOrdinal, GlobalOrdinal, Node> ())
90 using Teuchos::broadcast;
91 using Teuchos::outArg;
92 using Teuchos::reduceAll;
93 using Teuchos::REDUCE_MIN;
94 using Teuchos::REDUCE_MAX;
95 using Teuchos::typeName;
96 typedef GlobalOrdinal GO;
100 #ifdef HAVE_TPETRA_DEBUG 104 GST proc0NumGlobalElements = numGlobalElements;
105 broadcast<int, GST> (*comm_, 0, outArg (proc0NumGlobalElements));
106 GST minNumGlobalElements = numGlobalElements;
107 GST maxNumGlobalElements = numGlobalElements;
108 reduceAll<int, GST> (*comm, REDUCE_MIN, numGlobalElements, outArg (minNumGlobalElements));
109 reduceAll<int, GST> (*comm, REDUCE_MAX, numGlobalElements, outArg (maxNumGlobalElements));
110 TEUCHOS_TEST_FOR_EXCEPTION(
111 minNumGlobalElements != maxNumGlobalElements || numGlobalElements != minNumGlobalElements,
112 std::invalid_argument,
113 "Tpetra::Map constructor: All processes must provide the same number " 114 "of global elements. Process 0 set numGlobalElements = " 115 << proc0NumGlobalElements <<
". The calling process " 116 << comm->getRank () <<
" set numGlobalElements = " << numGlobalElements
117 <<
". The min and max values over all processes are " 118 << minNumGlobalElements <<
" resp. " << maxNumGlobalElements <<
".");
120 GO proc0IndexBase = indexBase;
121 broadcast<int, GO> (*comm_, 0, outArg (proc0IndexBase));
122 GO minIndexBase = indexBase;
123 GO maxIndexBase = indexBase;
124 reduceAll<int, GO> (*comm, REDUCE_MIN, indexBase, outArg (minIndexBase));
125 reduceAll<int, GO> (*comm, REDUCE_MAX, indexBase, outArg (maxIndexBase));
126 TEUCHOS_TEST_FOR_EXCEPTION(
127 minIndexBase != maxIndexBase || indexBase != minIndexBase,
128 std::invalid_argument,
129 "Tpetra::Map constructor: " 130 "All processes must provide the same indexBase argument. " 131 "Process 0 set indexBase = " << proc0IndexBase <<
". The calling " 132 "process " << comm->getRank () <<
" set indexBase = " << indexBase
133 <<
". The min and max values over all processes are " 134 << minIndexBase <<
" resp. " << maxIndexBase <<
".");
136 #endif // HAVE_TPETRA_DEBUG 155 TEUCHOS_TEST_FOR_EXCEPTION(
156 (numGlobalElements < 1 && numGlobalElements != 0),
157 std::invalid_argument,
158 "Tpetra::Map constructor: numGlobalElements (= " 159 << numGlobalElements <<
") must be nonnegative.");
161 TEUCHOS_TEST_FOR_EXCEPTION(
162 numGlobalElements == GSTI, std::invalid_argument,
163 "Tpetra::Map constructor: You provided numGlobalElements = Teuchos::" 164 "OrdinalTraits<Tpetra::global_size_t>::invalid(). This version of the " 165 "constructor requires a valid value of numGlobalElements. You " 166 "probably mistook this constructor for the \"contiguous nonuniform\" " 167 "constructor, which can compute the global number of elements for you " 168 "if you set numGlobalElements to that value.");
170 size_t numLocalElements = 0;
171 if (lOrG == GloballyDistributed) {
186 const GST numProcs =
static_cast<GST
> (comm_->getSize ());
187 const GST myRank =
static_cast<GST
> (comm_->getRank ());
188 const GST quotient = numGlobalElements / numProcs;
189 const GST remainder = numGlobalElements - quotient * numProcs;
192 if (myRank < remainder) {
193 numLocalElements =
static_cast<size_t> (1) + static_cast<size_t> (quotient);
196 startIndex = as<GO> (myRank) * as<GO> (numLocalElements);
198 numLocalElements = as<size_t> (quotient);
199 startIndex = as<GO> (myRank) * as<GO> (numLocalElements) +
203 minMyGID_ = indexBase + startIndex;
204 maxMyGID_ = indexBase + startIndex + numLocalElements - 1;
205 minAllGID_ = indexBase;
206 maxAllGID_ = indexBase + numGlobalElements - 1;
207 distributed_ = (numProcs > 1);
210 numLocalElements = as<size_t> (numGlobalElements);
211 minMyGID_ = indexBase;
212 maxMyGID_ = indexBase + numGlobalElements - 1;
213 distributed_ =
false;
216 minAllGID_ = indexBase;
217 maxAllGID_ = indexBase + numGlobalElements - 1;
218 indexBase_ = indexBase;
219 numGlobalElements_ = numGlobalElements;
220 numLocalElements_ = numLocalElements;
221 firstContiguousGID_ = minMyGID_;
222 lastContiguousGID_ = maxMyGID_;
229 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
232 size_t numLocalElements,
233 GlobalOrdinal indexBase,
234 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
235 const Teuchos::RCP<Node> &node) :
239 directory_ (new
Directory<LocalOrdinal, GlobalOrdinal, Node> ())
242 using Teuchos::broadcast;
243 using Teuchos::outArg;
244 using Teuchos::reduceAll;
245 using Teuchos::REDUCE_MIN;
246 using Teuchos::REDUCE_MAX;
247 using Teuchos::REDUCE_SUM;
249 typedef GlobalOrdinal GO;
253 #ifdef HAVE_TPETRA_DEBUG 255 GST debugGlobalSum = 0;
256 reduceAll<int, GST> (*comm, REDUCE_SUM, as<GST> (numLocalElements),
257 outArg (debugGlobalSum));
261 GST proc0NumGlobalElements = numGlobalElements;
262 broadcast<int, GST> (*comm_, 0, outArg (proc0NumGlobalElements));
263 GST minNumGlobalElements = numGlobalElements;
264 GST maxNumGlobalElements = numGlobalElements;
265 reduceAll<int, GST> (*comm, REDUCE_MIN, numGlobalElements, outArg (minNumGlobalElements));
266 reduceAll<int, GST> (*comm, REDUCE_MAX, numGlobalElements, outArg (maxNumGlobalElements));
267 TEUCHOS_TEST_FOR_EXCEPTION(
268 minNumGlobalElements != maxNumGlobalElements || numGlobalElements != minNumGlobalElements,
269 std::invalid_argument,
270 "Tpetra::Map constructor: All processes must provide the same number " 271 "of global elements. This is true even if that argument is Teuchos::" 272 "OrdinalTraits<global_size_t>::invalid() to signal that the Map should " 273 "compute the global number of elements. Process 0 set numGlobalElements" 274 " = " << proc0NumGlobalElements <<
". The calling process " 275 << comm->getRank () <<
" set numGlobalElements = " << numGlobalElements
276 <<
". The min and max values over all processes are " 277 << minNumGlobalElements <<
" resp. " << maxNumGlobalElements <<
".");
279 GO proc0IndexBase = indexBase;
280 broadcast<int, GO> (*comm_, 0, outArg (proc0IndexBase));
281 GO minIndexBase = indexBase;
282 GO maxIndexBase = indexBase;
283 reduceAll<int, GO> (*comm, REDUCE_MIN, indexBase, outArg (minIndexBase));
284 reduceAll<int, GO> (*comm, REDUCE_MAX, indexBase, outArg (maxIndexBase));
285 TEUCHOS_TEST_FOR_EXCEPTION(
286 minIndexBase != maxIndexBase || indexBase != minIndexBase,
287 std::invalid_argument,
288 "Tpetra::Map constructor: " 289 "All processes must provide the same indexBase argument. " 290 "Process 0 set indexBase = " << proc0IndexBase <<
". The calling " 291 "process " << comm->getRank () <<
" set indexBase = " << indexBase
292 <<
". The min and max values over all processes are " 293 << minIndexBase <<
" resp. " << maxIndexBase <<
".");
297 TEUCHOS_TEST_FOR_EXCEPTION(
298 numGlobalElements != GSTI && debugGlobalSum != numGlobalElements,
299 std::invalid_argument,
300 "Tpetra::Map constructor: The sum of numLocalElements over all " 301 "processes = " << debugGlobalSum <<
" != numGlobalElements = " 302 << numGlobalElements <<
". If you would like this constructor to " 303 "compute numGlobalElements for you, you may set numGlobalElements = " 304 "Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid() on input.");
306 #endif // HAVE_TPETRA_DEBUG 320 scan<int, GO> (*comm, REDUCE_SUM, numLocalElements, outArg (scanResult));
321 const GO myOffset = scanResult - numLocalElements;
323 if (numGlobalElements != GSTI) {
324 numGlobalElements_ = numGlobalElements;
330 const int numProcs = comm->getSize ();
331 GST globalSum = scanResult;
333 broadcast (*comm, numProcs - 1, outArg (globalSum));
335 numGlobalElements_ = globalSum;
337 #ifdef HAVE_TPETRA_DEBUG 339 TEUCHOS_TEST_FOR_EXCEPTION(
340 globalSum != debugGlobalSum, std::logic_error,
341 "Tpetra::Map constructor (contiguous nonuniform): " 342 "globalSum = " << globalSum <<
" != debugGlobalSum = " << debugGlobalSum
343 <<
". Please report this bug to the Tpetra developers.");
344 #endif // HAVE_TPETRA_DEBUG 346 numLocalElements_ = numLocalElements;
347 indexBase_ = indexBase;
348 minAllGID_ = indexBase;
350 maxAllGID_ = indexBase + numGlobalElements_ - 1;
351 minMyGID_ = indexBase + myOffset;
352 maxMyGID_ = indexBase + myOffset + numLocalElements - 1;
353 firstContiguousGID_ = minMyGID_;
354 lastContiguousGID_ = maxMyGID_;
356 distributed_ = checkIsDist ();
362 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
365 const Teuchos::ArrayView<const GlobalOrdinal> &entryList,
366 GlobalOrdinal indexBase,
367 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
368 const Teuchos::RCP<Node> &node) :
372 directory_ (new
Directory<LocalOrdinal, GlobalOrdinal, Node> ())
375 using Teuchos::ArrayView;
377 using Teuchos::broadcast;
378 using Teuchos::outArg;
380 using Teuchos::REDUCE_MAX;
381 using Teuchos::REDUCE_MIN;
382 using Teuchos::REDUCE_SUM;
383 using Teuchos::reduceAll;
384 using Teuchos::typeName;
385 typedef LocalOrdinal LO;
386 typedef GlobalOrdinal GO;
388 typedef typename ArrayView<const GO>::size_type size_type;
400 const size_t numLocalElements = as<size_t> (entryList.size ());
402 #ifdef HAVE_TPETRA_DEBUG 404 GST debugGlobalSum = 0;
405 reduceAll<int, GST> (*comm, REDUCE_SUM, as<GST> (numLocalElements),
406 outArg (debugGlobalSum));
410 GST proc0NumGlobalElements = numGlobalElements;
411 broadcast<int, GST> (*comm_, 0, outArg (proc0NumGlobalElements));
412 GST minNumGlobalElements = numGlobalElements;
413 GST maxNumGlobalElements = numGlobalElements;
414 reduceAll<int, GST> (*comm, REDUCE_MIN, numGlobalElements, outArg (minNumGlobalElements));
415 reduceAll<int, GST> (*comm, REDUCE_MAX, numGlobalElements, outArg (maxNumGlobalElements));
416 TEUCHOS_TEST_FOR_EXCEPTION(
417 minNumGlobalElements != maxNumGlobalElements || numGlobalElements != minNumGlobalElements,
418 std::invalid_argument,
419 "Tpetra::Map constructor: All processes must provide the same number " 420 "of global elements. This is true even if that argument is Teuchos::" 421 "OrdinalTraits<global_size_t>::invalid() to signal that the Map should " 422 "compute the global number of elements. Process 0 set numGlobalElements" 423 " = " << proc0NumGlobalElements <<
". The calling process " 424 << comm->getRank () <<
" set numGlobalElements = " << numGlobalElements
425 <<
". The min and max values over all processes are " 426 << minNumGlobalElements <<
" resp. " << maxNumGlobalElements <<
".");
428 GO proc0IndexBase = indexBase;
429 broadcast<int, GO> (*comm_, 0, outArg (proc0IndexBase));
430 GO minIndexBase = indexBase;
431 GO maxIndexBase = indexBase;
432 reduceAll<int, GO> (*comm, REDUCE_MIN, indexBase, outArg (minIndexBase));
433 reduceAll<int, GO> (*comm, REDUCE_MAX, indexBase, outArg (maxIndexBase));
434 TEUCHOS_TEST_FOR_EXCEPTION(
435 minIndexBase != maxIndexBase || indexBase != minIndexBase,
436 std::invalid_argument,
437 "Tpetra::Map constructor: " 438 "All processes must provide the same indexBase argument. " 439 "Process 0 set indexBase = " << proc0IndexBase <<
". The calling " 440 "process " << comm->getRank () <<
" set indexBase = " << indexBase
441 <<
". The min and max values over all processes are " 442 << minIndexBase <<
" resp. " << maxIndexBase <<
".");
446 TEUCHOS_TEST_FOR_EXCEPTION(
447 ((numGlobalElements != GSTI) && (debugGlobalSum != numGlobalElements)),
448 std::invalid_argument,
449 "Tpetra::Map constructor: The sum of entryList.size() over all " 450 "processes = " << debugGlobalSum <<
" != numGlobalElements = " 451 << numGlobalElements <<
". If you would like this constructor to " 452 "compute numGlobalElements for you, you may set numGlobalElements = " 453 "Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid() on input.");
455 #endif // HAVE_TPETRA_DEBUG 462 if (numGlobalElements != GSTI) {
463 numGlobalElements_ = numGlobalElements;
465 reduceAll<int, GST> (*comm, REDUCE_SUM, as<GST> (numLocalElements),
466 outArg (numGlobalElements_));
487 numLocalElements_ = numLocalElements;
488 indexBase_ = indexBase;
490 minMyGID_ = indexBase_;
491 maxMyGID_ = indexBase_;
501 if (numLocalElements_ > 0) {
505 Kokkos::View<GO*, device_type> lgMap (
"lgMap", numLocalElements_);
506 auto lgMap_host = Kokkos::create_mirror_view (lgMap);
508 firstContiguousGID_ = entryList[0];
509 lastContiguousGID_ = firstContiguousGID_+1;
517 lgMap_host[0] = firstContiguousGID_;
519 for ( ; i < numLocalElements_; ++i) {
520 const GO curGid = entryList[i];
521 const LO curLid = as<LO> (i);
523 if (lastContiguousGID_ != curGid)
break;
529 lgMap_host[curLid] = curGid;
530 ++lastContiguousGID_;
532 --lastContiguousGID_;
537 minMyGID_ = firstContiguousGID_;
538 maxMyGID_ = lastContiguousGID_;
542 ArrayView<const GO> nonContigEntries =
543 entryList (as<size_type> (i), entryList.size () - as<size_type> (i));
545 lastContiguousGID_, as<LO> (i));
547 for ( ; i < numLocalElements_; ++i) {
548 const GO curGid = entryList[i];
549 const LO curLid = as<LO> (i);
550 lgMap_host[curLid] = curGid;
554 if (curGid < minMyGID_) {
557 if (curGid > maxMyGID_) {
572 firstContiguousGID_ = indexBase_+1;
573 lastContiguousGID_ = indexBase_;
598 if (std::numeric_limits<GO>::is_signed) {
601 (as<GST> (numLocalElements_) < numGlobalElements_) ? 1 : 0;
604 minMaxInput[0] = -minMyGID_;
605 minMaxInput[1] = maxMyGID_;
606 minMaxInput[2] = localDist;
612 reduceAll<int, GO> (*comm, REDUCE_MAX, 3, minMaxInput, minMaxOutput);
613 minAllGID_ = -minMaxOutput[0];
614 maxAllGID_ = minMaxOutput[1];
615 const GO globalDist = minMaxOutput[2];
616 distributed_ = (comm_->getSize () > 1 && globalDist == 1);
620 reduceAll<int, GO> (*comm_, REDUCE_MIN, minMyGID_, outArg (minAllGID_));
621 reduceAll<int, GO> (*comm_, REDUCE_MAX, maxMyGID_, outArg (maxAllGID_));
622 distributed_ = checkIsDist ();
627 TEUCHOS_TEST_FOR_EXCEPTION(
628 minAllGID_ < indexBase_,
629 std::invalid_argument,
630 "Tpetra::Map constructor (noncontiguous): " 631 "Minimum global ID = " << minAllGID_ <<
" over all process(es) is " 632 "less than the given indexBase = " << indexBase_ <<
".");
639 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
644 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
648 TEUCHOS_TEST_FOR_EXCEPTION(
649 getComm ().is_null (), std::logic_error,
"Tpetra::Map::isOneToOne: " 650 "getComm() returns null. Please report this bug to the Tpetra " 655 return directory_->isOneToOne (*
this);
659 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
671 else if (globalIndex >= firstContiguousGID_ &&
672 globalIndex <= lastContiguousGID_) {
673 return static_cast<LocalOrdinal
> (globalIndex - firstContiguousGID_);
678 return glMap_.
get (globalIndex);
682 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
699 return lgMap_[localIndex];
703 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
715 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
723 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
728 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
734 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
741 firstContiguousGID_, lastContiguousGID_,
745 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
750 using Teuchos::outArg;
751 using Teuchos::REDUCE_MIN;
752 using Teuchos::reduceAll;
781 lgMap_.dimension_0 () != 0 && map.lgMap_.dimension_0 () != 0 &&
782 lgMap_.ptr_on_device () == map.lgMap_.ptr_on_device ()) {
796 TEUCHOS_TEST_FOR_EXCEPTION(
798 "Tpetra::Map::isCompatible: There's a bug in this method. We've already " 799 "checked that this condition is true above, but it's false here. " 800 "Please report this bug to the Tpetra developers.");
803 const int locallyCompat =
806 int globallyCompat = 0;
807 reduceAll<int, int> (*comm_, REDUCE_MIN, locallyCompat, outArg (globallyCompat));
808 return (globallyCompat == 1);
811 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
816 using Teuchos::ArrayView;
817 typedef GlobalOrdinal GO;
818 typedef typename ArrayView<const GO>::size_type size_type;
841 TEUCHOS_TEST_FOR_EXCEPTION(
843 "Tpetra::Map::locallySameAs: BUG");
846 const size_type numRhsElts = rhsElts.size ();
847 for (size_type k = 0; k < numRhsElts; ++k) {
848 const GO curLhsGid = minLhsGid +
static_cast<GO
> (k);
849 if (curLhsGid != rhsElts[k]) {
857 TEUCHOS_TEST_FOR_EXCEPTION(
859 "Tpetra::Map::locallySameAs: BUG");
862 const size_type numLhsElts = lhsElts.size ();
863 for (size_type k = 0; k < numLhsElts; ++k) {
864 const GO curRhsGid = minRhsGid +
static_cast<GO
> (k);
865 if (curRhsGid != lhsElts[k]) {
871 else if (this->lgMap_.ptr_on_device () == map.lgMap_.ptr_on_device ()) {
887 return std::equal (lhsElts.begin (), lhsElts.end (), rhsElts.begin ());
893 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
898 using Teuchos::outArg;
899 using Teuchos::REDUCE_MIN;
900 using Teuchos::reduceAll;
958 reduceAll<int, int> (*comm_, REDUCE_MIN, isSame_lcl, outArg (isSame_gbl));
959 return isSame_gbl == 1;
962 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
963 Teuchos::ArrayView<const GlobalOrdinal>
966 typedef GlobalOrdinal GO;
967 typedef Kokkos::View<GO*, device_type> lg_view_type;
972 const bool needToCreateLocalToGlobalMapping =
973 lgMap_.dimension_0 () == 0 && numLocalElements_ > 0;
975 if (needToCreateLocalToGlobalMapping) {
976 #ifdef HAVE_TEUCHOS_DEBUG 979 TEUCHOS_TEST_FOR_EXCEPTION( !
isContiguous(), std::logic_error,
980 "Tpetra::Map::getNodeElementList: The local-to-global mapping (lgMap_) " 981 "should have been set up already for a noncontiguous Map. Please report" 982 " this bug to the Tpetra team.");
983 #endif // HAVE_TEUCHOS_DEBUG 985 typedef typename Teuchos::ArrayRCP<GO>::size_type size_type;
988 lg_view_type lgMap (
"lgMap", numElts);
990 auto lgMap_host = Kokkos::create_mirror_view (lgMap);
992 for (size_type k = 0; k < numElts; ++k, ++gid) {
1005 const GO* lgMapHostRawPtr = lgMap_.ptr_on_device ();
1009 return Teuchos::ArrayView<const GO> (lgMapHostRawPtr, lgMap_.dimension_0 (),
1010 Teuchos::RCP_DISABLE_NODE_LOOKUP);
1013 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1015 return distributed_;
1018 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1020 using Teuchos::TypeNameTraits;
1021 std::ostringstream os;
1023 os <<
"Tpetra::Map: {" 1024 <<
"LocalOrdinalType: " << TypeNameTraits<LocalOrdinal>::name ()
1025 <<
", GlobalOrdinalType: " << TypeNameTraits<GlobalOrdinal>::name ()
1026 <<
", NodeType: " << TypeNameTraits<Node>::name ();
1027 if (this->getObjectLabel () !=
"") {
1028 os <<
", Label: \"" << this->getObjectLabel () <<
"\"";
1031 <<
", Number of processes: " <<
getComm ()->getSize ()
1032 <<
", Uniform: " << (
isUniform () ?
"true" :
"false")
1033 <<
", Contiguous: " << (
isContiguous () ?
"true" :
"false")
1034 <<
", Distributed: " << (
isDistributed () ?
"true" :
"false")
1039 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1043 const Teuchos::EVerbosityLevel verbLevel)
const 1047 using Teuchos::ArrayView;
1049 using Teuchos::OSTab;
1050 using Teuchos::toString;
1051 using Teuchos::TypeNameTraits;
1052 using Teuchos::VERB_DEFAULT;
1053 using Teuchos::VERB_NONE;
1054 using Teuchos::VERB_LOW;
1055 using Teuchos::VERB_MEDIUM;
1056 using Teuchos::VERB_HIGH;
1057 using Teuchos::VERB_EXTREME;
1058 typedef typename ArrayView<const GlobalOrdinal>::size_type size_type;
1062 const int myRank = comm_->getRank ();
1063 const int numProcs = comm_->getSize ();
1065 const Teuchos::EVerbosityLevel vl = (verbLevel == VERB_DEFAULT) ? VERB_LOW : verbLevel;
1071 width = std::max<size_t> (width, as<size_t> (12)) + 2;
1076 if (vl == VERB_NONE) {
1079 else if (vl == VERB_LOW) {
1081 out <<
"Tpetra::Map:" << endl;
1083 out <<
"LocalOrdinalType: " << TypeNameTraits<LocalOrdinal>::name () << endl
1084 <<
"GlobalOrdinalType: " << TypeNameTraits<GlobalOrdinal>::name () << endl
1085 <<
"NodeType: " << TypeNameTraits<Node>::name () << endl;
1086 if (this->getObjectLabel () !=
"") {
1087 out <<
"Label: \"" << this->getObjectLabel () <<
"\"" << endl;
1093 <<
"Number of processes: " <<
getComm ()->getSize () << endl
1094 <<
"Uniform: " << (
isUniform () ?
"true" :
"false") << endl
1095 <<
"Contiguous: " << (
isContiguous () ?
"true" :
"false") << endl
1096 <<
"Distributed: " << (
isDistributed () ?
"true" :
"false") << endl;
1100 if (vl >= VERB_HIGH) {
1101 for (
int p = 0; p < numProcs; ++p) {
1103 out <<
"Process " << myRank <<
":" << endl;
1105 out <<
"My number of entries: " << nME << endl
1108 if (vl == VERB_EXTREME) {
1109 out <<
"My global indices: [";
1110 for (size_type k = 0; k < myEntries.size (); ++k) {
1111 out << myEntries[k];
1112 if (k + 1 < myEntries.size ()) {
1128 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1129 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1133 using Teuchos::Comm;
1134 using Teuchos::null;
1136 using Teuchos::outArg;
1139 using Teuchos::REDUCE_MIN;
1140 using Teuchos::reduceAll;
1142 typedef LocalOrdinal LO;
1143 typedef GlobalOrdinal GO;
1153 const GST globalNumElts = OrdinalTraits<GST>::invalid ();
1155 RCP<Node> node = this->
getNode ();
1158 if (newComm.is_null ()) {
1173 GO newIndexBase = OrdinalTraits<GO>::invalid ();
1174 reduceAll<int, GO> (*newComm, REDUCE_MIN, myMinGid, outArg (newIndexBase));
1175 return rcp (
new map_type (globalNumElts, myElts, newIndexBase, newComm, node));
1179 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1180 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1184 using Teuchos::Comm;
1185 using Teuchos::null;
1186 using Teuchos::outArg;
1189 using Teuchos::REDUCE_MIN;
1190 using Teuchos::reduceAll;
1197 const int color = (numLocalElements_ == 0) ? 0 : 1;
1202 RCP<const Comm<int> > newComm = comm_->split (color, 0);
1208 if (newComm.is_null ()) {
1213 RCP<Map> map = rcp (
new Map ());
1215 map->comm_ = newComm;
1216 map->indexBase_ = indexBase_;
1217 map->numGlobalElements_ = numGlobalElements_;
1218 map->numLocalElements_ = numLocalElements_;
1219 map->minMyGID_ = minMyGID_;
1220 map->maxMyGID_ = maxMyGID_;
1221 map->minAllGID_ = minAllGID_;
1222 map->maxAllGID_ = maxAllGID_;
1223 map->firstContiguousGID_= firstContiguousGID_;
1224 map->lastContiguousGID_ = lastContiguousGID_;
1228 map->uniform_ = uniform_;
1229 map->contiguous_ = contiguous_;
1244 if (! distributed_ || newComm->getSize () == 1) {
1245 map->distributed_ =
false;
1247 const int iOwnAllGids = (numLocalElements_ == numGlobalElements_) ? 1 : 0;
1248 int allProcsOwnAllGids = 0;
1249 reduceAll<int, int> (*newComm, REDUCE_MIN, iOwnAllGids, outArg (allProcsOwnAllGids));
1250 map->distributed_ = (allProcsOwnAllGids == 1) ?
false :
true;
1253 map->lgMap_ = lgMap_;
1254 map->glMap_ = glMap_;
1272 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1276 TEUCHOS_TEST_FOR_EXCEPTION(
1277 directory_.is_null (), std::logic_error,
"Tpetra::Map::setupDirectory: " 1278 "The Directory is null. " 1279 "Please report this bug to the Tpetra developers.");
1283 if (! directory_->initialized ()) {
1284 directory_->initialize (*
this);
1288 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1292 const Teuchos::ArrayView<int>& PIDs,
1293 const Teuchos::ArrayView<LocalOrdinal>& LIDs)
const 1296 typedef Teuchos::ArrayView<int>::size_type size_type;
1305 if (GIDs.size () == 0) {
1308 for (size_type k = 0; k < PIDs.size (); ++k) {
1309 PIDs[k] = OrdinalTraits<int>::invalid ();
1311 for (size_type k = 0; k < LIDs.size (); ++k) {
1312 LIDs[k] = OrdinalTraits<LocalOrdinal>::invalid ();
1322 return directory_->getDirectoryEntries (*
this, GIDs, PIDs, LIDs);
1325 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1329 const Teuchos::ArrayView<int> & PIDs)
const 1332 if (GIDs.size () == 0) {
1336 for (Teuchos::ArrayView<int>::size_type k = 0; k < PIDs.size (); ++k) {
1347 return directory_->getDirectoryEntries (*
this, GIDs, PIDs);
1350 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1351 Teuchos::RCP<const Teuchos::Comm<int> >
1356 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1362 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1365 using Teuchos::outArg;
1366 using Teuchos::REDUCE_MIN;
1367 using Teuchos::reduceAll;
1369 bool global =
false;
1370 if (comm_->getSize () > 1) {
1374 if (numGlobalElements_ == as<global_size_t> (numLocalElements_)) {
1387 reduceAll<int, int> (*comm_, REDUCE_MIN, localRep, outArg (allLocalRep));
1388 if (allLocalRep != 1) {
1401 template <
class LocalOrdinal,
class GlobalOrdinal>
1402 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal> >
1404 typedef LocalOrdinal LO;
1405 typedef GlobalOrdinal GO;
1406 typedef typename ::Tpetra::Map<LO, GO>::node_type NT;
1407 return createLocalMapWithNode<LO, GO> (numElements, comm, KokkosClassic::Details::getNode<NT> ());
1410 template <
class LocalOrdinal,
class GlobalOrdinal>
1411 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal> >
1413 typedef LocalOrdinal LO;
1414 typedef GlobalOrdinal GO;
1415 typedef typename ::Tpetra::Map<LO, GO>::node_type NT;
1416 return createUniformContigMapWithNode<LO, GO> (numElements, comm, KokkosClassic::Details::getNode<NT> ());
1419 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1420 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1422 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1423 const Teuchos::RCP<Node>& node)
1427 const GlobalOrdinal indexBase =
static_cast<GlobalOrdinal
> (0);
1429 return rcp (
new map_type (numElements, indexBase, comm, GloballyDistributed, node));
1432 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1433 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1435 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1436 const Teuchos::RCP<Node>& node)
1441 const GlobalOrdinal indexBase =
static_cast<GlobalOrdinal
> (0);
1444 return rcp (
new map_type (globalNumElts, indexBase, comm, LocallyReplicated, node));
1447 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1448 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1450 size_t localNumElements,
1451 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1452 const Teuchos::RCP<Node>& node)
1456 const GlobalOrdinal indexBase =
static_cast<GlobalOrdinal
> (0);
1458 return rcp (
new map_type (numElements, localNumElements, indexBase, comm, node));
1461 template <
class LocalOrdinal,
class GlobalOrdinal>
1462 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal> >
1464 return Tpetra::createContigMapWithNode<LocalOrdinal,GlobalOrdinal>(numElements, localNumElements, comm, KokkosClassic::DefaultNode::getDefaultNode() );
1468 template <
class LocalOrdinal,
class GlobalOrdinal>
1469 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal> >
1471 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm)
1473 return Tpetra::createNonContigMapWithNode<LocalOrdinal,GlobalOrdinal>(elementList, comm, KokkosClassic::DefaultNode::getDefaultNode() );
1477 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1478 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1480 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
1481 const Teuchos::RCP<Node> &node)
1488 static_cast<GST> (0),
1493 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1494 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1496 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
const Teuchos::RCP< Node > &node) {
1497 Teuchos::RCP< Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > map;
1498 int sumOfWeights, elemsLeft, localNumElements;
1499 const int numImages = comm->getSize(),
1500 myImageID = comm->getRank();
1501 Teuchos::reduceAll<int>(*comm,Teuchos::REDUCE_SUM,myWeight,Teuchos::outArg(sumOfWeights));
1502 const double myShare = ((double)myWeight) / ((double)sumOfWeights);
1503 localNumElements = (int)std::floor( myShare * ((
double)numElements) );
1505 Teuchos::reduceAll<int>(*comm,Teuchos::REDUCE_SUM,localNumElements,Teuchos::outArg(elemsLeft));
1506 elemsLeft = numElements - elemsLeft;
1509 TEUCHOS_TEST_FOR_EXCEPT(elemsLeft < -numImages || numImages < elemsLeft);
1510 if (elemsLeft < 0) {
1512 if (myImageID >= numImages-elemsLeft) --localNumElements;
1514 else if (elemsLeft > 0) {
1516 if (myImageID < elemsLeft) ++localNumElements;
1519 return createContigMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(numElements,localNumElements,comm,node);
1524 template<
class LO,
class GO,
class NT>
1525 Teuchos::RCP<const Tpetra::Map<LO, GO, NT> >
1528 using Teuchos::Array;
1529 using Teuchos::ArrayView;
1535 const int myRank = M->getComm ()->getRank ();
1541 if (! M->isDistributed ()) {
1548 const GST numGlobalEntries = M->getGlobalNumElements ();
1549 if (M->isContiguous ()) {
1550 const size_t numLocalEntries =
1551 (myRank == 0) ? as<size_t> (numGlobalEntries) :
static_cast<size_t> (0);
1552 return rcp (
new map_type (numGlobalEntries, numLocalEntries,
1553 M->getIndexBase (), M->getComm (),
1557 ArrayView<const GO> myGids =
1558 (myRank == 0) ? M->getNodeElementList () : Teuchos::null;
1559 return rcp (
new map_type (GINV, myGids (), M->getIndexBase (),
1560 M->getComm (), M->getNode ()));
1564 else if (M->isContiguous ()) {
1571 const size_t numMyElems = M->getNodeNumElements ();
1572 ArrayView<const GO> myElems = M->getNodeElementList ();
1573 Array<int> owner_procs_vec (numMyElems);
1577 Array<GO> myOwned_vec (numMyElems);
1578 size_t numMyOwnedElems = 0;
1579 for (
size_t i = 0; i < numMyElems; ++i) {
1580 const GO GID = myElems[i];
1581 const int owner = owner_procs_vec[i];
1583 if (myRank == owner) {
1584 myOwned_vec[numMyOwnedElems++] = GID;
1587 myOwned_vec.resize (numMyOwnedElems);
1589 return rcp (
new map_type (GINV, myOwned_vec (), M->getIndexBase (),
1590 M->getComm (), M->getNode ()));
1594 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1595 Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1599 using Teuchos::Array;
1600 using Teuchos::ArrayView;
1602 typedef LocalOrdinal LO;
1603 typedef GlobalOrdinal GO;
1605 int myID = M->
getComm()->getRank();
1614 size_t numMyElems = M->getNodeNumElements ();
1615 ArrayView<const GO> myElems = M->getNodeElementList ();
1616 Array<int> owner_procs_vec (numMyElems);
1620 Array<GO> myOwned_vec (numMyElems);
1621 size_t numMyOwnedElems = 0;
1622 for (
size_t i = 0; i < numMyElems; ++i) {
1623 GO GID = myElems[i];
1624 int owner = owner_procs_vec[i];
1626 if (myID == owner) {
1627 myOwned_vec[numMyOwnedElems++] = GID;
1630 myOwned_vec.resize (numMyOwnedElems);
1636 return rcp (
new map_type (GINV, myOwned_vec (), M->getIndexBase (),
1637 M->getComm (), M->getNode ()));
1647 #define TPETRA_MAP_INSTANT(LO,GO,NODE) \ 1649 template class Map< LO , GO , NODE >; \ 1651 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1652 createLocalMapWithNode<LO,GO,NODE>(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< NODE > &node); \ 1654 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1655 createContigMapWithNode<LO,GO,NODE>(global_size_t numElements, size_t localNumElements, \ 1656 const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< NODE > &node); \ 1658 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1659 createNonContigMapWithNode(const Teuchos::ArrayView<const GO> &elementList, \ 1660 const RCP<const Teuchos::Comm<int> > &comm, \ 1661 const RCP<NODE> &node); \ 1662 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1663 createUniformContigMapWithNode<LO,GO,NODE>(global_size_t numElements, \ 1664 const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< NODE > &node); \ 1666 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1667 createWeightedContigMapWithNode<LO,GO,NODE>(int thisNodeWeight, global_size_t numElements, \ 1668 const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< NODE > &node); \ 1670 template Teuchos::RCP<const Map<LO,GO,NODE> > \ 1671 createOneToOne (const Teuchos::RCP<const Map<LO,GO,NODE> > &M); \ 1673 template Teuchos::RCP<const Map<LO,GO,NODE> > \ 1674 createOneToOne (const Teuchos::RCP<const Map<LO,GO,NODE> > &M, \ 1675 const Tpetra::Details::TieBreak<LO,GO> & tie_break); 1679 #define TPETRA_MAP_INSTANT_DEFAULTNODE(LO,GO) \ 1680 template Teuchos::RCP< const Map<LO,GO> > \ 1681 createLocalMap<LO,GO>( size_t, const Teuchos::RCP< const Teuchos::Comm< int > > &); \ 1683 template Teuchos::RCP< const Map<LO,GO> > \ 1684 createContigMap<LO,GO>( global_size_t, size_t, \ 1685 const Teuchos::RCP< const Teuchos::Comm< int > > &); \ 1687 template Teuchos::RCP< const Map<LO,GO> > \ 1688 createNonContigMap(const Teuchos::ArrayView<const GO> &, \ 1689 const RCP<const Teuchos::Comm<int> > &); \ 1691 template Teuchos::RCP< const Map<LO,GO> > \ 1692 createUniformContigMap<LO,GO>( global_size_t, \ 1693 const Teuchos::RCP< const Teuchos::Comm< int > > &); \ 1695 #endif // TPETRA_MAP_DEF_HPP Interface for breaking ties in ownership.
bool congruent(const Teuchos::Comm< int > &comm1, const Teuchos::Comm< int > &comm2)
Whether the two communicators are congruent.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is owned by this Map on the calling process.
KOKKOS_INLINE_FUNCTION ValueType get(const KeyType &key) const
Get the value corresponding to the given key.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createNonContigMap(const ArrayView< const GlobalOrdinal > &elementList, const RCP< const Teuchos::Comm< int > > &comm)
Non-member constructor for a non-contiguous Map with the default Kokkos Node.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode< Node >())
Nonmember constructor for a locally replicated Map with a specified Kokkos Node.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
bool isUniform() const
Whether the range of global indices is uniform.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createContigMapWithNode(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode< Node >())
Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map with a user-spec...
GlobalOrdinal getIndexBase() const
The index base for this Map.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
void deep_copy(const LittleBlock< ST2, LO > &dst, const LittleBlock< ST1, LO > &src, typename std::enable_if< std::is_convertible< ST1, ST2 >::value &&!std::is_const< ST2 >::value, int >::type *=NULL)
Copy the LittleBlock src into the LittleBlock dst.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
bool locallySameAs(const Map< LocalOrdinal, GlobalOrdinal, node_type > &map) const
Is the given Map locally the same as the input Map?
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createLocalMap(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a locally replicated Map with the default Kokkos Node.
Details::LocalMap< LocalOrdinal, GlobalOrdinal, device_type > local_map_type
Type of the "local" Map.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on the calling process.
"Local" part of Map suitable for Kokkos kernels.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createWeightedContigMapWithNode(int thisNodeWeight, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node)
Non-member constructor for a contiguous Map with user-defined weights and a user-specified Kokkos Nod...
Implementation details of Tpetra.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
size_t global_size_t
Global size_t object.
Traits class for "invalid" (flag) values of integer types that Tpetra uses as local ordinals or globa...
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createUniformContigMap(global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member constructor for a uniformly distributed, contiguous Map with the default Kokkos Node...
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createOneToOne(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &M)
Creates a one-to-one version of the given Map where each GID is owned by only one process...
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
Teuchos::RCP< Node > getNode() const
Get this Map's Node object.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map's communicator with a subset communicator.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
Return the process ranks and corresponding local indices for the given global indices.
LookupStatus getDirectoryEntries(const map_type &map, const Teuchos::ArrayView< const GlobalOrdinal > &globalIDs, const Teuchos::ArrayView< int > &nodeIDs) const
Given a global ID list, return the list of their owning process IDs.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
local_map_type getLocalMap() const
Get the local Map for Kokkos kernels.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createContigMap(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map with the default...
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Describes a parallel distribution of objects over processes.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Implement mapping from global ID to process ID and local ID.
Stand-alone utility functions and macros.
bool isOneToOne() const
Whether the Map is one to one.
void initialize(const map_type &map)
Initialize the Directory with its Map.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createNonContigMapWithNode(const ArrayView< const GlobalOrdinal > &elementList, const RCP< const Teuchos::Comm< int > > &comm, const RCP< Node > &node)
Non-member constructor for a non-contiguous Map with a user-specified Kokkos Node.
LocalGlobal
Enum for local versus global allocation of Map entries.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print this object with the given verbosity level to the given Teuchos::FancyOStream.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMapWithNode(global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode< Node >())
Non-member constructor for a uniformly distributed, contiguous Map with a user-specified Kokkos Node...
global_size_t getGlobalNumElements() const
The number of elements in this Map.
std::string description() const
Implementation of Teuchos::Describable.
Map()
Default constructor (that does nothing).