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));
562 bool isOneToOne ()
const;
570 return numGlobalElements_;
579 return numLocalElements_;
597 return static_cast<LocalOrdinal
> (0);
611 if (this->getNodeNumElements () == 0) {
612 return Tpetra::Details::OrdinalTraits<LocalOrdinal>::invalid ();
614 return static_cast<LocalOrdinal
> (this->getNodeNumElements () - 1);
666 LocalOrdinal getLocalElement (GlobalOrdinal globalIndex)
const;
676 GlobalOrdinal getGlobalElement (LocalOrdinal localIndex)
const;
714 getRemoteIndexList (
const Teuchos::ArrayView<const GlobalOrdinal>& GIDList,
715 const Teuchos::ArrayView< int>& nodeIDList,
716 const Teuchos::ArrayView< LocalOrdinal>& LIDList)
const;
742 getRemoteIndexList (
const Teuchos::ArrayView<const GlobalOrdinal> & GIDList,
743 const Teuchos::ArrayView< int> & nodeIDList)
const;
757 typedef Kokkos::View<
const GlobalOrdinal*,
759 device_type> global_indices_array_type;
781 global_indices_array_type getMyGlobalIndices ()
const;
793 Teuchos::ArrayView<const GlobalOrdinal> getNodeElementList()
const;
805 bool isNodeLocalElement (LocalOrdinal localIndex)
const;
813 bool isNodeGlobalElement (GlobalOrdinal globalIndex)
const;
821 bool isUniform ()
const;
834 bool isContiguous ()
const;
856 bool isDistributed ()
const;
944 Teuchos::RCP<const Teuchos::Comm<int> > getComm ()
const;
947 Teuchos::RCP<Node> getNode ()
const;
954 std::string description ()
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> >
1038 removeEmptyProcesses ()
const;
1067 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1068 replaceCommWithSubset (
const Teuchos::RCP<
const Teuchos::Comm<int> >& newComm)
const;
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*,
1239 device_type> lgMap_;
1249 mutable typename decltype (lgMap_)::HostMirror lgMapHost_;
1253 typedef ::Tpetra::Details::FixedHashTable<GlobalOrdinal, LocalOrdinal, device_type>
1268 global_to_local_table_type glMap_;
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.
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...
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.
Classes::Map< LocalOrdinal, GlobalOrdinal, Node > Map
Alias for Tpetra::Classes::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.
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.
Node::device_type device_type
The Kokkos device type over which to allocate Views and perform work.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
"Local" part of Map suitable for Kokkos kernels.
::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.
LocalOrdinal local_ordinal_type
The type of local indices.
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 > > 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().
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.
Forward declaration of Tpetra::Map.
Forward declaration for Tpetra::TieBreak.
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< 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 ...