Tpetra parallel linear algebra  Version of the Day
Tpetra_Map_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Tpetra: Templated Linear Algebra Services Package
5 // Copyright (2008) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #ifndef TPETRA_MAP_DECL_HPP
43 #define TPETRA_MAP_DECL_HPP
44 
48 
49 #include "Tpetra_ConfigDefs.hpp"
50 #include "Kokkos_DefaultNode.hpp"
51 #include "Kokkos_DualView.hpp"
52 #include "Teuchos_Describable.hpp"
53 #include "Tpetra_Details_FixedHashTable_decl.hpp"
55 
56 // mfh 27 Apr 2013: If HAVE_TPETRA_FIXED_HASH_TABLE is defined (which
57 // it is by default), then Map will used the fixed-structure hash
58 // table variant for global-to-local index lookups. Otherwise, it
59 // will use the dynamic-structure hash table variant.
60 //
61 // mfh 23 Mar 2014: I've removed all code in Map that uses the
62 // dynamic-structure hash table variant, since it has not been used
63 // for at least a year. However, I am retaining the #define, in case
64 // downstream code depends on it.
65 
66 #ifndef HAVE_TPETRA_FIXED_HASH_TABLE
67 # define HAVE_TPETRA_FIXED_HASH_TABLE 1
68 #endif // HAVE_TPETRA_FIXED_HASH_TABLE
69 
70 namespace Tpetra {
71 
72 #ifndef DOXYGEN_SHOULD_SKIP_THIS
73  // Forward declaration of Directory.
74  template <class LO, class GO, class N> class Directory;
75 #endif // DOXYGEN_SHOULD_SKIP_THIS
76 
77  namespace Details {
78 
79 #ifndef DOXYGEN_SHOULD_SKIP_THIS
80  // Forward declaration of TieBreak
81  template <class LO, class GO> class TieBreak;
82 #endif // DOXYGEN_SHOULD_SKIP_THIS
83 
86  template<class OutMapType, class InMapType>
87  struct MapCloner {
88  typedef typename OutMapType::node_type out_node_type;
89  typedef typename InMapType::node_type in_node_type;
90 
91  static OutMapType
92  clone (const InMapType& mapIn,
93  const Teuchos::RCP<out_node_type>& node2);
94  };
95 
110  template<class LocalOrdinal, class GlobalOrdinal, class DeviceType>
111  class LocalMap {
112  public:
114  const Kokkos::View<const GlobalOrdinal*, DeviceType>& lgMap,
115  const GlobalOrdinal indexBase,
116  const GlobalOrdinal myMinGid,
117  const GlobalOrdinal myMaxGid,
118  const GlobalOrdinal firstContiguousGid,
119  const GlobalOrdinal lastContiguousGid,
120  const LocalOrdinal numLocalElements,
121  const bool contiguous) :
122  glMap_ (glMap),
123  lgMap_ (lgMap),
124  indexBase_ (indexBase),
125  myMinGid_ (myMinGid),
126  myMaxGid_ (myMaxGid),
127  firstContiguousGid_ (firstContiguousGid),
128  lastContiguousGid_ (lastContiguousGid),
129  numLocalElements_ (numLocalElements),
130  contiguous_ (contiguous)
131  {}
132 
134  KOKKOS_INLINE_FUNCTION LocalOrdinal getNodeNumElements () const {
135  return numLocalElements_;
136  }
137 
139  KOKKOS_INLINE_FUNCTION GlobalOrdinal getIndexBase () const {
140  return indexBase_;
141  }
142 
147  KOKKOS_INLINE_FUNCTION bool isContiguous () const {
148  return contiguous_;
149  }
150 
152  KOKKOS_INLINE_FUNCTION LocalOrdinal getMinLocalIndex () const {
153  return 0;
154  }
155 
157  KOKKOS_INLINE_FUNCTION LocalOrdinal
159  {
160  if (numLocalElements_ == 0) {
162  } else { // Local indices are always zero-based.
163  return static_cast<LocalOrdinal> (numLocalElements_ - 1);
164  }
165  }
166 
168  KOKKOS_INLINE_FUNCTION GlobalOrdinal getMinGlobalIndex () const {
169  return myMinGid_;
170  }
171 
173  KOKKOS_INLINE_FUNCTION GlobalOrdinal getMaxGlobalIndex () const {
174  return myMaxGid_;
175  }
176 
178  KOKKOS_INLINE_FUNCTION LocalOrdinal
179  getLocalElement (const GlobalOrdinal globalIndex) const
180  {
181  if (contiguous_) {
182  if (globalIndex < myMinGid_ || globalIndex > myMaxGid_) {
184  }
185  return static_cast<LocalOrdinal> (globalIndex - myMinGid_);
186  }
187  else if (globalIndex >= firstContiguousGid_ &&
188  globalIndex <= lastContiguousGid_) {
189  return static_cast<LocalOrdinal> (globalIndex - firstContiguousGid_);
190  }
191  else {
192  // If the given global index is not in the table, this returns
193  // the same value as OrdinalTraits<LocalOrdinal>::invalid().
194  return glMap_.get (globalIndex);
195  }
196  }
197 
199  KOKKOS_INLINE_FUNCTION GlobalOrdinal
200  getGlobalElement (const LocalOrdinal localIndex) const
201  {
202  if (localIndex < getMinLocalIndex () || localIndex > getMaxLocalIndex ()) {
204  }
205  if (isContiguous ()) {
206  return getMinGlobalIndex () + localIndex;
207  }
208  else {
209  return lgMap_(localIndex);
210  }
211  }
212 
213  private:
215  Kokkos::View<const GlobalOrdinal*, DeviceType> lgMap_;
216  GlobalOrdinal indexBase_;
217  GlobalOrdinal myMinGid_;
218  GlobalOrdinal myMaxGid_;
219  GlobalOrdinal firstContiguousGid_;
220  GlobalOrdinal lastContiguousGid_;
221  LocalOrdinal numLocalElements_;
222  bool contiguous_;
223  };
224  } // namespace Details
225 
226  template<class Node>
227  Teuchos::RCP<Node> defaultArgNode() {
228  // Workaround function for a deferred visual studio bug
229  // http://connect.microsoft.com/VisualStudio/feedback/details/719847/erroneous-error-c2783-could-not-deduce-template-argument
230  // Use this function for default arguments rather than calling
231  // what is the return value below. Also helps in reducing
232  // duplication in various constructors.
233  return KokkosClassic::Details::getNode<Node> ();
234  }
235 
385  template <class LocalOrdinal = Details::DefaultTypes::local_ordinal_type,
386  class GlobalOrdinal = Details::DefaultTypes::global_ordinal_type,
388  class Map : public Teuchos::Describable {
389  public:
391 
392 
394  typedef LocalOrdinal local_ordinal_type;
396  typedef GlobalOrdinal global_ordinal_type;
398  typedef Node node_type;
399 
406  typedef typename Kokkos::Device<typename Node::execution_space,
407  typename Node::memory_space> device_type;
408 
424 
426 
428 
470  Map (global_size_t numGlobalElements,
471  GlobalOrdinal indexBase,
472  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
473  LocalGlobal lg=GloballyDistributed,
474  const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
475 
515  Map (global_size_t numGlobalElements,
516  size_t numLocalElements,
517  GlobalOrdinal indexBase,
518  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
519  const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
520 
555  Map (global_size_t numGlobalElements,
556  const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
557  GlobalOrdinal indexBase,
558  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
559  const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
560 
561 
572  Map ();
573 
575  ~Map ();
576 
578 
580 
585  bool isOneToOne () const;
586 
593  return numGlobalElements_;
594  }
595 
601  size_t getNodeNumElements () const {
602  return numLocalElements_;
603  }
604 
610  GlobalOrdinal getIndexBase () const {
611  return indexBase_;
612  }
613 
619  LocalOrdinal getMinLocalIndex () const {
620  return static_cast<LocalOrdinal> (0);
621  }
622 
633  LocalOrdinal getMaxLocalIndex () const {
634  if (this->getNodeNumElements () == 0) {
636  } else { // Local indices are always zero-based.
637  return static_cast<LocalOrdinal> (this->getNodeNumElements () - 1);
638  }
639  }
640 
646  GlobalOrdinal getMinGlobalIndex () const {
647  return minMyGID_;
648  }
649 
655  GlobalOrdinal getMaxGlobalIndex () const {
656  return maxMyGID_;
657  }
658 
664  GlobalOrdinal getMinAllGlobalIndex () const {
665  return minAllGID_;
666  }
667 
673  GlobalOrdinal getMaxAllGlobalIndex () const {
674  return maxAllGID_;
675  }
676 
689  LocalOrdinal getLocalElement (GlobalOrdinal globalIndex) const;
690 
699  GlobalOrdinal getGlobalElement (LocalOrdinal localIndex) const;
700 
705  local_map_type getLocalMap () const;
706 
737  getRemoteIndexList (const Teuchos::ArrayView<const GlobalOrdinal>& GIDList,
738  const Teuchos::ArrayView< int>& nodeIDList,
739  const Teuchos::ArrayView< LocalOrdinal>& LIDList) const;
740 
765  getRemoteIndexList (const Teuchos::ArrayView<const GlobalOrdinal> & GIDList,
766  const Teuchos::ArrayView< int> & nodeIDList) const;
767 
774  Teuchos::ArrayView<const GlobalOrdinal> getNodeElementList() const;
775 
777 
779 
786  bool isNodeLocalElement (LocalOrdinal localIndex) const;
787 
794  bool isNodeGlobalElement (GlobalOrdinal globalIndex) const;
795 
802  bool isUniform () const;
803 
815  bool isContiguous () const;
816 
837  bool isDistributed () const;
838 
863  bool isCompatible (const Map<LocalOrdinal,GlobalOrdinal,Node> &map) const;
864 
895  bool isSameAs (const Map<LocalOrdinal,GlobalOrdinal,Node> &map) const;
896 
901  bool locallySameAs (const Map<LocalOrdinal, GlobalOrdinal, node_type>& map) const;
902 
904 
906 
908  Teuchos::RCP<const Teuchos::Comm<int> > getComm () const;
909 
911  Teuchos::RCP<Node> getNode () const;
912 
914 
916 
918  std::string description () const;
919 
921  void
922  describe (Teuchos::FancyOStream &out,
923  const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const;
924 
926 
928 
930  template <class NodeOut>
931  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
932  clone (const RCP<NodeOut>& nodeOut) const;
933 
981  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
982  removeEmptyProcesses () const;
983 
1011  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1012  replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const;
1014 
1015  protected:
1016  // This lets other specializations of Map access all of this
1017  // specialization's internal methods and data, so that we can
1018  // implement clone() without exposing the details of Map to users.
1019  template <class LO, class GO, class N> friend class Map;
1020 
1021  private:
1022  template<class OutMapType, class InMapType>
1023  friend struct Details::MapCloner;
1024 
1032  void setupDirectory () const;
1033 
1048  bool checkIsDist() const;
1049 
1051  Teuchos::RCP<const Teuchos::Comm<int> > comm_;
1052 
1054  Teuchos::RCP<Node> node_;
1055 
1057  GlobalOrdinal indexBase_;
1058 
1060  global_size_t numGlobalElements_;
1061 
1063  size_t numLocalElements_;
1064 
1066  GlobalOrdinal minMyGID_;
1067 
1069  GlobalOrdinal maxMyGID_;
1070 
1072  GlobalOrdinal minAllGID_;
1073 
1075  GlobalOrdinal maxAllGID_;
1076 
1083  GlobalOrdinal firstContiguousGID_;
1084 
1098  GlobalOrdinal lastContiguousGID_;
1099 
1105  bool uniform_;
1106 
1108  bool contiguous_;
1109 
1116  bool distributed_;
1117 
1137  mutable Kokkos::View<GlobalOrdinal*, device_type> lgMap_;
1138 
1142 
1155  global_to_local_table_type glMap_;
1156 
1193  mutable Teuchos::RCP<Directory<LocalOrdinal,GlobalOrdinal,Node> > directory_;
1194 
1195  }; // Map class
1196 
1210  template <class LocalOrdinal, class GlobalOrdinal>
1211  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1212  createLocalMap (size_t numElements, const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1213 
1230  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1231  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1232  createLocalMapWithNode (size_t numElements,
1233  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1234  const Teuchos::RCP<Node>& node = defaultArgNode<Node> ());
1235 
1243  template <class LocalOrdinal, class GlobalOrdinal>
1244  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1246  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1247 
1254  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1255  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1257  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1258  const Teuchos::RCP<Node>& node =
1259  defaultArgNode<Node> ());
1260 
1269  template <class LocalOrdinal, class GlobalOrdinal>
1270  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1271  createContigMap (global_size_t numElements,
1272  size_t localNumElements,
1273  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
1274 
1281  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1282  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1284  size_t localNumElements,
1285  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1286  const Teuchos::RCP<Node>& node =
1287  defaultArgNode<Node> ());
1288 
1297  template <class LocalOrdinal, class GlobalOrdinal>
1298  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1299  createNonContigMap (const ArrayView<const GlobalOrdinal> &elementList,
1300  const RCP<const Teuchos::Comm<int> > &comm);
1301 
1308  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1309  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1310  createNonContigMapWithNode (const ArrayView<const GlobalOrdinal> &elementList,
1311  const RCP<const Teuchos::Comm<int> > &comm,
1312  const RCP<Node> &node);
1313 
1320  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1321  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1322  createWeightedContigMapWithNode (int thisNodeWeight,
1323  global_size_t numElements,
1324  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
1325  const Teuchos::RCP<Node> &node);
1326 
1333  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1334  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1335  createOneToOne (const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &M);
1336 
1344  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1345  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1346  createOneToOne(const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &M,
1348 
1349 } // Tpetra namespace
1350 
1351 #include "Tpetra_Directory_decl.hpp"
1352 
1353 namespace Tpetra {
1354  namespace Details {
1355 
1356  template<class OutMapType, class InMapType>
1357  OutMapType
1358  MapCloner<OutMapType, InMapType>::
1359  clone (const InMapType& mapIn,
1360  const Teuchos::RCP<out_node_type>& nodeOut)
1361  {
1362  static_assert (std::is_same<typename OutMapType::local_ordinal_type,
1363  typename InMapType::local_ordinal_type>::value,
1364  "Tpetra::Map clone: The LocalOrdinal template parameter "
1365  "of the input and output Map types must be the same.");
1366  static_assert (std::is_same<typename OutMapType::global_ordinal_type,
1367  typename InMapType::global_ordinal_type>::value,
1368  "Tpetra::Map clone: The GlobalOrdinal template parameter "
1369  "of the input and output Map types must be the same.");
1370  typedef typename OutMapType::local_ordinal_type LO;
1371  typedef typename OutMapType::global_ordinal_type GO;
1372  typedef ::Tpetra::Directory<LO, GO,
1373  typename OutMapType::node_type> out_dir_type;
1374  typedef typename OutMapType::global_to_local_table_type out_table_type;
1375  typedef typename OutMapType::device_type out_device_type;
1376 
1377  OutMapType mapOut; // Make an empty Map.
1378 
1379  // Fill the new Map with (possibly) shallow copies of all of the
1380  // original Map's data. This is safe because Map is immutable,
1381  // so users can't change the original Map.
1382  mapOut.comm_ = mapIn.comm_;
1383  mapOut.indexBase_ = mapIn.indexBase_;
1384  mapOut.numGlobalElements_ = mapIn.numGlobalElements_;
1385  mapOut.numLocalElements_ = mapIn.numLocalElements_;
1386  mapOut.minMyGID_ = mapIn.minMyGID_;
1387  mapOut.maxMyGID_ = mapIn.maxMyGID_;
1388  mapOut.minAllGID_ = mapIn.minAllGID_;
1389  mapOut.maxAllGID_ = mapIn.maxAllGID_;
1390  mapOut.firstContiguousGID_= mapIn.firstContiguousGID_;
1391  mapOut.lastContiguousGID_ = mapIn.lastContiguousGID_;
1392  mapOut.uniform_ = mapIn.uniform_;
1393  mapOut.contiguous_ = mapIn.contiguous_;
1394  mapOut.distributed_ = mapIn.distributed_;
1395  {
1396  // mfh 25 Dec 2015, 11 Jan 2016: We really only need to make a
1397  // deep copy if the two Map types have different memory
1398  // spaces. However, if you're calling clone(), it is likely
1399  // the case that the memory spaces differ, so it doesn't hurt
1400  // to make a deep copy here.
1401  Kokkos::View<GO*, out_device_type>
1402  lgMapOut ("lgMap", mapIn.lgMap_.dimension_0 ());
1403  Kokkos::deep_copy (lgMapOut, mapIn.lgMap_);
1404  mapOut.lgMap_ = lgMapOut; // cast to const
1405  }
1406  // This makes a deep copy only if necessary. We could have
1407  // defined operator= to do this, but that would violate
1408  // expectations. (Kokkos::View::operator= only does a shallow
1409  // copy, EVER.)
1410  mapOut.glMap_ = out_table_type (mapIn.glMap_);
1411  // New Map gets the new Node instance.
1412  mapOut.node_ = nodeOut;
1413 
1414  // We could cleverly clone the Directory here if it is
1415  // initialized, but there is no harm in simply creating it
1416  // uninitialized.
1417  mapOut.directory_ = Teuchos::rcp (new out_dir_type ());
1418 
1419  return mapOut;
1420  }
1421  } // namespace Details
1422 
1423 
1424  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1425  template <class NodeOut>
1426  RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
1428  clone (const Teuchos::RCP<NodeOut>& nodeOut) const
1429  {
1430  typedef Map<LocalOrdinal, GlobalOrdinal, Node> in_map_type;
1431  typedef Map<LocalOrdinal, GlobalOrdinal, NodeOut> out_map_type;
1433  // Copy constructor does a shallow copy.
1434  return Teuchos::rcp (new out_map_type (cloner_type::clone (*this, nodeOut)));
1435  }
1436 
1437 } // namespace Tpetra
1438 
1441 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1444 { return map1.isSameAs (map2); }
1445 
1448 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1451 { return ! map1.isSameAs (map2); }
1452 
1453 
1454 #endif // TPETRA_MAP_DECL_HPP
1455 
Interface for breaking ties in ownership.
KOKKOS_INLINE_FUNCTION GlobalOrdinal getMinGlobalIndex() const
The minimum global index on the calling process.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Traits class for "invalid" (flag) values of integer types that Tpetra uses as local ordinals or globa...
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, NodeOut > > clone(const RCP< NodeOut > &nodeOut) const
Advanced methods.
GlobalOrdinal global_ordinal_type
The type of global indices.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > 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.
KokkosClassic::DefaultNode::DefaultNodeType node_type
Default value of Node template parameter.
Kokkos::Device< typename Node::execution_space, typename Node::memory_space > device_type
The Kokkos device type over which to allocate Views and perform work.
KOKKOS_INLINE_FUNCTION LocalOrdinal getLocalElement(const GlobalOrdinal globalIndex) const
Get the local index corresponding to the given global index.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=defaultArgNode< Node >())
Nonmember constructor for a locally replicated Map with a specified 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=defaultArgNode< Node >())
Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map with a user-spec...
GlobalOrdinal getIndexBase() const
The index base for this Map.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
void deep_copy(const LittleBlock< ST2, LO > &dst, const LittleBlock< ST1, LO > &src, typename std::enable_if< std::is_convertible< ST1, ST2 >::value &&!std::is_const< ST2 >::value, int >::type *=NULL)
Copy the LittleBlock src into the LittleBlock dst.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
int local_ordinal_type
Default value of LocalOrdinal template parameter.
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.
Details::LocalMap< LocalOrdinal, GlobalOrdinal, device_type > local_map_type
Type of the "local" Map.
"Local" part of Map suitable for Kokkos kernels.
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...
Implementation details of Tpetra.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
size_t global_size_t
Global size_t object.
Traits class for "invalid" (flag) values of integer types that Tpetra uses as local ordinals or globa...
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.
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...
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createOneToOne(const 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...
KOKKOS_INLINE_FUNCTION GlobalOrdinal getGlobalElement(const LocalOrdinal localIndex) const
Get the global index corresponding to the given local index.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
KOKKOS_INLINE_FUNCTION bool isContiguous() const
Whether the Map is (locally) contiguous.
KOKKOS_INLINE_FUNCTION LocalOrdinal getNodeNumElements() const
The number of indices that live on the calling process.
KOKKOS_INLINE_FUNCTION LocalOrdinal getMinLocalIndex() const
The minimum local index.
Node node_type
The type of the Kokkos Node.
KOKKOS_INLINE_FUNCTION GlobalOrdinal getMaxGlobalIndex() const
The maximum global index on the calling process.
Implementation detail of Map::clone().
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > 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...
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Describes a parallel distribution of objects over processes.
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.
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.
LocalGlobal
Enum for local versus global allocation of Map entries.
KOKKOS_INLINE_FUNCTION GlobalOrdinal getIndexBase() const
The (global) index base.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
KOKKOS_INLINE_FUNCTION LocalOrdinal getMaxLocalIndex() const
The maximum local index.
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=defaultArgNode< Node >())
Non-member constructor for a uniformly distributed, contiguous Map with a user-specified Kokkos Node...
global_size_t getGlobalNumElements() const
The number of elements in this Map.