42 #ifndef TPETRA_DIRECTORY_HPP 43 #define TPETRA_DIRECTORY_HPP 45 #include "Tpetra_Distributor.hpp" 46 #include "Tpetra_Map.hpp" 47 #include "Tpetra_DirectoryImpl.hpp" 48 #include "Tpetra_Directory_decl.hpp" 52 template<
class LO,
class GO,
class NT>
57 template<
class LO,
class GO,
class NT>
65 template<
class LO,
class GO,
class NT>
72 template<
class LO,
class GO,
class NT>
79 TEUCHOS_TEST_FOR_EXCEPTION(
80 impl_ == NULL, std::logic_error,
"Tpetra::Directory::initialize: " 81 "The Directory claims that it has been initialized, " 82 "but its implementation object has not yet been created. " 83 "Please report this bug to the Tpetra developers.");
86 TEUCHOS_TEST_FOR_EXCEPTION(
87 impl_ != NULL, std::logic_error,
"Tpetra::Directory::initialize: " 88 "Directory implementation has already been initialized, " 89 "but initialized() returns false. " 90 "Please report this bug to the Tpetra developers.");
115 bool usedTieBreak =
false;
134 const int myRank = map.
getComm ()->getRank ();
139 std::vector<std::pair<int, LO> > pidLidList (1);
142 for (LO locInd = minLocInd; locInd <= maxLocInd; ++locInd) {
143 pidLidList[0] = std::make_pair (myRank, locInd);
161 std::vector<std::pair<int, LO> > pidLidList (1);
164 const int myRank = map.
getComm ()->getRank ();
165 for (LO locInd = minLocInd; locInd <= maxLocInd; ++locInd) {
166 pidLidList[0] = std::make_pair (myRank, locInd);
178 template<
class LO,
class GO,
class NT>
183 TEUCHOS_TEST_FOR_EXCEPTION(
184 impl_ == NULL, std::logic_error,
"Tpetra::Directory::initialize: " 185 "The Directory claims that it has been initialized, " 186 "but its implementation object has not yet been created. " 187 "Please report this bug to the Tpetra developers.");
190 TEUCHOS_TEST_FOR_EXCEPTION(
191 impl_ != NULL, std::logic_error,
"Tpetra::Directory::initialize: " 192 "Directory implementation has already been initialized, " 193 "but initialized() returns false. " 194 "Please report this bug to the Tpetra developers.");
214 TEUCHOS_TEST_FOR_EXCEPTION(
215 dir == NULL, std::logic_error,
"Tpetra::Directory::initialize: " 216 "Failed to create Directory implementation. " 217 "Please report this bug to the Tpetra developers.");
222 template<
class LO,
class GO,
class NT>
226 const Teuchos::ArrayView<const GO>& globalIDs,
227 const Teuchos::ArrayView<int>& nodeIDs)
const 235 const bool computeLIDs =
false;
236 return impl_->
getEntries (map, globalIDs, nodeIDs, Teuchos::null, computeLIDs);
239 template<
class LO,
class GO,
class NT>
243 const Teuchos::ArrayView<const GO>& globalIDs,
244 const Teuchos::ArrayView<int>& nodeIDs,
245 const Teuchos::ArrayView<LO>& localIDs)
const 253 const bool computeLIDs =
true;
254 return impl_->
getEntries (map, globalIDs, nodeIDs, localIDs, computeLIDs);
257 template<
class LO,
class GO,
class NT>
268 template<
class LO,
class GO,
class NT>
272 using Teuchos::TypeNameTraits;
274 std::ostringstream os;
276 <<
"<" << TypeNameTraits<LO>::name ()
277 <<
", " << TypeNameTraits<GO>::name ()
278 <<
", " << TypeNameTraits<NT>::name () <<
">";
290 #define TPETRA_DIRECTORY_INSTANT(LO,GO,NODE) \ 292 template class Directory< LO , GO , NODE >; \ 294 #endif // TPETRA_DIRECTORY_HPP Interface for breaking ties in ownership.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
bool isOneToOne(const map_type &map) const
Whether the Directory's input Map is (globally) one to one.
Implementation of Directory for a locally replicated Map.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
Implementation of Directory for a distributed noncontiguous Map.
Implementation of Directory for a distributed contiguous Map.
LookupStatus getDirectoryEntries(const map_type &map, 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.
bool initialized() const
Whether the Directory is initialized.
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
virtual bool mayHaveSideEffects() const
Whether selectedIndex() may have side effects.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
virtual std::size_t selectedIndex(GlobalOrdinal GID, const std::vector< std::pair< int, LocalOrdinal > > &pid_and_lid) const =0
Break any ties in ownership of the given global index GID.
A parallel distribution of indices over processes.
Computes the local ID and process ID corresponding to given global IDs.
virtual bool isOneToOne(const Teuchos::Comm< int > &comm) const =0
Whether the Directory's input Map is (globally) one to one.
Implement mapping from global ID to process ID and local ID.
void initialize(const map_type &map)
Initialize the Directory with its Map.
Directory()
Default constructor: the only one you should use.
bool isUniform() const
Whether the range of global indices is uniform.
LookupStatus getEntries(const map_type &map, const Teuchos::ArrayView< const GlobalOrdinal > &globalIDs, const Teuchos::ArrayView< int > &nodeIDs, const Teuchos::ArrayView< LocalOrdinal > &localIDs, const bool computeLIDs) const
std::string description() const
A one-line human-readable description of this object.
LocalOrdinal getMinLocalIndex() const
The minimum local index.