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 "Tpetra_Map_fwd.hpp"
51 #include "Tpetra_Directory_fwd.hpp"
52 #include "Tpetra_TieBreak_fwd.hpp"
54 #include "Kokkos_DefaultNode.hpp"
55 #include "Kokkos_DualView.hpp"
56 #include "Teuchos_Array.hpp"
57 #include "Teuchos_Comm.hpp"
58 #include "Teuchos_Describable.hpp"
59 
60 
61 namespace Tpetra {
62 
63  namespace Details {
64 
67  template<class OutMapType, class InMapType>
68  struct MapCloner {
69  typedef typename OutMapType::node_type out_node_type;
70  typedef typename InMapType::node_type in_node_type;
71 
72  static OutMapType
73  clone (const InMapType& mapIn,
74  const Teuchos::RCP<out_node_type>& node2);
75  };
76 
77  } // namespace Details
78 
243  template <class LocalOrdinal,
244  class GlobalOrdinal,
245  class Node>
246  class Map : public Teuchos::Describable {
247  public:
249 
250 
252  using local_ordinal_type = LocalOrdinal;
253 
255  using global_ordinal_type = GlobalOrdinal;
256 
262  using device_type = typename Node::device_type;
263 
265  using execution_space = typename device_type::execution_space;
266 
268  using memory_space = typename device_type::memory_space;
269 
271  using node_type = Node;
272 
289  device_type>;
290 
292 
294 
344  Map (const global_size_t numGlobalElements,
345  const global_ordinal_type indexBase,
346  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
347  const LocalGlobal lg=GloballyDistributed);
348 
349 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
350  TPETRA_DEPRECATED
351  Map (const global_size_t numGlobalElements,
352  const global_ordinal_type indexBase,
353  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
354  const LocalGlobal lg,
355  const Teuchos::RCP<Node> &node);
356 #endif // TPETRA_ENABLE_DEPRECATED_CODE
357 
393  Map (const global_size_t numGlobalElements,
394  const size_t numLocalElements,
395  const global_ordinal_type indexBase,
396  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
397 
398 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
399  TPETRA_DEPRECATED
400  Map (const global_size_t numGlobalElements,
401  const size_t numLocalElements,
402  const global_ordinal_type indexBase,
403  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
404  const Teuchos::RCP<Node> &node);
405 #endif // TPETRA_ENABLE_DEPRECATED_CODE
406 
447  Map (const global_size_t numGlobalElements,
448  const Kokkos::View<const GlobalOrdinal*, device_type>& indexList,
449  const GlobalOrdinal indexBase,
450  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
451 
493  Map (const global_size_t numGlobalElements,
494  const GlobalOrdinal indexList[],
495  const LocalOrdinal indexListSize,
496  const GlobalOrdinal indexBase,
497  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
498 
540  Map (const global_size_t numGlobalElements,
541  const Teuchos::ArrayView<const GlobalOrdinal>& indexList,
542  const GlobalOrdinal indexBase,
543  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
544 
545 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
546  TPETRA_DEPRECATED
547  Map (const global_size_t numGlobalElements,
548  const Teuchos::ArrayView<const GlobalOrdinal>& indexList,
549  const GlobalOrdinal indexBase,
550  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
551  const Teuchos::RCP<Node>& node);
552 #endif // TPETRA_ENABLE_DEPRECATED_CODE
553 
567  Map ();
568 
571 
574 
576  Map&
578 
580  Map&
582 
592  virtual ~Map ();
593 
595 
597 
602  bool isOneToOne () const;
603 
610  return numGlobalElements_;
611  }
612 
618  size_t getNodeNumElements () const {
619  return numLocalElements_;
620  }
621 
627  GlobalOrdinal getIndexBase () const {
628  return indexBase_;
629  }
630 
636  LocalOrdinal getMinLocalIndex () const {
637  return static_cast<LocalOrdinal> (0);
638  }
639 
650  LocalOrdinal getMaxLocalIndex () const {
651  if (this->getNodeNumElements () == 0) {
652  return Tpetra::Details::OrdinalTraits<LocalOrdinal>::invalid ();
653  } else { // Local indices are always zero-based.
654  return static_cast<LocalOrdinal> (this->getNodeNumElements () - 1);
655  }
656  }
657 
663  GlobalOrdinal getMinGlobalIndex () const {
664  return minMyGID_;
665  }
666 
672  GlobalOrdinal getMaxGlobalIndex () const {
673  return maxMyGID_;
674  }
675 
681  GlobalOrdinal getMinAllGlobalIndex () const {
682  return minAllGID_;
683  }
684 
690  GlobalOrdinal getMaxAllGlobalIndex () const {
691  return maxAllGID_;
692  }
693 
706  LocalOrdinal getLocalElement (GlobalOrdinal globalIndex) const;
707 
716  GlobalOrdinal getGlobalElement (LocalOrdinal localIndex) const;
717 
722  local_map_type getLocalMap () const;
723 
754  getRemoteIndexList (const Teuchos::ArrayView<const GlobalOrdinal>& GIDList,
755  const Teuchos::ArrayView< int>& nodeIDList,
756  const Teuchos::ArrayView< LocalOrdinal>& LIDList) const;
757 
782  getRemoteIndexList (const Teuchos::ArrayView<const GlobalOrdinal> & GIDList,
783  const Teuchos::ArrayView< int> & nodeIDList) const;
784 
785  private:
797  typedef Kokkos::View<const GlobalOrdinal*,
798  Kokkos::LayoutLeft,
799  device_type> global_indices_array_type;
800 
801  public:
821  global_indices_array_type getMyGlobalIndices () const;
822 
833  Teuchos::ArrayView<const GlobalOrdinal> getNodeElementList() const;
834 
836 
838 
845  bool isNodeLocalElement (LocalOrdinal localIndex) const;
846 
853  bool isNodeGlobalElement (GlobalOrdinal globalIndex) const;
854 
861  bool isUniform () const;
862 
874  bool isContiguous () const;
875 
896  bool isDistributed () const;
897 
922  bool isCompatible (const Map<LocalOrdinal,GlobalOrdinal,Node> &map) const;
923 
954  bool isSameAs (const Map<LocalOrdinal,GlobalOrdinal,Node> &map) const;
955 
961 
978 
980 
982 
984  Teuchos::RCP<const Teuchos::Comm<int> > getComm () const;
985 
986 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
987  TPETRA_DEPRECATED Teuchos::RCP<Node> getNode () const;
989 #endif // TPETRA_ENABLE_DEPRECATED_CODE
990 
992 
994 
996  std::string description () const;
997 
1019  void
1020  describe (Teuchos::FancyOStream &out,
1021  const Teuchos::EVerbosityLevel verbLevel =
1022  Teuchos::Describable::verbLevel_default) const;
1024 
1026 
1028 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1029  template <class NodeOut>
1030  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> > TPETRA_DEPRECATED
1031  clone (const Teuchos::RCP<NodeOut>& nodeOut) const;
1032 #endif
1033 
1081  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1082  removeEmptyProcesses () const;
1083 
1111  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1112  replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const;
1114 
1115  protected:
1116  // This lets other specializations of Map access all of this
1117  // specialization's internal methods and data, so that we can
1118  // implement clone() without exposing the details of Map to users.
1119  template <class LO, class GO, class N> friend class Map;
1120 
1121  private:
1122  template<class OutMapType, class InMapType>
1123  friend struct Details::MapCloner;
1124 
1129  std::string
1130  localDescribeToString (const Teuchos::EVerbosityLevel vl) const;
1131 
1139  void setupDirectory () const;
1140 
1155  bool checkIsDist() const;
1156 
1165  initialNonuniformDebugCheck (const global_size_t numGlobalElements,
1166  const size_t numLocalElements,
1167  const GlobalOrdinal indexBase,
1168  const Teuchos::RCP<const Teuchos::Comm<int> >& comm) const;
1169 
1170  void
1171  initWithNonownedHostIndexList (const global_size_t numGlobalElements,
1172  const Kokkos::View<const GlobalOrdinal*,
1173  Kokkos::LayoutLeft,
1174  Kokkos::HostSpace,
1175  Kokkos::MemoryUnmanaged>& entryList,
1176  const GlobalOrdinal indexBase,
1177  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1178 
1180  Teuchos::RCP<const Teuchos::Comm<int> > comm_;
1181 
1183  GlobalOrdinal indexBase_;
1184 
1187  global_size_t numGlobalElements_;
1188 
1190  size_t numLocalElements_;
1191 
1193  GlobalOrdinal minMyGID_;
1194 
1196  GlobalOrdinal maxMyGID_;
1197 
1200  GlobalOrdinal minAllGID_;
1201 
1204  GlobalOrdinal maxAllGID_;
1205 
1212  GlobalOrdinal firstContiguousGID_;
1213 
1227  GlobalOrdinal lastContiguousGID_;
1228 
1234  bool uniform_;
1235 
1237  bool contiguous_;
1238 
1247  bool distributed_;
1248 
1281  mutable Kokkos::View<const GlobalOrdinal*,
1282  Kokkos::LayoutLeft,
1283  device_type> lgMap_;
1284 
1292 #ifndef SWIG
1293  mutable Kokkos::View<const GlobalOrdinal*,
1294  Kokkos::LayoutLeft,
1295  Kokkos::HostSpace> lgMapHost_;
1296 #endif
1297 
1299  typedef ::Tpetra::Details::FixedHashTable<GlobalOrdinal, LocalOrdinal, device_type>
1300  global_to_local_table_type;
1301 
1314  global_to_local_table_type glMap_;
1315 
1352  mutable Teuchos::RCP<Directory<LocalOrdinal,GlobalOrdinal,Node> > directory_;
1353 
1354  }; // Map class
1355 
1369  template <class LocalOrdinal, class GlobalOrdinal>
1370  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal> >
1371  createLocalMap (const size_t numElements,
1372  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1373 
1388  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1389  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1390  createLocalMapWithNode (const size_t numElements,
1391  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1392 
1393 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1394  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1395  TPETRA_DEPRECATED
1396  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1397  createLocalMapWithNode (const size_t numElements,
1398  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1399  const Teuchos::RCP<Node>& node);
1400 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1401 
1409  template <class LocalOrdinal, class GlobalOrdinal>
1410  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1412  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1413 
1420  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1421  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1423  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1424 
1425 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1426  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1427  TPETRA_DEPRECATED
1428  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1429  createUniformContigMapWithNode (const global_size_t numElements,
1430  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1431  const Teuchos::RCP<Node>& node);
1432 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1433 
1440  template <class LocalOrdinal, class GlobalOrdinal>
1441  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1442  createContigMap (const global_size_t numElements,
1443  const size_t localNumElements,
1444  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1445 
1454  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1455  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1457  const size_t localNumElements,
1458  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1459 
1460 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1461  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1462  TPETRA_DEPRECATED
1463  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1464  createContigMapWithNode (const global_size_t numElements,
1465  const size_t localNumElements,
1466  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1467  const Teuchos::RCP<Node>& node);
1468 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1469 
1476  template <class LocalOrdinal, class GlobalOrdinal>
1477  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1478  createNonContigMap (const Teuchos::ArrayView<const GlobalOrdinal>& elementList,
1479  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1480 
1488  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1489  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1490  createNonContigMapWithNode (const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
1491  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
1492 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1493  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1494  TPETRA_DEPRECATED
1495  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1496  createNonContigMapWithNode (const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
1497  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
1498  const Teuchos::RCP<Node>& node);
1499 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1500 
1508 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1509  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1510  TPETRA_DEPRECATED
1511  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1512  createWeightedContigMapWithNode (const int thisNodeWeight,
1513  const global_size_t numElements,
1514  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
1515  const Teuchos::RCP<Node>& node = Teuchos::null);
1516 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1517 
1522  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1523  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1524  createOneToOne (const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& M);
1525 
1531  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1532  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1534  const ::Tpetra::Details::TieBreak<LocalOrdinal,GlobalOrdinal> & tie_break);
1535 
1536 } // namespace Tpetra
1537 
1538 #include "Tpetra_Directory_decl.hpp"
1539 
1540 namespace Tpetra {
1541  namespace Details {
1542 
1543  template<class OutMapType, class InMapType>
1544  OutMapType TPETRA_DEPRECATED
1545  MapCloner<OutMapType, InMapType>::
1546  clone (const InMapType& mapIn,
1547  const Teuchos::RCP<out_node_type>& /* nodeOut */)
1548  {
1549  static_assert (std::is_same<typename OutMapType::local_ordinal_type,
1550  typename InMapType::local_ordinal_type>::value,
1551  "Tpetra::Map clone: The LocalOrdinal template parameter "
1552  "of the input and output Map types must be the same.");
1553  static_assert (std::is_same<typename OutMapType::global_ordinal_type,
1554  typename InMapType::global_ordinal_type>::value,
1555  "Tpetra::Map clone: The GlobalOrdinal template parameter "
1556  "of the input and output Map types must be the same.");
1557  typedef typename OutMapType::local_ordinal_type LO;
1558  typedef typename OutMapType::global_ordinal_type GO;
1559  typedef ::Tpetra::Directory<LO, GO,
1560  typename OutMapType::node_type> out_dir_type;
1561  typedef typename OutMapType::global_to_local_table_type out_table_type;
1562  typedef typename OutMapType::device_type out_device_type;
1563 
1564  OutMapType mapOut; // Make an empty Map.
1565 
1566  // Fill the new Map with (possibly) shallow copies of all of the
1567  // original Map's data. This is safe because Map is immutable,
1568  // so users can't change the original Map.
1569  mapOut.comm_ = mapIn.comm_;
1570  mapOut.indexBase_ = mapIn.indexBase_;
1571  mapOut.numGlobalElements_ = mapIn.numGlobalElements_;
1572  mapOut.numLocalElements_ = mapIn.numLocalElements_;
1573  mapOut.minMyGID_ = mapIn.minMyGID_;
1574  mapOut.maxMyGID_ = mapIn.maxMyGID_;
1575  mapOut.minAllGID_ = mapIn.minAllGID_;
1576  mapOut.maxAllGID_ = mapIn.maxAllGID_;
1577  mapOut.firstContiguousGID_= mapIn.firstContiguousGID_;
1578  mapOut.lastContiguousGID_ = mapIn.lastContiguousGID_;
1579  mapOut.uniform_ = mapIn.uniform_;
1580  mapOut.contiguous_ = mapIn.contiguous_;
1581  mapOut.distributed_ = mapIn.distributed_;
1582  {
1583  // mfh 25 Dec 2015, 11 Jan 2016: We really only need to make a
1584  // deep copy if the two Map types have different memory
1585  // spaces. However, if you're calling clone(), it is likely
1586  // the case that the memory spaces differ, so it doesn't hurt
1587  // to make a deep copy here.
1588  Kokkos::View<GO*, Kokkos::LayoutLeft, out_device_type>
1589  lgMapOut ("lgMap", mapIn.lgMap_.extent (0));
1590  Kokkos::deep_copy (lgMapOut, mapIn.lgMap_);
1591  mapOut.lgMap_ = lgMapOut; // cast to const
1592 
1593  // mfh 11 Apr 2016: We can't just assign mapIn.lgMapHost_ to
1594  // mapOut.lgMapHost_ either. This is because the memory space
1595  // of the host mirror of a CudaUVMSpace View is also
1596  // CudaUVMSpace, but the memory space of the host mirror of a
1597  // HostSpace View is HostSpace. We can't assign one View to
1598  // another View with a different memory space.
1599  //
1600  // What we _can_ do here, though, is avoid a deep_copy in case
1601  // we're not using CUDA, by exploiting host mirrors.
1602 
1603  // lgMapOut is nonconst, so use it here instead of mapOut.lgMap_.
1604  auto lgMapHostOut =
1605  Kokkos::create_mirror_view (Kokkos::HostSpace (), lgMapOut);
1606  Kokkos::deep_copy (lgMapHostOut, lgMapOut);
1607  mapOut.lgMapHost_ = lgMapHostOut;
1608  }
1609  // This makes a deep copy only if necessary. We could have
1610  // defined operator= to do this, but that would violate
1611  // expectations. (Kokkos::View::operator= only does a shallow
1612  // copy, EVER.)
1613  mapOut.glMap_ = out_table_type (mapIn.glMap_);
1614 
1615  // We could cleverly clone the Directory here if it is
1616  // initialized, but there is no harm in simply creating it
1617  // uninitialized.
1618  mapOut.directory_ = Teuchos::rcp (new out_dir_type ());
1619 
1620  return mapOut;
1621  }
1622  } // namespace Details
1623 
1624 
1625 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1626  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1627  template <class NodeOut>
1628  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> > TPETRA_DEPRECATED
1629  Map<LocalOrdinal,GlobalOrdinal,Node>::
1630  clone (const Teuchos::RCP<NodeOut>& nodeOut) const
1631  {
1632  typedef Map<LocalOrdinal, GlobalOrdinal, Node> in_map_type;
1633  typedef Map<LocalOrdinal, GlobalOrdinal, NodeOut> out_map_type;
1634  typedef Details::MapCloner<out_map_type, in_map_type> cloner_type;
1635  // Copy constructor does a shallow copy.
1636  return Teuchos::rcp (new out_map_type (cloner_type::clone (*this, nodeOut)));
1637  }
1638 #endif
1639 
1640 } // namespace Tpetra
1641 
1644 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1647 { return map1.isSameAs (map2); }
1648 
1651 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1654 { return ! map1.isSameAs (map2); }
1655 
1656 
1657 #endif // TPETRA_MAP_DECL_HPP
Tpetra::Map::local_map_type
::Tpetra::Details::LocalMap< local_ordinal_type, global_ordinal_type, device_type > local_map_type
Type of the "local" Map.
Definition: Tpetra_Map_decl.hpp:289
Tpetra::Map::getMinGlobalIndex
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Definition: Tpetra_Map_decl.hpp:663
Tpetra::Map::isOneToOne
bool isOneToOne() const
Whether the Map is one to one.
Definition: Tpetra_Map_def.hpp:1207
Tpetra::createOneToOne
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createOneToOne(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &M)
Nonmember constructor for a contiguous Map with user-defined weights and a user-specified,...
Tpetra::createUniformContigMap
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createUniformContigMap(const 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.
Tpetra_Details_LocalMap.hpp
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
Tpetra::Map::replaceCommWithSubset
Teuchos::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.
Definition: Tpetra_Map_def.hpp:1821
Tpetra::Map::isLocallyFitted
bool isLocallyFitted(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is locally fitted to this Map.
Definition: Tpetra_Map_def.hpp:1461
Tpetra_Map_fwd.hpp
Forward declaration of Tpetra::Map.
Tpetra::Map::getMinLocalIndex
LocalOrdinal getMinLocalIndex() const
The minimum local index.
Definition: Tpetra_Map_decl.hpp:636
Tpetra::Map::removeEmptyProcesses
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Advanced methods.
Definition: Tpetra_Map_def.hpp:1932
Tpetra::Details::MapCloner
Implementation detail of Map::clone().
Definition: Tpetra_Map_decl.hpp:68
Tpetra::Map::operator!=
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.
Definition: Tpetra_Map_decl.hpp:1652
Tpetra::Map::getMaxLocalIndex
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
Definition: Tpetra_Map_decl.hpp:650
Tpetra::Map::getNodeElementList
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a NONOWNING view of the global indices owned by this process.
Definition: Tpetra_Map_def.hpp:1650
Tpetra::createContigMap
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createContigMap(const global_size_t numElements, const size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map using the defaul...
Tpetra::Map< LO, GO, NT >::device_type
typename Node::device_type device_type
This class' Kokkos::Device specialization.
Definition: Tpetra_Map_decl.hpp:262
Tpetra::Map::getGlobalElement
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
Definition: Tpetra_Map_def.hpp:1246
Tpetra::Map::~Map
virtual ~Map()
Destructor (virtual for memory safety of derived classes).
Definition: Tpetra_Map_def.hpp:1155
Tpetra_Directory_fwd.hpp
Forward declaration of Tpetra::Directory.
Tpetra::Map::isNodeGlobalElement
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is owned by this Map on the calling process.
Definition: Tpetra_Map_def.hpp:1278
Tpetra::Map::getMaxGlobalIndex
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
Definition: Tpetra_Map_decl.hpp:672
Tpetra::Map
A parallel distribution of indices over processes.
Definition: Tpetra_Map_decl.hpp:246
Tpetra::Map< LO, GO, NT >::memory_space
typename device_type::memory_space memory_space
The Kokkos memory space.
Definition: Tpetra_Map_decl.hpp:268
Tpetra::createLocalMap
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createLocalMap(const size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a locally replicated Map with the default Kokkos Node.
Tpetra::createUniformContigMapWithNode
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMapWithNode(const global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member constructor for a uniformly distributed, contiguous Map with a user-specified Kokkos Node.
Tpetra::Map::isSameAs
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Definition: Tpetra_Map_def.hpp:1506
Details
Implementation details of Tpetra.
Tpetra::Map< LO, GO, NT >::node_type
NT node_type
Legacy typedef that will go away at some point.
Definition: Tpetra_Map_decl.hpp:271
Tpetra::Map::getMinAllGlobalIndex
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
Definition: Tpetra_Map_decl.hpp:681
Tpetra::createLocalMapWithNode
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(const size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a locally replicated Map with a specified Kokkos Node.
Tpetra::createNonContigMapWithNode
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createNonContigMapWithNode(const Teuchos::ArrayView< const GlobalOrdinal > &elementList, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a noncontiguous Map with a user-specified, possibly nondefault Kokkos Node ...
Tpetra::createNonContigMap
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createNonContigMap(const Teuchos::ArrayView< const GlobalOrdinal > &elementList, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a non-contiguous Map using the default Kokkos::Device type.
Tpetra::Map::Map
Map(Map< local_ordinal_type, global_ordinal_type, node_type > &&)=default
Move constructor (shallow move).
Tpetra::LocalGlobal
LocalGlobal
Enum for local versus global allocation of Map entries.
Definition: Tpetra_ConfigDefs.hpp:118
Tpetra::Map::getNodeNumElements
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Definition: Tpetra_Map_decl.hpp:618
Tpetra::Map::getLocalMap
local_map_type getLocalMap() const
Get the local Map for Kokkos kernels.
Definition: Tpetra_Map_def.hpp:1297
Tpetra::Map::getComm
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
Definition: Tpetra_Map_def.hpp:2102
Tpetra::Map::describe
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Describe this object in a human-readable way to the given output stream.
Definition: Tpetra_Map_def.hpp:1746
Tpetra::Map::getGlobalNumElements
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Definition: Tpetra_Map_decl.hpp:609
Tpetra::Map< LO, GO, NT >::execution_space
typename device_type::execution_space execution_space
The Kokkos execution space.
Definition: Tpetra_Map_decl.hpp:265
Tpetra::LookupStatus
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
Definition: Tpetra_ConfigDefs.hpp:124
Tpetra::Map::getLocalElement
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
Definition: Tpetra_Map_def.hpp:1223
Tpetra::Map::operator=
Map & operator=(const Map< local_ordinal_type, global_ordinal_type, node_type > &)=default
Copy assigment (shallow copy).
Tpetra::Map::getMyGlobalIndices
global_indices_array_type getMyGlobalIndices() const
Return a view of the global indices owned by this process.
Definition: Tpetra_Map_def.hpp:1599
Tpetra::Map::isUniform
bool isUniform() const
Whether the range of global indices is uniform.
Definition: Tpetra_Map_def.hpp:1284
Tpetra::Map::getRemoteIndexList
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.
Definition: Tpetra_Map_def.hpp:2041
Tpetra::Map::Map
Map(const Map< local_ordinal_type, global_ordinal_type, node_type > &)=default
Copy constructor (shallow copy).
Tpetra::Map::getMaxAllGlobalIndex
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
Definition: Tpetra_Map_decl.hpp:690
Tpetra::Map::description
std::string description() const
Implementation of Teuchos::Describable.
Definition: Tpetra_Map_def.hpp:1675
Tpetra::Map::operator==
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.
Definition: Tpetra_Map_decl.hpp:1645
Tpetra::Map::isNodeLocalElement
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on the calling process.
Definition: Tpetra_Map_def.hpp:1266
Tpetra::Map::isCompatible
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Definition: Tpetra_Map_def.hpp:1308
Tpetra::createContigMapWithNode
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createContigMapWithNode(const global_size_t numElements, const size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Nonmember constructor for a (potentially) nonuniformly distributed, contiguous Map for a user-specifi...
Tpetra::Map::isContiguous
bool isContiguous() const
True if this Map is distributed contiguously, else false.
Definition: Tpetra_Map_def.hpp:1289
Tpetra::global_size_t
size_t global_size_t
Global size_t object.
Definition: Tpetra_ConfigDefs.hpp:109
Tpetra::Details::LocalMap
"Local" part of Map suitable for Kokkos kernels.
Definition: Tpetra_Details_LocalMap.hpp:71
Tpetra::Map< LO, GO, NT >::global_ordinal_type
GO global_ordinal_type
The type of global indices.
Definition: Tpetra_Map_decl.hpp:255
Tpetra
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Tpetra::deep_copy
void deep_copy(MultiVector< DS, DL, DG, DN > &dst, const MultiVector< SS, SL, SG, SN > &src)
Copy the contents of the MultiVector src into dst.
Definition: Tpetra_MultiVector_decl.hpp:2557
Tpetra::Map::locallySameAs
bool locallySameAs(const Map< LocalOrdinal, GlobalOrdinal, node_type > &map) const
Is this Map locally the same as the input Map?
Definition: Tpetra_Map_def.hpp:1374
Tpetra::Map< LO, GO, NT >::local_ordinal_type
LO local_ordinal_type
The type of local indices.
Definition: Tpetra_Map_decl.hpp:252
Tpetra_TieBreak_fwd.hpp
Forward declaration for Tpetra::TieBreak.
Tpetra::Map::getIndexBase
GlobalOrdinal getIndexBase() const
The index base for this Map.
Definition: Tpetra_Map_decl.hpp:627
Tpetra::Map::isDistributed
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
Definition: Tpetra_Map_def.hpp:1670