42 #ifndef TPETRA_DIRECTORY_HPP 43 #define TPETRA_DIRECTORY_HPP 45 #include <Teuchos_as.hpp> 46 #include <Tpetra_ConfigDefs.hpp> 47 #include <Tpetra_Distributor.hpp> 48 #include <Tpetra_Map.hpp> 49 #include <Tpetra_DirectoryImpl.hpp> 51 #include "Tpetra_Directory_decl.hpp" 55 template<
class LO,
class GO,
class NT>
60 template<
class LO,
class GO,
class NT>
68 template<
class LO,
class GO,
class NT>
75 template<
class LO,
class GO,
class NT>
82 TEUCHOS_TEST_FOR_EXCEPTION(
83 impl_ == NULL, std::logic_error,
"Tpetra::Directory::initialize: " 84 "The Directory claims that it has been initialized, " 85 "but its implementation object has not yet been created. " 86 "Please report this bug to the Tpetra developers.");
89 TEUCHOS_TEST_FOR_EXCEPTION(
90 impl_ != NULL, std::logic_error,
"Tpetra::Directory::initialize: " 91 "Directory implementation has already been initialized, " 92 "but initialized() returns false. " 93 "Please report this bug to the Tpetra developers.");
118 bool usedTieBreak =
false;
137 const int myRank = map.
getComm ()->getRank ();
142 std::vector<std::pair<int, LO> > pidLidList (1);
145 for (LO locInd = minLocInd; locInd <= maxLocInd; ++locInd) {
146 pidLidList[0] = std::make_pair (myRank, locInd);
164 std::vector<std::pair<int, LO> > pidLidList (1);
167 const int myRank = map.
getComm ()->getRank ();
168 for (LO locInd = minLocInd; locInd <= maxLocInd; ++locInd) {
169 pidLidList[0] = std::make_pair (myRank, locInd);
181 template<
class LO,
class GO,
class NT>
186 TEUCHOS_TEST_FOR_EXCEPTION(
187 impl_ == NULL, std::logic_error,
"Tpetra::Directory::initialize: " 188 "The Directory claims that it has been initialized, " 189 "but its implementation object has not yet been created. " 190 "Please report this bug to the Tpetra developers.");
193 TEUCHOS_TEST_FOR_EXCEPTION(
194 impl_ != NULL, std::logic_error,
"Tpetra::Directory::initialize: " 195 "Directory implementation has already been initialized, " 196 "but initialized() returns false. " 197 "Please report this bug to the Tpetra developers.");
217 TEUCHOS_TEST_FOR_EXCEPTION(
218 dir == NULL, std::logic_error,
"Tpetra::Directory::initialize: " 219 "Failed to create Directory implementation. " 220 "Please report this bug to the Tpetra developers.");
225 template<
class LO,
class GO,
class NT>
229 const Teuchos::ArrayView<const GO>& globalIDs,
230 const Teuchos::ArrayView<int>& nodeIDs)
const 238 const bool computeLIDs =
false;
239 return impl_->
getEntries (map, globalIDs, nodeIDs, Teuchos::null, computeLIDs);
242 template<
class LO,
class GO,
class NT>
246 const Teuchos::ArrayView<const GO>& globalIDs,
247 const Teuchos::ArrayView<int>& nodeIDs,
248 const Teuchos::ArrayView<LO>& localIDs)
const 256 const bool computeLIDs =
true;
257 return impl_->
getEntries (map, globalIDs, nodeIDs, localIDs, computeLIDs);
260 template<
class LO,
class GO,
class NT>
271 template<
class LO,
class GO,
class NT>
275 using Teuchos::TypeNameTraits;
277 std::ostringstream os;
279 <<
"<" << TypeNameTraits<LO>::name ()
280 <<
", " << TypeNameTraits<GO>::name ()
281 <<
", " << TypeNameTraits<NT>::name () <<
">";
293 #define TPETRA_DIRECTORY_INSTANT(LO,GO,NODE) \ 295 template class Directory< LO , GO , NODE >; \ 297 #endif // TPETRA_DIRECTORY_HPP Interface for breaking ties in ownership.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Implementation of Directory for a locally replicated Map.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
Definition of implementation details of Tpetra::Directory.
bool isUniform() const
Whether the range of global indices is uniform.
Implementation of Directory for a distributed noncontiguous Map.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
Implementation of Directory for a distributed contiguous Map.
bool isOneToOne(const map_type &map) const
Whether the Directory's input Map is (globally) one to one.
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
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
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.
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.
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Describes a parallel distribution of objects 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.
bool initialized() const
Whether the Directory is initialized.
void initialize(const map_type &map)
Initialize the Directory with its Map.
Directory()
Default constructor: the only one you should use.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
std::string description() const
A one-line human-readable description of this object.
virtual bool mayHaveSideEffects() const
Whether selectedIndex() may have side effects.