Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_TpetraMap_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Xpetra: A linear algebra interface package
4//
5// Copyright 2012 NTESS and the Xpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef XPETRA_TPETRAMAP_DECL_HPP
11#define XPETRA_TPETRAMAP_DECL_HPP
12
13/* this file is automatically generated - do not edit (see script/tpetra.py) */
14
16
17#include <Tpetra_Map.hpp>
18
19#include "Xpetra_Map_decl.hpp"
20#include "Xpetra_Utils.hpp"
21
22#include "Xpetra_Exceptions.hpp"
23
24namespace Xpetra {
25
26template <class LocalOrdinal, class GlobalOrdinal, class Node>
27const RCP<Map<LocalOrdinal, GlobalOrdinal, Node> > toXpetraNonConst(const RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > &map);
28
29template <class LocalOrdinal,
30 class GlobalOrdinal,
31 class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
33 : public virtual Map<LocalOrdinal, GlobalOrdinal, Node> {
34 public:
36
38
39
41
42 TpetraMap(global_size_t numGlobalElements,
43 GlobalOrdinal indexBase,
44 const Teuchos::RCP<const Teuchos::Comm<int> > &comm,
46
48
49 TpetraMap(global_size_t numGlobalElements,
50 size_t numLocalElements,
51 GlobalOrdinal indexBase,
52 const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
53
55
56 TpetraMap(global_size_t numGlobalElements,
58 GlobalOrdinal indexBase,
59 const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
60
62 TpetraMap(global_size_t numGlobalElements,
63 const Kokkos::View<const GlobalOrdinal *, typename Node::device_type> &indexList,
64 GlobalOrdinal indexBase,
65 const Teuchos::RCP<const Teuchos::Comm<int> > &comm);
66
68 ~TpetraMap();
69
71
72
75
77 size_t getLocalNumElements() const;
78
80 GlobalOrdinal getIndexBase() const;
81
83 LocalOrdinal getMinLocalIndex() const;
84
86 LocalOrdinal getMaxLocalIndex() const;
87
89 GlobalOrdinal getMinGlobalIndex() const;
90
92 GlobalOrdinal getMaxGlobalIndex() const;
93
95 GlobalOrdinal getMinAllGlobalIndex() const;
96
98 GlobalOrdinal getMaxAllGlobalIndex() const;
99
101 LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const;
102
104 GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const;
105
108
111
114
117
119
121
122
124 bool isNodeLocalElement(LocalOrdinal localIndex) const;
125
127 bool isNodeGlobalElement(GlobalOrdinal globalIndex) const;
128
130 bool isContiguous() const;
131
133 bool isDistributed() const;
134
137
140
142
144
145
148
150
152
153
155 std::string description() const;
156
159
162
164
166
167
170
172 UnderlyingLib lib() const;
173
176
180
182
183 protected:
185
186}; // TpetraMap class
187
188template <class LocalOrdinal, class GlobalOrdinal, class Node>
190 // TODO: throw exception
192 return *tpetraMap.getTpetra_Map();
193}
194
195template <class LocalOrdinal, class GlobalOrdinal, class Node>
198 if (map != Teuchos::null) {
199 XPETRA_RCP_DYNAMIC_CAST(const TpetraMapClass, map->getMap(), tpetraMap, "toTpetra");
200 return tpetraMap->getTpetra_Map();
201 }
202 return Teuchos::null;
203}
204
205// In some cases (for instance, in MueLu adapter to Tpetra operator), we need to return a reference. This is only possible if
206// we assume that the map argument is nonzero
207template <class LocalOrdinal, class GlobalOrdinal, class Node>
209 TEUCHOS_TEST_FOR_EXCEPTION(map.is_null(), std::invalid_argument, "map must be nonzero");
211 XPETRA_RCP_DYNAMIC_CAST(const TpetraMapClass, map->getMap(), tpetraMap, "toTpetra");
212 return tpetraMap->getTpetra_Map();
213}
214
215template <class LocalOrdinal, class GlobalOrdinal, class Node>
217 if (!map.is_null())
219
220 return Teuchos::null;
221}
222
223template <class LocalOrdinal, class GlobalOrdinal, class Node>
225 if (!map.is_null())
227
228 return Teuchos::null;
229}
230
231namespace useTpetra {
232
234template <class LocalOrdinal, class GlobalOrdinal, class Node>
236createLocalMapWithNode(size_t numElements, const Teuchos::RCP<const Teuchos::Comm<int> > &comm) {
237 XPETRA_MONITOR("useTpetra::createLocalMapWithNode");
238
239 return rcp(new TpetraMap<LocalOrdinal, GlobalOrdinal, Node>(Tpetra::createLocalMapWithNode<LocalOrdinal, GlobalOrdinal, Node>(numElements, comm)));
240}
241
243template <class LocalOrdinal, class GlobalOrdinal>
245createContigMap(global_size_t numElements, size_t localNumElements, const Teuchos::RCP<const Teuchos::Comm<int> > &comm) {
246 XPETRA_MONITOR("useTpetra::createContigMap");
247
248 return rcp(new TpetraMap<LocalOrdinal, GlobalOrdinal, typename Tpetra::Map<>::node_type>(Tpetra::createContigMap<LocalOrdinal, GlobalOrdinal, typename Tpetra::Map<>::node_type>(numElements, localNumElements, comm)));
249}
250
252template <class LocalOrdinal, class GlobalOrdinal, class Node>
254createContigMapWithNode(global_size_t numElements, size_t localNumElements,
255 const Teuchos::RCP<const Teuchos::Comm<int> > &comm) {
256 XPETRA_MONITOR("useTpetra::createContigMap");
257 return rcp(new TpetraMap<LocalOrdinal, GlobalOrdinal, Node>(Tpetra::createContigMapWithNode<LocalOrdinal, GlobalOrdinal, Node>(numElements, localNumElements, comm)));
258}
259} // namespace useTpetra
260
261#define XPETRA_TPETRAMAP_SHORT
262} // namespace Xpetra
263#endif // XPETRA_TPETRAMAP_DECL_HPP
#define XPETRA_MONITOR(funcName)
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
static const EVerbosityLevel verbLevel_default
Kokkos::View< const global_ordinal_type *, typename Node::device_type > global_indices_array_device_type
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
bool isDistributed() const
Whether this Map is globally distributed or locally replicated.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const
The local index corresponding to the given global index.
LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const
Return the process IDs and corresponding local IDs for the given global IDs.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print this object with the given verbosity level to the given FancyOStream.
GlobalOrdinal getMaxAllGlobalIndex() const
The maximum global index over all processes in the communicator.
std::string description() const
Return a simple one-line description of this object.
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Teuchos::ArrayView< const GlobalOrdinal > getLocalElementList() const
Return a view of the global indices owned by this node.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > map_
size_t getLocalNumElements() const
The number of elements belonging to the calling node.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
typename Map< LocalOrdinal, GlobalOrdinal, Node >::local_map_type local_map_type
bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is identical to this Map.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Map() const
Get the underlying Tpetra map.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const
Return a new Map with processes with zero elements removed.
GlobalOrdinal getIndexBase() const
The index base for this Map.
GlobalOrdinal getMinGlobalIndex() const
The minimum global index owned by the calling process.
GlobalOrdinal getMinAllGlobalIndex() const
The minimum global index over all processes in the communicator.
local_map_type getLocalMap() const
Get the local Map for Kokkos kernels.
bool isNodeLocalElement(LocalOrdinal localIndex) const
True if the local index is valid for this Map on this node, else false.
LocalOrdinal getMaxLocalIndex() const
The maximum local index on the calling process.
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.
Map< LocalOrdinal, GlobalOrdinal, Node >::global_indices_array_device_type global_indices_array_device_type
bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const
True if and only if map is compatible with this Map.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get this Map's Comm object.
GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const
The global index corresponding to the given local index.
GlobalOrdinal getMaxGlobalIndex() const
The maximum global index owned by the calling process.
LocalOrdinal getMinLocalIndex() const
The minimum local index.
global_indices_array_device_type getMyGlobalIndicesDevice() const
Return a view of the global indices owned by this process.
bool isNodeGlobalElement(GlobalOrdinal globalIndex) const
True if the global index is found in this Map on this node, else false.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal > > createContigMap(const global_size_t numElements, const size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Teuchos::RCP< const TpetraMap< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member function to create a locally replicated Map with a specified node.
Teuchos::RCP< const TpetraMap< LocalOrdinal, GlobalOrdinal, Node > > createContigMapWithNode(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member function to create a (potentially) non-uniform, contiguous Map with a user-specified node.
Teuchos::RCP< const TpetraMap< LocalOrdinal, GlobalOrdinal, typename Tpetra::Map<>::node_type > > createContigMap(global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int > > &comm)
Non-member function to create a (potentially) non-uniform, contiguous Map with the default node.
const RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > toXpetraNonConst(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toXpetra(RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > graph)
size_t global_size_t
Global size_t object.
const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > toTpetraNonZero(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)