42 #ifndef TPETRA_MAP_DECL_HPP
43 #define TPETRA_MAP_DECL_HPP
45 #include <Kokkos_DefaultNode.hpp>
46 #include <Teuchos_Describable.hpp>
49 #include "Tpetra_ConfigDefs.hpp"
56 #ifndef HAVE_TPETRA_FIXED_HASH_TABLE
57 # define HAVE_TPETRA_FIXED_HASH_TABLE 1
58 #endif // HAVE_TPETRA_FIXED_HASH_TABLE
65 #ifndef DOXYGEN_SHOULD_SKIP_THIS
67 template <
class LO,
class GO,
class N>
class Directory;
69 # ifdef HAVE_TPETRA_FIXED_HASH_TABLE
71 template<
class GlobalOrdinal,
class LocalOrdinal>
76 template<
class GlobalOrdinal,
class LocalOrdinal>
79 # endif // HAVE_TPETRA_FIXED_HASH_TABLE
80 #endif // DOXYGEN_SHOULD_SKIP_THIS
188 template <
class LocalOrdinal,
189 class GlobalOrdinal = LocalOrdinal,
190 class Node = Kokkos::DefaultNode::DefaultNodeType>
191 class Map :
public Teuchos::Describable {
248 GlobalOrdinal indexBase,
249 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
251 const Teuchos::RCP<Node> &node = Kokkos::Details::getNode<Node>());
293 size_t numLocalElements,
294 GlobalOrdinal indexBase,
295 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
296 const Teuchos::RCP<Node> &node = Kokkos::Details::getNode<Node>());
333 const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
334 GlobalOrdinal indexBase,
335 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
336 const Teuchos::RCP<Node> &node = Kokkos::Details::getNode<Node>());
356 return Teuchos::OrdinalTraits<LocalOrdinal>::zero();
366 return Teuchos::OrdinalTraits<LocalOrdinal>::invalid ();
428 const Teuchos::ArrayView< int>& nodeIDList,
429 const Teuchos::ArrayView< LocalOrdinal>& LIDList)
const;
456 const Teuchos::ArrayView< int> & nodeIDList)
const;
581 const Teuchos::RCP<const Teuchos::Comm<int> > &
getComm()
const;
584 const Teuchos::RCP<Node> &
getNode()
const;
595 describe (Teuchos::FancyOStream &out,
596 const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
603 template <
class Node2>
604 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node2> >
clone (
const RCP<Node2>& node2)
const;
653 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
683 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
691 template <
class LO,
class GO,
class N>
friend class Map;
709 void setupDirectory ()
const;
725 bool checkIsDist()
const;
735 Teuchos::RCP<const Teuchos::Comm<int> > comm_;
743 Teuchos::RCP<Node> node_;
746 GlobalOrdinal indexBase_;
750 size_t numLocalElements_;
752 GlobalOrdinal minMyGID_, maxMyGID_;
754 GlobalOrdinal minAllGID_, maxAllGID_;
756 GlobalOrdinal firstContiguousGID_, lastContiguousGID_;
784 mutable Teuchos::ArrayRCP<GlobalOrdinal> lgMap_;
786 #ifdef HAVE_TPETRA_FIXED_HASH_TABLE
792 #endif // HAVE_TPETRA_FIXED_HASH_TABLE
806 RCP<global_to_local_table_type> glMap_;
832 mutable Teuchos::RCP<Directory<LocalOrdinal,GlobalOrdinal,Node> > directory_;
850 template <
class LocalOrdinal,
class GlobalOrdinal>
851 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
852 createLocalMap (
size_t numElements,
const Teuchos::RCP<
const Teuchos::Comm<int> >& comm);
870 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
871 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
873 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
874 const Teuchos::RCP<Node>& node = Kokkos::Details::getNode<Node> ());
884 template <
class LocalOrdinal,
class GlobalOrdinal>
885 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
894 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
895 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
897 const Teuchos::RCP<
const Teuchos::Comm< int > > &comm,
898 const Teuchos::RCP< Node > &node = Kokkos::Details::getNode<Node>());
908 template <
class LocalOrdinal,
class GlobalOrdinal>
909 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Kokkos::DefaultNode::DefaultNodeType> >
911 size_t localNumElements,
912 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm);
920 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
921 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
923 size_t localNumElements,
924 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
925 const Teuchos::RCP<Node> &node);
935 template <
class LocalOrdinal,
class GlobalOrdinal>
936 Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Kokkos::DefaultNode::DefaultNodeType> >
938 const RCP<
const Teuchos::Comm<int> > &comm);
946 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
947 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
949 const RCP<
const Teuchos::Comm<int> > &comm,
950 const RCP<Node> &node);
958 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
959 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
962 const Teuchos::RCP<
const Teuchos::Comm<int> > &comm,
963 const Teuchos::RCP<Node> &node);
971 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
972 Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
973 createOneToOne(Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> > &M);
977 #include "Tpetra_Directory_decl.hpp"
980 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
981 template <
class Node2>
982 RCP<const Map<LocalOrdinal, GlobalOrdinal, Node2> >
986 RCP<Map2> map = rcp (
new Map2 ());
991 map->indexBase_ = indexBase_;
992 map->numGlobalElements_ = numGlobalElements_;
993 map->numLocalElements_ = numLocalElements_;
994 map->minMyGID_ = minMyGID_;
995 map->maxMyGID_ = maxMyGID_;
996 map->minAllGID_ = minAllGID_;
997 map->maxAllGID_ = maxAllGID_;
998 map->firstContiguousGID_= firstContiguousGID_;
999 map->lastContiguousGID_ = lastContiguousGID_;
1000 map->uniform_ = uniform_;
1001 map->contiguous_ = contiguous_;
1002 map->distributed_ = distributed_;
1003 map->lgMap_ = lgMap_;
1004 map->glMap_ = glMap_;
1011 if (! directory_.is_null ()) {
1013 map->directory_ = directory_->template clone<Node2> (map.create_weak ());
1021 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1028 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1033 #endif // TPETRA_MAP_DECL_HPP
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is valid for this Map on this process.
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.
GlobalOrdinal global_ordinal_type
The type of global indices.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
const Teuchos::RCP< const Teuchos::Comm< int > > & getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Kokkos::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.
bool isUniform() const
Whether the range of global indices is uniform.
GlobalOrdinal getIndexBase() const
The index base for this Map.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
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.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
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.
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-spec...
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node2 > > clone(const RCP< Node2 > &node2) const
Advanced methods.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on this process.
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 Nod...
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
size_t global_size_t
Global size_t object.
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...
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
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.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a view of the global indices owned by this process.
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.
Node node_type
The type of the Kokkos Node.
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Describes a parallel distribution of objects over processes.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Kokkos::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...
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
LocalOrdinal local_ordinal_type
The type of local indices.
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.
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=Kokkos::Details::getNode< Node >())
Non-member constructor for a uniformly distributed, contiguous Map with a user-specified Kokkos Node...
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.
const Teuchos::RCP< Node > & getNode() const
Get this Map's Node object.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Kokkos::Details::getNode< Node >())
Nonmember constructor for a locally replicated Map with a specified Kokkos Node.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
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...
std::string description() const
Implementation of Teuchos::Describable.
Map()
Default constructor (that does nothing).