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
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
std::string description() const
Return a simple one-line description of this object.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
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.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
TpetraMap(const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
TpetraMap constructor to wrap a Tpetra::Map object.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
Return the process IDs for the given global IDs.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
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.
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.
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 isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
LocalOrdinal getMinLocalIndex() const
The minimum local 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.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
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.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
GlobalOrdinal getIndexBase() const
The index base for this Map.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
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
Return the process IDs for the given global IDs.
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.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
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 getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
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().
bool isContiguous() const
True if this Map is distributed contiguously, else false.
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.
size_t global_size_t
Global size_t object.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
GlobalOrdinal getIndexBase() const
The index base for this Map.
GlobalOrdinal getIndexBase() const
The index base for this Map.
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.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
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.
std::string description() const
Return a simple one-line description of this object.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this node.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
#define XPETRA_MONITOR(funcName)
size_t getNodeNumElements() const
The number of elements belonging to the calling node.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
TpetraMap(const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
TpetraMap constructor to wrap a Tpetra::Map 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.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
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().
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
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.
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.
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.
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.
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.
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.