Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
286  using local_map_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 typename decltype (lgMap_)::HostMirror lgMapHost_;
1294 #endif
1295 
1297  typedef ::Tpetra::Details::FixedHashTable<GlobalOrdinal, LocalOrdinal, device_type>
1298  global_to_local_table_type;
1299 
1312  global_to_local_table_type glMap_;
1313 
1350  mutable Teuchos::RCP<Directory<LocalOrdinal,GlobalOrdinal,Node> > directory_;
1351 
1352  }; // Map class
1353 
1367  template <class LocalOrdinal, class GlobalOrdinal>
1368  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal> >
1369  createLocalMap (const size_t numElements,
1370  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1371 
1386  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1387  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1388  createLocalMapWithNode (const size_t numElements,
1389  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1390 
1391 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1392  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1393  TPETRA_DEPRECATED
1394  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1395  createLocalMapWithNode (const size_t numElements,
1396  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1397  const Teuchos::RCP<Node>& node);
1398 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1399 
1407  template <class LocalOrdinal, class GlobalOrdinal>
1408  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1409  createUniformContigMap (const global_size_t numElements,
1410  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1411 
1418  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1419  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1420  createUniformContigMapWithNode (const global_size_t numElements,
1421  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1422 
1423 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1424  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1425  TPETRA_DEPRECATED
1426  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1427  createUniformContigMapWithNode (const global_size_t numElements,
1428  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1429  const Teuchos::RCP<Node>& node);
1430 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1431 
1438  template <class LocalOrdinal, class GlobalOrdinal>
1439  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1440  createContigMap (const global_size_t numElements,
1441  const size_t localNumElements,
1442  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1443 
1452  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1453  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1454  createContigMapWithNode (const global_size_t numElements,
1455  const size_t localNumElements,
1456  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1457 
1458 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1459  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1460  TPETRA_DEPRECATED
1461  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1462  createContigMapWithNode (const global_size_t numElements,
1463  const size_t localNumElements,
1464  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1465  const Teuchos::RCP<Node>& node);
1466 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1467 
1474  template <class LocalOrdinal, class GlobalOrdinal>
1475  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1476  createNonContigMap (const Teuchos::ArrayView<const GlobalOrdinal>& elementList,
1477  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1478 
1486  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1487  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1488  createNonContigMapWithNode (const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
1489  const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
1490 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1491  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1492  TPETRA_DEPRECATED
1493  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1494  createNonContigMapWithNode (const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
1495  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
1496  const Teuchos::RCP<Node>& node);
1497 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1498 
1506 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1507  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1508  TPETRA_DEPRECATED
1509  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1510  createWeightedContigMapWithNode (const int thisNodeWeight,
1511  const global_size_t numElements,
1512  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
1513  const Teuchos::RCP<Node>& node = Teuchos::null);
1514 #endif // TPETRA_ENABLE_DEPRECATED_CODE
1515 
1520  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1521  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1522  createOneToOne (const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& M);
1523 
1529  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1530  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1531  createOneToOne(const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &M,
1532  const ::Tpetra::Details::TieBreak<LocalOrdinal,GlobalOrdinal> & tie_break);
1533 
1534 } // namespace Tpetra
1535 
1536 #include "Tpetra_Directory_decl.hpp"
1537 
1538 namespace Tpetra {
1539  namespace Details {
1540 
1541  template<class OutMapType, class InMapType>
1542  OutMapType TPETRA_DEPRECATED
1543  MapCloner<OutMapType, InMapType>::
1544  clone (const InMapType& mapIn,
1545  const Teuchos::RCP<out_node_type>& /* nodeOut */)
1546  {
1547  static_assert (std::is_same<typename OutMapType::local_ordinal_type,
1548  typename InMapType::local_ordinal_type>::value,
1549  "Tpetra::Map clone: The LocalOrdinal template parameter "
1550  "of the input and output Map types must be the same.");
1551  static_assert (std::is_same<typename OutMapType::global_ordinal_type,
1552  typename InMapType::global_ordinal_type>::value,
1553  "Tpetra::Map clone: The GlobalOrdinal template parameter "
1554  "of the input and output Map types must be the same.");
1555  typedef typename OutMapType::local_ordinal_type LO;
1556  typedef typename OutMapType::global_ordinal_type GO;
1557  typedef ::Tpetra::Directory<LO, GO,
1558  typename OutMapType::node_type> out_dir_type;
1559  typedef typename OutMapType::global_to_local_table_type out_table_type;
1560  typedef typename OutMapType::device_type out_device_type;
1561 
1562  OutMapType mapOut; // Make an empty Map.
1563 
1564  // Fill the new Map with (possibly) shallow copies of all of the
1565  // original Map's data. This is safe because Map is immutable,
1566  // so users can't change the original Map.
1567  mapOut.comm_ = mapIn.comm_;
1568  mapOut.indexBase_ = mapIn.indexBase_;
1569  mapOut.numGlobalElements_ = mapIn.numGlobalElements_;
1570  mapOut.numLocalElements_ = mapIn.numLocalElements_;
1571  mapOut.minMyGID_ = mapIn.minMyGID_;
1572  mapOut.maxMyGID_ = mapIn.maxMyGID_;
1573  mapOut.minAllGID_ = mapIn.minAllGID_;
1574  mapOut.maxAllGID_ = mapIn.maxAllGID_;
1575  mapOut.firstContiguousGID_= mapIn.firstContiguousGID_;
1576  mapOut.lastContiguousGID_ = mapIn.lastContiguousGID_;
1577  mapOut.uniform_ = mapIn.uniform_;
1578  mapOut.contiguous_ = mapIn.contiguous_;
1579  mapOut.distributed_ = mapIn.distributed_;
1580  {
1581  // mfh 25 Dec 2015, 11 Jan 2016: We really only need to make a
1582  // deep copy if the two Map types have different memory
1583  // spaces. However, if you're calling clone(), it is likely
1584  // the case that the memory spaces differ, so it doesn't hurt
1585  // to make a deep copy here.
1586  Kokkos::View<GO*, Kokkos::LayoutLeft, out_device_type>
1587  lgMapOut ("lgMap", mapIn.lgMap_.extent (0));
1588  Kokkos::deep_copy (lgMapOut, mapIn.lgMap_);
1589  mapOut.lgMap_ = lgMapOut; // cast to const
1590 
1591  // mfh 11 Apr 2016: We can't just assign mapIn.lgMapHost_ to
1592  // mapOut.lgMapHost_ either. This is because the memory space
1593  // of the host mirror of a CudaUVMSpace View is also
1594  // CudaUVMSpace, but the memory space of the host mirror of a
1595  // HostSpace View is HostSpace. We can't assign one View to
1596  // another View with a different memory space.
1597  //
1598  // What we _can_ do here, though, is avoid a deep_copy in case
1599  // we're not using CUDA, by exploiting host mirrors.
1600 
1601  static_assert (std::is_same<typename decltype (mapOut.lgMapHost_)::array_layout,
1602  typename decltype (mapIn.lgMapHost_)::array_layout>::value,
1603  "mapOut.lgMapHost_ and MapIn.lgMapHost_ do not have the same "
1604  "array_layout. Please report this bug to the Tpetra developers.");
1605 
1606  // lgMapOut is nonconst, so use it here instead of mapOut.lgMap_.
1607  auto lgMapHostOut = Kokkos::create_mirror_view (lgMapOut);
1608  Kokkos::deep_copy (lgMapHostOut, lgMapOut);
1609  mapOut.lgMapHost_ = lgMapHostOut;
1610  }
1611  // This makes a deep copy only if necessary. We could have
1612  // defined operator= to do this, but that would violate
1613  // expectations. (Kokkos::View::operator= only does a shallow
1614  // copy, EVER.)
1615  mapOut.glMap_ = out_table_type (mapIn.glMap_);
1616 
1617  // We could cleverly clone the Directory here if it is
1618  // initialized, but there is no harm in simply creating it
1619  // uninitialized.
1620  mapOut.directory_ = Teuchos::rcp (new out_dir_type ());
1621 
1622  return mapOut;
1623  }
1624  } // namespace Details
1625 
1626 
1627 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1628  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1629  template <class NodeOut>
1630  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> > TPETRA_DEPRECATED
1631  Map<LocalOrdinal,GlobalOrdinal,Node>::
1632  clone (const Teuchos::RCP<NodeOut>& nodeOut) const
1633  {
1634  typedef Map<LocalOrdinal, GlobalOrdinal, Node> in_map_type;
1635  typedef Map<LocalOrdinal, GlobalOrdinal, NodeOut> out_map_type;
1636  typedef Details::MapCloner<out_map_type, in_map_type> cloner_type;
1637  // Copy constructor does a shallow copy.
1638  return Teuchos::rcp (new out_map_type (cloner_type::clone (*this, nodeOut)));
1639  }
1640 #endif
1641 
1642 } // namespace Tpetra
1643 
1646 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1649 { return map1.isSameAs (map2); }
1650 
1653 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1656 { return ! map1.isSameAs (map2); }
1657 
1658 
1659 #endif // TPETRA_MAP_DECL_HPP
bool isLocallyFitted(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is locally fitted to this Map.
LO local_ordinal_type
The type of local indices.
virtual ~Map()
Destructor (virtual for memory safety of derived classes).
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
GO global_ordinal_type
The type of global indices.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is owned by this Map on the calling process.
global_indices_array_type getMyGlobalIndices() const
Return a view of the global indices owned by this process.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
bool isUniform() const
Whether the range of global indices is uniform.
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
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...
GlobalOrdinal getIndexBase() const
The index base for this Map.
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Advanced methods.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
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.
typename device_type::memory_space memory_space
The Kokkos memory space.
bool locallySameAs(const Map< LocalOrdinal, GlobalOrdinal, node_type > &map) const
Is this Map locally the same as the input Map?
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on the calling process.
&quot;Local&quot; part of Map suitable for Kokkos kernels.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
size_t global_size_t
Global size_t object.
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.
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, possibly nondefault Kokkos Node type.
Forward declaration of Tpetra::Directory.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const
Replace this Map&#39;s communicator with a subset communicator.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
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...
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.
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.
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...
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
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.
local_map_type getLocalMap() const
Get the local Map for Kokkos kernels.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a NONOWNING view of the global indices owned by this process.
typename device_type::execution_space execution_space
The Kokkos execution space.
Implementation detail of Map::clone().
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...
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
A parallel distribution of indices over processes.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
bool isOneToOne() const
Whether the Map is one to one.
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.
Map & operator=(const Map< local_ordinal_type, global_ordinal_type, node_type > &)=default
Copy assigment (shallow copy).
typename node_type::device_type device_type
This class&#39; Kokkos::Device specialization.
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.
LocalGlobal
Enum for local versus global allocation of Map entries.
::Tpetra::Details::LocalMap< local_ordinal_type, global_ordinal_type, device_type > local_map_type
Type of the &quot;local&quot; Map.
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.
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 ...
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
node_type node_type
Legacy typedef that will go away at some point.
Forward declaration of Tpetra::Map.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Forward declaration for Tpetra::TieBreak.
std::string description() const
Implementation of Teuchos::Describable.
Map()
Default constructor (that does nothing).