Tpetra Matrix/Vector Services Version of the Day
Protected Member Functions | Related Functions
Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > Class Template Reference

Describes a parallel distribution of objects over processes. More...

#include <Tpetra_Map_decl.hpp>

Inheritance diagram for Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >:
Inheritance graph
[legend]

List of all members.

Public Types

Typedefs
typedef LocalOrdinal local_ordinal_type
 The type of local indices.
typedef GlobalOrdinal global_ordinal_type
 The type of global indices.
typedef Node node_type
 The type of the Kokkos Node.

Public Member Functions

Constructors and destructor
 Map (global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=GloballyDistributed, const Teuchos::RCP< Node > &node=KokkosClassic::Details::getNode< Node >())
 Constructor with Tpetra-defined contiguous uniform distribution.
 Map (global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=KokkosClassic::Details::getNode< Node >())
 Constructor with a user-defined contiguous distribution.
 Map (global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=KokkosClassic::Details::getNode< Node >())
 Constructor with user-defined arbitrary (possibly noncontiguous) distribution.
 ~Map ()
 Destructor.
Attributes
global_size_t getGlobalNumElements () const
 The number of elements in this Map.
size_t getNodeNumElements () const
 The number of elements belonging to the calling process.
GlobalOrdinal getIndexBase () const
 The index base for this Map.
LocalOrdinal getMinLocalIndex () const
 The minimum local index.
LocalOrdinal getMaxLocalIndex () const
 The maximum local index on the calling process.
GlobalOrdinal getMinGlobalIndex () const
 The minimum global index owned by the calling process.
GlobalOrdinal getMaxGlobalIndex () const
 The maximum global index owned by the calling process.
GlobalOrdinal getMinAllGlobalIndex () const
 The minimum global index over all processes in the communicator.
GlobalOrdinal getMaxAllGlobalIndex () const
 The maximum global index over all processes in the communicator.
LocalOrdinal getLocalElement (GlobalOrdinal globalIndex) const
 The local index corresponding to the given global index.
GlobalOrdinal getGlobalElement (LocalOrdinal localIndex) const
 The global index corresponding to the given local index.
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.
LookupStatus getRemoteIndexList (const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const
 Return the process ranks for the given global indices.
Teuchos::ArrayView< const
GlobalOrdinal > 
getNodeElementList () const
 Return a view of the global indices owned by this process.
Boolean tests
bool isNodeLocalElement (LocalOrdinal localIndex) const
 Whether the given local index is valid for this Map on this process.
bool isNodeGlobalElement (GlobalOrdinal globalIndex) const
 Whether the given global index is valid for this Map on this process.
bool isUniform () const
 Whether the range of global indices is uniform.
bool isContiguous () const
 True if this Map is distributed contiguously, else false.
bool isDistributed () const
 Whether this Map is globally distributed or locally replicated.
bool isCompatible (const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
 True if and only if map is compatible with this Map.
bool isSameAs (const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
 True if and only if map is identical to this Map.
Teuchos::RCP< const
Teuchos::Comm< int > > 
getComm () const
 Accessors for the Teuchos::Comm and Kokkos Node objects.
Teuchos::RCP< Node > getNode () const
 Get this Map's Node object.
std::string description () const
 Implementation of Teuchos::Describable.
void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Print this object with the given verbosity level to the given Teuchos::FancyOStream.
template<class Node2 >
RCP< const Map< LocalOrdinal,
GlobalOrdinal, Node2 > > 
clone (const RCP< Node2 > &node2) const
 Advanced methods.
RCP< const Map< LocalOrdinal,
GlobalOrdinal, Node > > 
removeEmptyProcesses () const
 Return a new Map with processes with zero elements removed.
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.

Protected Member Functions

 Map ()
 Default constructor (that does nothing).

Related Functions

(Note that these are not member functions.)

template<class LocalOrdinal , class GlobalOrdinal >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal > > 
createLocalMap (size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
 Nonmember constructor for a locally replicated Map with the default Kokkos Node.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal,
Node > > 
createLocalMapWithNode (size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=KokkosClassic::Details::getNode< Node >())
 Nonmember constructor for a locally replicated Map with a specified Kokkos Node.
template<class LocalOrdinal , class GlobalOrdinal >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal > > 
createUniformContigMap (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.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal,
Node > > 
createUniformContigMapWithNode (global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=KokkosClassic::Details::getNode< Node >())
 Non-member constructor for a uniformly distributed, contiguous Map with a user-specified Kokkos Node.
template<class LocalOrdinal , class GlobalOrdinal >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal,
KokkosClassic::DefaultNode::DefaultNodeType > > 
createContigMap (global_size_t numElements, 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 Kokkos Node.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal,
Node > > 
createContigMapWithNode (global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node)
 Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map with a user-specified Kokkos Node.
template<class LocalOrdinal , class GlobalOrdinal >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal,
KokkosClassic::DefaultNode::DefaultNodeType > > 
createNonContigMap (const ArrayView< const GlobalOrdinal > &elementList, const RCP< const Teuchos::Comm< int > > &comm)
 Non-member constructor for a non-contiguous Map with the default Kokkos Node.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal,
Node > > 
createNonContigMapWithNode (const ArrayView< const GlobalOrdinal > &elementList, const RCP< const Teuchos::Comm< int > > &comm, const RCP< Node > &node)
 Non-member constructor for a non-contiguous Map with a user-specified Kokkos Node.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal,
Node > > 
createWeightedContigMapWithNode (int thisNodeWeight, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node)
 Non-member constructor for a contiguous Map with user-defined weights and a user-specified Kokkos Node.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map
< LocalOrdinal, GlobalOrdinal,
Node > > 
createOneToOne (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.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
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 is owned by only one process. The rule to break ties is specifed by the tie break object.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
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.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
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.

Detailed Description

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
class Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >

Describes a parallel distribution of objects over processes.

Template Parameters:
LocalOrdinalThe type of local indices. Should be an integer, and generally should be signed. A good model of LocalOrdinal is int. (In Epetra, this is always just int.)
GlobalOrdinalThe type of global indices. Should be an integer, and generally should be signed. Also, sizeof(GlobalOrdinal) should be greater than to equal to sizeof(LocalOrdinal). For example, if LocalOrdinal is int, good models of GlobalOrdinal are int, long, long long (if the configure-time option Teuchos_ENABLE_LONG_LONG_INT was set), or ptrdiff_t.
NodeA class implementing on-node shared-memory parallel operations. It must implement the Kokkos Node API. The default Node type should suffice for most users. The actual default type depends on your Trilinos build options.

This class describes a distribution of data elements over one or more processes in a communicator. Each element has a global index (of type GlobalOrdinal) uniquely associated to it. Each global index in the Map is "owned" by one or more processes in the Map's communicator. The user gets to decide what an "element" means; examples include a row or column of a sparse matrix (as in CrsMatrix), or a row of one or more vectors (as in MultiVector).

Prerequisites

Before reading the rest of this documentation, it helps to know something about the Teuchos memory management classes, in particular Teuchos::RCP, Teuchos::ArrayRCP, and Teuchos::ArrayView. You should also know a little bit about MPI (the Message Passing Interface for distributed-memory programming). You won't have to use MPI directly to use Map, but it helps to be familiar with the general idea of distributed storage of data over a communicator.

Map concepts

Local and global indices

The distinction between local and global indices and types might confuse new Tpetra users. Global indices represent the elements of a distributed object (such as rows or columns of a CrsMatrix, or rows of a MultiVector) uniquely over the entire object, which may be distributed over multiple processes. Local indices are local to the process that owns them. If global index G is owned by process P, then there is a unique local index L on process P corresponding to G. If the local index L is valid on process P, then there is a unique global index G owned by P corresponding to the pair (L, P). However, multiple processes might own the same global index (an "overlapping Map"), so a global index G might correspond to multiple (L, P) pairs. In summary, local indices on a process correspond to object elements (e.g., sparse matrix rows or columns) owned by that process.

Tpetra differs from Epetra in that local and global indices may have different types. In Epetra, local and global indices both have type int. In Tpetra, you get to pick the type of each. For example, you can use a 64-bit integer GlobalOrdinal type to solve problems with more than $2^{31}$ unknowns, but a 32-bit integer LocalOrdinal type to save bandwidth in sparse matrix-vector multiply.

Contiguous or noncontiguous

A contiguous Map divides an interval of global indices over the processes in its communicator, such that each process gets a contiguous interval of zero or more of those global indices, with the indices owned by a process p strictly greater than those owned by process q if $p > q$. Formally, we call a Map contiguous when all of the following hold:

  1. the set of global indices (over all processes) forms an interval,
  2. every global index in that interval is owned by exactly one process in the Map's communicator,
  3. the (ordered) list of global indices on each process p in the Map's communicator forms a contiguous interval, and
  4. if process p owns a global index $g_p$ and process q owns a global index $g_q$, and if $p > q$, then $g_p > g_q$.

Different processes may own different numbers of global indices. We call a Map uniform if it is contiguous, and if the user let the Map divide a global count of indices evenly over the Map's communicator's processes. The latter happens by calling the version of Map's constructor that takes a global count of indices, rather than a local count or an arbitrary list of indices.

Map optimizes for the contiguous case. For example, noncontiguous Maps always require communication in order to figure out which process owns a particular global index. (This communication happens in getRemoteIndexList().) Contiguous but nonuniform Maps may also require communication in this case, though we may only need to perform that communication once (at Map setup time). Contiguous Maps also can convert between global and local indices more efficiently.

Globally distributed or locally replicated

Globally distributed means that all of the following are true:

  1. The map's communicator has more than one process.
  2. There is at least one process in the map's communicator, whose local number of elements does not equal the number of global elements. (That is, not all the elements are replicated over all the processes.)

If at least one of the above are not true, then the map is locally replicated. (The two are mutually exclusive.)

Globally distributed objects are partitioned across multiple processes in a communicator. Each process owns at least one element in the object's Map that is not owned by another process. For locally replicated objects, each element in the object's Map is owned redundantly by all processes in the object's communicator. Some algorithms use objects that are too small to be distributed across all processes. The upper Hessenberg matrix in a GMRES iterative solve is a good example. In other cases, such as with block iterative methods, block dot product functions produce small dense matrices that are required by all images. Replicated local objects handle these situations.

Examples:

CrsMatrix_BlockExtraction.cpp, LocalMatOpExample.cpp, and Tpetra_Power_Method.cpp.

Definition at line 220 of file Tpetra_Map_decl.hpp.


Member Typedef Documentation

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
typedef LocalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::local_ordinal_type

The type of local indices.

Definition at line 226 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
typedef GlobalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::global_ordinal_type

The type of global indices.

Definition at line 228 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
typedef Node Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::node_type

The type of the Kokkos Node.

Definition at line 230 of file Tpetra_Map_decl.hpp.


Constructor & Destructor Documentation

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::Map ( global_size_t  numGlobalElements,
GlobalOrdinal  indexBase,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm,
LocalGlobal  lg = GloballyDistributed,
const Teuchos::RCP< Node > &  node = KokkosClassic::Details::getNode< Node >() 
)

Constructor with Tpetra-defined contiguous uniform distribution.

This constructor produces a Map with the following contiguous range of numGlobalElements elements: indexBase, indexBase + 1, ..., numGlobalElements + indexBase - 1. Depending on the lg argument, the elements will either be distributed evenly over all the processes in the given communicator comm, or replicated on all processes in the communicator.

Preconditions on numGlobalElements and indexBase will only be checked in a debug build (when Trilinos was configured with CMake option TEUCHOS_ENABLE_DEBUG:BOOL=ON). If checks are enabled and any check fails, the constructor will throw std::invalid_argument on all processes in the given communicator.

Parameters:
numGlobalElements[in] Number of elements in the Map (over all processes).
indexBase[in] The base of the global indices in the Map. This must be the same on every process in the communicator. The index base will also be the smallest global index in the Map. (If you don't know what this should be, use zero.)
lg[in] Either GloballyDistributed or LocallyReplicated. If GloballyDistributed and the communicator contains P processes, then each process will own either numGlobalElements/P or numGlobalElements/P + 1 nonoverlapping contiguous elements. If LocallyReplicated, then all processes will get the same set of elements, namely indexBase, indexBase + 1, ..., numGlobalElements + indexBase - 1.
comm[in] Communicator over which to distribute the elements.
node[in/out] Kokkos Node instance. The type of this object must match the type of the Node template parameter.
template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::Map ( global_size_t  numGlobalElements,
size_t  numLocalElements,
GlobalOrdinal  indexBase,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm,
const Teuchos::RCP< Node > &  node = KokkosClassic::Details::getNode< Node >() 
)

Constructor with a user-defined contiguous distribution.

If N is the sum of numLocalElements over all processes, then this constructor produces a nonoverlapping Map with N elements distributed over all the processes in the given communicator comm, with either numLocalElements or numLocalElements+1 contiguous elements on the calling process.

Preconditions on numGlobalElements, numLocalElements, and indexBase will only be checked in a debug build (when Trilinos was configured with CMake option TEUCHOS_ENABLE_DEBUG:BOOL=ON). If checks are enabled and any check fails, the constructor will throw std::invalid_argument on all processes in the given communicator.

Parameters:
numGlobalElements[in] If numGlobalElements == Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid(), then the number of global elements will be computed (via a global communication) as the sum of numLocalElements over all processes. Otherwise, it must equal the sum of numLocalElements over all processes.
numLocalElements[in] Number of elements that the calling process will own in the Map.
indexBase[in] The base of the global indices in the Map. This must be the same on every process in the given communicator. For this Map constructor, the index base will also be the smallest global index in the Map. If you don't know what this should be, use zero.
comm[in] Communicator over which to distribute the elements.
node[in/out] Kokkos Node instance. The type of this object must match the type of the Node template parameter.
template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::Map ( global_size_t  numGlobalElements,
const Teuchos::ArrayView< const GlobalOrdinal > &  elementList,
GlobalOrdinal  indexBase,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm,
const Teuchos::RCP< Node > &  node = KokkosClassic::Details::getNode< Node >() 
)

Constructor with user-defined arbitrary (possibly noncontiguous) distribution.

Call this constructor if you have an arbitrary list of global indices for each process in the given communicator. Those indices need not be contiguous, and the sets of global indices on different processes may overlap. This is the constructor to use to make a general overlapping distribution.

Parameters:
numGlobalElements[in] If numGlobalElements == Teuchos::OrdinalTraits<Tpetra::global_size_t>::invalid(), the number of global elements will be computed (via a global communication) as the sum of the counts of local elements. Otherwise, it must equal the sum of the local elements over all processes. This will only be checked if Trilinos' Teuchos package was built with debug support (CMake Boolean option Teuchos_ENABLE_DEBUG:BOOL=ON). If verification fails, the constructor will throw std::invalid_argument.
elementList[in] List of global indices owned by the calling process.
indexBase[in] The base of the global indices in the Map. This must be the same on every process in the given communicator. Currently, Map requires that this equal the global minimum index over all processes' elementList inputs.
comm[in] Communicator over which to distribute the elements.
node[in/out] Kokkos Node instance. The type of this object must match the type of the Node template parameter.
template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::~Map ( )

Destructor.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::Map ( ) [inline, protected]

Default constructor (that does nothing).

We use this in clone() and removeEmptyProcesses(), where we have the information to initialize the Map more efficiently ourselves, without going through one of the three usual Map construction paths.

Definition at line 729 of file Tpetra_Map_decl.hpp.


Member Function Documentation

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
global_size_t Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getGlobalNumElements ( ) const [inline]

The number of elements in this Map.

Definition at line 376 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
size_t Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getNodeNumElements ( ) const [inline]

The number of elements belonging to the calling process.

Definition at line 379 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
GlobalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getIndexBase ( ) const [inline]

The index base for this Map.

Definition at line 382 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
LocalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getMinLocalIndex ( ) const [inline]

The minimum local index.

Definition at line 385 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
LocalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getMaxLocalIndex ( ) const [inline]

The maximum local index on the calling process.

If this process owns no elements, that is, if getNodeNumElements() == 0, then this method returns Teuchos::OrdinalTraits<LocalOrdinal>::invalid().

Definition at line 394 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
GlobalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getMinGlobalIndex ( ) const [inline]

The minimum global index owned by the calling process.

Definition at line 404 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
GlobalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getMaxGlobalIndex ( ) const [inline]

The maximum global index owned by the calling process.

Definition at line 407 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
GlobalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getMinAllGlobalIndex ( ) const [inline]

The minimum global index over all processes in the communicator.

Definition at line 410 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
GlobalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getMaxAllGlobalIndex ( ) const [inline]

The maximum global index over all processes in the communicator.

Definition at line 413 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
LocalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getLocalElement ( GlobalOrdinal  globalIndex) const

The local index corresponding to the given global index.

If the given global index is not owned by this process, return Teuchos::OrdinalTraits<LocalOrdinal>::invalid().

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
GlobalOrdinal Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getGlobalElement ( LocalOrdinal  localIndex) const

The global index corresponding to the given local index.

If the given local index is not valid on the calling process, return Teuchos::OrdinalTraits<GlobalOrdinal>::invalid().

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
LookupStatus Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::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.

This operation must always be called as a collective over all processes in the Map's communicator. For a distributed noncontiguous Map, this operation requires communication.

Parameters:
GIDList[in] List of global indices for which to find process ranks and local indices. These global indices need not be owned by the calling process. Indeed, they need not be owned by any process.
nodeIDList[out] List of process rank corresponding to the given global indices. If a global index does not belong to any process, the resulting process rank is -1.
LIDList[out] List of local indices (that is, the local index on the process that owns them) corresponding to the given global indices. If a global index does not have a local index, the resulting local index is Teuchos::OrdinalTraits<LocalOrdinal>::invalid().
Precondition:
nodeIDList.size() == GIDList.size()
LIDList.size() == GIDList.size()
Returns:
IDNotPresent indicates that for at least one global index, we could not find the corresponding process rank. Otherwise, return AllIDsPresent.
Note:
This is crucial technology used in Export, Import, CrsGraph, and CrsMatrix.
template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
LookupStatus Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getRemoteIndexList ( const Teuchos::ArrayView< const GlobalOrdinal > &  GIDList,
const Teuchos::ArrayView< int > &  nodeIDList 
) const

Return the process ranks for the given global indices.

This method must always be called as a collective over all processes in the Map's communicator. For a distributed noncontiguous Map, this operation requires communication.

Parameters:
GIDList[in] List of global indices for which to find process ranks and local indices. These global indices need not be owned by the calling process. Indeed, they need not be owned by any process.
nodeIDList[out] List of process ranks corresponding to the given global indices. If a global index does not belong to any process, the resulting process rank is -1.
Precondition:
nodeIDList.size() == GIDList.size()
Returns:
IDNotPresent indicates that for at least one global index, we could not find the corresponding process rank. Otherwise, return AllIDsPresent.
Note:
For a distributed noncontiguous Map, this operation requires communication. This is crucial technology used in Export, Import, CrsGraph, and CrsMatrix.
template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
Teuchos::ArrayView<const GlobalOrdinal> Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getNodeElementList ( ) const

Return a view of the global indices owned by this process.

If you call this method on a contiguous Map, it will create and cache the list of global indices for later use. Beware of calling this if the calling process owns a very large number of global indices.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
bool Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::isNodeLocalElement ( LocalOrdinal  localIndex) const

Whether the given local index is valid for this Map on this process.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
bool Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::isNodeGlobalElement ( GlobalOrdinal  globalIndex) const

Whether the given global index is valid for this Map on this process.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
bool Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::isUniform ( ) const

Whether the range of global indices is uniform.

This is a conservative quantity. It need only be true if the Map was constructed using the first (uniform contiguous) constructor or a nonmember constructor that calls it. We reserve the right to do more work to check this in the future.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
bool Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::isContiguous ( ) const

True if this Map is distributed contiguously, else false.

Currently, creating this Map using the constructor for a user-defined arbitrary distribution (that takes a list of global elements owned on each process) means that this method always returns false. We currently make no effort to test whether the user-provided global indices are actually contiguous on all the processes. Many operations may be faster for contiguous Maps. Thus, if you know the indices are contiguous on all processes, you should consider using one of the constructors for contiguous elements.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
bool Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::isDistributed ( ) const

Whether this Map is globally distributed or locally replicated.

Returns:
True if this Map is globally distributed, else false.

"Globally distributed" means that all of the following are true:

  1. The map's communicator has more than one process.
  2. There is at least one process in the map's communicator, whose local number of elements does not equal the number of global elements. (That is, not all the elements are replicated over all the processes.)

If at least one of the above are not true, then the map is "locally replicated." (The two are mutually exclusive.)

Calling this method requires no communication or computation, because the result is precomputed in Map's constructors.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
bool Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::isCompatible ( const Map< LocalOrdinal, GlobalOrdinal, Node > &  map) const

True if and only if map is compatible with this Map.

Two Maps are "compatible" if all of the following are true:

  1. Their communicators have the same numbers of processes. (This is necessary even to call this method.)
  2. They have the same global number of elements.
  3. They have the same number of local elements on each process.

Determining #3 requires communication (a reduction over this Map's communicator). This method assumes that the input Map is valid on all processes in this Map's communicator.

Compatibility is useful for determining correctness of certain operations, like assigning one MultiVector X to another Y. If X and Y have the same number of columns, and if their Maps are compatible, then it is legal to assign X to Y or to assign Y to X.

The behavior of this method is undefined if the input Map's communicator and this Map's communicator have different numbers of processes. This method must be called collectively over this Map's communicator.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
bool Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::isSameAs ( const Map< LocalOrdinal, GlobalOrdinal, Node > &  map) const

True if and only if map is identical to this Map.

"Identical" is stronger than "compatible." Two Maps are identical if all of the following are true:

  1. Their communicators are congruent (have the same number of processes, in the same order: this corresponds to the MPI_IDENT or MPI_CONGRUENT return values of MPI_Comm_compare).
  2. They have the same min and max global indices.
  3. They have the same global number of elements.
  4. They are either both distributed, or both not distributed.
  5. Their index bases are the same.
  6. They have the same number of local elements on each process.
  7. They have the same global indices on each process.

"Identical" (isSameAs()) includes and is stronger than "compatible" (isCompatible()).

A Map corresponds to a block permutation over process ranks and global element indices. Two Maps with different numbers of processes in their communicators cannot be compatible, let alone identical. Two identical Maps correspond to the same permutation.

The behavior of this method is undefined if the input Map's communicator and this Map's communicator have different numbers of processes. This method must be called collectively over this Map's communicator.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
Teuchos::RCP<const Teuchos::Comm<int> > Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getComm ( ) const

Accessors for the Teuchos::Comm and Kokkos Node objects.

Get this Map's Comm object.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
Teuchos::RCP<Node> Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::getNode ( ) const

Get this Map's Node object.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
std::string Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::description ( ) const [virtual]

Implementation of Teuchos::Describable.

Return a simple one-line description of this object.

Reimplemented from Teuchos::Describable.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
void Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::describe ( Teuchos::FancyOStream out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const [virtual]

Print this object with the given verbosity level to the given Teuchos::FancyOStream.

Reimplemented from Teuchos::Describable.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
template<class Node2 >
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node2 > > Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::clone ( const RCP< Node2 > &  node2) const

Advanced methods.

Create a shallow copy of this Map, with a different Node type.

Definition at line 1028 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::removeEmptyProcesses ( ) const

Return a new Map with processes with zero elements removed.

Warning:
This method is only for expert users. Understanding how to use this method correctly requires some familiarity with semantics of MPI communicators.
We make no promises of backwards compatibility for this method. It may go away or change at any time.

This method first computes a new communicator, which contains only those processes in this Map's communicator (the "original communicator") that have a nonzero number of elements in this Map (the "original Map"). It then returns a new Map distributed over the new communicator. The new Map represents the same distribution as the original Map, except that processes containing zero elements are not included in the new Map or its communicator. On processes not included in the new Map or communicator, this method returns Teuchos::null.

The returned Map always has a distinct communicator from this Map's original communicator. The new communicator contains a subset of processes from the original communicator. Even if the number of processes in the new communicator equals the number of processes in the original communicator, the new communicator is distinct. (In an MPI implementation, the new communicator is created using MPI_Comm_split.) Furthermore, a process may have a different rank in the new communicator, so be wary of classes that like to store the rank rather than asking the communicator for it each time.

This method must be called collectively on the original communicator. It leaves the original Map and communicator unchanged.

This method was intended for applications such as algebraic multigrid or other multilevel preconditioners. Construction of each level of the multilevel preconditioner typically requires constructing sparse matrices, which in turn requires all-reduces over all participating processes at that level. Matrix sizes at successively coarser levels shrink geometrically. At the coarsest levels, some processes might be left with zero rows of the matrix, or the multigrid implementation might "rebalance" (redistribute the matrix) and intentionally leave some processes with zero rows. Removing processes with zero rows makes the all-reduces and other communication operations cheaper.

template<class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::replaceCommWithSubset ( const Teuchos::RCP< const Teuchos::Comm< int > > &  newComm) const

Replace this Map's communicator with a subset communicator.

Warning:
This method is only for expert users. Understanding how to use this method correctly requires some familiarity with semantics of MPI communicators.
We make no promises of backwards compatibility for this method. It may go away or change at any time.
Precondition:
The input communicator's processes are a subset of this Map's current communicator's processes.
On processes which are not included in the input communicator, the input communicator is null.

This method must be called collectively on the original communicator. It leaves the original Map and communicator unchanged.

Note:
This method differs from removeEmptyProcesses(), in that it does not assume that excluded processes have zero entries. For example, one might wish to remove empty processes from the row Map of a CrsGraph using removeEmptyProcesses(), and then apply the resulting subset communicator to the column, domain, and range Maps of the same graph. For the latter three Maps, one would in general use this method instead of removeEmptyProcesses(), giving the new row Map's communicator to this method.

Friends And Related Function Documentation

template<class LocalOrdinal , class GlobalOrdinal >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createLocalMap ( size_t  numElements,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm 
) [related]

Nonmember constructor for a locally replicated Map with the default Kokkos Node.

This method returns a Map instantiated on the default Kokkos Node type, KokkosClassic::DefaultNode::DefaultNodeType. The Map is configured to use zero-based indexing.

Parameters:
numElements[in] Number of elements on each process. Each process gets the same set of elements, namely 0, 1, ..., numElements - 1.
comm[in] The Map's communicator.
template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode ( size_t  numElements,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm,
const Teuchos::RCP< Node > &  node = KokkosClassic::Details::getNode< Node >() 
) [related]

Nonmember constructor for a locally replicated Map with a specified Kokkos Node.

This method returns a Map instantiated on the given Kokkos Node instance. The Map is configured to use zero-based indexing.

Parameters:
numElements[in] Number of elements on each process. Each process gets the same set of elements, namely 0, 1, ..., numElements - 1.
comm[in] The Map's communicator.
node[in] The Kokkos Node instance. If not provided, we will construct an instance of the correct type for you.
template<class LocalOrdinal , class GlobalOrdinal >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createUniformContigMap ( global_size_t  numElements,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm 
) [related]

Non-member constructor for a uniformly distributed, contiguous Map with the default Kokkos Node.

This method returns a Map instantiated on the Kokkos default node type, KokkosClassic::DefaultNode::DefaultNodeType.

The Map is configured to use zero-based indexing.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMapWithNode ( global_size_t  numElements,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm,
const Teuchos::RCP< Node > &  node = KokkosClassic::Details::getNode< Node >() 
) [related]

Non-member constructor for a uniformly distributed, contiguous Map with a user-specified Kokkos Node.

The Map is configured to use zero-based indexing.

template<class LocalOrdinal , class GlobalOrdinal >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, KokkosClassic::DefaultNode::DefaultNodeType > > createContigMap ( global_size_t  numElements,
size_t  localNumElements,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm 
) [related]

Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map with the default Kokkos Node.

This method returns a Map instantiated on the Kokkos default node type, KokkosClassic::DefaultNode::DefaultNodeType.

The Map is configured to use zero-based indexing.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createContigMapWithNode ( global_size_t  numElements,
size_t  localNumElements,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm,
const Teuchos::RCP< Node > &  node 
) [related]

Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map with a user-specified Kokkos Node.

The Map is configured to use zero-based indexing.

template<class LocalOrdinal , class GlobalOrdinal >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, KokkosClassic::DefaultNode::DefaultNodeType > > createNonContigMap ( const ArrayView< const GlobalOrdinal > &  elementList,
const RCP< const Teuchos::Comm< int > > &  comm 
) [related]

Non-member constructor for a non-contiguous Map with the default Kokkos Node.

This method returns a Map instantiated on the Kokkos default node type, KokkosClassic::DefaultNode::DefaultNodeType.

The Map is configured to use zero-based indexing.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createNonContigMapWithNode ( const ArrayView< const GlobalOrdinal > &  elementList,
const RCP< const Teuchos::Comm< int > > &  comm,
const RCP< Node > &  node 
) [related]

Non-member constructor for a non-contiguous Map with a user-specified Kokkos Node.

The Map is configured to use zero-based indexing.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createWeightedContigMapWithNode ( int  thisNodeWeight,
global_size_t  numElements,
const Teuchos::RCP< const Teuchos::Comm< int > > &  comm,
const Teuchos::RCP< Node > &  node 
) [related]

Non-member constructor for a contiguous Map with user-defined weights and a user-specified Kokkos Node.

The Map is configured to use zero-based indexing.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createOneToOne ( Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &  M) [related]

Creates a one-to-one version of the given Map where each GID is owned by only one process.

The user must guarantee there are no duplicate GID on the same processor. Unexepected behavior may result.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
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 
) [related]

Creates a one-to-one version of the given Map where each GID is owned by only one process. The rule to break ties is specifed by the tie break object.

The user must guarantee there are no duplicate GID on the same processor. Unexepected behavior may result.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
bool operator== ( const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &  map1,
const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &  map2 
) [related]

True if map1 is the same as (in the sense of isSameAs()) map2, else false.

Definition at line 1066 of file Tpetra_Map_decl.hpp.

template<class LocalOrdinal , class GlobalOrdinal , class Node >
bool operator!= ( const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &  map1,
const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &  map2 
) [related]

True if map1 is not the same as (in the sense of isSameAs()) map2, else false.

Definition at line 1073 of file Tpetra_Map_decl.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines