|
Tpetra Matrix/Vector Services
Version of the Day
|
Implement mapping from global ID to process ID and local ID. More...
#include <Tpetra_Directory_decl.hpp>
Inherits Describable.
Public Types | |
| typedef Map< LocalOrdinal, GlobalOrdinal, Node > | map_type |
| Type of the Map specialization to give to the constructor. | |
Public Member Functions | |
Constructors/Destructor. | |
| Directory (const Teuchos::RCP< const map_type > &map) | |
| Constructor. | |
| ~Directory () | |
| Destructor. | |
Implementation of Teuchos::Describable. | |
| std::string | description () const |
| A one-line human-readable description of this object. | |
Query methods. | |
| LookupStatus | getDirectoryEntries (const Teuchos::ArrayView< const GlobalOrdinal > &globalIDs, const Teuchos::ArrayView< int > &nodeIDs) const |
| Given a global ID list, return the list of their owning process IDs. | |
| LookupStatus | getDirectoryEntries (const Teuchos::ArrayView< const GlobalOrdinal > &globalIDs, const Teuchos::ArrayView< int > &nodeIDs, const Teuchos::ArrayView< LocalOrdinal > &localIDs) const |
| Given a global ID list, return a list of their owning process IDs and their corresponding local IDs. | |
Implement mapping from global ID to process ID and local ID.
This class is an implementation detail of Map. It is mainly of interest to Tpetra developers and does not normally appear in users' code. If using this with a Map, the template parameters of Directory should always be the same as the template parameters of Map.
| LocalOrdinal | Same as Map's LocalOrdinal template parameter. The type of local IDs. |
| GlobalOrdinal | Same as Map's GlobalOrdinal template parameter. The type of global IDs. Defaults to the same type as LocalOrdinal. |
| Node | Same as Map's Node template parameter. Defaults to the default Kokkos Node type. |
Directory implements looking up the process IDs and local IDs corresponding to a given list of global IDs. Each Map owns a Directory object that does this. Map::getRemoteIndexList() calls the Map's directory's getDirectoryEntries() method directly. Directory has three different ways to perform this lookup, depending on the kind of Map.
1. If the user's Map is not distributed (i.e., is serial or locally replicated), then my process ID is the process ID for all global IDs. I can get the local ID (if requested) directly from the user's Map via its getLocalElement() method (which requires no communication).
2. If the user's Map is distributed but contiguous, then I build an array (replicated on all processes) that maps from each process ID to the minimum global ID that it owns. This trades time and communication for space (
entries in the array if there are P processes in the communicator), in that it allows lookups without communication (once the array has been built).
3. If the user's Map is distributed and noncontiguous, then I have to store a general mapping from global ID to (process ID, local ID). I can't afford to store the whole mapping redundantly on all processes, so I distribute it using another Map (the "directory Map"). This is a uniform contiguous Map whose keys are the global IDs. (Contiguity of the directory Map prevents infinite corecursion between Map's constructor and Directory's constructor.)
This class is templated on the same LocalOrdinal and GlobalOrdinal types on which Map is templated. Just as with Map, the LocalOrdinal type defaults to int if omitted. The GlobalOrdinal type defaults to the LocalOrdinal type, and the Node type defaults to Kokkos' default node type.
Epetra_Directory or Epetra_BasicDirectory. Epetra_BlockMap creates its Epetra_Directory object on demand whenever the map's RemoteIDList() method is called. Tpetra::Map's getRemoteIndexList() method assumes that the map's directory already exists. Epetra_Directory is an abstract interface with one implementation (Epetra_BasicDirectory); Tpetra::Directory is a concrete implementation.Definition at line 131 of file Tpetra_Directory_decl.hpp.
| typedef Map<LocalOrdinal, GlobalOrdinal, Node> Tpetra::Directory< LocalOrdinal, GlobalOrdinal, Node >::map_type |
Type of the Map specialization to give to the constructor.
Definition at line 134 of file Tpetra_Directory_decl.hpp.
| Tpetra::Directory< LocalOrdinal, GlobalOrdinal, Node >::Directory | ( | const Teuchos::RCP< const map_type > & | map | ) | [explicit] |
| Tpetra::Directory< LO, GO, NT >::~Directory | ( | ) |
Destructor.
Definition at line 89 of file Tpetra_Directory_def.hpp.
| std::string Tpetra::Directory< LO, GO, NT >::description | ( | ) | const |
A one-line human-readable description of this object.
Definition at line 114 of file Tpetra_Directory_def.hpp.
| LookupStatus Tpetra::Directory< LocalOrdinal, GlobalOrdinal, Node >::getDirectoryEntries | ( | const Teuchos::ArrayView< const GlobalOrdinal > & | globalIDs, |
| const Teuchos::ArrayView< int > & | nodeIDs | ||
| ) | const |
Given a global ID list, return the list of their owning process IDs.
Given a list globalIDs of global identifiers (GIDs), return the corresponding list nodeIDs of the process ranks which own those GIDs. Tpetra uses this to figure out the locations of nonlocal Map entries.
| globalIDs | [in] List of global IDs to look up. |
| nodeIDs | [out] On input, an array view with the same number of entries as globalIDs. On output, nodeIDs[i] is the ID of the process which owns globalIDs[i]. If globalIDs[i] is not present in the directory (i.e., is not owned by any process in the Directory's communicator), nodeIDs[i] is -1. |
nodeIDs.size() != globalIDs.size(), then this method throws a std::runtime_error exception. | LookupStatus Tpetra::Directory< LocalOrdinal, GlobalOrdinal, Node >::getDirectoryEntries | ( | const Teuchos::ArrayView< const GlobalOrdinal > & | globalIDs, |
| const Teuchos::ArrayView< int > & | nodeIDs, | ||
| const Teuchos::ArrayView< LocalOrdinal > & | localIDs | ||
| ) | const |
Given a global ID list, return a list of their owning process IDs and their corresponding local IDs.
Given a list globalIDs of global identifiers (GIDs), return the corresponding list nodeIDs of the process ranks which own those GIDs, as well as the list of the local identifiers (LIDs). Tpetra uses this to figure out the locations of nonlocal Map entries.
| globalIDs | [in] List of global IDs to look up. |
| nodeIDs | [out] On input, an array view with the same number of entries as globalIDs. On output, nodeIDs[i] is the ID of the process which owns globalIDs[i]. If globalIDs[i] is not present in the directory (i.e., is not owned by any process in the Directory's communicator), then nodeIDs[i] == -1. |
| localIDs | [out] On input, an array view with the same number of entries as globalIDs. On output, localIDs[i] is the local identifier corresponding to the global identifier globalIDs[i]. If globalIDs[i] is not present in the directory, then localIDs[i] == Teuchos::OrdinalTraits<LocalOrdinal>::invalid(). |
nodeIDs.size() != globalIDs.size() or localIDs.size() != globalIDs.size(), then this method throws a std::runtime_error exception.
1.7.6.1