Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_TpetraExport_def.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// Xpetra: A linear algebra interface package
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact
39// Jonathan Hu (jhu@sandia.gov)
40// Andrey Prokopenko (aprokop@sandia.gov)
41// Ray Tuminaro (rstumin@sandia.gov)
42//
43// ***********************************************************************
44//
45// @HEADER
46#ifndef XPETRA_TPETRAEXPORT_DEF_HPP
47#define XPETRA_TPETRAEXPORT_DEF_HPP
48
49
51#include "Tpetra_Distributor.hpp"
52
53namespace Xpetra {
54
55template<class LocalOrdinal, class GlobalOrdinal, class Node>
58 const Teuchos::RCP<const map_type>& target)
59 : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(source), toTpetra(target))))
60{
61}
62
63
64template<class LocalOrdinal, class GlobalOrdinal, class Node>
67 const Teuchos::RCP<const map_type>& target,
69 : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(source), toTpetra(target), plist)))
70{
71}
72
73
74template<class LocalOrdinal, class GlobalOrdinal, class Node>
77 : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rhs))))
78{
79}
80
81
82template<class LocalOrdinal, class GlobalOrdinal, class Node>
85{
86}
87
88
89template<class LocalOrdinal, class GlobalOrdinal, class Node>
90size_t
92getNumSameIDs() const
93{
94 XPETRA_MONITOR("TpetraExport::getNumSameIDs");
95 return export_->getNumSameIDs();
96}
97
98
99template<class LocalOrdinal, class GlobalOrdinal, class Node>
100size_t
102getNumPermuteIDs() const
103{
104 XPETRA_MONITOR("TpetraExport::getNumPermuteIDs");
105 return export_->getNumPermuteIDs();
106}
107
108
109template<class LocalOrdinal, class GlobalOrdinal, class Node>
112getPermuteFromLIDs() const
113{
114 XPETRA_MONITOR("TpetraExport::getPermuteFromLIDs");
115 return export_->getPermuteFromLIDs();
116}
117
118
119template<class LocalOrdinal, class GlobalOrdinal, class Node>
122getPermuteToLIDs() const
123{
124 XPETRA_MONITOR("TpetraExport::getPermuteToLIDs");
125 return export_->getPermuteToLIDs();
126}
127
128
129template<class LocalOrdinal, class GlobalOrdinal, class Node>
130size_t
132getNumRemoteIDs() const
133{
134 XPETRA_MONITOR("TpetraExport::getNumRemoteIDs");
135 return export_->getNumRemoteIDs();
136}
137
138
139template<class LocalOrdinal, class GlobalOrdinal, class Node>
142getRemoteLIDs() const
143{
144 XPETRA_MONITOR("TpetraExport::getRemoteLIDs");
145 return export_->getRemoteLIDs();
146}
147
148
149template<class LocalOrdinal, class GlobalOrdinal, class Node>
150size_t
152getNumExportIDs() const
153{
154 XPETRA_MONITOR("TpetraExport::getNumExportIDs");
155 return export_->getNumExportIDs();
156}
157
158
159template<class LocalOrdinal, class GlobalOrdinal, class Node>
162getExportLIDs() const
163{
164 XPETRA_MONITOR("TpetraExport::getExportLIDs");
165 return export_->getExportLIDs();
166}
167
168
169template<class LocalOrdinal, class GlobalOrdinal, class Node>
172getExportPIDs() const
173{
174 XPETRA_MONITOR("TpetraExport::getExportPIDs");
175 return export_->getExportPIDs();
176}
177
178
179template<class LocalOrdinal, class GlobalOrdinal, class Node>
182getSourceMap() const
183{
184 XPETRA_MONITOR("TpetraExport::getSourceMap");
185 return toXpetra(export_->getSourceMap());
186}
187
188
189template<class LocalOrdinal, class GlobalOrdinal, class Node>
192getTargetMap() const
193{
194 XPETRA_MONITOR("TpetraExport::getTargetMap");
195 return toXpetra(export_->getTargetMap());
196}
197
198template<class LocalOrdinal, class GlobalOrdinal, class Node>
199void
202 XPETRA_MONITOR("TpetraExport::setDistributorParameters");
203 export_->getDistributor().setParameterList(params);
204 auto revDistor = export_->getDistributor().getReverse(false);
205 if (!revDistor.is_null())
206 revDistor->setParameterList(params);
207}
208
209
210template<class LocalOrdinal, class GlobalOrdinal, class Node>
211void
213print(std::ostream& os) const
214{
215 XPETRA_MONITOR("TpetraExport::print");
216 export_->print(os);
217}
218
219
220template<class LocalOrdinal, class GlobalOrdinal, class Node>
223 const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp)
224 : export_(exp)
225{
226}
227
228
229template<class LocalOrdinal, class GlobalOrdinal, class Node>
232getTpetra_Export() const
233{
234 return export_;
235}
236
237
238
239#ifdef HAVE_XPETRA_EPETRA
240
241#if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) \
242 || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
243
244// stub implementation for GO=int and NO=EpetraNode
245template<>
246class TpetraExport<int, int, EpetraNode>
247 : public Export<int, int, EpetraNode>
248{
249
250 public:
251 typedef int LocalOrdinal;
252 typedef int GlobalOrdinal;
254
257
259
260
263 {
266 "int",
267 typeid(EpetraNode).name());
268 }
269
270
273 const Teuchos::RCP<const map_type>& target,
275 {
278 "int",
279 typeid(EpetraNode).name());
280 }
281
282
285 {
288 "int",
289 typeid(EpetraNode).name());
290 }
291
292
295
296
298
300
301
302
304 size_t getNumSameIDs() const { return 0; }
305
306
308 size_t getNumPermuteIDs() const { return 0; }
309
310
313
314
317
318
320 size_t getNumRemoteIDs() const { return 0; }
321
322
325
326
328 size_t getNumExportIDs() const { return 0; }
329
330
333
334
337
338
341
342
345
348
349
351
353
354
355
357 void print(std::ostream& os) const
358 { /* noop */
359 }
360
361
363
364
366
367
368
370 TpetraExport(const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp)
371 {
374 "int",
375 typeid(EpetraNode).name());
376 }
377
378
380
382
383}; // TpetraExport class (specialization for LO=GO=int)
384#endif // #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT)))
385
386
387
388#if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) \
389 || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
390
391// stub implementation for GO=long long and NO=EpetraNode
392template<>
393class TpetraExport<int, long long, EpetraNode>
394 : public Export<int, long long, EpetraNode>
395{
396
397 public:
398 typedef int LocalOrdinal;
399 typedef long long GlobalOrdinal;
401
404
406
407
408
411 {
414 "long long",
415 typeid(EpetraNode).name());
416 }
417
418
421 const Teuchos::RCP<const map_type>& target,
423 {
426 "long long",
427 typeid(EpetraNode).name());
428 }
429
430
433 {
436 "long long",
437 typeid(EpetraNode).name());
438 }
439
440
443
444
446
448
449
450
452 size_t getNumSameIDs() const { return 0; }
453
454
456 size_t getNumPermuteIDs() const { return 0; }
457
458
461
462
465
466
468 size_t getNumRemoteIDs() const { return 0; }
469
470
473
474
476 size_t getNumExportIDs() const { return 0; }
477
478
481
482
485
486
489
490
493
496
498
500
501
502
504 void print(std::ostream& os) const
505 { /* noop */
506 }
507
508
510
512
513
514
516 TpetraExport(const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp)
517 {
520 "long long",
521 typeid(EpetraNode).name());
522 }
523
524
526
527
529
530}; // TpetraExport class (specialization for GO=long long, NO=EpetraNode)
531#endif // #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG)))
532
533
534#endif // HAVE_XPETRA_EPETRA
535
536
537} // namespace Xpetra
538
539
540#endif // XPETRA_TPETRAEXPORT_DEF_HPP
541
542
#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.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Xpetra namespace
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)