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 
257  template <class LocalOrdinal = ::Tpetra::Details::DefaultTypes::local_ordinal_type,
258  class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
260  class Map : public Teuchos::Describable {
261  public:
263 
264 
266  typedef LocalOrdinal local_ordinal_type;
268  typedef GlobalOrdinal global_ordinal_type;
270  typedef Node node_type;
271 
273  typedef typename Node::execution_space execution_space;
275  typedef typename Node::memory_space memory_space;
276 
283  typedef typename Node::device_type device_type;
284 
300 
302 
304 
357  Map (global_size_t numGlobalElements,
358  GlobalOrdinal indexBase,
359  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
360  LocalGlobal lg=GloballyDistributed,
361  const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
362 
401  Map (global_size_t numGlobalElements,
402  size_t numLocalElements,
403  GlobalOrdinal indexBase,
404  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
405  const Teuchos::RCP<Node> &node = defaultArgNode<Node>());
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 
543  Map (const global_size_t numGlobalElements,
544  const Teuchos::ArrayView<const GlobalOrdinal>& indexList,
545  const GlobalOrdinal indexBase,
546  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
547  const Teuchos::RCP<Node>& node = defaultArgNode<Node>());
548 
562  Map ();
563 
565  ~Map ();
566 
568 
570 
575  bool isOneToOne () const;
576 
583  return numGlobalElements_;
584  }
585 
591  size_t getNodeNumElements () const {
592  return numLocalElements_;
593  }
594 
600  GlobalOrdinal getIndexBase () const {
601  return indexBase_;
602  }
603 
609  LocalOrdinal getMinLocalIndex () const {
610  return static_cast<LocalOrdinal> (0);
611  }
612 
623  LocalOrdinal getMaxLocalIndex () const {
624  if (this->getNodeNumElements () == 0) {
625  return Tpetra::Details::OrdinalTraits<LocalOrdinal>::invalid ();
626  } else { // Local indices are always zero-based.
627  return static_cast<LocalOrdinal> (this->getNodeNumElements () - 1);
628  }
629  }
630 
636  GlobalOrdinal getMinGlobalIndex () const {
637  return minMyGID_;
638  }
639 
645  GlobalOrdinal getMaxGlobalIndex () const {
646  return maxMyGID_;
647  }
648 
654  GlobalOrdinal getMinAllGlobalIndex () const {
655  return minAllGID_;
656  }
657 
663  GlobalOrdinal getMaxAllGlobalIndex () const {
664  return maxAllGID_;
665  }
666 
679  LocalOrdinal getLocalElement (GlobalOrdinal globalIndex) const;
680 
689  GlobalOrdinal getGlobalElement (LocalOrdinal localIndex) const;
690 
695  local_map_type getLocalMap () const;
696 
727  getRemoteIndexList (const Teuchos::ArrayView<const GlobalOrdinal>& GIDList,
728  const Teuchos::ArrayView< int>& nodeIDList,
729  const Teuchos::ArrayView< LocalOrdinal>& LIDList) const;
730 
755  getRemoteIndexList (const Teuchos::ArrayView<const GlobalOrdinal> & GIDList,
756  const Teuchos::ArrayView< int> & nodeIDList) const;
757 
758  private:
770  typedef Kokkos::View<const GlobalOrdinal*,
771  Kokkos::LayoutLeft,
772  device_type> global_indices_array_type;
773 
774  public:
794  global_indices_array_type getMyGlobalIndices () const;
795 
806  Teuchos::ArrayView<const GlobalOrdinal> getNodeElementList() const;
807 
809 
811 
818  bool isNodeLocalElement (LocalOrdinal localIndex) const;
819 
826  bool isNodeGlobalElement (GlobalOrdinal globalIndex) const;
827 
834  bool isUniform () const;
835 
847  bool isContiguous () const;
848 
869  bool isDistributed () const;
870 
895  bool isCompatible (const Map<LocalOrdinal,GlobalOrdinal,Node> &map) const;
896 
927  bool isSameAs (const Map<LocalOrdinal,GlobalOrdinal,Node> &map) const;
928 
933  bool locallySameAs (const Map<LocalOrdinal, GlobalOrdinal, node_type>& map) const;
934 
936 
938 
940  Teuchos::RCP<const Teuchos::Comm<int> > getComm () const;
941 
943  Teuchos::RCP<Node> getNode () const;
944 
946 
948 
950  std::string description () const;
951 
973  void
974  describe (Teuchos::FancyOStream &out,
975  const Teuchos::EVerbosityLevel verbLevel =
976  Teuchos::Describable::verbLevel_default) const;
978 
980 
982  template <class NodeOut>
983  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
984  clone (const Teuchos::RCP<NodeOut>& nodeOut) const;
985 
1033  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1034  removeEmptyProcesses () const;
1035 
1063  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
1064  replaceCommWithSubset (const Teuchos::RCP<const Teuchos::Comm<int> >& newComm) const;
1066 
1067  protected:
1068  // This lets other specializations of Map access all of this
1069  // specialization's internal methods and data, so that we can
1070  // implement clone() without exposing the details of Map to users.
1071  template <class LO, class GO, class N> friend class Map;
1072 
1073  private:
1074  template<class OutMapType, class InMapType>
1075  friend struct Details::MapCloner;
1076 
1081  std::string
1082  localDescribeToString (const Teuchos::EVerbosityLevel vl) const;
1083 
1091  void setupDirectory () const;
1092 
1107  bool checkIsDist() const;
1108 
1117  initialNonuniformDebugCheck (const global_size_t numGlobalElements,
1118  const size_t numLocalElements,
1119  const GlobalOrdinal indexBase,
1120  const Teuchos::RCP<const Teuchos::Comm<int> >& comm) const;
1121 
1122  void
1123  initWithNonownedHostIndexList (const global_size_t numGlobalElements,
1124  const Kokkos::View<const GlobalOrdinal*,
1125  Kokkos::LayoutLeft,
1126  Kokkos::HostSpace,
1127  Kokkos::MemoryUnmanaged>& entryList,
1128  const GlobalOrdinal indexBase,
1129  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1130 
1132  Teuchos::RCP<const Teuchos::Comm<int> > comm_;
1133 
1139  Teuchos::RCP<Node> node_;
1140 
1142  GlobalOrdinal indexBase_;
1143 
1146  global_size_t numGlobalElements_;
1147 
1149  size_t numLocalElements_;
1150 
1152  GlobalOrdinal minMyGID_;
1153 
1155  GlobalOrdinal maxMyGID_;
1156 
1159  GlobalOrdinal minAllGID_;
1160 
1163  GlobalOrdinal maxAllGID_;
1164 
1171  GlobalOrdinal firstContiguousGID_;
1172 
1186  GlobalOrdinal lastContiguousGID_;
1187 
1193  bool uniform_;
1194 
1196  bool contiguous_;
1197 
1206  bool distributed_;
1207 
1240  mutable Kokkos::View<const GlobalOrdinal*,
1241  Kokkos::LayoutLeft,
1242  device_type> lgMap_;
1243 
1251  mutable typename decltype (lgMap_)::HostMirror lgMapHost_;
1252 
1256 
1269  global_to_local_table_type glMap_;
1270 
1307  mutable Teuchos::RCP<Directory<LocalOrdinal,GlobalOrdinal,Node> > directory_;
1308 
1309  }; // Map class
1310 
1324  template <class LocalOrdinal, class GlobalOrdinal>
1325  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1326  createLocalMap (const size_t numElements,
1327  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1328 
1345  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1346  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1347  createLocalMapWithNode (const size_t numElements,
1348  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1349  const Teuchos::RCP<Node>& node = Teuchos::null);
1350 
1358  template <class LocalOrdinal, class GlobalOrdinal>
1359  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal> >
1360  createUniformContigMap (const global_size_t numElements,
1361  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1362 
1369  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1370  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1371  createUniformContigMapWithNode (const global_size_t numElements,
1372  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1373  const Teuchos::RCP<Node>& node = Teuchos::null);
1374 
1383  template <class LocalOrdinal, class GlobalOrdinal>
1384  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1385  createContigMap (const global_size_t numElements,
1386  const size_t localNumElements,
1387  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1388 
1395  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1396  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >
1397  createContigMapWithNode (const global_size_t numElements,
1398  const size_t localNumElements,
1399  const Teuchos::RCP<const Teuchos::Comm<int> >& comm,
1400  const Teuchos::RCP<Node>& node =
1401  defaultArgNode<Node> ());
1402 
1411  template <class LocalOrdinal, class GlobalOrdinal>
1412  Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal> >
1413  createNonContigMap (const Teuchos::ArrayView<const GlobalOrdinal>& elementList,
1414  const Teuchos::RCP<const Teuchos::Comm<int> >& comm);
1415 
1422  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1423  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1424  createNonContigMapWithNode (const Teuchos::ArrayView<const GlobalOrdinal> &elementList,
1425  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
1426  const Teuchos::RCP<Node>& node = Teuchos::null);
1427 
1434  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1435  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1436  createWeightedContigMapWithNode (const int thisNodeWeight,
1437  const global_size_t numElements,
1438  const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
1439  const Teuchos::RCP<Node>& node = Teuchos::null);
1440 
1447  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1448  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1449  createOneToOne (const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &M);
1450 
1458  template<class LocalOrdinal, class GlobalOrdinal, class Node>
1459  Teuchos::RCP< const Map<LocalOrdinal,GlobalOrdinal,Node> >
1460  createOneToOne(const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > &M,
1462 
1463 } // Tpetra namespace
1464 
1465 #include "Tpetra_Directory_decl.hpp"
1466 
1467 namespace Tpetra {
1468  namespace Details {
1469 
1470  template<class OutMapType, class InMapType>
1471  OutMapType
1472  MapCloner<OutMapType, InMapType>::
1473  clone (const InMapType& mapIn,
1474  const Teuchos::RCP<out_node_type>& nodeOut)
1475  {
1476  static_assert (std::is_same<typename OutMapType::local_ordinal_type,
1477  typename InMapType::local_ordinal_type>::value,
1478  "Tpetra::Map clone: The LocalOrdinal template parameter "
1479  "of the input and output Map types must be the same.");
1480  static_assert (std::is_same<typename OutMapType::global_ordinal_type,
1481  typename InMapType::global_ordinal_type>::value,
1482  "Tpetra::Map clone: The GlobalOrdinal template parameter "
1483  "of the input and output Map types must be the same.");
1484  typedef typename OutMapType::local_ordinal_type LO;
1485  typedef typename OutMapType::global_ordinal_type GO;
1486  typedef ::Tpetra::Directory<LO, GO,
1487  typename OutMapType::node_type> out_dir_type;
1488  typedef typename OutMapType::global_to_local_table_type out_table_type;
1489  typedef typename OutMapType::device_type out_device_type;
1490 
1491  OutMapType mapOut; // Make an empty Map.
1492 
1493  // If out_node_type::execution_space hasn't been initialized
1494  // (because nodeOut is null) initialize it now, by letting
1495  // defaultArgNode create the out_node_type instance. Do this
1496  // first, since we'll be creating Kokkos::View instances with
1497  // out_node_type::device_type below, and this requires that
1498  // out_node_type::execution_space be initialized.
1499  mapOut.node_ = nodeOut.is_null () ? defaultArgNode<out_node_type> () : nodeOut;
1500 
1501  // Fill the new Map with (possibly) shallow copies of all of the
1502  // original Map's data. This is safe because Map is immutable,
1503  // so users can't change the original Map.
1504  mapOut.comm_ = mapIn.comm_;
1505  mapOut.indexBase_ = mapIn.indexBase_;
1506  mapOut.numGlobalElements_ = mapIn.numGlobalElements_;
1507  mapOut.numLocalElements_ = mapIn.numLocalElements_;
1508  mapOut.minMyGID_ = mapIn.minMyGID_;
1509  mapOut.maxMyGID_ = mapIn.maxMyGID_;
1510  mapOut.minAllGID_ = mapIn.minAllGID_;
1511  mapOut.maxAllGID_ = mapIn.maxAllGID_;
1512  mapOut.firstContiguousGID_= mapIn.firstContiguousGID_;
1513  mapOut.lastContiguousGID_ = mapIn.lastContiguousGID_;
1514  mapOut.uniform_ = mapIn.uniform_;
1515  mapOut.contiguous_ = mapIn.contiguous_;
1516  mapOut.distributed_ = mapIn.distributed_;
1517  {
1518  // mfh 25 Dec 2015, 11 Jan 2016: We really only need to make a
1519  // deep copy if the two Map types have different memory
1520  // spaces. However, if you're calling clone(), it is likely
1521  // the case that the memory spaces differ, so it doesn't hurt
1522  // to make a deep copy here.
1523  Kokkos::View<GO*, Kokkos::LayoutLeft, out_device_type>
1524  lgMapOut ("lgMap", mapIn.lgMap_.dimension_0 ());
1525  Kokkos::deep_copy (lgMapOut, mapIn.lgMap_);
1526  mapOut.lgMap_ = lgMapOut; // cast to const
1527 
1528  // mfh 11 Apr 2016: We can't just assign mapIn.lgMapHost_ to
1529  // mapOut.lgMapHost_ either. This is because the memory space
1530  // of the host mirror of a CudaUVMSpace View is also
1531  // CudaUVMSpace, but the memory space of the host mirror of a
1532  // HostSpace View is HostSpace. We can't assign one View to
1533  // another View with a different memory space.
1534  //
1535  // What we _can_ do here, though, is avoid a deep_copy in case
1536  // we're not using CUDA, by exploiting host mirrors.
1537 
1538  static_assert (std::is_same<typename decltype (mapOut.lgMapHost_)::array_layout,
1539  typename decltype (mapIn.lgMapHost_)::array_layout>::value,
1540  "mapOut.lgMapHost_ and MapIn.lgMapHost_ do not have the same "
1541  "array_layout. Please report this bug to the Tpetra developers.");
1542 
1543  // lgMapOut is nonconst, so use it here instead of mapOut.lgMap_.
1544  auto lgMapHostOut = Kokkos::create_mirror_view (lgMapOut);
1545  Kokkos::deep_copy (lgMapHostOut, lgMapOut);
1546  mapOut.lgMapHost_ = lgMapHostOut;
1547  }
1548  // This makes a deep copy only if necessary. We could have
1549  // defined operator= to do this, but that would violate
1550  // expectations. (Kokkos::View::operator= only does a shallow
1551  // copy, EVER.)
1552  mapOut.glMap_ = out_table_type (mapIn.glMap_);
1553 
1554  // We could cleverly clone the Directory here if it is
1555  // initialized, but there is no harm in simply creating it
1556  // uninitialized.
1557  mapOut.directory_ = Teuchos::rcp (new out_dir_type ());
1558 
1559  return mapOut;
1560  }
1561  } // namespace Details
1562 
1563 
1564  template <class LocalOrdinal, class GlobalOrdinal, class Node>
1565  template <class NodeOut>
1566  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, NodeOut> >
1568  clone (const Teuchos::RCP<NodeOut>& nodeOut) const
1569  {
1570  typedef Map<LocalOrdinal, GlobalOrdinal, Node> in_map_type;
1571  typedef Map<LocalOrdinal, GlobalOrdinal, NodeOut> out_map_type;
1573  // Copy constructor does a shallow copy.
1574  return Teuchos::rcp (new out_map_type (cloner_type::clone (*this, nodeOut)));
1575  }
1576 
1577  namespace Details {
1596  template <class LocalOrdinal,class GlobalOrdinal, class Node>
1597  bool
1600  } // namespace Details
1601 
1602 } // namespace Tpetra
1603 
1606 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1609 { return map1.isSameAs (map2); }
1610 
1613 template <class LocalOrdinal, class GlobalOrdinal, class Node>
1616 { return ! map1.isSameAs (map2); }
1617 
1618 
1619 #endif // TPETRA_MAP_DECL_HPP
1620 
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.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Node::memory_space memory_space
The Kokkos memory space.
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.
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.
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.
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.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
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.
size_t global_size_t
Global size_t object.
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, 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...
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.
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.
Node::device_type device_type
The Kokkos device type over which to allocate Views and perform work.
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().
A parallel distribution of indices 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.
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 > > 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.
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.