40#ifndef TPETRA_MAP_DECL_HPP
41#define TPETRA_MAP_DECL_HPP
47#include "Tpetra_ConfigDefs.hpp"
52#include "KokkosCompat_DefaultNode.hpp"
53#include "Kokkos_DualView.hpp"
54#include "Teuchos_Array.hpp"
55#include "Teuchos_Comm.hpp"
56#include "Teuchos_Describable.hpp"
225 template <
class LocalOrdinal,
228 class Map :
public Teuchos::Describable {
256#ifdef KOKKOS_ENABLE_CUDA
257 using no_uvm_memory_space =
typename std::conditional<std::is_same<memory_space, Kokkos::CudaUVMSpace>::value,
337 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
377 const size_t numLocalElements,
379 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm);
423 const Kokkos::View<const global_ordinal_type*, device_type>& indexList,
425 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
472 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
516 const Teuchos::ArrayView<const global_ordinal_type>& indexList,
518 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
577 return numGlobalElements_;
586 return numLocalElements_;
619 return Tpetra::Details::OrdinalTraits<local_ordinal_type>::invalid ();
722 const Teuchos::ArrayView< int>& nodeIDList,
723 const Teuchos::ArrayView< local_ordinal_type>& LIDList)
const;
750 const Teuchos::ArrayView< int> & nodeIDList)
const;
766 Kokkos::HostSpace> global_indices_array_type;
951 Teuchos::RCP<const Teuchos::Comm<int> >
getComm ()
const;
983 describe (Teuchos::FancyOStream &out,
984 const Teuchos::EVerbosityLevel verbLevel =
985 Teuchos::Describable::verbLevel_default)
const;
1038 Teuchos::RCP<const Map<local_ordinal_type, global_ordinal_type, Node> >
1068 Teuchos::RCP<const Map<local_ordinal_type, global_ordinal_type, Node> >
1078 localDescribeToString (
const Teuchos::EVerbosityLevel vl)
const;
1087 void setupDirectory ()
const;
1103 bool checkIsDist()
const;
1113 initialNonuniformDebugCheck(
1114 const char errorMessagePrefix[],
1116 const size_t numLocalElements,
1118 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
const;
1121 initWithNonownedHostIndexList(
1122 const char errorMessagePrefix[],
1127 Kokkos::MemoryUnmanaged>& entryList,
1129 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm);
1132 Teuchos::RCP<const Teuchos::Comm<int> > comm_;
1142 size_t numLocalElements_;
1244 Kokkos::HostSpace> lgMapHost_;
1263 global_to_local_table_type glMap_;
1268 global_to_local_table_host_type;
1275 global_to_local_table_host_type glMapHost_;
1313 mutable Teuchos::RCP<
1333 template <
class LocalOrdinal,
class GlobalOrdinal>
1334 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal> >
1336 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1352 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1353 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1355 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1365 template <
class LocalOrdinal,
class GlobalOrdinal>
1366 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1368 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1376 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1377 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1379 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1388 template <
class LocalOrdinal,
class GlobalOrdinal>
1389 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1391 const size_t localNumElements,
1392 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1402 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1403 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1405 const size_t localNumElements,
1406 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1415 template <
class LocalOrdinal,
class GlobalOrdinal>
1416 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1418 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
1427 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1428 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1430 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm);
1444 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1445 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1453 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1454 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1456 const ::Tpetra::Details::TieBreak<LocalOrdinal,GlobalOrdinal> & tie_break);
1460#include "Tpetra_Directory_decl.hpp"
1464template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1471template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
Forward declaration of Tpetra::Directory.
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.
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.
Forward declaration of Tpetra::Map.
Forward declaration for Tpetra::TieBreak.
"Local" part of Map suitable for Kokkos kernels.
Implement mapping from global ID to process ID and local ID.
A parallel distribution of indices over processes.
Map & operator=(const Map< local_ordinal_type, global_ordinal_type, node_type > &)=default
Copy assigment (shallow copy).
Map(Map< local_ordinal_type, global_ordinal_type, node_type > &&)=default
Move constructor (shallow move).
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
bool isOneToOne() const
Whether the Map is one to one.
std::string description() const
Implementation of Teuchos::Describable.
Teuchos::ArrayView< const global_ordinal_type > getLocalElementList() const
Return a NONOWNING view of the global indices owned by this process.
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.
global_ordinal_type getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
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 > > 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_ordinal_type getGlobalElement(local_ordinal_type localIndex) const
The global index corresponding to the given local index.
Node node_type
Legacy typedef that will go away at some point.
Map()
Default constructor (that does nothing).
GlobalOrdinal global_ordinal_type
The type of global indices.
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.
bool isNodeLocalElement(local_ordinal_type localIndex) const
Whether the given local index is valid for this Map on the calling process.
bool isUniform() const
Whether the range of global indices is uniform.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
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.
typename device_type::execution_space execution_space
The Kokkos execution space.
LocalOrdinal local_ordinal_type
The type of local indices.
Teuchos::RCP< const Map< local_ordinal_type, global_ordinal_type, Node > > removeEmptyProcesses() const
Advanced methods.
global_ordinal_type getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
bool isCompatible(const Map< local_ordinal_type, global_ordinal_type, Node > &map) const
True if and only if map is compatible with this Map.
global_ordinal_type getIndexBase() const
The index base for this Map.
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...
bool locallySameAs(const Map< local_ordinal_type, global_ordinal_type, node_type > &map) const
Is this Map locally the same as the input Map?
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.
virtual ~Map()
Destructor (virtual for memory safety of derived classes).
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,...
global_ordinal_type getMinGlobalIndex() const
The minimum global index owned by the calling process.
local_ordinal_type getLocalElement(global_ordinal_type globalIndex) const
The local index corresponding to the given global index.
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.
::Tpetra::Details::LocalMap< local_ordinal_type, global_ordinal_type, device_type > local_map_type
Type of the "local" Map.
global_ordinal_type getMaxGlobalIndex() const
The maximum global index owned by the calling process.
Map(const Map< local_ordinal_type, global_ordinal_type, node_type > &)=default
Copy constructor (shallow copy).
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.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
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 ...
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.
bool isNodeGlobalElement(global_ordinal_type globalIndex) const
Whether the given global index is owned by this Map on the calling process.
bool isSameAs(const Map< local_ordinal_type, global_ordinal_type, Node > &map) const
True if and only if map is identical to this Map.
local_ordinal_type getMinLocalIndex() const
The minimum local index.
size_t getLocalNumElements() const
The number of elements belonging to the calling process.
local_map_type getLocalMap() const
Get the local Map for Kokkos kernels.
global_indices_array_type getMyGlobalIndices() const
Return a view of the global indices owned by this process.
typename device_type::memory_space memory_space
The Kokkos memory space.
local_ordinal_type getMaxLocalIndex() const
The maximum local index on the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createOneToOne(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &M, const ::Tpetra::Details::TieBreak< LocalOrdinal, GlobalOrdinal > &tie_break)
Creates a one-to-one version of the given Map where each GID lives on 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)
Nonmember constructor for a (potentially) nonuniformly distributed, contiguous Map for a user-specifi...
device_type no_uvm_device_type
The hash will be CudaSpace, not CudaUVMSpace.
typename Node::device_type device_type
This class' Kokkos::Device specialization.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
size_t global_size_t
Global size_t object.
LocalGlobal
Enum for local versus global allocation of Map entries.