46 #ifndef XPETRA_EPETRAMAP_HPP 47 #define XPETRA_EPETRAMAP_HPP 54 #include <Epetra_Map.h> 55 #include <Epetra_BlockMap.h> 66 template<
class GlobalOrdinal,
class Node>
68 template<
class GlobalOrdinal,
class Node>
72 template<
class GlobalOrdinal,
class Node>
76 template<
class GlobalOrdinal,
class Node>
78 :
public virtual Map<int, GlobalOrdinal, Node>
92 GlobalOrdinal indexBase,
93 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
95 const Teuchos::RCP< Node > &node = Teuchos::rcp (
new Node))
98 "Xpetra::EpetraMap only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
102 EpetraMapT(
global_size_t numGlobalElements,
size_t numLocalElements, GlobalOrdinal indexBase,
const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
const Teuchos::RCP< Node > &node=Teuchos::rcp(
new Node)) {
104 "Xpetra::EpetraMap only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
109 const Teuchos::ArrayView< const GlobalOrdinal > &elementList,
110 GlobalOrdinal indexBase,
111 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
112 const Teuchos::RCP< Node > &node = Teuchos::rcp(
new Node)) {
114 "Xpetra::EpetraMap only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
161 Teuchos::ArrayView< const GlobalOrdinal >
getNodeElementList()
const {
return ArrayView< const GlobalOrdinal >(); }
191 Teuchos::RCP< const Teuchos::Comm< int > >
getComm()
const {
return Teuchos::null; }
196 return Teuchos::rcp (
new Node);
208 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const { }
219 RCP<const Map<int,GlobalOrdinal,Node> >
replaceCommWithSubset(
const Teuchos::RCP<
const Teuchos::Comm< int > > &newComm)
const {
return Teuchos::null; }
236 "Xpetra::EpetraMap only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
247 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 248 #ifdef HAVE_XPETRA_TPETRA 251 local_map_type getLocalMap ()
const {
253 "Xpetra::EpetraMap only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
254 TEUCHOS_UNREACHABLE_RETURN(local_map_type());
258 #warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too." 267 RCP<const Epetra_BlockMap>
map_;
271 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 274 :
public virtual Map<int, int, EpetraNode>
291 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
293 const Teuchos::RCP< Node > &node = Teuchos::rcp(
new Node))
297 std::string errPrefix;
298 errPrefix = Teuchos::typeName(*
this) +
"::constructor(numGlobal,indexBase,comm,lOrG): ";
301 const int myImageID = comm->getRank();
306 Teuchos::broadcast<int,global_size_t>(*comm,0,&rootNGE);
307 Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB);
308 int localChecks[2], globalChecks[2];
311 if (numGlobalElements != rootNGE) {
312 localChecks[0] = myImageID;
315 else if (indexBase != rootIB) {
316 localChecks[0] = myImageID;
321 Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
322 if (globalChecks[0] != -1) {
323 if (globalChecks[1] == 1) {
324 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
325 errPrefix <<
"numGlobal must be the same on all nodes (examine node " << globalChecks[0] <<
").");
327 else if (globalChecks[1] == 2) {
328 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
329 errPrefix <<
"indexBase must be the same on all nodes (examine node " << globalChecks[0] <<
").");
333 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
334 errPrefix <<
"logic error. Please contact the Tpetra team.");
348 using Teuchos::outArg;
350 const size_t L0 = Teuchos::OrdinalTraits<size_t>::zero();
351 const size_t L1 = Teuchos::OrdinalTraits<size_t>::one();
352 const global_size_t GST0 = Teuchos::OrdinalTraits<global_size_t>::zero();
353 const global_size_t GST1 = Teuchos::OrdinalTraits<global_size_t>::one();
354 const global_size_t GSTI = Teuchos::OrdinalTraits<global_size_t>::invalid();
356 std::string errPrefix;
357 errPrefix = Teuchos::typeName(*
this) +
"::constructor(numGlobal,numLocal,indexBase,platform): ";
360 const int myImageID = comm->getRank();
365 int localChecks[2], globalChecks[2];
373 Teuchos::reduceAll<int,global_size_t>(*comm,Teuchos::REDUCE_SUM,
374 Teuchos::as<global_size_t>(numLocalElements),outArg(global_sum));
381 if (numLocalElements < L1 && numLocalElements != L0) {
383 localChecks[0] = myImageID;
386 else if (numGlobalElements < GST1 && numGlobalElements != GST0 && numGlobalElements != GSTI) {
388 localChecks[0] = myImageID;
391 else if (numGlobalElements != GSTI && numGlobalElements != global_sum) {
393 localChecks[0] = myImageID;
398 Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB);
399 if (indexBase != rootIB) {
400 localChecks[0] = myImageID;
405 Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
406 if (globalChecks[0] != -1) {
407 if (globalChecks[1] == 1) {
408 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
409 errPrefix <<
"numLocal is not valid on at least one node (possibly node " 410 << globalChecks[0] <<
").");
412 else if (globalChecks[1] == 2) {
413 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
414 errPrefix <<
"numGlobal is not valid on at least one node (possibly node " 415 << globalChecks[0] <<
").");
417 else if (globalChecks[1] == 3) {
418 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
419 errPrefix <<
"numGlobal doesn't match sum of numLocal (== " 420 << global_sum <<
") on at least one node (possibly node " 421 << globalChecks[0] <<
").");
423 else if (globalChecks[1] == 4) {
424 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
425 errPrefix <<
"indexBase is not the same on all nodes (examine node " 426 << globalChecks[0] <<
").");
430 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
431 errPrefix <<
"logic error. Please contact the Tpetra team.");
438 if (numGlobalElements == GSTI) {
439 numGlobalElements = global_sum;}
446 const Teuchos::ArrayView< const GlobalOrdinal > &elementList,
448 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
449 const Teuchos::RCP< Node > &node = Teuchos::rcp(
new Node))
451 if (numGlobalElements == Teuchos::OrdinalTraits<global_size_t>::invalid()) {
494 LookupStatus getRemoteIndexList(
const Teuchos::ArrayView< const GlobalOrdinal > &GIDList,
const Teuchos::ArrayView< int > &nodeIDList,
const Teuchos::ArrayView< LocalOrdinal > &LIDList)
const {
XPETRA_MONITOR(
"EpetraMapT::getRemoteIndexList");
return toXpetra(
map_->RemoteIDList(static_cast<int>(GIDList.size()), GIDList.getRawPtr(), nodeIDList.getRawPtr(), LIDList.getRawPtr())); }
497 LookupStatus getRemoteIndexList(
const Teuchos::ArrayView< const GlobalOrdinal > &GIDList,
const Teuchos::ArrayView< int > &nodeIDList)
const {
XPETRA_MONITOR(
"EpetraMapT::getRemoteIndexList");
return toXpetra(
map_->RemoteIDList(static_cast<int>(GIDList.size()), GIDList.getRawPtr(), nodeIDList.getRawPtr(), 0)); }
535 return Teuchos::rcp (
new Node);
548 std::ostringstream oss;
549 oss << Teuchos::Describable::description();
559 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {
562 const Teuchos::RCP<const Teuchos::Comm<int> > comm_ =
getComm();
567 using Teuchos::VERB_DEFAULT;
568 using Teuchos::VERB_NONE;
569 using Teuchos::VERB_LOW;
570 using Teuchos::VERB_MEDIUM;
571 using Teuchos::VERB_HIGH;
572 using Teuchos::VERB_EXTREME;
576 int myImageID = comm_->getRank();
577 int numImages = comm_->getSize();
579 Teuchos::EVerbosityLevel vl = verbLevel;
580 if (vl == VERB_DEFAULT) vl = VERB_LOW;
586 width = ::std::max<size_t>(width, (size_t) 12) + 2;
588 Teuchos::OSTab tab(out);
590 if (vl == VERB_NONE) {
593 else if (vl == VERB_LOW) {
597 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
598 if (myImageID == imageCtr) {
599 if (myImageID == 0) {
607 if (vl == VERB_HIGH || vl == VERB_EXTREME) {
608 out <<
"Number of Local Elements = " << nME << endl
613 if (vl == VERB_EXTREME) {
614 out << std::setw(width) <<
"Node ID" 615 << std::setw(width) <<
"Local Index" 616 << std::setw(width) <<
"Global Index" 618 for (
size_t i=0; i < nME; i++) {
619 out << std::setw(width) << myImageID
620 << std::setw(width) << i
621 << std::setw(width) << myEntries[i]
644 return Teuchos::null;
646 const RCP< const Map<int, GlobalOrdinal, Node> > NewMapX = toXpetra<GlobalOrdinal, Node>(*NewMap);
653 RCP<const Map<int,GlobalOrdinal,Node> >
replaceCommWithSubset(
const Teuchos::RCP<
const Teuchos::Comm< int > > &newComm)
const {
654 throw std::runtime_error(
"Xpetra::EpetraMapT::replaceCommWithSubset has not yet been implemented.");
655 TEUCHOS_UNREACHABLE_RETURN(Teuchos::null);
665 if (gid ==
map_->IndexBase64()-1)
return (-1);
678 TEUCHOS_TEST_FOR_EXCEPTION(!map->GlobalIndicesIsType<
GlobalOrdinal>(), std::runtime_error,
"Xpetra::EpetraMapT: GlobalOrdinal mismatch.");
691 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 692 #ifdef HAVE_XPETRA_TPETRA 695 local_map_type getLocalMap ()
const {
696 if (isInitializedLocalMap_)
699 typedef GlobalOrdinal
GO;
702 typedef typename Node::device_type DeviceType;
704 typedef Tpetra::Details::FixedHashTable<GO, LO, DeviceType> glMapType;
705 typedef ::Kokkos::View<GO*, ::Kokkos::LayoutLeft, DeviceType> lgMapType;
712 size_t numLocalElements =
map_->NumMyElements();
714 GO firstContiguousGID, lastContiguousGID;
717 if (numLocalElements) {
720 firstContiguousGID = myMinGID;
721 lastContiguousGID = myMaxGID+1;
727 lgMap = lgMapType(
"lgMap", numLocalElements);
729 firstContiguousGID = GIDs[0];
730 lastContiguousGID = firstContiguousGID+1;
733 lgMap(0) = firstContiguousGID;
734 for ( ; i < numLocalElements; ++i) {
735 const GO curGID = GIDs[i];
736 const LO curLid = Teuchos::as<LO> (i);
738 if (lastContiguousGID != curGID)
745 lgMap(curLid) = curGID;
750 ::Kokkos::View<GO*, ::Kokkos::LayoutLeft, DeviceType>
751 nonContigGIDs (
"nonContigGIDs", numLocalElements-i);
753 for (
size_t idx = 0; idx < numLocalElements - i; idx++)
754 nonContigGIDs(idx) = GIDs[i+idx];
756 glMap = glMapType (nonContigGIDs,
759 static_cast<LO> (i));
761 for ( ; i < numLocalElements; ++i) {
762 const GO curGID = GIDs[i];
763 const LO curLid = Teuchos::as<LO> (i);
765 lgMap(curLid) = curGID;
771 firstContiguousGID = indexBase+1;
772 lastContiguousGID = indexBase;
774 localMap_ = local_map_type(glMap, lgMap, indexBase, myMinGID, myMaxGID, firstContiguousGID, lastContiguousGID, numLocalElements, contiguous);
776 isInitializedLocalMap_ =
true;
782 mutable local_map_type localMap_;
783 mutable bool isInitializedLocalMap_ =
false;
786 #warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too." 793 RCP<const Epetra_BlockMap>
map_;
795 #endif // #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 798 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 801 :
public virtual Map<int, long long, EpetraNode>
818 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
820 const Teuchos::RCP< Node > &node = Teuchos::rcp(
new Node)) {
823 std::string errPrefix;
824 errPrefix = Teuchos::typeName(*
this) +
"::constructor(numGlobal,indexBase,comm,lOrG): ";
827 const int myImageID = comm->getRank();
832 Teuchos::broadcast<int,global_size_t>(*comm,0,&rootNGE);
833 Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB);
834 int localChecks[2], globalChecks[2];
837 if (numGlobalElements != rootNGE) {
838 localChecks[0] = myImageID;
841 else if (indexBase != rootIB) {
842 localChecks[0] = myImageID;
847 Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
848 if (globalChecks[0] != -1) {
849 if (globalChecks[1] == 1) {
850 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
851 errPrefix <<
"numGlobal must be the same on all nodes (examine node " << globalChecks[0] <<
").");
853 else if (globalChecks[1] == 2) {
854 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
855 errPrefix <<
"indexBase must be the same on all nodes (examine node " << globalChecks[0] <<
").");
859 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
860 errPrefix <<
"logic error. Please contact the Tpetra team.");
873 using Teuchos::outArg;
875 const size_t L0 = Teuchos::OrdinalTraits<size_t>::zero();
876 const size_t L1 = Teuchos::OrdinalTraits<size_t>::one();
877 const global_size_t GST0 = Teuchos::OrdinalTraits<global_size_t>::zero();
878 const global_size_t GST1 = Teuchos::OrdinalTraits<global_size_t>::one();
879 const global_size_t GSTI = Teuchos::OrdinalTraits<global_size_t>::invalid();
881 std::string errPrefix;
882 errPrefix = Teuchos::typeName(*
this) +
"::constructor(numGlobal,numLocal,indexBase,platform): ";
885 const int myImageID = comm->getRank();
890 int localChecks[2], globalChecks[2];
898 Teuchos::reduceAll<int,global_size_t>(*comm,Teuchos::REDUCE_SUM,
899 Teuchos::as<global_size_t>(numLocalElements),outArg(global_sum));
906 if (numLocalElements < L1 && numLocalElements != L0) {
908 localChecks[0] = myImageID;
911 else if (numGlobalElements < GST1 && numGlobalElements != GST0 && numGlobalElements != GSTI) {
913 localChecks[0] = myImageID;
916 else if (numGlobalElements != GSTI && numGlobalElements != global_sum) {
918 localChecks[0] = myImageID;
923 Teuchos::broadcast<int,GlobalOrdinal>(*comm,0,&rootIB);
924 if (indexBase != rootIB) {
925 localChecks[0] = myImageID;
930 Teuchos::reduceAll<int,int>(*comm,Teuchos::REDUCE_MAX,2,localChecks,globalChecks);
931 if (globalChecks[0] != -1) {
932 if (globalChecks[1] == 1) {
933 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
934 errPrefix <<
"numLocal is not valid on at least one node (possibly node " 935 << globalChecks[0] <<
").");
937 else if (globalChecks[1] == 2) {
938 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
939 errPrefix <<
"numGlobal is not valid on at least one node (possibly node " 940 << globalChecks[0] <<
").");
942 else if (globalChecks[1] == 3) {
943 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
944 errPrefix <<
"numGlobal doesn't match sum of numLocal (== " 945 << global_sum <<
") on at least one node (possibly node " 946 << globalChecks[0] <<
").");
948 else if (globalChecks[1] == 4) {
949 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
950 errPrefix <<
"indexBase is not the same on all nodes (examine node " 951 << globalChecks[0] <<
").");
955 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
956 errPrefix <<
"logic error. Please contact the Tpetra team.");
963 if (numGlobalElements == GSTI) {
964 numGlobalElements = global_sum;}
971 const Teuchos::ArrayView< const GlobalOrdinal > &elementList,
973 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
974 const Teuchos::RCP< Node > &node = Teuchos::rcp(
new Node)) {
975 if (numGlobalElements == Teuchos::OrdinalTraits<global_size_t>::invalid()) {
1018 LookupStatus getRemoteIndexList(
const Teuchos::ArrayView< const GlobalOrdinal > &GIDList,
const Teuchos::ArrayView< int > &nodeIDList,
const Teuchos::ArrayView< LocalOrdinal > &LIDList)
const {
XPETRA_MONITOR(
"EpetraMapT::getRemoteIndexList");
return toXpetra(
map_->RemoteIDList(GIDList.size(), GIDList.getRawPtr(), nodeIDList.getRawPtr(), LIDList.getRawPtr())); }
1021 LookupStatus getRemoteIndexList(
const Teuchos::ArrayView< const GlobalOrdinal > &GIDList,
const Teuchos::ArrayView< int > &nodeIDList)
const {
XPETRA_MONITOR(
"EpetraMapT::getRemoteIndexList");
return toXpetra(
map_->RemoteIDList(GIDList.size(), GIDList.getRawPtr(), nodeIDList.getRawPtr(), 0)); }
1059 return Teuchos::rcp (
new Node);
1072 std::ostringstream oss;
1073 oss << Teuchos::Describable::description();
1083 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {
1086 const Teuchos::RCP<const Teuchos::Comm<int> > comm_ =
getComm();
1091 using Teuchos::VERB_DEFAULT;
1092 using Teuchos::VERB_NONE;
1093 using Teuchos::VERB_LOW;
1094 using Teuchos::VERB_MEDIUM;
1095 using Teuchos::VERB_HIGH;
1096 using Teuchos::VERB_EXTREME;
1100 int myImageID = comm_->getRank();
1101 int numImages = comm_->getSize();
1103 Teuchos::EVerbosityLevel vl = verbLevel;
1104 if (vl == VERB_DEFAULT) vl = VERB_LOW;
1110 width = ::std::max<size_t>(width, (size_t) 12) + 2;
1112 Teuchos::OSTab tab(out);
1114 if (vl == VERB_NONE) {
1117 else if (vl == VERB_LOW) {
1121 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1122 if (myImageID == imageCtr) {
1123 if (myImageID == 0) {
1131 if (vl == VERB_HIGH || vl == VERB_EXTREME) {
1132 out <<
"Number of Local Elements = " << nME << endl
1137 if (vl == VERB_EXTREME) {
1138 out << std::setw(width) <<
"Node ID" 1139 << std::setw(width) <<
"Local Index" 1140 << std::setw(width) <<
"Global Index" 1142 for (
size_t i=0; i < nME; i++) {
1143 out << std::setw(width) << myImageID
1144 << std::setw(width) << i
1145 << std::setw(width) << myEntries[i]
1168 return Teuchos::null;
1170 const RCP< const Map<int, GlobalOrdinal, Node> > NewMapX = toXpetra<GlobalOrdinal, Node>(*NewMap);
1177 RCP<const Map<int,GlobalOrdinal,Node> >
replaceCommWithSubset(
const Teuchos::RCP<
const Teuchos::Comm< int > > &newComm)
const {
1178 throw std::runtime_error(
"Xpetra::EpetraMapT::replaceCommWithSubset has not yet been implemented.");
1189 if (gid ==
map_->IndexBase64()-1)
return (-1);
1202 TEUCHOS_TEST_FOR_EXCEPTION(!map->GlobalIndicesIsType<
GlobalOrdinal>(), std::runtime_error,
"Xpetra::EpetraMapT: GlobalOrdinal mismatch.");
1213 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1214 #ifdef HAVE_XPETRA_TPETRA 1217 local_map_type getLocalMap ()
const {
1218 if (isInitializedLocalMap_)
1221 typedef GlobalOrdinal
GO;
1224 typedef typename Node::device_type DeviceType;
1226 typedef Tpetra::Details::FixedHashTable<GO, LO, DeviceType> glMapType;
1227 typedef ::Kokkos::View<GO*, ::Kokkos::LayoutLeft, DeviceType> lgMapType;
1234 size_t numLocalElements =
map_->NumMyElements();
1236 GO firstContiguousGID, lastContiguousGID;
1239 if (numLocalElements) {
1242 firstContiguousGID = myMinGID;
1243 lastContiguousGID = myMaxGID+1;
1249 lgMap = lgMapType(
"lgMap", numLocalElements);
1251 firstContiguousGID = GIDs[0];
1252 lastContiguousGID = firstContiguousGID+1;
1255 lgMap(0) = firstContiguousGID;
1256 for ( ; i < numLocalElements; ++i) {
1257 const GO curGID = GIDs[i];
1258 const LO curLid = Teuchos::as<LO> (i);
1260 if (lastContiguousGID != curGID)
1267 lgMap(curLid) = curGID;
1268 ++lastContiguousGID;
1270 --lastContiguousGID;
1272 ::Kokkos::View<GO*, ::Kokkos::LayoutLeft, DeviceType>
1273 nonContigGIDs (
"nonContigGIDs", numLocalElements-i);
1275 for (
size_t idx = 0; idx < numLocalElements - i; idx++)
1276 nonContigGIDs(idx) = GIDs[i+idx];
1278 glMap = glMapType (nonContigGIDs,
1281 static_cast<LO> (i));
1283 for ( ; i < numLocalElements; ++i) {
1284 const GO curGID = GIDs[i];
1285 const LO curLid = Teuchos::as<LO> (i);
1287 lgMap(curLid) = curGID;
1293 firstContiguousGID = indexBase+1;
1294 lastContiguousGID = indexBase;
1296 localMap_ = local_map_type(glMap, lgMap, indexBase, myMinGID, myMaxGID, firstContiguousGID, lastContiguousGID, numLocalElements, contiguous);
1298 isInitializedLocalMap_ =
true;
1304 mutable local_map_type localMap_;
1305 mutable bool isInitializedLocalMap_ =
false;
1308 #warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too." 1319 #endif // #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 1323 #endif // XPETRA_EPETRAMAP_HPP GlobalOrdinal global_ordinal_type
virtual ~EpetraMapT()
Destructor.
Teuchos::RCP< Node > getNode() const
Get this Map's Node object.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
UnderlyingLib lib() const
Get the library used by this object (Epetra or Epetra?)
global_size_t getGlobalNumElements() const
The number of elements in this Map.
UnderlyingLib lib() const
Get the library used by this object (Epetra or Epetra?)
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.
const Epetra_BlockMap & getEpetra_BlockMap() const
Get the underlying Epetra map.
GlobalOrdinal global_ordinal_type
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 getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
LocalOrdinal local_ordinal_type
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
std::string description() const
Return a simple one-line description of this object.
RCP< const Map< int, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::rcp(new Node))
Constructor with a user-defined contiguous distribution.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on this process.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
EpetraMapT(const Teuchos::RCP< const Epetra_BlockMap > &map)
EpetraMapT constructor to wrap a Epetra_Map object.
EpetraMapT(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed, const Teuchos::RCP< Node > &node=Teuchos::rcp(new Node))
Constructor with Tpetra-defined contiguous uniform distribution.
EpetraMapT(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed, const Teuchos::RCP< Node > &node=Teuchos::rcp(new Node))
Constructor with Tpetra-defined contiguous uniform distribution.
RCP< const Map< int, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map's communicator with a subset communicator.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on this process.
Exception throws to report errors in the internal logical of the program.
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.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
RCP< const Map< int, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
const Epetra_Map & getEpetra_Map() const
EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::rcp(new Node))
Constructor with a user-defined contiguous distribution.
EpetraMapT(const Teuchos::RCP< const Epetra_BlockMap > &map)
EpetraMapT constructor to wrap a Epetra_Map object.
const Epetra_BlockMap & getEpetra_BlockMap() const
Get the underlying Epetra map.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
UnderlyingLib lib() const
Get the library used by this object (Epetra or Epetra?)
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
GlobalOrdinal getIndexBase() const
The index base for this Map.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
const Epetra_Map & getEpetra_Map() const
GlobalOrdinal getIndexBase() const
The index base for this Map.
EpetraMapT(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::rcp(new Node))
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on this process.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
Return the global index for a given local index. Note that this returns -1 if not found on this proce...
bool isContiguous() const
True if this Map is distributed contiguously, else false.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
RCP< const Map< int, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map's communicator with a subset communicator.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
RCP< const Map< int, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map's communicator with a subset communicator.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
GlobalOrdinal getIndexBase() const
The index base for this Map.
std::string description() const
Return a simple one-line description of this object.
EpetraMapT(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed, const Teuchos::RCP< Node > &node=Teuchos::rcp(new Node))
Constructor with Tpetra-defined contiguous uniform distribution.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
RCP< const Epetra_BlockMap > map_
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
#define IF_EPETRA_EXCEPTION_THEN_THROW_GLOBAL_INVALID_ARG(sourceCode)
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
virtual ~EpetraMapT()
Destructor.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
RCP< const Epetra_BlockMap > map_
size_t global_size_t
Global size_t object.
EpetraMapT(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::rcp(new Node))
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
Teuchos::RCP< Node > getNode() const
Get this Map's Node object.
RCP< const Epetra_BlockMap > map_
global_size_t getGlobalNumElements() const
The number of elements in this Map.
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.
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.
EpetraMapT(const Teuchos::RCP< const Epetra_BlockMap > &map)
EpetraMapT constructor to wrap a Epetra_Map object.
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process ranks for the given global indices.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
GlobalOrdinal global_ordinal_type
virtual ~EpetraMapT()
Destructor.
LocalOrdinal local_ordinal_type
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process ranks for the given global indices.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
RCP< const Map< int, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process ranks for the given global indices.
#define XPETRA_MONITOR(funcName)
Teuchos::RCP< Node > getNode() const
Get this Map's Node object.
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.
EpetraMapT(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::rcp(new Node))
Constructor with a user-defined contiguous distribution.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
Return the global index for a given local index. Note that this returns -1 if not found on this proce...
const Epetra_BlockMap & getEpetra_BlockMap() const
Get the underlying Epetra map.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
Return the global index for a given local index. Note that this returns -1 if not found on this proce...
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
const Epetra_Map & getEpetra_Map() const
EpetraMapT(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::rcp(new Node))
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
std::string description() const
Return a simple one-line description of this object.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.