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"
51 #include "Kokkos_DefaultNode.hpp"
52 #include "Kokkos_DualView.hpp"
53 #include "Teuchos_Describable.hpp"
54 
55 namespace Tpetra {
56 
57 #ifndef DOXYGEN_SHOULD_SKIP_THIS
58  // Forward declaration of Directory.
59  template <class LO, class GO, class N> class Directory;
60 #endif // DOXYGEN_SHOULD_SKIP_THIS
61 
62  namespace Details {
63 
64 #ifndef DOXYGEN_SHOULD_SKIP_THIS
65  // Forward declaration of TieBreak
66  template <class LO, class GO> class TieBreak;
67 #endif // DOXYGEN_SHOULD_SKIP_THIS
68 
71  template<class OutMapType, class InMapType>
72  struct MapCloner {
73  typedef typename OutMapType::node_type out_node_type;
74  typedef typename InMapType::node_type in_node_type;
75 
76  static OutMapType
77  clone (const InMapType& mapIn,
78  const Teuchos::RCP<out_node_type>& node2);
79  };
80 
81  } // namespace Details
82 
83  template<class Node>
84  Teuchos::RCP<Node> defaultArgNode() {
85  // Workaround function for a deferred visual studio bug
86  // http://connect.microsoft.com/VisualStudio/feedback/details/719847/erroneous-error-c2783-could-not-deduce-template-argument
87  // Use this function for default arguments rather than calling
88  // what is the return value below. Also helps in reducing
89  // duplication in various constructors.
90  return KokkosClassic::Details::getNode<Node> ();
91  }
92 
242  template <class LocalOrdinal = ::Tpetra::Details::DefaultTypes::local_ordinal_type,
243  class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
245  class Map : public Teuchos::Describable {
246  public:
248 
249 
251  typedef LocalOrdinal local_ordinal_type;
253  typedef GlobalOrdinal global_ordinal_type;
255  typedef Node node_type;
256 
258  typedef typename Node::execution_space execution_space;
260  typedef typename Node::memory_space memory_space;
261 
268  typedef typename Node::device_type device_type;
269 
285 
287 
289 
342  Map (global_size_t numGlobalElements,
343  GlobalOrdinal indexBase,
344  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
345  LocalGlobal lg=GloballyDistributed,
346  const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
347 
386  Map (global_size_t numGlobalElements,
387  size_t numLocalElements,
388  GlobalOrdinal indexBase,
389  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
390  const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
391 
432  Map (const global_size_t numGlobalElements,
433  const Kokkos::View<const GlobalOrdinal*, device_type>& indexList,
434  const GlobalOrdinal indexBase,
435  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
436 
478  Map (const global_size_t numGlobalElements,
479  const GlobalOrdinal indexList[],
480  const LocalOrdinal indexListSize,
481  const GlobalOrdinal indexBase,
482  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
483 
528  Map (const global_size_t numGlobalElements,
529  const Teuchos::ArrayView<const GlobalOrdinal>& indexList,
530  const GlobalOrdinal indexBase,
531  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
532  const Teuchos::RCP<Node>& node = defaultArgNode<Node>());
533 
547  Map ();
548 
550  ~Map ();
551 
553 
555 
560  bool isOneToOne () const;
561 
568  return numGlobalElements_;
569  }
570 
576  size_t getNodeNumElements () const {
577  return numLocalElements_;
578  }
579 
585  GlobalOrdinal getIndexBase () const {
586  return indexBase_;
587  }
588 
594  LocalOrdinal getMinLocalIndex () const {
595  return static_cast<LocalOrdinal> (0);
596  }
597 
608  LocalOrdinal getMaxLocalIndex () const {
609  if (this->getNodeNumElements () == 0) {
611  } else { // Local indices are always zero-based.
612  return static_cast<LocalOrdinal> (this->getNodeNumElements () - 1);
613  }
614  }
615 
621  GlobalOrdinal getMinGlobalIndex () const {
622  return minMyGID_;
623  }
624 
630  GlobalOrdinal getMaxGlobalIndex () const {
631  return maxMyGID_;
632  }
633 
639  GlobalOrdinal getMinAllGlobalIndex () const {
640  return minAllGID_;
641  }
642 
648  GlobalOrdinal getMaxAllGlobalIndex () const {
649  return maxAllGID_;
650  }
651 
664  LocalOrdinal getLocalElement (GlobalOrdinal globalIndex) const;
665 
674  GlobalOrdinal getGlobalElement (LocalOrdinal localIndex) const;
675 
680  local_map_type getLocalMap () const;
681 
712  getRemoteIndexList (const Teuchos::ArrayView<const GlobalOrdinal>& GIDList,
713  const Teuchos::ArrayView< int>& nodeIDList,
714  const Teuchos::ArrayView< LocalOrdinal>& LIDList) const;
715 
740  getRemoteIndexList (const Teuchos::ArrayView<const GlobalOrdinal> & GIDList,
741  const Teuchos::ArrayView< int> & nodeIDList) const;
742 
743  private:
755  typedef Kokkos::View<const GlobalOrdinal*,
756  Kokkos::LayoutLeft,
757  device_type> global_indices_array_type;
758 
759  public:
779  global_indices_array_type getMyGlobalIndices () const;
780 
791  Teuchos::ArrayView<const GlobalOrdinal> getNodeElementList() const;
792 
794 
796 
803  bool isNodeLocalElement (LocalOrdinal localIndex) const;
804 
811  bool isNodeGlobalElement (GlobalOrdinal globalIndex) const;
812 
819  bool isUniform () const;
820 
832  bool isContiguous () const;
833 
854  bool isDistributed () const;
855 
880  bool isCompatible (const Map<LocalOrdinal,GlobalOrdinal,Node> &map) const;
881 
912  bool isSameAs (const Map<LocalOrdinal,GlobalOrdinal,Node> &map) const;
913 
919 
921 
923 
925  Teuchos::RCP<const Teuchos::Comm<int> > getComm () const;
926 
928  Teuchos::RCP<Node> getNode () const;
929 
931 
933 
935  std::string description () const;
936 
958  void
959  describe (Teuchos::FancyOStream &out,
960  const Teuchos::EVerbosityLevel verbLevel =
961  Teuchos::Describable::verbLevel_default) const;
963 
965 
967  template <class NodeOut>
968  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
969  clone (const Teuchos::RCP<NodeOut>& nodeOut) const;
970 
1018  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1019  removeEmptyProcesses () const;
1020 
1048  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1049  replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const;
1051 
1052  protected:
1053  // This lets other specializations of Map access all of this
1054  // specialization's internal methods and data, so that we can
1055  // implement clone() without exposing the details of Map to users.
1056  template <class LO, class GO, class N> friend class Map;
1057 
1058  private:
1059  template<class OutMapType, class InMapType>
1060  friend struct Details::MapCloner;
1061 
1066  std::string
1067  localDescribeToString (const Teuchos::EVerbosityLevel vl) const;
1068 
1076  void setupDirectory () const;
1077 
1092  bool checkIsDist() const;
1093 
1102  initialNonuniformDebugCheck (const global_size_t numGlobalElements,
1103  const size_t numLocalElements,
1104  const GlobalOrdinal indexBase,
1105  const Teuchos::RCP<const Teuchos::Comm<int> >& comm) const;
1106 
1107  void
1108  initWithNonownedHostIndexList (const global_size_t numGlobalElements,
1109  const Kokkos::View<const GlobalOrdinal*,
1110  Kokkos::LayoutLeft,
1111  Kokkos::HostSpace,
1112  Kokkos::MemoryUnmanaged>& entryList,
1113  const GlobalOrdinal indexBase,
1114  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1115 
1117  Teuchos::RCP<const Teuchos::Comm<int> > comm_;
1118 
1124  Teuchos::RCP<Node> node_;
1125 
1127  GlobalOrdinal indexBase_;
1128 
1131  global_size_t numGlobalElements_;
1132 
1134  size_t numLocalElements_;
1135 
1137  GlobalOrdinal minMyGID_;
1138 
1140  GlobalOrdinal maxMyGID_;
1141 
1144  GlobalOrdinal minAllGID_;
1145 
1148  GlobalOrdinal maxAllGID_;
1149 
1156  GlobalOrdinal firstContiguousGID_;
1157 
1171  GlobalOrdinal lastContiguousGID_;
1172 
1178  bool uniform_;
1179 
1181  bool contiguous_;
1182 
1191  bool distributed_;
1192 
1225  mutable Kokkos::View<const GlobalOrdinal*,
1226  Kokkos::LayoutLeft,
1227  device_type> lgMap_;
1228 
1236  mutable typename decltype (lgMap_)::HostMirror lgMapHost_;
1237 
1240  global_to_local_table_type;
1241 
1254  global_to_local_table_type glMap_;
1255 
1292  mutable Teuchos::RCP<Directory<LocalOrdinal,GlobalOrdinal,Node> > directory_;
1293 
1294  }; // Map class
1295 
1309  template <class LocalOrdinal, class GlobalOrdinal>
1310  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1311  createLocalMap (const size_t numElements,
1312  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1313 
1330  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1331  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1332  createLocalMapWithNode (const size_t numElements,
1333  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1334  const Teuchos::RCP<Node>& node = Teuchos::null);
1335 
1343  template <class LocalOrdinal, class GlobalOrdinal>
1344  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1345  createUniformContigMap (const global_size_t numElements,
1346  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1347 
1354  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1355  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1356  createUniformContigMapWithNode (const global_size_t numElements,
1357  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1358  const Teuchos::RCP<Node>& node = Teuchos::null);
1359 
1368  template <class LocalOrdinal, class GlobalOrdinal>
1369  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1370  createContigMap (const global_size_t numElements,
1371  const size_t localNumElements,
1372  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1373 
1380  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1381  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1382  createContigMapWithNode (const global_size_t numElements,
1383  const size_t localNumElements,
1384  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1385  const Teuchos::RCP<Node>& node =
1386  defaultArgNode<Node> ());
1387 
1396  template <class LocalOrdinal, class GlobalOrdinal>
1397  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1398  createNonContigMap (const Teuchos::ArrayView<const GlobalOrdinal>& elementList,
1399  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1400 
1407  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1408  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1409  createNonContigMapWithNode (const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
1410  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
1411  const Teuchos::RCP<Node>& node = Teuchos::null);
1412 
1419  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1420  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1421  createWeightedContigMapWithNode (const int thisNodeWeight,
1422  const global_size_t numElements,
1423  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
1424  const Teuchos::RCP<Node>& node = Teuchos::null);
1425 
1432  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1433  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1434  createOneToOne (const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &M);
1435 
1443  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1444  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1445  createOneToOne(const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &M,
1447 
1448 } // Tpetra namespace
1449 
1450 #include "Tpetra_Directory_decl.hpp"
1451 
1452 namespace Tpetra {
1453  namespace Details {
1454 
1455  template<class OutMapType, class InMapType>
1456  OutMapType
1457  MapCloner<OutMapType, InMapType>::
1458  clone (const InMapType& mapIn,
1459  const Teuchos::RCP<out_node_type>& nodeOut)
1460  {
1461  static_assert (std::is_same<typename OutMapType::local_ordinal_type,
1462  typename InMapType::local_ordinal_type>::value,
1463  "Tpetra::Map clone: The LocalOrdinal template parameter "
1464  "of the input and output Map types must be the same.");
1465  static_assert (std::is_same<typename OutMapType::global_ordinal_type,
1466  typename InMapType::global_ordinal_type>::value,
1467  "Tpetra::Map clone: The GlobalOrdinal template parameter "
1468  "of the input and output Map types must be the same.");
1469  typedef typename OutMapType::local_ordinal_type LO;
1470  typedef typename OutMapType::global_ordinal_type GO;
1471  typedef ::Tpetra::Directory<LO, GO,
1472  typename OutMapType::node_type> out_dir_type;
1473  typedef typename OutMapType::global_to_local_table_type out_table_type;
1474  typedef typename OutMapType::device_type out_device_type;
1475 
1476  OutMapType mapOut; // Make an empty Map.
1477 
1478  // Fill the new Map with (possibly) shallow copies of all of the
1479  // original Map's data. This is safe because Map is immutable,
1480  // so users can't change the original Map.
1481  mapOut.comm_ = mapIn.comm_;
1482  mapOut.indexBase_ = mapIn.indexBase_;
1483  mapOut.numGlobalElements_ = mapIn.numGlobalElements_;
1484  mapOut.numLocalElements_ = mapIn.numLocalElements_;
1485  mapOut.minMyGID_ = mapIn.minMyGID_;
1486  mapOut.maxMyGID_ = mapIn.maxMyGID_;
1487  mapOut.minAllGID_ = mapIn.minAllGID_;
1488  mapOut.maxAllGID_ = mapIn.maxAllGID_;
1489  mapOut.firstContiguousGID_= mapIn.firstContiguousGID_;
1490  mapOut.lastContiguousGID_ = mapIn.lastContiguousGID_;
1491  mapOut.uniform_ = mapIn.uniform_;
1492  mapOut.contiguous_ = mapIn.contiguous_;
1493  mapOut.distributed_ = mapIn.distributed_;
1494  {
1495  // mfh 25 Dec 2015, 11 Jan 2016: We really only need to make a
1496  // deep copy if the two Map types have different memory
1497  // spaces. However, if you're calling clone(), it is likely
1498  // the case that the memory spaces differ, so it doesn't hurt
1499  // to make a deep copy here.
1500  Kokkos::View<GO*, Kokkos::LayoutLeft, out_device_type>
1501  lgMapOut ("lgMap", mapIn.lgMap_.dimension_0 ());
1502  Kokkos::deep_copy (lgMapOut, mapIn.lgMap_);
1503  mapOut.lgMap_ = lgMapOut; // cast to const
1504 
1505  // mfh 11 Apr 2016: We can't just assign mapIn.lgMapHost_ to
1506  // mapOut.lgMapHost_ either. This is because the memory space
1507  // of the host mirror of a CudaUVMSpace View is also
1508  // CudaUVMSpace, but the memory space of the host mirror of a
1509  // HostSpace View is HostSpace. We can't assign one View to
1510  // another View with a different memory space.
1511  //
1512  // What we _can_ do here, though, is avoid a deep_copy in case
1513  // we're not using CUDA, by exploiting host mirrors.
1514 
1515  static_assert (std::is_same<typename decltype (mapOut.lgMapHost_)::array_layout,
1516  typename decltype (mapIn.lgMapHost_)::array_layout>::value,
1517  "mapOut.lgMapHost_ and MapIn.lgMapHost_ do not have the same "
1518  "array_layout. Please report this bug to the Tpetra developers.");
1519 
1520  // lgMapOut is nonconst, so use it here instead of mapOut.lgMap_.
1521  auto lgMapHostOut = Kokkos::create_mirror_view (lgMapOut);
1522  Kokkos::deep_copy (lgMapHostOut, lgMapOut);
1523  mapOut.lgMapHost_ = lgMapHostOut;
1524  }
1525  // This makes a deep copy only if necessary. We could have
1526  // defined operator= to do this, but that would violate
1527  // expectations. (Kokkos::View::operator= only does a shallow
1528  // copy, EVER.)
1529  mapOut.glMap_ = out_table_type (mapIn.glMap_);
1530  // New Map gets the new Node instance.
1531  mapOut.node_ = nodeOut;
1532 
1533  // We could cleverly clone the Directory here if it is
1534  // initialized, but there is no harm in simply creating it
1535  // uninitialized.
1536  mapOut.directory_ = Teuchos::rcp (new out_dir_type ());
1537 
1538  return mapOut;
1539  }
1540  } // namespace Details
1541 
1542 
1543  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1544  template <class NodeOut>
1545  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
1547  clone (const Teuchos::RCP<NodeOut>& nodeOut) const
1548  {
1549  typedef Map<LocalOrdinal, GlobalOrdinal, Node> in_map_type;
1550  typedef Map<LocalOrdinal, GlobalOrdinal, NodeOut> out_map_type;
1552  // Copy constructor does a shallow copy.
1553  return Teuchos::rcp (new out_map_type (cloner_type::clone (*this, nodeOut)));
1554  }
1555 
1556  namespace Details {
1575  template <class LocalOrdinal,class GlobalOrdinal, class Node>
1576  bool
1579  } // namespace Details
1580 
1581 } // namespace Tpetra
1582 
1585 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1588 { return map1.isSameAs (map2); }
1589 
1592 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1595 { return ! map1.isSameAs (map2); }
1596 
1597 
1598 #endif // TPETRA_MAP_DECL_HPP
1599 
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMapWithNode(const global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::null)
Non-member constructor for a uniformly distributed, contiguous Map with a user-specified Kokkos Node...
Interface for breaking ties in ownership.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Node::memory_space memory_space
The Kokkos memory space.
~Map()
Destructor.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
GlobalOrdinal global_ordinal_type
The type of global indices.
KokkosClassic::DefaultNode::DefaultNodeType node_type
Default value of Node template parameter.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
Whether the given global index is owned by this Map on the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(const size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::null)
Nonmember constructor for a locally replicated Map with a specified Kokkos Node.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, NodeOut > > clone(const Teuchos::RCP< NodeOut > &nodeOut) const
Advanced methods.
std::string description() const
Implementation of Teuchos::Describable.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createWeightedContigMapWithNode(const int thisNodeWeight, const global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::null)
Non-member constructor for a contiguous Map with user-defined weights and a user-specified Kokkos Nod...
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
void deep_copy(MultiVector< DS, DL, DG, DN, dstClassic > &dst, const MultiVector< SS, SL, SG, SN, srcClassic > &src)
Copy the contents of the MultiVector src into dst.
local_map_type getLocalMap() const
Get the local Map for Kokkos kernels.
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.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
bool locallySameAs(const Map< LocalOrdinal, GlobalOrdinal, node_type > &map) const
Is this Map locally the same as the input Map?
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
int local_ordinal_type
Default value of LocalOrdinal template parameter.
Details::LocalMap< LocalOrdinal, GlobalOrdinal, device_type > local_map_type
Type of the "local" Map.
"Local" part of Map suitable for Kokkos kernels.
size_t getNodeNumElements() const
The number of elements belonging to the calling process.
Implementation details of Tpetra.
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.
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...
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
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...
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
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, const Teuchos::RCP< Node > &node=defaultArgNode< Node >())
Non-member constructor for a (potentially) non-uniformly distributed, contiguous Map with a user-spec...
Node::execution_space execution_space
The Kokkos execution space.
global_indices_array_type getMyGlobalIndices() const
Return a view of the global indices owned by this process.
bool isOneToOne() const
Whether the Map is one to one.
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 getIndexBase() const
The index base for this Map.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
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.
Node::device_type device_type
The Kokkos device type over which to allocate Views and perform work.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a NONOWNING 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.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
Node node_type
The type of the Kokkos Node.
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 with the default...
bool isLocallyFitted(const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map1, const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map2)
Is map1 locally fitted to map2?
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.
Implementation detail of Map::clone().
Describes a parallel distribution of objects over processes.
Teuchos::RCP< Node > getNode() const
Get this Map&#39;s Node object.
LocalOrdinal local_ordinal_type
The type of local indices.
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createNonContigMap(const Teuchos::ArrayView< const GlobalOrdinal > &elementList, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member constructor for a non-contiguous Map with the default Kokkos Node.
LocalGlobal
Enum for local versus global allocation of Map entries.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on the calling process.
bool isUniform() const
Whether the range of global indices is uniform.
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.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createNonContigMapWithNode(const Teuchos::ArrayView< const GlobalOrdinal > &elementList, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, const Teuchos::RCP< Node > &node=Teuchos::null)
Non-member constructor for a non-contiguous Map with a user-specified Kokkos Node.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
Map()
Default constructor (that does nothing).