All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
53 namespace Xpetra {
54 
55 template<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 
64 template<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 
74 template<class LocalOrdinal, class GlobalOrdinal, class Node>
77  : export_(Teuchos::rcp(new Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rhs))))
78 {
79 }
80 
81 
82 template<class LocalOrdinal, class GlobalOrdinal, class Node>
85 {
86 }
87 
88 
89 template<class LocalOrdinal, class GlobalOrdinal, class Node>
90 size_t
93 {
94  XPETRA_MONITOR("TpetraExport::getNumSameIDs");
95  return export_->getNumSameIDs();
96 }
97 
98 
99 template<class LocalOrdinal, class GlobalOrdinal, class Node>
100 size_t
103 {
104  XPETRA_MONITOR("TpetraExport::getNumPermuteIDs");
105  return export_->getNumPermuteIDs();
106 }
107 
108 
109 template<class LocalOrdinal, class GlobalOrdinal, class Node>
113 {
114  XPETRA_MONITOR("TpetraExport::getPermuteFromLIDs");
115  return export_->getPermuteFromLIDs();
116 }
117 
118 
119 template<class LocalOrdinal, class GlobalOrdinal, class Node>
123 {
124  XPETRA_MONITOR("TpetraExport::getPermuteToLIDs");
125  return export_->getPermuteToLIDs();
126 }
127 
128 
129 template<class LocalOrdinal, class GlobalOrdinal, class Node>
130 size_t
133 {
134  XPETRA_MONITOR("TpetraExport::getNumRemoteIDs");
135  return export_->getNumRemoteIDs();
136 }
137 
138 
139 template<class LocalOrdinal, class GlobalOrdinal, class Node>
143 {
144  XPETRA_MONITOR("TpetraExport::getRemoteLIDs");
145  return export_->getRemoteLIDs();
146 }
147 
148 
149 template<class LocalOrdinal, class GlobalOrdinal, class Node>
150 size_t
153 {
154  XPETRA_MONITOR("TpetraExport::getNumExportIDs");
155  return export_->getNumExportIDs();
156 }
157 
158 
159 template<class LocalOrdinal, class GlobalOrdinal, class Node>
163 {
164  XPETRA_MONITOR("TpetraExport::getExportLIDs");
165  return export_->getExportLIDs();
166 }
167 
168 
169 template<class LocalOrdinal, class GlobalOrdinal, class Node>
173 {
174  XPETRA_MONITOR("TpetraExport::getExportPIDs");
175  return export_->getExportPIDs();
176 }
177 
178 
179 template<class LocalOrdinal, class GlobalOrdinal, class Node>
183 {
184  XPETRA_MONITOR("TpetraExport::getSourceMap");
185  return toXpetra(export_->getSourceMap());
186 }
187 
188 
189 template<class LocalOrdinal, class GlobalOrdinal, class Node>
193 {
194  XPETRA_MONITOR("TpetraExport::getTargetMap");
195  return toXpetra(export_->getTargetMap());
196 }
197 
198 template<class LocalOrdinal, class GlobalOrdinal, class Node>
199 void
202  XPETRA_MONITOR("TpetraExport::setDistributorParameters");
203  export_->getDistributor().setParameterList(params);
204 }
205 
206 
207 template<class LocalOrdinal, class GlobalOrdinal, class Node>
208 void
210 print(std::ostream& os) const
211 {
212  XPETRA_MONITOR("TpetraExport::print");
213  export_->print(os);
214 }
215 
216 
217 template<class LocalOrdinal, class GlobalOrdinal, class Node>
220  const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp)
221  : export_(exp)
222 {
223 }
224 
225 
226 template<class LocalOrdinal, class GlobalOrdinal, class Node>
230 {
231  return export_;
232 }
233 
234 
235 
236 #ifdef HAVE_XPETRA_EPETRA
237 
238 #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) \
239  || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
240 
241 // stub implementation for GO=int and NO=EpetraNode
242 template<>
243 class TpetraExport<int, int, EpetraNode>
244  : public Export<int, int, EpetraNode>
245 {
246 
247  public:
248  typedef int LocalOrdinal;
249  typedef int GlobalOrdinal;
250  typedef EpetraNode Node;
251 
254 
256 
257 
260  {
263  "int",
264  typeid(EpetraNode).name());
265  }
266 
267 
270  const Teuchos::RCP<const map_type>& target,
272  {
275  "int",
276  typeid(EpetraNode).name());
277  }
278 
279 
282  {
285  "int",
286  typeid(EpetraNode).name());
287  }
288 
289 
292 
293 
295 
297 
298 
299 
301  size_t getNumSameIDs() const { return 0; }
302 
303 
305  size_t getNumPermuteIDs() const { return 0; }
306 
307 
310 
311 
314 
315 
317  size_t getNumRemoteIDs() const { return 0; }
318 
319 
322 
323 
325  size_t getNumExportIDs() const { return 0; }
326 
327 
330 
331 
334 
335 
338 
339 
342 
345 
346 
348 
350 
351 
352 
354  void print(std::ostream& os) const
355  { /* noop */
356  }
357 
358 
360 
361 
363 
364 
365 
367  TpetraExport(const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp)
368  {
371  "int",
372  typeid(EpetraNode).name());
373  }
374 
375 
377 
379 
380 }; // TpetraExport class (specialization for LO=GO=int)
381 #endif // #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT)))
382 
383 
384 
385 #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) \
386  || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
387 
388 // stub implementation for GO=long long and NO=EpetraNode
389 template<>
390 class TpetraExport<int, long long, EpetraNode>
391  : public Export<int, long long, EpetraNode>
392 {
393 
394  public:
395  typedef int LocalOrdinal;
396  typedef long long GlobalOrdinal;
397  typedef EpetraNode Node;
398 
401 
403 
404 
405 
408  {
411  "long long",
412  typeid(EpetraNode).name());
413  }
414 
415 
418  const Teuchos::RCP<const map_type>& target,
420  {
423  "long long",
424  typeid(EpetraNode).name());
425  }
426 
427 
430  {
433  "long long",
434  typeid(EpetraNode).name());
435  }
436 
437 
440 
441 
443 
445 
446 
447 
449  size_t getNumSameIDs() const { return 0; }
450 
451 
453  size_t getNumPermuteIDs() const { return 0; }
454 
455 
458 
459 
462 
463 
465  size_t getNumRemoteIDs() const { return 0; }
466 
467 
470 
471 
473  size_t getNumExportIDs() const { return 0; }
474 
475 
478 
479 
482 
483 
486 
487 
490 
493 
495 
497 
498 
499 
501  void print(std::ostream& os) const
502  { /* noop */
503  }
504 
505 
507 
509 
510 
511 
513  TpetraExport(const RCP<const Tpetra::Export<LocalOrdinal, GlobalOrdinal, Node>>& exp)
514  {
517  "long long",
518  typeid(EpetraNode).name());
519  }
520 
521 
523 
524 
526 
527 }; // TpetraExport class (specialization for GO=long long, NO=EpetraNode)
528 #endif // #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG)))
529 
530 
531 #endif // HAVE_XPETRA_EPETRA
532 
533 
534 } // namespace Xpetra
535 
536 
537 #endif // XPETRA_TPETRAEXPORT_DEF_HPP
538 
539 
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.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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.
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.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
ArrayView< const LocalOrdinal > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
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.