Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_Map_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_MAP_DECL_HPP
11#define XPETRA_MAP_DECL_HPP
12
13#include "Xpetra_ConfigDefs.hpp"
14
15#include <Tpetra_KokkosCompat_DefaultNode.hpp>
16#include <Teuchos_Describable.hpp>
17
18#ifdef HAVE_XPETRA_EPETRA
19#include "Epetra_config.h"
20#endif
21
22#ifdef HAVE_XPETRA_TPETRA
23#include <Tpetra_Map.hpp>
24#endif
25
26namespace Xpetra {
27
28// TODO move this typedef to another place
29// Node which is used for Epetra. This can be either the
30// Serial node or OpenMP node (but not both)
31#ifdef HAVE_XPETRA_EPETRA
32#ifdef EPETRA_HAVE_OMP
33typedef Tpetra::KokkosCompat::KokkosOpenMPWrapperNode EpetraNode;
34#else
35typedef Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode;
36#endif
37#endif
38
44
45template <class LocalOrdinal,
46 class GlobalOrdinal,
47 class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
48class Map
49 : public Teuchos::Describable {
50 public:
51 typedef LocalOrdinal local_ordinal_type;
52 typedef GlobalOrdinal global_ordinal_type;
53 typedef Node node_type;
54
55 typedef Kokkos::View<const global_ordinal_type *, typename Node::device_type> global_indices_array_device_type;
56
58
59
61 virtual ~Map();
62
64
66
67
70
72 virtual size_t getLocalNumElements() const = 0;
73
75 virtual GlobalOrdinal getIndexBase() const = 0;
76
78 virtual LocalOrdinal getMinLocalIndex() const = 0;
79
81 virtual LocalOrdinal getMaxLocalIndex() const = 0;
82
84 virtual GlobalOrdinal getMinGlobalIndex() const = 0;
85
87 virtual GlobalOrdinal getMaxGlobalIndex() const = 0;
88
90 virtual GlobalOrdinal getMinAllGlobalIndex() const = 0;
91
93 virtual GlobalOrdinal getMaxAllGlobalIndex() const = 0;
94
96 virtual LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const = 0;
97
99 virtual GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const = 0;
100
103 const Teuchos::ArrayView<int> &nodeIDList,
104 const Teuchos::ArrayView<LocalOrdinal> &LIDList) const = 0;
105
108 const Teuchos::ArrayView<int> &nodeIDList) const = 0;
109
112
115
117
119
120
122 virtual bool isNodeLocalElement(LocalOrdinal localIndex) const = 0;
123
125 virtual bool isNodeGlobalElement(GlobalOrdinal globalIndex) const = 0;
126
128 virtual bool isContiguous() const = 0;
129
131 virtual bool isDistributed() const = 0;
132
134 virtual bool isCompatible(const Map<LocalOrdinal, GlobalOrdinal, Node> &map) const = 0;
135
137 virtual bool isSameAs(const Map<LocalOrdinal, GlobalOrdinal, Node> &map) const = 0;
138
140
142
143
146
148
150
151
153 virtual std::string description() const = 0;
154
158
160
162
163
166
169 replaceCommWithSubset(const Teuchos::RCP<const Teuchos::Comm<int> > &newComm) const = 0;
170
172
174
175
177 virtual UnderlyingLib lib() const = 0;
178
179 // TODO: find a better solution for this hack
180 // The problem is that EpetraMap, TpetraMap and StridedMap all inherit Map. To have proper toEpetra() we
181 // need to understand the type of underlying matrix. But in src/Map we have no knowledge of StridedMaps, so
182 // we cannot check for it by casting. This function allows us to avoid the restriction, as StridedMap redefines
183 // it to return the base map.
185
186#ifdef HAVE_XPETRA_TPETRA
187 typedef typename Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node>::local_map_type local_map_type;
188
190 virtual local_map_type getLocalMap() const = 0;
191#endif
192
194
195}; // Map class
196
197} // namespace Xpetra
198
199#define XPETRA_MAP_SHORT
200#endif // XPETRA_MAP_DECL_HPP
static const EVerbosityLevel verbLevel_default
virtual GlobalOrdinal getMaxGlobalIndex() const =0
The maximum global index owned by the calling process.
virtual LocalOrdinal getMinLocalIndex() const =0
The minimum local index.
GlobalOrdinal global_ordinal_type
virtual GlobalOrdinal getIndexBase() const =0
The index base for this Map.
Kokkos::View< const global_ordinal_type *, typename Node::device_type > global_indices_array_device_type
virtual bool isDistributed() const =0
Whether this Map is globally distributed or locally replicated.
virtual local_map_type getLocalMap() const =0
Get the local Map for Kokkos kernels.
virtual UnderlyingLib lib() const =0
Get the library used by this object (Tpetra or Epetra?)
virtual RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > removeEmptyProcesses() const =0
Return a new Map with processes with zero elements removed.
virtual bool isNodeGlobalElement(GlobalOrdinal globalIndex) const =0
Whether the given global index is valid for this Map on this process.
Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node >::local_map_type local_map_type
virtual global_size_t getGlobalNumElements() const =0
The number of elements in this Map.
virtual bool isContiguous() const =0
True if this Map is distributed contiguously, else false.
virtual GlobalOrdinal getMinAllGlobalIndex() const =0
The minimum global index over all processes in the communicator.
virtual RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > replaceCommWithSubset(const Teuchos::RCP< const Teuchos::Comm< int > > &newComm) const =0
Replace this Map's communicator with a subset communicator.
virtual GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const =0
The global index corresponding to the given local index.
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
virtual LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const =0
The local index corresponding to the given global index.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const =0
Print this object with the given verbosity level to the given Teuchos::FancyOStream.
virtual LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList) const =0
Return the process ranks for the given global indices.
virtual LocalOrdinal getMaxLocalIndex() const =0
The maximum local index on the calling process.
virtual ~Map()
Destructor.
virtual GlobalOrdinal getMaxAllGlobalIndex() const =0
The maximum global index over all processes in the communicator.
virtual std::string description() const =0
Return a simple one-line description of this object.
LocalOrdinal local_ordinal_type
virtual size_t getLocalNumElements() const =0
The number of elements belonging to the calling process.
virtual bool isCompatible(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const =0
True if and only if map is compatible with this Map.
virtual bool isSameAs(const Map< LocalOrdinal, GlobalOrdinal, Node > &map) const =0
True if and only if map is identical to this Map.
virtual GlobalOrdinal getMinGlobalIndex() const =0
The minimum global index owned by the calling process.
virtual bool isNodeLocalElement(LocalOrdinal localIndex) const =0
Whether the given local index is valid for this Map on this process.
virtual global_indices_array_device_type getMyGlobalIndicesDevice() const =0
Return a view of the global indices owned by this process on the Map's device.
virtual Teuchos::ArrayView< const GlobalOrdinal > getLocalElementList() const =0
Return a view of the global indices owned by this process.
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const =0
Get this Map's Comm object.
virtual LookupStatus getRemoteIndexList(const Teuchos::ArrayView< const GlobalOrdinal > &GIDList, const Teuchos::ArrayView< int > &nodeIDList, const Teuchos::ArrayView< LocalOrdinal > &LIDList) const =0
Return the process ranks and corresponding local indices for the given global indices.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
size_t global_size_t
Global size_t object.