40 #ifndef TPETRA_MAP_DECL_HPP
41 #define TPETRA_MAP_DECL_HPP
47 #include "Tpetra_ConfigDefs.hpp"
52 #include "Kokkos_DefaultNode.hpp"
53 #include "Kokkos_DualView.hpp"
54 #include "Teuchos_Array.hpp"
55 #include "Teuchos_Comm.hpp"
56 #include "Teuchos_Describable.hpp"
65 template<
class OutMapType,
class InMapType>
67 typedef typename OutMapType::node_type out_node_type;
68 typedef typename InMapType::node_type in_node_type;
71 clone (
const InMapType& mapIn,
72 const Teuchos::RCP<out_node_type>& node2);
241 template <
class LocalOrdinal,
244 class Map :
public Teuchos::Describable {
344 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
384 const size_t numLocalElements,
386 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm);
430 const Kokkos::View<const global_ordinal_type*, device_type>& indexList,
432 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
479 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
523 const Teuchos::ArrayView<const global_ordinal_type>& indexList,
525 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
584 return numGlobalElements_;
593 return numLocalElements_;
626 return Tpetra::Details::OrdinalTraits<local_ordinal_type>::invalid ();
729 const Teuchos::ArrayView< int>& nodeIDList,
730 const Teuchos::ArrayView< local_ordinal_type>& LIDList)
const;
757 const Teuchos::ArrayView< int> & nodeIDList)
const;
958 Teuchos::RCP<const Teuchos::Comm<int> >
getComm ()
const;
990 describe (Teuchos::FancyOStream &out,
991 const Teuchos::EVerbosityLevel verbLevel =
992 Teuchos::Describable::verbLevel_default)
const;
1045 Teuchos::RCP<const Map<local_ordinal_type, global_ordinal_type, Node> >
1075 Teuchos::RCP<const Map<local_ordinal_type, global_ordinal_type, Node> >
1083 template <
class LO,
class GO,
class N>
friend class Map;
1086 template<
class OutMapType,
class InMapType>
1094 localDescribeToString (
const Teuchos::EVerbosityLevel vl)
const;
1103 void setupDirectory ()
const;
1119 bool checkIsDist()
const;
1129 initialNonuniformDebugCheck(
1130 const char errorMessagePrefix[],
1132 const size_t numLocalElements,
1134 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
const;
1137 initWithNonownedHostIndexList(
1138 const char errorMessagePrefix[],
1143 Kokkos::MemoryUnmanaged>& entryList,
1145 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm);
1148 Teuchos::RCP<const Teuchos::Comm<int> > comm_;
1158 size_t numLocalElements_;
1263 Kokkos::HostSpace> lgMapHost_;
1267 typedef ::Tpetra::Details::FixedHashTable<global_ordinal_type, local_ordinal_type, device_type>
1268 global_to_local_table_type;
1282 global_to_local_table_type glMap_;
1320 mutable Teuchos::RCP<
1340 template <
class LocalOrdinal,
class GlobalOrdinal>
1341 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal> >
1343 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1359 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1360 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1362 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1372 template <
class LocalOrdinal,
class GlobalOrdinal>
1373 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1375 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1383 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1384 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1386 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1395 template <
class LocalOrdinal,
class GlobalOrdinal>
1396 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1398 const size_t localNumElements,
1399 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1409 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1410 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1412 const size_t localNumElements,
1413 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1422 template <
class LocalOrdinal,
class GlobalOrdinal>
1423 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1425 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1434 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1435 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1437 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm);
1451 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1452 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1453 createOneToOne (
const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& M);
1460 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1461 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1462 createOneToOne(
const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> > &M,
1463 const ::Tpetra::Details::TieBreak<LocalOrdinal,GlobalOrdinal> & tie_break);
1467 #include "Tpetra_Directory_decl.hpp"
1472 template<
class OutMapType,
class InMapType>
1473 OutMapType TPETRA_DEPRECATED
1474 MapCloner<OutMapType, InMapType>::
1475 clone (
const InMapType& mapIn,
1476 const Teuchos::RCP<out_node_type>& )
1478 static_assert (std::is_same<
typename OutMapType::local_ordinal_type,
1479 typename InMapType::local_ordinal_type>::value,
1480 "Tpetra::Map clone: The LocalOrdinal template parameter "
1481 "of the input and output Map types must be the same.");
1482 static_assert (std::is_same<
typename OutMapType::global_ordinal_type,
1483 typename InMapType::global_ordinal_type>::value,
1484 "Tpetra::Map clone: The GlobalOrdinal template parameter "
1485 "of the input and output Map types must be the same.");
1486 typedef typename OutMapType::local_ordinal_type LO;
1487 typedef typename OutMapType::global_ordinal_type GO;
1488 typedef ::Tpetra::Directory<LO, GO,
1489 typename OutMapType::node_type> out_dir_type;
1490 typedef typename OutMapType::global_to_local_table_type out_table_type;
1491 typedef typename OutMapType::device_type out_device_type;
1498 mapOut.comm_ = mapIn.comm_;
1499 mapOut.indexBase_ = mapIn.indexBase_;
1500 mapOut.numGlobalElements_ = mapIn.numGlobalElements_;
1501 mapOut.numLocalElements_ = mapIn.numLocalElements_;
1502 mapOut.minMyGID_ = mapIn.minMyGID_;
1503 mapOut.maxMyGID_ = mapIn.maxMyGID_;
1504 mapOut.minAllGID_ = mapIn.minAllGID_;
1505 mapOut.maxAllGID_ = mapIn.maxAllGID_;
1506 mapOut.firstContiguousGID_= mapIn.firstContiguousGID_;
1507 mapOut.lastContiguousGID_ = mapIn.lastContiguousGID_;
1508 mapOut.uniform_ = mapIn.uniform_;
1509 mapOut.contiguous_ = mapIn.contiguous_;
1510 mapOut.distributed_ = mapIn.distributed_;
1517 Kokkos::View<GO*, Kokkos::LayoutLeft, out_device_type>
1518 lgMapOut (
"lgMap", mapIn.lgMap_.extent (0));
1520 mapOut.lgMap_ = lgMapOut;
1534 Kokkos::create_mirror_view (Kokkos::HostSpace (), lgMapOut);
1536 mapOut.lgMapHost_ = lgMapHostOut;
1542 mapOut.glMap_ = out_table_type (mapIn.glMap_);
1547 mapOut.directory_ = Teuchos::rcp (
new out_dir_type ());
1558 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1565 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1571 #endif // TPETRA_MAP_DECL_HPP
global_ordinal_type getMaxGlobalIndex() const
The maximum global index owned by the calling process.
LO local_ordinal_type
The type of local indices.
virtual ~Map()
Destructor (virtual for memory safety of derived classes).
GO global_ordinal_type
The type of global indices.
bool isSameAs(const Map< local_ordinal_type, global_ordinal_type, Node > &map) const
True if and only if map is identical to this Map.
global_indices_array_type getMyGlobalIndices() const
Return a view of the global indices owned by this process.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
bool isLocallyFitted(const Map< local_ordinal_type, global_ordinal_type, Node > &map) const
True if and only if map is locally fitted to this Map.
bool isUniform() const
Whether the range of global indices is uniform.
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createContigMapWithNode(const global_size_t numElements, const size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a (potentially) nonuniformly distributed, contiguous Map for a user-specifi...
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
Teuchos::RCP< const Map< local_ordinal_type, global_ordinal_type, Node > > removeEmptyProcesses() const
Advanced methods.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
bool operator!=(const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map1, const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map2)
True if map1 is not the same as (in the sense of isSameAs()) map2, else false.
typename device_type::memory_space memory_space
The Kokkos memory space.
local_ordinal_type getMinLocalIndex() const
The minimum local index.
"Local" part of Map suitable for Kokkos kernels.
size_t global_size_t
Global size_t object.
void deep_copy(MultiVector< DS, DL, DG, DN > &dst, const MultiVector< SS, SL, SG, SN > &src)
Copy the contents of the MultiVector src into dst.
bool isCompatible(const Map< local_ordinal_type, global_ordinal_type, Node > &map) const
True if and only if map is compatible with this Map.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createOneToOne(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &M)
Nonmember constructor for a contiguous Map with user-defined weights and a user-specified, possibly nondefault Kokkos Node type.
global_ordinal_type getIndexBase() const
The index base for this Map.
global_ordinal_type getGlobalElement(local_ordinal_type localIndex) const
The global index corresponding to the given local index.
Forward declaration of Tpetra::Directory.
local_ordinal_type getMaxLocalIndex() const
The maximum local index on the calling process.
bool isNodeLocalElement(local_ordinal_type localIndex) const
Whether the given local index is valid for this Map on the calling process.
Teuchos::RCP< const Map< local_ordinal_type, global_ordinal_type, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map's communicator with a subset communicator.
bool isNodeGlobalElement(global_ordinal_type globalIndex) const
Whether the given global index is owned by this Map on the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createUniformContigMap(const 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...
bool operator==(const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map1, const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map2)
True if map1 is the same as (in the sense of isSameAs()) map2, else false.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createContigMap(const global_size_t numElements, const size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map using the defaul...
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createLocalMap(const size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a locally replicated Map with the default Kokkos Node.
local_map_type getLocalMap() const
Get the local Map for Kokkos kernels.
Teuchos::ArrayView< const global_ordinal_type > getNodeElementList() const
Return a NONOWNING view of the global indices owned by this process.
global_ordinal_type getMinGlobalIndex() const
The minimum global index owned by the calling process.
typename device_type::execution_space execution_space
The Kokkos execution space.
Implementation detail of Map::clone().
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMapWithNode(const global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member constructor for a uniformly distributed, contiguous Map with a user-specified Kokkos Node...
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
A parallel distribution of indices over processes.
global_ordinal_type getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
local_ordinal_type getLocalElement(global_ordinal_type globalIndex) const
The local index corresponding to the given global index.
Implement mapping from global ID to process ID and local ID.
bool isOneToOne() const
Whether the Map is one to one.
bool locallySameAs(const Map< local_ordinal_type, global_ordinal_type, node_type > &map) const
Is this Map locally the same as the input Map?
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(const size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a locally replicated Map with a specified Kokkos Node.
Map & operator=(const Map< local_ordinal_type, global_ordinal_type, node_type > &)=default
Copy assigment (shallow copy).
typename node_type::device_type device_type
This class' Kokkos::Device specialization.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createNonContigMap(const Teuchos::ArrayView< const GlobalOrdinal > &elementList, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a non-contiguous Map using the default Kokkos::Device type.
LocalGlobal
Enum for local versus global allocation of Map entries.
::Tpetra::Details::LocalMap< local_ordinal_type, global_ordinal_type, device_type > local_map_type
Type of the "local" Map.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const global_ordinal_type > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< local_ordinal_type > &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
Describe this object in a human-readable way to the given output stream.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createNonContigMapWithNode(const Teuchos::ArrayView< const GlobalOrdinal > &elementList, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a noncontiguous Map with a user-specified, possibly nondefault Kokkos Node ...
node_type node_type
Legacy typedef that will go away at some point.
global_ordinal_type getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
Forward declaration of Tpetra::Map.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Forward declaration for Tpetra::TieBreak.
std::string description() const
Implementation of Teuchos::Describable.
Map()
Default constructor (that does nothing).