Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_TpetraImport_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_TPETRAIMPORT_DEF_HPP
11#define XPETRA_TPETRAIMPORT_DEF_HPP
13
14#include "Xpetra_Import.hpp"
16#include "Xpetra_Exceptions.hpp"
17
18#include "Xpetra_TpetraMap.hpp"
19#include "Tpetra_Import.hpp"
20#include "Tpetra_Distributor.hpp"
21
22namespace Xpetra {
23
24template <class LocalOrdinal, class GlobalOrdinal, class Node>
26 : import_(Teuchos::rcp(new Tpetra::Import<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(source), toTpetra(target)))) {}
27
28template <class LocalOrdinal, class GlobalOrdinal, class Node>
30 : import_(Teuchos::rcp(new Tpetra::Import<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(source), toTpetra(target), plist))) {}
31
32template <class LocalOrdinal, class GlobalOrdinal, class Node>
34 : import_(Teuchos::rcp(new Tpetra::Import<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(import)))) {}
35
36template <class LocalOrdinal, class GlobalOrdinal, class Node>
38
39template <class LocalOrdinal, class GlobalOrdinal, class Node>
45
46template <class LocalOrdinal, class GlobalOrdinal, class Node>
48 XPETRA_MONITOR("TpetraImport::getNumSameIDs");
49 return import_->getNumSameIDs();
50}
51
52template <class LocalOrdinal, class GlobalOrdinal, class Node>
54 XPETRA_MONITOR("TpetraImport::getNumPermuteIDs");
55 return import_->getNumPermuteIDs();
56}
57
58template <class LocalOrdinal, class GlobalOrdinal, class Node>
60 XPETRA_MONITOR("TpetraImport::getPermuteFromLIDs");
61 return import_->getPermuteFromLIDs();
62}
63
64template <class LocalOrdinal, class GlobalOrdinal, class Node>
66 XPETRA_MONITOR("TpetraImport::getPermuteToLIDs");
67 return import_->getPermuteToLIDs();
68}
69
70template <class LocalOrdinal, class GlobalOrdinal, class Node>
72 XPETRA_MONITOR("TpetraImport::getNumRemoteIDs");
73 return import_->getNumRemoteIDs();
74}
75
76template <class LocalOrdinal, class GlobalOrdinal, class Node>
78 XPETRA_MONITOR("TpetraImport::setDistributorParameters");
79 import_->getDistributor().setParameterList(params);
80 auto revDistor = import_->getDistributor().getReverse(false);
81 if (!revDistor.is_null())
82 revDistor->setParameterList(params);
83}
84
85template <class LocalOrdinal, class GlobalOrdinal, class Node>
87 XPETRA_MONITOR("TpetraImport::getRemoteLIDs");
88 return import_->getRemoteLIDs();
89}
90
91template <class LocalOrdinal, class GlobalOrdinal, class Node>
93 XPETRA_MONITOR("TpetraImport::getNumExportIDs");
94 return import_->getNumExportIDs();
95}
96
97template <class LocalOrdinal, class GlobalOrdinal, class Node>
99 XPETRA_MONITOR("TpetraImport::getExportLIDs");
100 return import_->getExportLIDs();
101}
102
103template <class LocalOrdinal, class GlobalOrdinal, class Node>
105 XPETRA_MONITOR("TpetraImport::getExportPIDs");
106 return import_->getExportPIDs();
107}
108
109template <class LocalOrdinal, class GlobalOrdinal, class Node>
114
115template <class LocalOrdinal, class GlobalOrdinal, class Node>
120
121template <class LocalOrdinal, class GlobalOrdinal, class Node>
123 XPETRA_MONITOR("TpetraImport::print");
124 import_->print(os);
125}
126
127template <class LocalOrdinal, class GlobalOrdinal, class Node>
128TpetraImport<LocalOrdinal, GlobalOrdinal, Node>::TpetraImport(const RCP<const Tpetra::Import<LocalOrdinal, GlobalOrdinal, Node> > &import)
129 : import_(import) {}
130
131template <class LocalOrdinal, class GlobalOrdinal, class Node>
133
134#ifdef HAVE_XPETRA_EPETRA
135
136#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
137 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
138
139// stub implementation for GO=int and NO=EpetraNode
140template <>
141class TpetraImport<int, int, EpetraNode> : public Import<int, int, EpetraNode> {
142 public:
143 typedef int LocalOrdinal;
144 typedef int GlobalOrdinal;
146
149
151
152
157
162
167
170
174 return Teuchos::null;
175 }
176
178
180
181
183 size_t getNumSameIDs() const { return 0; }
184
186 size_t getNumPermuteIDs() const { return 0; }
187
190
193
195 size_t getNumRemoteIDs() const { return 0; }
196
199
201 size_t getNumExportIDs() const { return 0; }
202
205
208
211
214
217
219
221
222
224 void print(std::ostream &os) const { /* noop */
225 }
226
228
230
231
233 TpetraImport(const RCP<const Tpetra::Import<LocalOrdinal, GlobalOrdinal, Node> > &import) {
235 }
236
238
240
241}; // TpetraImport class (stub implementation for GO=int, NO=EpetraNode)
242#endif
243
244#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
245 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
246
247// stub implementation for GO=long long and NO=EpetraNode
248template <>
249class TpetraImport<int, long long, EpetraNode> : public Import<int, long long, EpetraNode> {
250 public:
251 typedef int LocalOrdinal;
252 typedef long long GlobalOrdinal;
254
257
259
260
265
270
275
278
282 return Teuchos::null;
283 }
284
286
288
289
291 size_t getNumSameIDs() const { return 0; }
292
294 size_t getNumPermuteIDs() const { return 0; }
295
298
301
303 size_t getNumRemoteIDs() const { return 0; }
304
307
309 size_t getNumExportIDs() const { return 0; }
310
313
316
319
322
325
327
329
330
332 void print(std::ostream &os) const { /* noop */
333 }
334
336
338
339
341 TpetraImport(const RCP<const Tpetra::Import<LocalOrdinal, GlobalOrdinal, Node> > &import) {
343 }
344
346
348
349}; // TpetraImport class (stub implementation for GO=long long, NO=EpetraNode)
350#endif
351
352#endif // HAVE_XPETRA_EPETRA
353
354} // namespace Xpetra
355
356#endif
#define XPETRA_MONITOR(funcName)
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
void setDistributorParameters(const Teuchos::RCP< Teuchos::ParameterList > params) const
Set parameters on the underlying object.
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
size_t getNumSameIDs() const
Number of initial identical IDs.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const
The Target Map used to construct this Import object.
ArrayView< const LocalOrdinal > getPermuteFromLIDs() const
List of local IDs in the source Map that are permuted.
ArrayView< const LocalOrdinal > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
TpetraImport(const Import< LocalOrdinal, GlobalOrdinal, Node > &import)
Copy constructor.
void print(std::ostream &os) const
Print the Import's data to the given output stream.
RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Import() const
Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > createRemoteOnlyImport(const Teuchos::RCP< const map_type > &remoteTarget) const
Special "constructor".
TpetraImport(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target)
Construct an Import from the source and target Maps.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The Source Map used to construct this Import object.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
TpetraImport(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).
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
ArrayView< const LocalOrdinal > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
TpetraImport(const RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > > &import)
TpetraImport constructor to wrap a Tpetra::Import object.
ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
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.
ArrayView< const LocalOrdinal > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
TpetraImport(const Import< LocalOrdinal, GlobalOrdinal, Node > &import)
Copy constructor.
TpetraImport(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).
void print(std::ostream &os) const
Print the Import's data to the given output stream.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The Source Map used to construct this Import object.
Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > createRemoteOnlyImport(const Teuchos::RCP< const map_type > &remoteTarget) const
Special "constructor".
ArrayView< const LocalOrdinal > getPermuteFromLIDs() const
List of local IDs in the source Map that are permuted.
void setDistributorParameters(const Teuchos::RCP< Teuchos::ParameterList > params) const
Set parameters on the underlying object.
TpetraImport(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target)
Construct an Import from the source and target Maps.
ArrayView< const LocalOrdinal > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
size_t getNumSameIDs() const
Number of initial identical IDs.
RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Import() const
ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const
The Target Map used to construct this Import object.
TpetraImport(const RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > > &import)
TpetraImport constructor to wrap a Tpetra::Import object.
void setDistributorParameters(const Teuchos::RCP< Teuchos::ParameterList > params) const
Set parameters on distributor.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const
The Target Map used to construct this Import object.
RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Import() const
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
size_t getNumSameIDs() const
Number of initial identical IDs.
ArrayView< const LocalOrdinal > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > createRemoteOnlyImport(const Teuchos::RCP< const map_type > &remoteTarget) const
Special "constructor".
TpetraImport(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target)
Construct an Import from the source and target Maps.
void print(std::ostream &os) const
Print the Import's data to the given output stream.
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.
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The Source Map used to construct this Import object.
ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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)