42 #ifndef TPETRA_MAP_DECL_HPP 43 #define TPETRA_MAP_DECL_HPP 49 #include "Tpetra_ConfigDefs.hpp" 54 #include "Kokkos_DefaultNode.hpp" 55 #include "Kokkos_DualView.hpp" 56 #include "Teuchos_Array.hpp" 57 #include "Teuchos_Comm.hpp" 58 #include "Teuchos_Describable.hpp" 68 template<
class OutMapType,
class InMapType>
70 typedef typename OutMapType::node_type out_node_type;
71 typedef typename InMapType::node_type in_node_type;
74 clone (
const InMapType& mapIn,
75 const Teuchos::RCP<out_node_type>& node2);
245 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
247 class Map :
public Teuchos::Describable {
285 typedef ::Tpetra::Details::LocalMap<LocalOrdinal, GlobalOrdinal, device_type>
345 GlobalOrdinal indexBase,
346 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
348 const Teuchos::RCP<Node> &node = Teuchos::rcp (
new Node));
389 size_t numLocalElements,
390 GlobalOrdinal indexBase,
391 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
392 const Teuchos::RCP<Node> &node = Teuchos::rcp (
new Node));
435 const Kokkos::View<const GlobalOrdinal*, device_type>& indexList,
436 const GlobalOrdinal indexBase,
437 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
481 const GlobalOrdinal indexList[],
482 const LocalOrdinal indexListSize,
483 const GlobalOrdinal indexBase,
484 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
531 const Teuchos::ArrayView<const GlobalOrdinal>& indexList,
532 const GlobalOrdinal indexBase,
533 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
534 const Teuchos::RCP<Node>& node = Teuchos::rcp (
new Node));
570 return numGlobalElements_;
579 return numLocalElements_;
597 return static_cast<LocalOrdinal
> (0);
612 return Tpetra::Details::OrdinalTraits<LocalOrdinal>::invalid ();
715 const Teuchos::ArrayView< int>& nodeIDList,
716 const Teuchos::ArrayView< LocalOrdinal>& LIDList)
const;
743 const Teuchos::ArrayView< int> & nodeIDList)
const;
757 typedef Kokkos::View<
const GlobalOrdinal*,
944 Teuchos::RCP<const Teuchos::Comm<int> >
getComm ()
const;
947 Teuchos::RCP<Node>
getNode ()
const;
978 describe (Teuchos::FancyOStream &out,
979 const Teuchos::EVerbosityLevel verbLevel =
980 Teuchos::Describable::verbLevel_default)
const;
986 template <
class NodeOut>
987 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
988 clone (
const Teuchos::RCP<NodeOut>& nodeOut)
const;
1037 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1067 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1075 template <
class LO,
class GO,
class N>
friend class Map;
1078 template<
class OutMapType,
class InMapType>
1086 localDescribeToString (
const Teuchos::EVerbosityLevel vl)
const;
1095 void setupDirectory ()
const;
1111 bool checkIsDist()
const;
1121 initialNonuniformDebugCheck (
const global_size_t numGlobalElements,
1122 const size_t numLocalElements,
1123 const GlobalOrdinal indexBase,
1124 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm)
const;
1127 initWithNonownedHostIndexList (
const global_size_t numGlobalElements,
1128 const Kokkos::View<
const GlobalOrdinal*,
1131 Kokkos::MemoryUnmanaged>& entryList,
1132 const GlobalOrdinal indexBase,
1133 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1136 Teuchos::RCP<const Teuchos::Comm<int> > comm_;
1139 GlobalOrdinal indexBase_;
1146 size_t numLocalElements_;
1149 GlobalOrdinal minMyGID_;
1152 GlobalOrdinal maxMyGID_;
1156 GlobalOrdinal minAllGID_;
1160 GlobalOrdinal maxAllGID_;
1168 GlobalOrdinal firstContiguousGID_;
1183 GlobalOrdinal lastContiguousGID_;
1237 mutable Kokkos::View<
const GlobalOrdinal*,
1249 mutable typename decltype (lgMap_)::HostMirror lgMapHost_;
1253 typedef ::Tpetra::Details::FixedHashTable<GlobalOrdinal, LocalOrdinal, device_type>
1306 mutable Teuchos::RCP<Directory<LocalOrdinal,GlobalOrdinal,Node> > directory_;
1325 template <
class LocalOrdinal,
class GlobalOrdinal>
1326 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal> >
1328 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1346 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1347 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1349 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1350 const Teuchos::RCP<Node>& node = Teuchos::null);
1359 template <
class LocalOrdinal,
class GlobalOrdinal>
1360 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1362 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1370 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1371 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1373 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1374 const Teuchos::RCP<Node>& node = Teuchos::null);
1382 template <
class LocalOrdinal,
class GlobalOrdinal>
1383 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1385 const size_t localNumElements,
1386 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1396 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1397 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1399 const size_t localNumElements,
1400 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1401 const Teuchos::RCP<Node>& node = Teuchos::null);
1409 template <
class LocalOrdinal,
class GlobalOrdinal>
1410 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1412 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1421 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1422 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1424 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
1425 const Teuchos::RCP<Node>& node = Teuchos::null);
1434 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1435 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1438 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
1439 const Teuchos::RCP<Node>& node = Teuchos::null);
1445 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1446 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1454 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1455 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1457 const ::Tpetra::Details::TieBreak<LocalOrdinal,GlobalOrdinal> & tie_break);
1461 #include "Tpetra_Directory_decl.hpp" 1467 template<
class OutMapType,
class InMapType>
1469 MapCloner<OutMapType, InMapType>::
1470 clone (
const InMapType& mapIn,
1471 const Teuchos::RCP<out_node_type>& nodeOut)
1473 static_assert (std::is_same<
typename OutMapType::local_ordinal_type,
1474 typename InMapType::local_ordinal_type>::value,
1475 "Tpetra::Map clone: The LocalOrdinal template parameter " 1476 "of the input and output Map types must be the same.");
1477 static_assert (std::is_same<
typename OutMapType::global_ordinal_type,
1478 typename InMapType::global_ordinal_type>::value,
1479 "Tpetra::Map clone: The GlobalOrdinal template parameter " 1480 "of the input and output Map types must be the same.");
1481 typedef typename OutMapType::local_ordinal_type LO;
1482 typedef typename OutMapType::global_ordinal_type GO;
1484 typename OutMapType::node_type> out_dir_type;
1485 typedef typename OutMapType::global_to_local_table_type out_table_type;
1486 typedef typename OutMapType::device_type out_device_type;
1493 mapOut.comm_ = mapIn.comm_;
1494 mapOut.indexBase_ = mapIn.indexBase_;
1495 mapOut.numGlobalElements_ = mapIn.numGlobalElements_;
1496 mapOut.numLocalElements_ = mapIn.numLocalElements_;
1497 mapOut.minMyGID_ = mapIn.minMyGID_;
1498 mapOut.maxMyGID_ = mapIn.maxMyGID_;
1499 mapOut.minAllGID_ = mapIn.minAllGID_;
1500 mapOut.maxAllGID_ = mapIn.maxAllGID_;
1501 mapOut.firstContiguousGID_= mapIn.firstContiguousGID_;
1502 mapOut.lastContiguousGID_ = mapIn.lastContiguousGID_;
1503 mapOut.uniform_ = mapIn.uniform_;
1504 mapOut.contiguous_ = mapIn.contiguous_;
1505 mapOut.distributed_ = mapIn.distributed_;
1512 Kokkos::View<GO*, Kokkos::LayoutLeft, out_device_type>
1513 lgMapOut (
"lgMap", mapIn.lgMap_.extent (0));
1515 mapOut.lgMap_ = lgMapOut;
1527 static_assert (std::is_same<
typename decltype (mapOut.lgMapHost_)::array_layout,
1528 typename decltype (mapIn.lgMapHost_)::array_layout>::value,
1529 "mapOut.lgMapHost_ and MapIn.lgMapHost_ do not have the same " 1530 "array_layout. Please report this bug to the Tpetra developers.");
1533 auto lgMapHostOut = Kokkos::create_mirror_view (lgMapOut);
1535 mapOut.lgMapHost_ = lgMapHostOut;
1541 mapOut.glMap_ = out_table_type (mapIn.glMap_);
1546 mapOut.directory_ = Teuchos::rcp (
new out_dir_type ());
1553 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1554 template <
class NodeOut>
1555 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
1557 clone (
const Teuchos::RCP<NodeOut>& nodeOut)
const 1563 return Teuchos::rcp (
new out_map_type (cloner_type::clone (*
this, nodeOut)));
1571 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1578 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1584 #endif // TPETRA_MAP_DECL_HPP global_size_t getGlobalNumElements() const
The number of elements in this Map.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Node::execution_space execution_space
The Kokkos execution space.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMapWithNode(const global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::null)
Non-member constructor for a uniformly distributed, contiguous Map with a user-specified Kokkos Node...
LocalOrdinal getMinLocalIndex() const
The minimum local index.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
GlobalOrdinal global_ordinal_type
The type of global indices.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
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 lives on only one process.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
::Tpetra::Details::LocalMap< LocalOrdinal, GlobalOrdinal, device_type > local_map_type
Type of the "local" Map.
Classes::Directory< LocalOrdinal, GlobalOrdinal, Node > Directory
Alias for Tpetra::Classes::Directory.
local_map_type getLocalMap() const
Get the local Map for Kokkos kernels.
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...
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, NodeOut > > clone(const Teuchos::RCP< NodeOut > &nodeOut) const
Advanced methods.
Node node_type
The type of the Kokkos Node.
int local_ordinal_type
Default value of Scalar template parameter.
GlobalOrdinal getIndexBase() const
The index base for 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.
bool isLocallyFitted(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is locally fitted to this Map.
Implementation details of Tpetra.
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.
Teuchos::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 isContiguous() const
True if this Map is distributed contiguously, else false.
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.
Node::memory_space memory_space
The Kokkos memory space.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Forward declaration of Tpetra::Directory.
bool locallySameAs(const Map< LocalOrdinal, GlobalOrdinal, node_type > &map) const
Is this Map locally the same as the input Map?
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a NONOWNING view of the global indices owned by this process.
Node::device_type device_type
The Kokkos device type over which to allocate Views and perform work.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
::Kokkos::Compat::KokkosDeviceWrapperNode< execution_space > node_type
Default value of Node template parameter.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
std::string description() const
Implementation of Teuchos::Describable.
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.
LocalOrdinal local_ordinal_type
The type of local indices.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on the calling process.
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.
Map()
Default constructor (that does nothing).
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.
A parallel distribution of indices over processes.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(const size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::null)
Nonmember constructor for a locally replicated Map with a specified Kokkos Node.
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, const Teuchos::RCP< Node > &node=Teuchos::null)
Nonmember constructor for a (potentially) nonuniformly distributed, contiguous Map for a user-specifi...
LocalGlobal
Enum for local versus global allocation of Map entries.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createWeightedContigMapWithNode(const int thisNodeWeight, const global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::null)
Nonmember constructor for a contiguous Map with user-defined weights and a user-specified, possibly nondefault Kokkos Node type.
Implementation detail of Map::clone().
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is owned by this Map on the calling process.
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.
global_indices_array_type getMyGlobalIndices() const
Return a view of the global indices owned by this process.
Forward declaration of Tpetra::Map.
Forward declaration for Tpetra::TieBreak.
bool isUniform() const
Whether the range of global indices is uniform.
bool isOneToOne() const
Whether the Map is one to one.
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...
Teuchos::RCP< Node > getNode() const
Get this Map's Node object.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createNonContigMapWithNode(const Teuchos::ArrayView< const GlobalOrdinal > &elementList, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::null)
Nonmember constructor for a noncontiguous Map with a user-specified, possibly nondefault Kokkos Node ...