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::DualView<GO*, device_type> lgMap (
"lgMap", numLocalElements_);
506 typedef typename Kokkos::DualView<GO*, device_type>::t_host::memory_space host_memory_space;
507 auto lgMap_host = lgMap.template view<host_memory_space> ();
508 lgMap.template modify<host_memory_space> ();
510 firstContiguousGID_ = entryList[0];
511 lastContiguousGID_ = firstContiguousGID_+1;
519 lgMap_host[0] = firstContiguousGID_;
521 for ( ; i < numLocalElements_; ++i) {
522 const GO curGid = entryList[i];
523 const LO curLid = as<LO> (i);
525 if (lastContiguousGID_ != curGid)
break;
531 lgMap_host[curLid] = curGid;
532 ++lastContiguousGID_;
534 --lastContiguousGID_;
539 minMyGID_ = firstContiguousGID_;
540 maxMyGID_ = lastContiguousGID_;
544 ArrayView<const GO> nonContigEntries =
545 entryList (as<size_type> (i), entryList.size () - as<size_type> (i));
547 lastContiguousGID_, as<LO> (i));
549 for ( ; i < numLocalElements_; ++i) {
550 const GO curGid = entryList[i];
551 const LO curLid = as<LO> (i);
552 lgMap_host[curLid] = curGid;
556 if (curGid < minMyGID_) {
559 if (curGid > maxMyGID_) {
566 typedef typename Kokkos::DualView<GO*, device_type>::t_dev::memory_space device_memory_space;
567 lgMap.template sync<device_memory_space> ();
576 firstContiguousGID_ = indexBase_+1;
577 lastContiguousGID_ = indexBase_;
602 if (std::numeric_limits<GO>::is_signed) {
605 (as<GST> (numLocalElements_) < numGlobalElements_) ? 1 : 0;
608 minMaxInput[0] = -minMyGID_;
609 minMaxInput[1] = maxMyGID_;
610 minMaxInput[2] = localDist;
616 reduceAll<int, GO> (*comm, REDUCE_MAX, 3, minMaxInput, minMaxOutput);
617 minAllGID_ = -minMaxOutput[0];
618 maxAllGID_ = minMaxOutput[1];
619 const GO globalDist = minMaxOutput[2];
620 distributed_ = (comm_->getSize () > 1 && globalDist == 1);
624 reduceAll<int, GO> (*comm_, REDUCE_MIN, minMyGID_, outArg (minAllGID_));
625 reduceAll<int, GO> (*comm_, REDUCE_MAX, maxMyGID_, outArg (maxAllGID_));
626 distributed_ = checkIsDist ();
631 TEUCHOS_TEST_FOR_EXCEPTION(
632 minAllGID_ < indexBase_,
633 std::invalid_argument,
634 "Tpetra::Map constructor (noncontiguous): " 635 "Minimum global ID = " << minAllGID_ <<
" over all process(es) is " 636 "less than the given indexBase = " << indexBase_ <<
".");
643 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
648 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
652 TEUCHOS_TEST_FOR_EXCEPTION(
653 getComm ().is_null (), std::logic_error,
"Tpetra::Map::isOneToOne: " 654 "getComm() returns null. Please report this bug to the Tpetra " 659 return directory_->isOneToOne (*
this);
663 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
675 else if (globalIndex >= firstContiguousGID_ &&
676 globalIndex <= lastContiguousGID_) {
677 return static_cast<LocalOrdinal
> (globalIndex - firstContiguousGID_);
682 return glMap_.
get (globalIndex);
686 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
700 return lgMap_.h_view[localIndex];
704 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
716 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
724 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
729 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
734 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
739 using Teuchos::outArg;
740 using Teuchos::REDUCE_MIN;
741 using Teuchos::reduceAll;
770 lgMap_.dimension_0 () != 0 && map.lgMap_.dimension_0 () != 0 &&
771 lgMap_.d_view.ptr_on_device () == map.lgMap_.d_view.ptr_on_device ()) {
785 TEUCHOS_TEST_FOR_EXCEPTION(
787 "Tpetra::Map::isCompatible: There's a bug in this method. We've already " 788 "checked that this condition is true above, but it's false here. " 789 "Please report this bug to the Tpetra developers.");
792 const int locallyCompat =
795 int globallyCompat = 0;
796 reduceAll<int, int> (*comm_, REDUCE_MIN, locallyCompat, outArg (globallyCompat));
797 return (globallyCompat == 1);
800 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
805 using Teuchos::ArrayView;
806 typedef GlobalOrdinal GO;
807 typedef typename ArrayView<const GO>::size_type size_type;
830 TEUCHOS_TEST_FOR_EXCEPTION(
832 "Tpetra::Map::locallySameAs: BUG");
835 const size_type numRhsElts = rhsElts.size ();
836 for (size_type k = 0; k < numRhsElts; ++k) {
837 const GO curLhsGid = minLhsGid +
static_cast<GO
> (k);
838 if (curLhsGid != rhsElts[k]) {
846 TEUCHOS_TEST_FOR_EXCEPTION(
848 "Tpetra::Map::locallySameAs: BUG");
851 const size_type numLhsElts = lhsElts.size ();
852 for (size_type k = 0; k < numLhsElts; ++k) {
853 const GO curRhsGid = minRhsGid +
static_cast<GO
> (k);
854 if (curRhsGid != lhsElts[k]) {
860 else if (this->lgMap_.d_view.ptr_on_device () == map.lgMap_.d_view.ptr_on_device ()) {
876 return std::equal (lhsElts.begin (), lhsElts.end (), rhsElts.begin ());
882 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
887 using Teuchos::outArg;
888 using Teuchos::REDUCE_MIN;
889 using Teuchos::reduceAll;
947 reduceAll<int, int> (*comm_, REDUCE_MIN, isSame_lcl, outArg (isSame_gbl));
948 return isSame_gbl == 1;
951 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
952 Teuchos::ArrayView<const GlobalOrdinal>
955 typedef GlobalOrdinal GO;
956 typedef Kokkos::DualView<GO*, device_type> dual_view_type;
957 typedef typename dual_view_type::t_dev::memory_space device_memory_space;
958 typedef typename dual_view_type::t_host::memory_space host_memory_space;
963 const bool needToCreateLocalToGlobalMapping = lgMap_.dimension_0 () == 0 && numLocalElements_ > 0;
965 if (needToCreateLocalToGlobalMapping) {
966 #ifdef HAVE_TEUCHOS_DEBUG 969 TEUCHOS_TEST_FOR_EXCEPTION( !
isContiguous(), std::logic_error,
970 "Tpetra::Map::getNodeElementList: The local-to-global mapping (lgMap_) " 971 "should have been set up already for a noncontiguous Map. Please report" 972 " this bug to the Tpetra team.");
973 #endif // HAVE_TEUCHOS_DEBUG 975 typedef typename Teuchos::ArrayRCP<GO>::size_type size_type;
978 dual_view_type lgMap (
"lgMap", numElts);
979 lgMap.template modify<host_memory_space> ();
982 auto lgMap_host = lgMap.template view<host_memory_space> ();
984 for (size_type k = 0; k < numElts; ++k, ++gid) {
990 lgMap.template sync<device_memory_space> ();
996 const GO* lgMapHostRawPtr =
997 lgMap_.template view<host_memory_space> ().ptr_on_device ();
1001 return Teuchos::ArrayView<const GO> (lgMapHostRawPtr, lgMap_.dimension_0 (),
1002 Teuchos::RCP_DISABLE_NODE_LOOKUP);
1005 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1007 return distributed_;
1010 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1012 using Teuchos::TypeNameTraits;
1013 std::ostringstream os;
1015 os <<
"Tpetra::Map: {" 1016 <<
"LocalOrdinalType: " << TypeNameTraits<LocalOrdinal>::name ()
1017 <<
", GlobalOrdinalType: " << TypeNameTraits<GlobalOrdinal>::name ()
1018 <<
", NodeType: " << TypeNameTraits<Node>::name ();
1019 if (this->getObjectLabel () !=
"") {
1020 os <<
", Label: \"" << this->getObjectLabel () <<
"\"";
1023 <<
", Number of processes: " <<
getComm ()->getSize ()
1024 <<
", Uniform: " << (
isUniform () ?
"true" :
"false")
1025 <<
", Contiguous: " << (
isContiguous () ?
"true" :
"false")
1026 <<
", Distributed: " << (
isDistributed () ?
"true" :
"false")
1031 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1035 const Teuchos::EVerbosityLevel verbLevel)
const 1039 using Teuchos::ArrayView;
1041 using Teuchos::OSTab;
1042 using Teuchos::toString;
1043 using Teuchos::TypeNameTraits;
1044 using Teuchos::VERB_DEFAULT;
1045 using Teuchos::VERB_NONE;
1046 using Teuchos::VERB_LOW;
1047 using Teuchos::VERB_MEDIUM;
1048 using Teuchos::VERB_HIGH;
1049 using Teuchos::VERB_EXTREME;
1050 typedef typename ArrayView<const GlobalOrdinal>::size_type size_type;
1054 const int myRank = comm_->getRank ();
1055 const int numProcs = comm_->getSize ();
1057 const Teuchos::EVerbosityLevel vl = (verbLevel == VERB_DEFAULT) ? VERB_LOW : verbLevel;
1063 width = std::max<size_t> (width, as<size_t> (12)) + 2;
1068 if (vl == VERB_NONE) {
1071 else if (vl == VERB_LOW) {
1073 out <<
"Tpetra::Map:" << endl;
1075 out <<
"LocalOrdinalType: " << TypeNameTraits<LocalOrdinal>::name () << endl
1076 <<
"GlobalOrdinalType: " << TypeNameTraits<GlobalOrdinal>::name () << endl
1077 <<
"NodeType: " << TypeNameTraits<Node>::name () << endl;
1078 if (this->getObjectLabel () !=
"") {
1079 out <<
"Label: \"" << this->getObjectLabel () <<
"\"" << endl;
1085 <<
"Number of processes: " <<
getComm ()->getSize () << endl
1086 <<
"Uniform: " << (
isUniform () ?
"true" :
"false") << endl
1087 <<
"Contiguous: " << (
isContiguous () ?
"true" :
"false") << endl
1088 <<
"Distributed: " << (
isDistributed () ?
"true" :
"false") << endl;
1092 if (vl >= VERB_HIGH) {
1093 for (
int p = 0; p < numProcs; ++p) {
1095 out <<
"Process " << myRank <<
":" << endl;
1097 out <<
"My number of entries: " << nME << endl
1100 if (vl == VERB_EXTREME) {
1101 out <<
"My global indices: [";
1102 for (size_type k = 0; k < myEntries.size (); ++k) {
1103 out << myEntries[k];
1104 if (k + 1 < myEntries.size ()) {
1120 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1121 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1125 using Teuchos::Comm;
1126 using Teuchos::null;
1128 using Teuchos::outArg;
1131 using Teuchos::REDUCE_MIN;
1132 using Teuchos::reduceAll;
1134 typedef LocalOrdinal LO;
1135 typedef GlobalOrdinal GO;
1145 const GST globalNumElts = OrdinalTraits<GST>::invalid ();
1147 RCP<Node> node = this->
getNode ();
1150 if (newComm.is_null ()) {
1165 GO newIndexBase = OrdinalTraits<GO>::invalid ();
1166 reduceAll<int, GO> (*newComm, REDUCE_MIN, myMinGid, outArg (newIndexBase));
1167 return rcp (
new map_type (globalNumElts, myElts, newIndexBase, newComm, node));
1171 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1172 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1176 using Teuchos::Comm;
1177 using Teuchos::null;
1178 using Teuchos::outArg;
1181 using Teuchos::REDUCE_MIN;
1182 using Teuchos::reduceAll;
1189 const int color = (numLocalElements_ == 0) ? 0 : 1;
1194 RCP<const Comm<int> > newComm = comm_->split (color, 0);
1200 if (newComm.is_null ()) {
1205 RCP<Map> map = rcp (
new Map ());
1207 map->comm_ = newComm;
1208 map->indexBase_ = indexBase_;
1209 map->numGlobalElements_ = numGlobalElements_;
1210 map->numLocalElements_ = numLocalElements_;
1211 map->minMyGID_ = minMyGID_;
1212 map->maxMyGID_ = maxMyGID_;
1213 map->minAllGID_ = minAllGID_;
1214 map->maxAllGID_ = maxAllGID_;
1215 map->firstContiguousGID_= firstContiguousGID_;
1216 map->lastContiguousGID_ = lastContiguousGID_;
1220 map->uniform_ = uniform_;
1221 map->contiguous_ = contiguous_;
1236 if (! distributed_ || newComm->getSize () == 1) {
1237 map->distributed_ =
false;
1239 const int iOwnAllGids = (numLocalElements_ == numGlobalElements_) ? 1 : 0;
1240 int allProcsOwnAllGids = 0;
1241 reduceAll<int, int> (*newComm, REDUCE_MIN, iOwnAllGids, outArg (allProcsOwnAllGids));
1242 map->distributed_ = (allProcsOwnAllGids == 1) ?
false :
true;
1245 map->lgMap_ = lgMap_;
1246 map->glMap_ = glMap_;
1264 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1268 TEUCHOS_TEST_FOR_EXCEPTION(
1269 directory_.is_null (), std::logic_error,
"Tpetra::Map::setupDirectory: " 1270 "The Directory is null. " 1271 "Please report this bug to the Tpetra developers.");
1275 if (! directory_->initialized ()) {
1276 directory_->initialize (*
this);
1280 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1284 const Teuchos::ArrayView<int>& PIDs,
1285 const Teuchos::ArrayView<LocalOrdinal>& LIDs)
const 1288 typedef Teuchos::ArrayView<int>::size_type size_type;
1297 if (GIDs.size () == 0) {
1300 for (size_type k = 0; k < PIDs.size (); ++k) {
1301 PIDs[k] = OrdinalTraits<int>::invalid ();
1303 for (size_type k = 0; k < LIDs.size (); ++k) {
1304 LIDs[k] = OrdinalTraits<LocalOrdinal>::invalid ();
1314 return directory_->getDirectoryEntries (*
this, GIDs, PIDs, LIDs);
1317 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1321 const Teuchos::ArrayView<int> & PIDs)
const 1324 if (GIDs.size () == 0) {
1328 for (Teuchos::ArrayView<int>::size_type k = 0; k < PIDs.size (); ++k) {
1339 return directory_->getDirectoryEntries (*
this, GIDs, PIDs);
1342 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1343 Teuchos::RCP<const Teuchos::Comm<int> >
1348 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1354 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1357 using Teuchos::outArg;
1358 using Teuchos::REDUCE_MIN;
1359 using Teuchos::reduceAll;
1361 bool global =
false;
1362 if (comm_->getSize () > 1) {
1366 if (numGlobalElements_ == as<global_size_t> (numLocalElements_)) {
1379 reduceAll<int, int> (*comm_, REDUCE_MIN, localRep, outArg (allLocalRep));
1380 if (allLocalRep != 1) {
1393 template <
class LocalOrdinal,
class GlobalOrdinal>
1394 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal> >
1396 typedef LocalOrdinal LO;
1397 typedef GlobalOrdinal GO;
1398 typedef typename ::Tpetra::Map<LO, GO>::node_type NT;
1399 return createLocalMapWithNode<LO, GO> (numElements, comm, KokkosClassic::Details::getNode<NT> ());
1402 template <
class LocalOrdinal,
class GlobalOrdinal>
1403 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal> >
1405 typedef LocalOrdinal LO;
1406 typedef GlobalOrdinal GO;
1407 typedef typename ::Tpetra::Map<LO, GO>::node_type NT;
1408 return createUniformContigMapWithNode<LO, GO> (numElements, comm, KokkosClassic::Details::getNode<NT> ());
1411 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1412 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1414 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1415 const Teuchos::RCP<Node>& node)
1419 const GlobalOrdinal indexBase =
static_cast<GlobalOrdinal
> (0);
1421 return rcp (
new map_type (numElements, indexBase, comm, GloballyDistributed, node));
1424 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1425 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1427 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1428 const Teuchos::RCP<Node>& node)
1433 const GlobalOrdinal indexBase =
static_cast<GlobalOrdinal
> (0);
1436 return rcp (
new map_type (globalNumElts, indexBase, comm, LocallyReplicated, node));
1439 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1440 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1442 size_t localNumElements,
1443 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1444 const Teuchos::RCP<Node>& node)
1448 const GlobalOrdinal indexBase =
static_cast<GlobalOrdinal
> (0);
1450 return rcp (
new map_type (numElements, localNumElements, indexBase, comm, node));
1453 template <
class LocalOrdinal,
class GlobalOrdinal>
1454 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal> >
1456 return Tpetra::createContigMapWithNode<LocalOrdinal,GlobalOrdinal>(numElements, localNumElements, comm, KokkosClassic::DefaultNode::getDefaultNode() );
1460 template <
class LocalOrdinal,
class GlobalOrdinal>
1461 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal> >
1463 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm)
1465 return Tpetra::createNonContigMapWithNode<LocalOrdinal,GlobalOrdinal>(elementList, comm, KokkosClassic::DefaultNode::getDefaultNode() );
1469 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1470 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1472 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
1473 const Teuchos::RCP<Node> &node)
1480 static_cast<GST> (0),
1485 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1486 Teuchos::RCP< const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1488 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
const Teuchos::RCP< Node > &node) {
1489 Teuchos::RCP< Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > map;
1490 int sumOfWeights, elemsLeft, localNumElements;
1491 const int numImages = comm->getSize(),
1492 myImageID = comm->getRank();
1493 Teuchos::reduceAll<int>(*comm,Teuchos::REDUCE_SUM,myWeight,Teuchos::outArg(sumOfWeights));
1494 const double myShare = ((double)myWeight) / ((double)sumOfWeights);
1495 localNumElements = (int)std::floor( myShare * ((
double)numElements) );
1497 Teuchos::reduceAll<int>(*comm,Teuchos::REDUCE_SUM,localNumElements,Teuchos::outArg(elemsLeft));
1498 elemsLeft = numElements - elemsLeft;
1501 TEUCHOS_TEST_FOR_EXCEPT(elemsLeft < -numImages || numImages < elemsLeft);
1502 if (elemsLeft < 0) {
1504 if (myImageID >= numImages-elemsLeft) --localNumElements;
1506 else if (elemsLeft > 0) {
1508 if (myImageID < elemsLeft) ++localNumElements;
1511 return createContigMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(numElements,localNumElements,comm,node);
1516 template<
class LO,
class GO,
class NT>
1517 Teuchos::RCP<const Tpetra::Map<LO, GO, NT> >
1520 using Teuchos::Array;
1521 using Teuchos::ArrayView;
1527 const int myRank = M->getComm ()->getRank ();
1533 if (! M->isDistributed ()) {
1540 const GST numGlobalEntries = M->getGlobalNumElements ();
1541 if (M->isContiguous ()) {
1542 const size_t numLocalEntries =
1543 (myRank == 0) ? as<size_t> (numGlobalEntries) :
static_cast<size_t> (0);
1544 return rcp (
new map_type (numGlobalEntries, numLocalEntries,
1545 M->getIndexBase (), M->getComm (),
1549 ArrayView<const GO> myGids =
1550 (myRank == 0) ? M->getNodeElementList () : Teuchos::null;
1551 return rcp (
new map_type (GINV, myGids (), M->getIndexBase (),
1552 M->getComm (), M->getNode ()));
1556 else if (M->isContiguous ()) {
1563 const size_t numMyElems = M->getNodeNumElements ();
1564 ArrayView<const GO> myElems = M->getNodeElementList ();
1565 Array<int> owner_procs_vec (numMyElems);
1569 Array<GO> myOwned_vec (numMyElems);
1570 size_t numMyOwnedElems = 0;
1571 for (
size_t i = 0; i < numMyElems; ++i) {
1572 const GO GID = myElems[i];
1573 const int owner = owner_procs_vec[i];
1575 if (myRank == owner) {
1576 myOwned_vec[numMyOwnedElems++] = GID;
1579 myOwned_vec.resize (numMyOwnedElems);
1581 return rcp (
new map_type (GINV, myOwned_vec (), M->getIndexBase (),
1582 M->getComm (), M->getNode ()));
1586 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1587 Teuchos::RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
1591 using Teuchos::Array;
1592 using Teuchos::ArrayView;
1594 typedef LocalOrdinal LO;
1595 typedef GlobalOrdinal GO;
1597 int myID = M->
getComm()->getRank();
1606 size_t numMyElems = M->getNodeNumElements ();
1607 ArrayView<const GO> myElems = M->getNodeElementList ();
1608 Array<int> owner_procs_vec (numMyElems);
1612 Array<GO> myOwned_vec (numMyElems);
1613 size_t numMyOwnedElems = 0;
1614 for (
size_t i = 0; i < numMyElems; ++i) {
1615 GO GID = myElems[i];
1616 int owner = owner_procs_vec[i];
1618 if (myID == owner) {
1619 myOwned_vec[numMyOwnedElems++] = GID;
1622 myOwned_vec.resize (numMyOwnedElems);
1628 return rcp (
new map_type (GINV, myOwned_vec (), M->getIndexBase (),
1629 M->getComm (), M->getNode ()));
1639 #define TPETRA_MAP_INSTANT(LO,GO,NODE) \ 1641 template class Map< LO , GO , NODE >; \ 1643 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1644 createLocalMapWithNode<LO,GO,NODE>(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< NODE > &node); \ 1646 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1647 createContigMapWithNode<LO,GO,NODE>(global_size_t numElements, size_t localNumElements, \ 1648 const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< NODE > &node); \ 1650 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1651 createNonContigMapWithNode(const Teuchos::ArrayView<const GO> &elementList, \ 1652 const RCP<const Teuchos::Comm<int> > &comm, \ 1653 const RCP<NODE> &node); \ 1654 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1655 createUniformContigMapWithNode<LO,GO,NODE>(global_size_t numElements, \ 1656 const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< NODE > &node); \ 1658 template Teuchos::RCP< const Map<LO,GO,NODE> > \ 1659 createWeightedContigMapWithNode<LO,GO,NODE>(int thisNodeWeight, global_size_t numElements, \ 1660 const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< NODE > &node); \ 1662 template Teuchos::RCP<const Map<LO,GO,NODE> > \ 1663 createOneToOne (const Teuchos::RCP<const Map<LO,GO,NODE> > &M); \ 1665 template Teuchos::RCP<const Map<LO,GO,NODE> > \ 1666 createOneToOne (const Teuchos::RCP<const Map<LO,GO,NODE> > &M, \ 1667 const Tpetra::Details::TieBreak<LO,GO> & tie_break); 1671 #define TPETRA_MAP_INSTANT_DEFAULTNODE(LO,GO) \ 1672 template Teuchos::RCP< const Map<LO,GO> > \ 1673 createLocalMap<LO,GO>( size_t, const Teuchos::RCP< const Teuchos::Comm< int > > &); \ 1675 template Teuchos::RCP< const Map<LO,GO> > \ 1676 createContigMap<LO,GO>( global_size_t, size_t, \ 1677 const Teuchos::RCP< const Teuchos::Comm< int > > &); \ 1679 template Teuchos::RCP< const Map<LO,GO> > \ 1680 createNonContigMap(const Teuchos::ArrayView<const GO> &, \ 1681 const RCP<const Teuchos::Comm<int> > &); \ 1683 template Teuchos::RCP< const Map<LO,GO> > \ 1684 createUniformContigMap<LO,GO>( global_size_t, \ 1685 const Teuchos::RCP< const Teuchos::Comm< int > > &); \ 1687 #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.
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.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on the calling process.
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.
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).