46 #ifndef XPETRA_TPETRAMAP_DEF_HPP 47 #define XPETRA_TPETRAMAP_DEF_HPP 62 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
65 GlobalOrdinal indexBase,
66 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
68 : map_ (Teuchos::rcp (new Tpetra::
Map< LocalOrdinal, GlobalOrdinal, Node > (numGlobalElements,
77 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
80 size_t numLocalElements,
81 GlobalOrdinal indexBase,
82 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm)
83 : map_ (Teuchos::rcp (new Tpetra::
Map< LocalOrdinal, GlobalOrdinal, Node > (numGlobalElements,
92 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
95 const Teuchos::ArrayView< const GlobalOrdinal > &elementList,
96 GlobalOrdinal indexBase,
97 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm)
98 : map_(Teuchos::rcp(new Tpetra::
Map< LocalOrdinal, GlobalOrdinal, Node >(numGlobalElements,
105 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 106 #ifdef HAVE_XPETRA_TPETRA 109 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
112 const Kokkos::View<const GlobalOrdinal*, typename Node::device_type>& indexList,
113 GlobalOrdinal indexBase,
114 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm)
115 : map_(Teuchos::rcp(new Tpetra::
Map< LocalOrdinal, GlobalOrdinal, Node >(numGlobalElements,
124 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
130 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
132 {
XPETRA_MONITOR(
"TpetraMap::getGlobalNumElements");
return map_->getGlobalNumElements(); }
134 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
136 {
XPETRA_MONITOR(
"TpetraMap::getNodeNumElements");
return map_->getNodeNumElements(); }
138 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
140 {
XPETRA_MONITOR(
"TpetraMap::getIndexBase");
return map_->getIndexBase(); }
142 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
144 {
XPETRA_MONITOR(
"TpetraMap::getMinLocalIndex");
return map_->getMinLocalIndex(); }
146 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
148 {
XPETRA_MONITOR(
"TpetraMap::getMaxLocalIndex");
return map_->getMaxLocalIndex(); }
150 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
152 {
XPETRA_MONITOR(
"TpetraMap::getMinGlobalIndex");
return map_->getMinGlobalIndex(); }
154 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
156 {
XPETRA_MONITOR(
"TpetraMap::getMaxGlobalIndex");
return map_->getMaxGlobalIndex(); }
158 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
160 {
XPETRA_MONITOR(
"TpetraMap::getMinAllGlobalIndex");
return map_->getMinAllGlobalIndex(); }
162 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
164 {
XPETRA_MONITOR(
"TpetraMap::getMaxAllGlobalIndex");
return map_->getMaxAllGlobalIndex(); }
166 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
168 {
XPETRA_MONITOR(
"TpetraMap::getLocalElement");
return map_->getLocalElement(globalIndex); }
170 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
172 {
XPETRA_MONITOR(
"TpetraMap::getGlobalElement");
return map_->getGlobalElement(localIndex); }
174 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
176 {
XPETRA_MONITOR(
"TpetraMap::getRemoteIndexList");
return toXpetra(map_->getRemoteIndexList(GIDList, nodeIDList, LIDList)); }
178 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
180 {
XPETRA_MONITOR(
"TpetraMap::getRemoteIndexList");
return toXpetra(map_->getRemoteIndexList(GIDList, nodeIDList)); }
182 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
184 {
XPETRA_MONITOR(
"TpetraMap::getNodeElementList");
return map_->getNodeElementList(); }
186 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
188 {
XPETRA_MONITOR(
"TpetraMap::isNodeLocalElement");
return map_->isNodeLocalElement(localIndex); }
190 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
192 {
XPETRA_MONITOR(
"TpetraMap::isNodeGlobalElement");
return map_->isNodeGlobalElement(globalIndex); }
194 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
196 {
XPETRA_MONITOR(
"TpetraMap::isContiguous");
return map_->isContiguous(); }
198 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
200 {
XPETRA_MONITOR(
"TpetraMap::isDistributed");
return map_->isDistributed(); }
202 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
206 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
210 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
214 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
216 {
XPETRA_MONITOR(
"TpetraMap::description");
return map_->description(); }
218 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
220 {
XPETRA_MONITOR(
"TpetraMap::describe"); map_->describe(out, verbLevel); }
222 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
225 return toXpetra(map_->removeEmptyProcesses());
228 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
231 return toXpetra(map_->replaceCommWithSubset(newComm));
234 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
238 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
241 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
246 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 247 #ifdef HAVE_XPETRA_TPETRA 249 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
252 return map_->getLocalMap();
258 #ifdef HAVE_XPETRA_EPETRA 260 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \ 261 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT)))) 266 :
public virtual Map<int,int,EpetraNode> {
282 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
292 size_t numLocalElements,
294 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm) {
303 const Teuchos::ArrayView< const GlobalOrdinal > &elementList,
305 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm) {
358 Teuchos::ArrayView< const GlobalOrdinal >
getNodeElementList()
const {
return Teuchos::ArrayView<const GlobalOrdinal>(); }
389 Teuchos::RCP< const Teuchos::Comm< int > >
getComm()
const {
return Teuchos::null; }
401 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const { }
404 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
replaceCommWithSubset (
const Teuchos::RCP<
const Teuchos::Comm<int> >& newComm)
const {
return Teuchos::null; }
412 TpetraMap(
const Teuchos::RCP<
const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map) {
420 RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > >
getTpetra_Map()
const {
return Teuchos::null; }
422 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 423 #ifdef HAVE_XPETRA_TPETRA 426 local_map_type getLocalMap ()
const {
427 return local_map_type();
437 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \ 438 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG)))) 442 :
public virtual Map<int,long long,EpetraNode> {
455 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
462 size_t numLocalElements,
464 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm) {
470 const Teuchos::ArrayView< const GlobalOrdinal > &elementList,
472 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm) {
524 Teuchos::ArrayView< const GlobalOrdinal >
getNodeElementList()
const {
return Teuchos::ArrayView<const GlobalOrdinal>(); }
555 Teuchos::RCP< const Teuchos::Comm< int > >
getComm()
const {
return Teuchos::null; }
567 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const { }
570 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
replaceCommWithSubset (
const Teuchos::RCP<
const Teuchos::Comm<int> >& newComm)
const {
return Teuchos::null; }
578 TpetraMap(
const Teuchos::RCP<
const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node > > &map) {
586 RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > >
getTpetra_Map()
const {
return Teuchos::null; }
588 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 589 #ifdef HAVE_XPETRA_TPETRA 592 local_map_type getLocalMap ()
const {
594 return local_map_type();
603 #endif // HAVE_XPETRA_EPETRA 609 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
616 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
622 #endif // XPETRA_TPETRAMAP_DEF_HPP bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
TpetraMap(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with a user-defined contiguous distribution.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
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 FancyOStream.
GlobalOrdinal getIndexBase() const
The index base for this Map.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
std::string description() const
Return a simple one-line description of this object.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
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.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process IDs for the given global IDs.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
TpetraMap(const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
TpetraMap constructor to wrap a Tpetra::Map object.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
Return the process IDs and corresponding local IDs for the given global IDs.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
std::string description() const
Return a simple one-line description of this object.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
Return the process IDs and corresponding local IDs for the given global IDs.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
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.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
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 FancyOStream.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
TpetraMap(global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with a user-defined contiguous distribution.
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
GlobalOrdinal getIndexBase() const
The index base for this Map.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
bool operator!=(const Xpetra::TpetraMap< LocalOrdinal, GlobalOrdinal, Node > &map1, const Xpetra::TpetraMap< LocalOrdinal, GlobalOrdinal, Node > &map2)
Returns true if map is not identical to this map. Implemented in TpetraMap::isSameAs().
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
GlobalOrdinal getIndexBase() const
The index base for this Map.
size_t global_size_t
Global size_t 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.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
Return the process IDs and corresponding local IDs for the given global IDs.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process IDs for the given global IDs.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
#define XPETRA_MONITOR(funcName)
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
TpetraMap(const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
TpetraMap constructor to wrap a Tpetra::Map object.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
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 FancyOStream.
std::string description() const
Return a simple one-line description of this object.
TpetraMap(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
Constructor with Tpetra-defined contiguous uniform distribution.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
bool operator==(const Xpetra::TpetraMap< LocalOrdinal, GlobalOrdinal, Node > &map1, const Xpetra::TpetraMap< LocalOrdinal, GlobalOrdinal, Node > &map2)
Returns true if map is identical to this map. Implemented in TpetraMap::isSameAs().
bool isContiguous() const
True if this Map is distributed contiguously, else false.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
TpetraMap(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
TpetraMap(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
Constructor with Tpetra-defined contiguous uniform distribution.
TpetraMap(global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
TpetraMap(global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed)
Constructor with Tpetra-defined contiguous uniform distribution.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.