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> ();
258 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
260 class Map :
public Teuchos::Describable {
358 GlobalOrdinal indexBase,
359 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
361 const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
402 size_t numLocalElements,
403 GlobalOrdinal indexBase,
404 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
405 const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
448 const Kokkos::View<const GlobalOrdinal*, device_type>& indexList,
449 const GlobalOrdinal indexBase,
450 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
494 const GlobalOrdinal indexList[],
495 const LocalOrdinal indexListSize,
496 const GlobalOrdinal indexBase,
497 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
544 const Teuchos::ArrayView<const GlobalOrdinal>& indexList,
545 const GlobalOrdinal indexBase,
546 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
547 const Teuchos::RCP<Node>& node = defaultArgNode<Node>());
575 bool isOneToOne ()
const;
583 return numGlobalElements_;
592 return numLocalElements_;
610 return static_cast<LocalOrdinal
> (0);
624 if (this->getNodeNumElements () == 0) {
625 return Tpetra::Details::OrdinalTraits<LocalOrdinal>::invalid ();
627 return static_cast<LocalOrdinal
> (this->getNodeNumElements () - 1);
679 LocalOrdinal getLocalElement (GlobalOrdinal globalIndex)
const;
689 GlobalOrdinal getGlobalElement (LocalOrdinal localIndex)
const;
727 getRemoteIndexList (
const Teuchos::ArrayView<const GlobalOrdinal>& GIDList,
728 const Teuchos::ArrayView< int>& nodeIDList,
729 const Teuchos::ArrayView< LocalOrdinal>& LIDList)
const;
755 getRemoteIndexList (
const Teuchos::ArrayView<const GlobalOrdinal> & GIDList,
756 const Teuchos::ArrayView< int> & nodeIDList)
const;
770 typedef Kokkos::View<
const GlobalOrdinal*,
772 device_type> global_indices_array_type;
794 global_indices_array_type getMyGlobalIndices ()
const;
806 Teuchos::ArrayView<const GlobalOrdinal> getNodeElementList()
const;
818 bool isNodeLocalElement (LocalOrdinal localIndex)
const;
826 bool isNodeGlobalElement (GlobalOrdinal globalIndex)
const;
834 bool isUniform ()
const;
847 bool isContiguous ()
const;
869 bool isDistributed ()
const;
940 Teuchos::RCP<const Teuchos::Comm<int> > getComm ()
const;
943 Teuchos::RCP<Node> getNode ()
const;
950 std::string description ()
const;
974 describe (Teuchos::FancyOStream &out,
975 const Teuchos::EVerbosityLevel verbLevel =
976 Teuchos::Describable::verbLevel_default)
const;
982 template <
class NodeOut>
983 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
984 clone (
const Teuchos::RCP<NodeOut>& nodeOut)
const;
1033 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1034 removeEmptyProcesses ()
const;
1063 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1064 replaceCommWithSubset (
const Teuchos::RCP<
const Teuchos::Comm<int> >& newComm)
const;
1071 template <
class LO,
class GO,
class N>
friend class Map;
1074 template<
class OutMapType,
class InMapType>
1082 localDescribeToString (
const Teuchos::EVerbosityLevel vl)
const;
1091 void setupDirectory ()
const;
1107 bool checkIsDist()
const;
1117 initialNonuniformDebugCheck (
const global_size_t numGlobalElements,
1118 const size_t numLocalElements,
1119 const GlobalOrdinal indexBase,
1120 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm)
const;
1123 initWithNonownedHostIndexList (
const global_size_t numGlobalElements,
1124 const Kokkos::View<
const GlobalOrdinal*,
1127 Kokkos::MemoryUnmanaged>& entryList,
1128 const GlobalOrdinal indexBase,
1129 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1132 Teuchos::RCP<const Teuchos::Comm<int> > comm_;
1139 Teuchos::RCP<Node> node_;
1142 GlobalOrdinal indexBase_;
1149 size_t numLocalElements_;
1152 GlobalOrdinal minMyGID_;
1155 GlobalOrdinal maxMyGID_;
1159 GlobalOrdinal minAllGID_;
1163 GlobalOrdinal maxAllGID_;
1171 GlobalOrdinal firstContiguousGID_;
1186 GlobalOrdinal lastContiguousGID_;
1240 mutable Kokkos::View<
const GlobalOrdinal*,
1242 device_type> lgMap_;
1251 mutable typename decltype (lgMap_)::HostMirror lgMapHost_;
1269 global_to_local_table_type glMap_;
1307 mutable Teuchos::RCP<Directory<LocalOrdinal,GlobalOrdinal,Node> > directory_;
1324 template <
class LocalOrdinal,
class GlobalOrdinal>
1325 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1327 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1345 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1346 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1348 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1349 const Teuchos::RCP<Node>& node = Teuchos::null);
1358 template <
class LocalOrdinal,
class GlobalOrdinal>
1359 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1361 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1369 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1370 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1372 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1373 const Teuchos::RCP<Node>& node = Teuchos::null);
1383 template <
class LocalOrdinal,
class GlobalOrdinal>
1384 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1386 const size_t localNumElements,
1387 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1395 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1396 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1398 const size_t localNumElements,
1399 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
1400 const Teuchos::RCP<Node>& node =
1401 defaultArgNode<Node> ());
1411 template <
class LocalOrdinal,
class GlobalOrdinal>
1412 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1414 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1422 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1423 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1425 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
1426 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);
1447 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1448 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1458 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1459 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1465 #include "Tpetra_Directory_decl.hpp" 1470 template<
class OutMapType,
class InMapType>
1472 MapCloner<OutMapType, InMapType>::
1473 clone (
const InMapType& mapIn,
1474 const Teuchos::RCP<out_node_type>& nodeOut)
1476 static_assert (std::is_same<
typename OutMapType::local_ordinal_type,
1477 typename InMapType::local_ordinal_type>::value,
1478 "Tpetra::Map clone: The LocalOrdinal template parameter " 1479 "of the input and output Map types must be the same.");
1480 static_assert (std::is_same<
typename OutMapType::global_ordinal_type,
1481 typename InMapType::global_ordinal_type>::value,
1482 "Tpetra::Map clone: The GlobalOrdinal template parameter " 1483 "of the input and output Map types must be the same.");
1484 typedef typename OutMapType::local_ordinal_type LO;
1485 typedef typename OutMapType::global_ordinal_type GO;
1486 typedef ::Tpetra::Directory<LO, GO,
1487 typename OutMapType::node_type> out_dir_type;
1488 typedef typename OutMapType::global_to_local_table_type out_table_type;
1489 typedef typename OutMapType::device_type out_device_type;
1499 mapOut.node_ = nodeOut.is_null () ? defaultArgNode<out_node_type> () : nodeOut;
1504 mapOut.comm_ = mapIn.comm_;
1505 mapOut.indexBase_ = mapIn.indexBase_;
1506 mapOut.numGlobalElements_ = mapIn.numGlobalElements_;
1507 mapOut.numLocalElements_ = mapIn.numLocalElements_;
1508 mapOut.minMyGID_ = mapIn.minMyGID_;
1509 mapOut.maxMyGID_ = mapIn.maxMyGID_;
1510 mapOut.minAllGID_ = mapIn.minAllGID_;
1511 mapOut.maxAllGID_ = mapIn.maxAllGID_;
1512 mapOut.firstContiguousGID_= mapIn.firstContiguousGID_;
1513 mapOut.lastContiguousGID_ = mapIn.lastContiguousGID_;
1514 mapOut.uniform_ = mapIn.uniform_;
1515 mapOut.contiguous_ = mapIn.contiguous_;
1516 mapOut.distributed_ = mapIn.distributed_;
1523 Kokkos::View<GO*, Kokkos::LayoutLeft, out_device_type>
1524 lgMapOut (
"lgMap", mapIn.lgMap_.dimension_0 ());
1526 mapOut.lgMap_ = lgMapOut;
1538 static_assert (std::is_same<
typename decltype (mapOut.lgMapHost_)::array_layout,
1539 typename decltype (mapIn.lgMapHost_)::array_layout>::value,
1540 "mapOut.lgMapHost_ and MapIn.lgMapHost_ do not have the same " 1541 "array_layout. Please report this bug to the Tpetra developers.");
1544 auto lgMapHostOut = Kokkos::create_mirror_view (lgMapOut);
1546 mapOut.lgMapHost_ = lgMapHostOut;
1552 mapOut.glMap_ = out_table_type (mapIn.glMap_);
1557 mapOut.directory_ = Teuchos::rcp (
new out_dir_type ());
1564 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1565 template <
class NodeOut>
1566 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
1568 clone (
const Teuchos::RCP<NodeOut>& nodeOut)
const 1574 return Teuchos::rcp (
new out_map_type (cloner_type::clone (*
this, nodeOut)));
1596 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1606 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1613 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1619 #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.
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().
A parallel distribution of indices 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.