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#include <Tpetra_Map.hpp>
19
20namespace Xpetra {
21
22// TODO move this typedef to another place
23// Node which is used for Epetra. This can be either the
24// Serial node or OpenMP node (but not both)
25
30
31template <class LocalOrdinal,
32 class GlobalOrdinal,
33 class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
34class Map
35 : public Teuchos::Describable {
36 public:
37 typedef LocalOrdinal local_ordinal_type;
38 typedef GlobalOrdinal global_ordinal_type;
39 typedef Node node_type;
40
41 typedef Kokkos::View<const global_ordinal_type *, typename Node::device_type> global_indices_array_device_type;
42
44
45
47 virtual ~Map();
48
50
52
53
56
58 virtual size_t getLocalNumElements() const = 0;
59
61 virtual GlobalOrdinal getIndexBase() const = 0;
62
64 virtual LocalOrdinal getMinLocalIndex() const = 0;
65
67 virtual LocalOrdinal getMaxLocalIndex() const = 0;
68
70 virtual GlobalOrdinal getMinGlobalIndex() const = 0;
71
73 virtual GlobalOrdinal getMaxGlobalIndex() const = 0;
74
76 virtual GlobalOrdinal getMinAllGlobalIndex() const = 0;
77
79 virtual GlobalOrdinal getMaxAllGlobalIndex() const = 0;
80
82 virtual LocalOrdinal getLocalElement(GlobalOrdinal globalIndex) const = 0;
83
85 virtual GlobalOrdinal getGlobalElement(LocalOrdinal localIndex) const = 0;
86
89 const Teuchos::ArrayView<int> &nodeIDList,
90 const Teuchos::ArrayView<LocalOrdinal> &LIDList) const = 0;
91
94 const Teuchos::ArrayView<int> &nodeIDList) const = 0;
95
98
101
103
105
106
108 virtual bool isNodeLocalElement(LocalOrdinal localIndex) const = 0;
109
111 virtual bool isNodeGlobalElement(GlobalOrdinal globalIndex) const = 0;
112
114 virtual bool isContiguous() const = 0;
115
117 virtual bool isDistributed() const = 0;
118
120 virtual bool isCompatible(const Map<LocalOrdinal, GlobalOrdinal, Node> &map) const = 0;
121
123 virtual bool isSameAs(const Map<LocalOrdinal, GlobalOrdinal, Node> &map) const = 0;
124
126
128
129
132
134
136
137
139 virtual std::string description() const = 0;
140
144
146
148
149
152
155 replaceCommWithSubset(const Teuchos::RCP<const Teuchos::Comm<int> > &newComm) const = 0;
156
158
160
161
163 virtual UnderlyingLib lib() const = 0;
164
165 // TODO: find a better solution for this hack
166 // The problem is that EpetraMap, TpetraMap and StridedMap all inherit Map. To have proper toEpetra() we
167 // need to understand the type of underlying matrix. But in src/Map we have no knowledge of StridedMaps, so
168 // we cannot check for it by casting. This function allows us to avoid the restriction, as StridedMap redefines
169 // it to return the base map.
171
173
175 virtual local_map_type getLocalMap() const = 0;
176
178
179}; // Map class
180
181} // namespace Xpetra
182
183#define XPETRA_MAP_SHORT
184#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.
size_t global_size_t
Global size_t object.