42 #ifndef TPETRA_MAP_DECL_HPP 43 #define TPETRA_MAP_DECL_HPP 49 #include "Tpetra_ConfigDefs.hpp" 51 #include "Kokkos_DefaultNode.hpp" 52 #include "Kokkos_DualView.hpp" 53 #include "Teuchos_Describable.hpp" 57 #ifndef DOXYGEN_SHOULD_SKIP_THIS 59 template <
class LO,
class GO,
class N>
class Directory;
60 #endif // DOXYGEN_SHOULD_SKIP_THIS 64 #ifndef DOXYGEN_SHOULD_SKIP_THIS 66 template <
class LO,
class GO>
class TieBreak;
67 #endif // DOXYGEN_SHOULD_SKIP_THIS 71 template<
class OutMapType,
class InMapType>
73 typedef typename OutMapType::node_type out_node_type;
74 typedef typename InMapType::node_type in_node_type;
77 clone (
const InMapType& mapIn,
78 const Teuchos::RCP<out_node_type>& node2);
84 Teuchos::RCP<Node> defaultArgNode() {
90 return KokkosClassic::Details::getNode<Node> ();
243 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
245 class Map :
public Teuchos::Describable {
343 GlobalOrdinal indexBase,
344 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
346 const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
387 size_t numLocalElements,
388 GlobalOrdinal indexBase,
389 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
390 const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
433 const Kokkos::View<const GlobalOrdinal*, device_type>& indexList,
434 const GlobalOrdinal indexBase,
435 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
479 const GlobalOrdinal indexList[],
480 const LocalOrdinal indexListSize,
481 const GlobalOrdinal indexBase,
482 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
529 const Teuchos::ArrayView<const GlobalOrdinal>& indexList,
530 const GlobalOrdinal indexBase,
531 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
532 const Teuchos::RCP<Node>& node = defaultArgNode<Node>());
560 bool isOneToOne ()
const;
568 return numGlobalElements_;
577 return numLocalElements_;
595 return static_cast<LocalOrdinal
> (0);
609 if (this->getNodeNumElements () == 0) {
612 return static_cast<LocalOrdinal
> (this->getNodeNumElements () - 1);
664 LocalOrdinal getLocalElement (GlobalOrdinal globalIndex)
const;
674 GlobalOrdinal getGlobalElement (LocalOrdinal localIndex)
const;
712 getRemoteIndexList (
const Teuchos::ArrayView<const GlobalOrdinal>& GIDList,
713 const Teuchos::ArrayView< int>& nodeIDList,
714 const Teuchos::ArrayView< LocalOrdinal>& LIDList)
const;
740 getRemoteIndexList (
const Teuchos::ArrayView<const GlobalOrdinal> & GIDList,
741 const Teuchos::ArrayView< int> & nodeIDList)
const;
755 typedef Kokkos::View<
const GlobalOrdinal*,
757 device_type> global_indices_array_type;
779 global_indices_array_type getMyGlobalIndices ()
const;
791 Teuchos::ArrayView<const GlobalOrdinal> getNodeElementList()
const;
803 bool isNodeLocalElement (LocalOrdinal localIndex)
const;
811 bool isNodeGlobalElement (GlobalOrdinal globalIndex)
const;
819 bool isUniform ()
const;
832 bool isContiguous ()
const;
854 bool isDistributed ()
const;
925 Teuchos::RCP<const Teuchos::Comm<int> > getComm ()
const;
928 Teuchos::RCP<Node> getNode ()
const;
935 std::string description ()
const;
959 describe (Teuchos::FancyOStream &out,
960 const Teuchos::EVerbosityLevel verbLevel =
961 Teuchos::Describable::verbLevel_default)
const;
967 template <
class NodeOut>
968 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
969 clone (
const Teuchos::RCP<NodeOut>& nodeOut)
const;
1018 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1019 removeEmptyProcesses ()
const;
1048 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1049 replaceCommWithSubset (
const Teuchos::RCP<
const Teuchos::Comm<int> >& newComm)
const;
1056 template <
class LO,
class GO,
class N>
friend class Map;
1059 template<
class OutMapType,
class InMapType>
1067 localDescribeToString (
const Teuchos::EVerbosityLevel vl)
const;
1076 void setupDirectory ()
const;
1092 bool checkIsDist()
const;
1102 initialNonuniformDebugCheck (
const global_size_t numGlobalElements,
1103 const size_t numLocalElements,
1104 const GlobalOrdinal indexBase,
1105 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm)
const;
1108 initWithNonownedHostIndexList (
const global_size_t numGlobalElements,
1109 const Kokkos::View<
const GlobalOrdinal*,
1112 Kokkos::MemoryUnmanaged>& entryList,
1113 const GlobalOrdinal indexBase,
1114 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1117 Teuchos::RCP<const Teuchos::Comm<int> > comm_;
1124 Teuchos::RCP<Node> node_;
1127 GlobalOrdinal indexBase_;
1134 size_t numLocalElements_;
1137 GlobalOrdinal minMyGID_;
1140 GlobalOrdinal maxMyGID_;
1144 GlobalOrdinal minAllGID_;
1148 GlobalOrdinal maxAllGID_;
1156 GlobalOrdinal firstContiguousGID_;
1171 GlobalOrdinal lastContiguousGID_;
1225 mutable Kokkos::View<
const GlobalOrdinal*,
1227 device_type> lgMap_;
1236 mutable typename decltype (lgMap_)::HostMirror lgMapHost_;
1254 global_to_local_table_type glMap_;
1292 mutable Teuchos::RCP<Directory<LocalOrdinal,GlobalOrdinal,Node> > directory_;
1309 template <
class LocalOrdinal,
class GlobalOrdinal>
1310 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1312 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1330 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1331 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1333 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1334 const Teuchos::RCP<Node>& node = Teuchos::null);
1343 template <
class LocalOrdinal,
class GlobalOrdinal>
1344 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1346 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1354 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1355 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1357 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1358 const Teuchos::RCP<Node>& node = Teuchos::null);
1368 template <
class LocalOrdinal,
class GlobalOrdinal>
1369 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1371 const size_t localNumElements,
1372 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1380 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1381 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1383 const size_t localNumElements,
1384 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1385 const Teuchos::RCP<Node>& node =
1386 defaultArgNode<Node> ());
1396 template <
class LocalOrdinal,
class GlobalOrdinal>
1397 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1399 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1407 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1408 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1410 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
1411 const Teuchos::RCP<Node>& node = Teuchos::null);
1419 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1420 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1423 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
1424 const Teuchos::RCP<Node>& node = Teuchos::null);
1432 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1433 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1443 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1444 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1450 #include "Tpetra_Directory_decl.hpp" 1455 template<
class OutMapType,
class InMapType>
1457 MapCloner<OutMapType, InMapType>::
1458 clone (
const InMapType& mapIn,
1459 const Teuchos::RCP<out_node_type>& nodeOut)
1461 static_assert (std::is_same<
typename OutMapType::local_ordinal_type,
1462 typename InMapType::local_ordinal_type>::value,
1463 "Tpetra::Map clone: The LocalOrdinal template parameter " 1464 "of the input and output Map types must be the same.");
1465 static_assert (std::is_same<
typename OutMapType::global_ordinal_type,
1466 typename InMapType::global_ordinal_type>::value,
1467 "Tpetra::Map clone: The GlobalOrdinal template parameter " 1468 "of the input and output Map types must be the same.");
1469 typedef typename OutMapType::local_ordinal_type LO;
1470 typedef typename OutMapType::global_ordinal_type GO;
1471 typedef ::Tpetra::Directory<LO, GO,
1472 typename OutMapType::node_type> out_dir_type;
1473 typedef typename OutMapType::global_to_local_table_type out_table_type;
1474 typedef typename OutMapType::device_type out_device_type;
1481 mapOut.comm_ = mapIn.comm_;
1482 mapOut.indexBase_ = mapIn.indexBase_;
1483 mapOut.numGlobalElements_ = mapIn.numGlobalElements_;
1484 mapOut.numLocalElements_ = mapIn.numLocalElements_;
1485 mapOut.minMyGID_ = mapIn.minMyGID_;
1486 mapOut.maxMyGID_ = mapIn.maxMyGID_;
1487 mapOut.minAllGID_ = mapIn.minAllGID_;
1488 mapOut.maxAllGID_ = mapIn.maxAllGID_;
1489 mapOut.firstContiguousGID_= mapIn.firstContiguousGID_;
1490 mapOut.lastContiguousGID_ = mapIn.lastContiguousGID_;
1491 mapOut.uniform_ = mapIn.uniform_;
1492 mapOut.contiguous_ = mapIn.contiguous_;
1493 mapOut.distributed_ = mapIn.distributed_;
1500 Kokkos::View<GO*, Kokkos::LayoutLeft, out_device_type>
1501 lgMapOut (
"lgMap", mapIn.lgMap_.dimension_0 ());
1503 mapOut.lgMap_ = lgMapOut;
1515 static_assert (std::is_same<
typename decltype (mapOut.lgMapHost_)::array_layout,
1516 typename decltype (mapIn.lgMapHost_)::array_layout>::value,
1517 "mapOut.lgMapHost_ and MapIn.lgMapHost_ do not have the same " 1518 "array_layout. Please report this bug to the Tpetra developers.");
1521 auto lgMapHostOut = Kokkos::create_mirror_view (lgMapOut);
1523 mapOut.lgMapHost_ = lgMapHostOut;
1529 mapOut.glMap_ = out_table_type (mapIn.glMap_);
1531 mapOut.node_ = nodeOut;
1536 mapOut.directory_ = Teuchos::rcp (
new out_dir_type ());
1543 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1544 template <
class NodeOut>
1545 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
1547 clone (
const Teuchos::RCP<NodeOut>& nodeOut)
const 1553 return Teuchos::rcp (
new out_map_type (cloner_type::clone (*
this, nodeOut)));
1575 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1585 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1592 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1598 #endif // TPETRA_MAP_DECL_HPP 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...
Interface for breaking ties in ownership.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Node::memory_space memory_space
The Kokkos memory space.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
GlobalOrdinal global_ordinal_type
The type of global indices.
KokkosClassic::DefaultNode::DefaultNodeType node_type
Default value of Node template parameter.
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.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, NodeOut > > clone(const Teuchos::RCP< NodeOut > &nodeOut) const
Advanced methods.
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)
Non-member constructor for a contiguous Map with user-defined weights and a user-specified Kokkos Nod...
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
void deep_copy(MultiVector< DS, DL, DG, DN, dstClassic > &dst, const MultiVector< SS, SL, SG, SN, srcClassic > &src)
Copy the contents of the MultiVector src into dst.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
int local_ordinal_type
Default value of LocalOrdinal template parameter.
Details::LocalMap< LocalOrdinal, GlobalOrdinal, device_type > local_map_type
Type of the "local" Map.
"Local" part of Map suitable for Kokkos kernels.
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Implementation details of Tpetra.
size_t global_size_t
Global size_t object.
Traits class for "invalid" (flag) values of integer types that Tpetra uses as local ordinals or globa...
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.
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 is owned by only one process...
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=defaultArgNode< Node >())
Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map with a user-spec...
Node::execution_space execution_space
The Kokkos execution space.
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...
GlobalOrdinal getIndexBase() const
The index base for this Map.
Node::device_type device_type
The Kokkos device type over which to allocate Views and perform work.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Node node_type
The type of the Kokkos Node.
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 with the default...
bool isLocallyFitted(const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map1, const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map2)
Is map1 locally fitted to map2?
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.
Implementation detail of Map::clone().
Describes a parallel distribution of objects over processes.
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.
LocalOrdinal local_ordinal_type
The type of local indices.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createNonContigMap(const Teuchos::ArrayView< const GlobalOrdinal > &elementList, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member constructor for a non-contiguous Map with the default Kokkos Node.
LocalGlobal
Enum for local versus global allocation of Map entries.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
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)
Non-member constructor for a non-contiguous Map with a user-specified Kokkos Node.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.