Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_TpetraExport_def.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_TPETRAEXPORT_DEF_HPP
11#define XPETRA_TPETRAEXPORT_DEF_HPP
12
14#include "Tpetra_Distributor.hpp"
15
16namespace Xpetra {
17
18template <class LocalOrdinal, class GlobalOrdinal, class Node>
21 const Teuchos::RCP<const map_type>& target)
22 : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(source), toTpetra(target)))) {
23}
24
25template <class LocalOrdinal, class GlobalOrdinal, class Node>
28 const Teuchos::RCP<const map_type>& target,
30 : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(source), toTpetra(target), plist))) {
31}
32
33template <class LocalOrdinal, class GlobalOrdinal, class Node>
36 : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rhs)))) {
37}
38
39template <class LocalOrdinal, class GlobalOrdinal, class Node>
43
44template <class LocalOrdinal, class GlobalOrdinal, class Node>
45size_t
47 getNumSameIDs() const {
48 XPETRA_MONITOR("TpetraExport::getNumSameIDs");
49 return export_->getNumSameIDs();
50}
51
52template <class LocalOrdinal, class GlobalOrdinal, class Node>
53size_t
55 getNumPermuteIDs() const {
56 XPETRA_MONITOR("TpetraExport::getNumPermuteIDs");
57 return export_->getNumPermuteIDs();
58}
59
60template <class LocalOrdinal, class GlobalOrdinal, class Node>
63 getPermuteFromLIDs() const {
64 XPETRA_MONITOR("TpetraExport::getPermuteFromLIDs");
65 return export_->getPermuteFromLIDs();
66}
67
68template <class LocalOrdinal, class GlobalOrdinal, class Node>
71 getPermuteToLIDs() const {
72 XPETRA_MONITOR("TpetraExport::getPermuteToLIDs");
73 return export_->getPermuteToLIDs();
74}
75
76template <class LocalOrdinal, class GlobalOrdinal, class Node>
77size_t
79 getNumRemoteIDs() const {
80 XPETRA_MONITOR("TpetraExport::getNumRemoteIDs");
81 return export_->getNumRemoteIDs();
82}
83
84template <class LocalOrdinal, class GlobalOrdinal, class Node>
87 getRemoteLIDs() const {
88 XPETRA_MONITOR("TpetraExport::getRemoteLIDs");
89 return export_->getRemoteLIDs();
90}
91
92template <class LocalOrdinal, class GlobalOrdinal, class Node>
93size_t
95 getNumExportIDs() const {
96 XPETRA_MONITOR("TpetraExport::getNumExportIDs");
97 return export_->getNumExportIDs();
98}
99
100template <class LocalOrdinal, class GlobalOrdinal, class Node>
103 getExportLIDs() const {
104 XPETRA_MONITOR("TpetraExport::getExportLIDs");
105 return export_->getExportLIDs();
106}
107
108template <class LocalOrdinal, class GlobalOrdinal, class Node>
111 getExportPIDs() const {
112 XPETRA_MONITOR("TpetraExport::getExportPIDs");
113 return export_->getExportPIDs();
114}
115
116template <class LocalOrdinal, class GlobalOrdinal, class Node>
119 getSourceMap() const {
120 XPETRA_MONITOR("TpetraExport::getSourceMap");
121 return toXpetra(export_->getSourceMap());
122}
123
124template <class LocalOrdinal, class GlobalOrdinal, class Node>
127 getTargetMap() const {
128 XPETRA_MONITOR("TpetraExport::getTargetMap");
129 return toXpetra(export_->getTargetMap());
130}
131
132template <class LocalOrdinal, class GlobalOrdinal, class Node>
135 XPETRA_MONITOR("TpetraExport::setDistributorParameters");
136 export_->getDistributor().setParameterList(params);
137 auto revDistor = export_->getDistributor().getReverse(false);
138 if (!revDistor.is_null())
139 revDistor->setParameterList(params);
140}
141
142template <class LocalOrdinal, class GlobalOrdinal, class Node>
144 print(std::ostream& os) const {
145 XPETRA_MONITOR("TpetraExport::print");
146 export_->print(os);
147}
148
149template <class LocalOrdinal, class GlobalOrdinal, class Node>
152 const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp)
153 : export_(exp) {
154}
155
156template <class LocalOrdinal, class GlobalOrdinal, class Node>
162
163#ifdef HAVE_XPETRA_EPETRA
164
165#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
166
167// stub implementation for GO=int and NO=EpetraNode
168template <>
169class TpetraExport<int, int, EpetraNode>
170 : public Export<int, int, EpetraNode> {
171 public:
172 typedef int LocalOrdinal;
173 typedef int GlobalOrdinal;
175
178
180
181
189
199
207
210
212
214
215
217 size_t getNumSameIDs() const { return 0; }
218
220 size_t getNumPermuteIDs() const { return 0; }
221
224
227
229 size_t getNumRemoteIDs() const { return 0; }
230
233
235 size_t getNumExportIDs() const { return 0; }
236
239
242
245
248
251
253
255
256
258 void print(std::ostream& os) const { /* noop */
259 }
260
262
264
265
267 TpetraExport(const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp) {
270 "int",
271 typeid(EpetraNode).name());
272 }
273
275
277
278}; // TpetraExport class (specialization for LO=GO=int)
279#endif // #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT)))
280
281#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
282
283// stub implementation for GO=long long and NO=EpetraNode
284template <>
285class TpetraExport<int, long long, EpetraNode>
286 : public Export<int, long long, EpetraNode> {
287 public:
288 typedef int LocalOrdinal;
289 typedef long long GlobalOrdinal;
291
294
296
297
305
315
323
326
328
330
331
333 size_t getNumSameIDs() const { return 0; }
334
336 size_t getNumPermuteIDs() const { return 0; }
337
340
343
345 size_t getNumRemoteIDs() const { return 0; }
346
349
351 size_t getNumExportIDs() const { return 0; }
352
355
358
361
364
367
369
371
372
374 void print(std::ostream& os) const { /* noop */
375 }
376
378
380
381
383 TpetraExport(const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp) {
386 "long long",
387 typeid(EpetraNode).name());
388 }
389
391
393
394}; // TpetraExport class (specialization for GO=long long, NO=EpetraNode)
395#endif // #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG)))
396
397#endif // HAVE_XPETRA_EPETRA
398
399} // namespace Xpetra
400
401#endif // XPETRA_TPETRAEXPORT_DEF_HPP
#define XPETRA_MONITOR(funcName)
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
void print(std::ostream &os) const
Print the Export's data to the given output stream.
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
TpetraExport(const RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > > &exp)
TpetraExport constructor to wrap a Tpetra::Export object.
TpetraExport(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target)
Construct a Export object from the source and target Map.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
TpetraExport(const Export< LocalOrdinal, GlobalOrdinal, Node > &rhs)
Copy constructor.
ArrayView< const LocalOrdinal > getPermuteFromLIDs() const
List of local IDs in the source Map that are permuted.
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
ArrayView< const LocalOrdinal > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Export() const
ArrayView< const LocalOrdinal > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
void setDistributorParameters(const Teuchos::RCP< Teuchos::ParameterList > params) const
Set parameters on the underlying object.
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
TpetraExport(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target, const Teuchos::RCP< Teuchos::ParameterList > &plist)
Constructor (with list of parameters).
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const
The target Map used to construct this Export.
size_t getNumSameIDs() const
Number of initial identical IDs.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The source Map used to construct this Export.
ArrayView< const LocalOrdinal > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Export() const
TpetraExport(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target, const Teuchos::RCP< Teuchos::ParameterList > &plist)
Constructor (with list of parameters).
size_t getNumSameIDs() const
Number of initial identical IDs.
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
void print(std::ostream &os) const
Print the Export's data to the given output stream.
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
ArrayView< const LocalOrdinal > getPermuteFromLIDs() const
List of local IDs in the source Map that are permuted.
ArrayView< const LocalOrdinal > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const
The target Map used to construct this Export.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The source Map used to construct this Export.
TpetraExport(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target)
Construct a Export object from the source and target Map.
void setDistributorParameters(const Teuchos::RCP< Teuchos::ParameterList > params) const
Set parameters on the underlying object.
TpetraExport(const RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > > &exp)
TpetraExport constructor to wrap a Tpetra::Export object.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
TpetraExport(const Export< LocalOrdinal, GlobalOrdinal, Node > &rhs)
Copy constructor.
ArrayView< const LocalOrdinal > getPermuteFromLIDs() const
List of local IDs in the source Map that are permuted.
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
void setDistributorParameters(const Teuchos::RCP< Teuchos::ParameterList > params) const
Set distributor parameters.
ArrayView< const LocalOrdinal > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The source Map used to construct this Export.
size_t getNumSameIDs() const
Number of initial identical IDs.
ArrayView< const LocalOrdinal > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const
The target Map used to construct this Export.
ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Export() const
void print(std::ostream &os) const
Print the Export's data to the given output stream.
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
TpetraExport(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target)
Construct a Export object from the source and target Map.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)