Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
16 namespace Xpetra {
17 
18 template <class LocalOrdinal, class GlobalOrdinal, class Node>
20  TpetraExport(const Teuchos::RCP<const map_type>& source,
21  const Teuchos::RCP<const map_type>& target)
22  : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(source), toTpetra(target)))) {
23 }
24 
25 template <class LocalOrdinal, class GlobalOrdinal, class Node>
27  TpetraExport(const Teuchos::RCP<const map_type>& source,
28  const Teuchos::RCP<const map_type>& target,
29  const Teuchos::RCP<Teuchos::ParameterList>& plist)
30  : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(source), toTpetra(target), plist))) {
31 }
32 
33 template <class LocalOrdinal, class GlobalOrdinal, class Node>
36  : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rhs)))) {
37 }
38 
39 template <class LocalOrdinal, class GlobalOrdinal, class Node>
42 }
43 
44 template <class LocalOrdinal, class GlobalOrdinal, class Node>
45 size_t
47  getNumSameIDs() const {
48  XPETRA_MONITOR("TpetraExport::getNumSameIDs");
49  return export_->getNumSameIDs();
50 }
51 
52 template <class LocalOrdinal, class GlobalOrdinal, class Node>
53 size_t
56  XPETRA_MONITOR("TpetraExport::getNumPermuteIDs");
57  return export_->getNumPermuteIDs();
58 }
59 
60 template <class LocalOrdinal, class GlobalOrdinal, class Node>
61 ArrayView<const LocalOrdinal>
64  XPETRA_MONITOR("TpetraExport::getPermuteFromLIDs");
65  return export_->getPermuteFromLIDs();
66 }
67 
68 template <class LocalOrdinal, class GlobalOrdinal, class Node>
69 ArrayView<const LocalOrdinal>
72  XPETRA_MONITOR("TpetraExport::getPermuteToLIDs");
73  return export_->getPermuteToLIDs();
74 }
75 
76 template <class LocalOrdinal, class GlobalOrdinal, class Node>
77 size_t
80  XPETRA_MONITOR("TpetraExport::getNumRemoteIDs");
81  return export_->getNumRemoteIDs();
82 }
83 
84 template <class LocalOrdinal, class GlobalOrdinal, class Node>
85 ArrayView<const LocalOrdinal>
87  getRemoteLIDs() const {
88  XPETRA_MONITOR("TpetraExport::getRemoteLIDs");
89  return export_->getRemoteLIDs();
90 }
91 
92 template <class LocalOrdinal, class GlobalOrdinal, class Node>
93 size_t
96  XPETRA_MONITOR("TpetraExport::getNumExportIDs");
97  return export_->getNumExportIDs();
98 }
99 
100 template <class LocalOrdinal, class GlobalOrdinal, class Node>
101 ArrayView<const LocalOrdinal>
103  getExportLIDs() const {
104  XPETRA_MONITOR("TpetraExport::getExportLIDs");
105  return export_->getExportLIDs();
106 }
107 
108 template <class LocalOrdinal, class GlobalOrdinal, class Node>
109 ArrayView<const int>
111  getExportPIDs() const {
112  XPETRA_MONITOR("TpetraExport::getExportPIDs");
113  return export_->getExportPIDs();
114 }
115 
116 template <class LocalOrdinal, class GlobalOrdinal, class Node>
117 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
119  getSourceMap() const {
120  XPETRA_MONITOR("TpetraExport::getSourceMap");
121  return toXpetra(export_->getSourceMap());
122 }
123 
124 template <class LocalOrdinal, class GlobalOrdinal, class Node>
125 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
127  getTargetMap() const {
128  XPETRA_MONITOR("TpetraExport::getTargetMap");
129  return toXpetra(export_->getTargetMap());
130 }
131 
132 template <class LocalOrdinal, class GlobalOrdinal, class Node>
134  setDistributorParameters(const Teuchos::RCP<Teuchos::ParameterList> params) const {
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 
142 template <class LocalOrdinal, class GlobalOrdinal, class Node>
144  print(std::ostream& os) const {
145  XPETRA_MONITOR("TpetraExport::print");
146  export_->print(os);
147 }
148 
149 template <class LocalOrdinal, class GlobalOrdinal, class Node>
152  const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp)
153  : export_(exp) {
154 }
155 
156 template <class LocalOrdinal, class GlobalOrdinal, class Node>
157 RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>
160  return export_;
161 }
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
168 template <>
169 class TpetraExport<int, int, EpetraNode>
170  : public Export<int, int, EpetraNode> {
171  public:
172  typedef int LocalOrdinal;
173  typedef int GlobalOrdinal;
174  typedef EpetraNode Node;
175 
178 
180 
181 
183  TpetraExport(const Teuchos::RCP<const map_type>& source, const Teuchos::RCP<const map_type>& target) {
186  "int",
187  typeid(EpetraNode).name());
188  }
189 
191  TpetraExport(const Teuchos::RCP<const map_type>& source,
192  const Teuchos::RCP<const map_type>& target,
193  const Teuchos::RCP<Teuchos::ParameterList>& plist) {
196  "int",
197  typeid(EpetraNode).name());
198  }
199 
204  "int",
205  typeid(EpetraNode).name());
206  }
207 
210 
212 
214 
215 
217  size_t getNumSameIDs() const { return 0; }
218 
220  size_t getNumPermuteIDs() const { return 0; }
221 
223  ArrayView<const LocalOrdinal> getPermuteFromLIDs() const { return Teuchos::ArrayView<const LocalOrdinal>(); }
224 
226  ArrayView<const LocalOrdinal> getPermuteToLIDs() const { return Teuchos::ArrayView<const LocalOrdinal>(); }
227 
229  size_t getNumRemoteIDs() const { return 0; }
230 
232  ArrayView<const LocalOrdinal> getRemoteLIDs() const { return Teuchos::ArrayView<const LocalOrdinal>(); }
233 
235  size_t getNumExportIDs() const { return 0; }
236 
238  ArrayView<const LocalOrdinal> getExportLIDs() const { return Teuchos::ArrayView<const LocalOrdinal>(); }
239 
241  ArrayView<const int> getExportPIDs() const { return Teuchos::ArrayView<const int>(); }
242 
244  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getSourceMap() const { return Teuchos::null; }
245 
247  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getTargetMap() const { return Teuchos::null; }
248 
250  void setDistributorParameters(const Teuchos::RCP<Teuchos::ParameterList> params) const {};
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 
274  RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>> getTpetra_Export() const { return Teuchos::null; }
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
284 template <>
285 class TpetraExport<int, long long, EpetraNode>
286  : public Export<int, long long, EpetraNode> {
287  public:
288  typedef int LocalOrdinal;
289  typedef long long GlobalOrdinal;
290  typedef EpetraNode Node;
291 
294 
296 
297 
299  TpetraExport(const Teuchos::RCP<const map_type>& source, const Teuchos::RCP<const map_type>& target) {
302  "long long",
303  typeid(EpetraNode).name());
304  }
305 
307  TpetraExport(const Teuchos::RCP<const map_type>& source,
308  const Teuchos::RCP<const map_type>& target,
309  const Teuchos::RCP<Teuchos::ParameterList>& plist) {
312  "long long",
313  typeid(EpetraNode).name());
314  }
315 
320  "long long",
321  typeid(EpetraNode).name());
322  }
323 
326 
328 
330 
331 
333  size_t getNumSameIDs() const { return 0; }
334 
336  size_t getNumPermuteIDs() const { return 0; }
337 
339  ArrayView<const LocalOrdinal> getPermuteFromLIDs() const { return Teuchos::ArrayView<const LocalOrdinal>(); }
340 
342  ArrayView<const LocalOrdinal> getPermuteToLIDs() const { return Teuchos::ArrayView<const LocalOrdinal>(); }
343 
345  size_t getNumRemoteIDs() const { return 0; }
346 
348  ArrayView<const LocalOrdinal> getRemoteLIDs() const { return Teuchos::ArrayView<const LocalOrdinal>(); }
349 
351  size_t getNumExportIDs() const { return 0; }
352 
354  ArrayView<const LocalOrdinal> getExportLIDs() const { return Teuchos::ArrayView<const LocalOrdinal>(); }
355 
357  ArrayView<const int> getExportPIDs() const { return Teuchos::ArrayView<const int>(); }
358 
360  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getSourceMap() const { return Teuchos::null; }
361 
363  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>> getTargetMap() const { return Teuchos::null; }
364 
366  void setDistributorParameters(const Teuchos::RCP<Teuchos::ParameterList> params) const {};
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 
390  RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>> getTpetra_Export() const { return Teuchos::null; }
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
size_t getNumSameIDs() const
Number of initial identical IDs.
TpetraExport(const Export< LocalOrdinal, GlobalOrdinal, Node > &rhs)
Copy constructor.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The source Map used to construct this Export.
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.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const
The target Map used to construct this Export.
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, const Teuchos::RCP< Teuchos::ParameterList > &plist)
Constructor (with list of parameters).
RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Export() const
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
TpetraExport(const Export< LocalOrdinal, GlobalOrdinal, Node > &rhs)
Copy constructor.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
ArrayView< const LocalOrdinal > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Export() const
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
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.
void print(std::ostream &os) const
Print the Export&#39;s data to the given output stream.
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.
size_t getNumSameIDs() const
Number of initial identical IDs.
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.
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).
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
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.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const
The target Map used to construct this Export.
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The source Map used to construct this Export.
TpetraExport(const RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node >> &exp)
TpetraExport constructor to wrap a Tpetra::Export object.
void setDistributorParameters(const Teuchos::RCP< Teuchos::ParameterList > params) const
Set parameters on the underlying object.
void setDistributorParameters(const Teuchos::RCP< Teuchos::ParameterList > params) const
Set parameters on the underlying object.
RCP< const Tpetra::Export< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Export() const
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const
The target 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.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
void print(std::ostream &os) const
Print the Export&#39;s data to the given output stream.
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 distributor parameters.
#define XPETRA_MONITOR(funcName)
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
ArrayView< const LocalOrdinal > getPermuteFromLIDs() const
List of local IDs in the source Map that are permuted.
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.
ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
ArrayView< const LocalOrdinal > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
ArrayView< const LocalOrdinal > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The source Map used to construct this Export.
void print(std::ostream &os) const
Print the Export&#39;s data to the given output stream.
ArrayView< const LocalOrdinal > getPermuteFromLIDs() const
List of local IDs in the source Map that are permuted.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)