Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_EpetraExport.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_EPETRAEXPORT_HPP
11 #define XPETRA_EPETRAEXPORT_HPP
12 
14 
15 #include "Xpetra_Export.hpp"
16 
17 #include "Xpetra_EpetraMap.hpp" //TMP
18 
19 #include "Epetra_Export.h"
20 
21 #if defined(XPETRA_ENABLE_DEPRECATED_CODE)
22 #ifdef __GNUC__
23 #if defined(Xpetra_SHOW_DEPRECATED_WARNINGS)
24 #warning "The header file Trilinos/packages/xpetra/src/Export/Xpetra_EpetraExport.hpp is deprecated."
25 #endif
26 #endif
27 #else
28 #error "The header file Trilinos/packages/xpetra/src/Export/Xpetra_EpetraExport.hpp is deprecated."
29 #endif
30 
31 // Note: 'export' is a reserved keyword in C++. Do not use 'export' as a variable name.
32 
33 namespace Xpetra {
34 
35 // TODO: move that elsewhere
36 template <class GlobalOrdinal, class Node>
37 XPETRA_DEPRECATED const Epetra_Export &toEpetra(const Export<int, GlobalOrdinal, Node> &);
38 template <class GlobalOrdinal, class Node>
39 XPETRA_DEPRECATED RCP<const Export<int, GlobalOrdinal, Node> > toXpetra(const Epetra_Export *exp);
40 
41 template <class EpetraGlobalOrdinal, class Node>
42 class XPETRA_DEPRECATED EpetraExportT
43  : public Export<int, EpetraGlobalOrdinal, Node> {
44  typedef int LocalOrdinal;
45  typedef EpetraGlobalOrdinal GlobalOrdinal;
48 
49  public:
51 
52 
54  EpetraExportT(const Teuchos::RCP<const map_type> &source, const Teuchos::RCP<const map_type> &target)
55  : export_(rcp(new Epetra_Export(toEpetra<GlobalOrdinal, Node>(source), toEpetra<GlobalOrdinal, Node>(target)))) {} // Warning: Epetra(Target, Source) vs. Tpetra(Source, Target)
56 
58  // Definition not in cpp, so comment out
59  // EpetraExportT(const Teuchos::RCP< const map_type > &source, const Teuchos::RCP< const map_type > &target, const Teuchos::RCP< Teuchos::ParameterList > &plist);
60 
62  // Definition not in cpp, so comment out
63  // EpetraExportT(const Export< LocalOrdinal, GlobalOrdinal, Node > &rhs);
64 
67 
69 
71 
72 
74  size_t getNumSameIDs() const {
75  XPETRA_MONITOR("EpetraExportT::getNumSameIDs");
76  return export_->NumSameIDs();
77  }
78 
80  size_t getNumPermuteIDs() const {
81  XPETRA_MONITOR("EpetraExportT::getNumPermuteIDs");
82  return export_->NumPermuteIDs();
83  }
84 
86  ArrayView<const LocalOrdinal> getPermuteFromLIDs() const {
87  XPETRA_MONITOR("EpetraExportT::getPermuteFromLIDs");
88  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO EpetraExportT<EpetraGlobalOrdinal>::getExportImageIDs not implemented");
89  }
90 
92  ArrayView<const LocalOrdinal> getPermuteToLIDs() const {
93  XPETRA_MONITOR("EpetraExportT::getPermuteToLIDs");
94  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO EpetraExportT<EpetraGlobalOrdinal>::getPermuteToLIDs not implemented");
95  }
96 
98  size_t getNumRemoteIDs() const {
99  XPETRA_MONITOR("EpetraExportT::getNumRemoteIDs");
100  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO EpetraExportT<EpetraGlobalOrdinal>::getNumRemoteIDs not implemented");
101  }
102 
104  ArrayView<const LocalOrdinal> getRemoteLIDs() const {
105  XPETRA_MONITOR("EpetraExportT::getRemoteLIDs");
106  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO EpetraExportT<EpetraGlobalOrdinal>::getRemoteLIDs not implemented");
107  }
108 
110  size_t getNumExportIDs() const {
111  XPETRA_MONITOR("EpetraExportT::getNumExportIDs");
112  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO EpetraExportT<EpetraGlobalOrdinal>::getNumExportIDs not implemented");
113  }
114 
116  ArrayView<const LocalOrdinal> getExportLIDs() const {
117  XPETRA_MONITOR("EpetraExportT::getExportLIDs");
118  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO EpetraExportT<EpetraGlobalOrdinal>::getExportLIDs not implemented");
119  }
120 
122  ArrayView<const int> getExportPIDs() const {
123  XPETRA_MONITOR("EpetraExportT::getExportImageIDs");
124  return ArrayView<const int>(export_->ExportPIDs(), export_->NumExportIDs());
125  }
126 
128  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getSourceMap() const {
129  XPETRA_MONITOR("EpetraExportT::getSourceMap");
130  return toXpetra<GlobalOrdinal, Node>(export_->SourceMap());
131  }
132 
134  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getTargetMap() const {
135  XPETRA_MONITOR("EpetraExportT::getTargetMap");
136  return toXpetra<GlobalOrdinal, Node>(export_->TargetMap());
137  }
138 
140  void setDistributorParameters(const Teuchos::RCP<Teuchos::ParameterList> params) const { XPETRA_MONITOR("EpetraExportT::setDistributorParameters"); }
141 
143 
145 
146 
148  void print(std::ostream &os) const {
149  XPETRA_MONITOR("EpetraExportT::");
150  export_->Print(os);
151  }
152 
154 
156 
157 
159  EpetraExportT(const RCP<const Epetra_Export> &exp)
160  : export_(exp) {}
161 
163  RCP<const Epetra_Export> getEpetra_Export() const { return export_; }
164 
166 
167  private:
168  RCP<const Epetra_Export> export_;
169 
170 }; // EpetraExportT class
171 
172 } // namespace Xpetra
173 
174 #endif // XPETRA_EPETRAEXPORT_HPP
ArrayView< const LocalOrdinal > getExportLIDs() const
List of entries in the source Map that will be sent to other processes.
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.
RCP< const Epetra_Export > getEpetra_Export() const
Get the underlying Epetra export.
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 Export.
ArrayView< const int > getExportPIDs() const
List of processes to which entries will be sent.
void print(std::ostream &os) const
Print the Export&#39;s data to the given output stream.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getSourceMap() const
The source Map used to construct this Export.
size_t getNumPermuteIDs() const
Number of IDs to permute but not to communicate.
EpetraExportT(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.
RCP< const Epetra_Export > export_
size_t getNumRemoteIDs() const
Number of entries not on the calling process.
Exception throws when you call an unimplemented method of Xpetra.
EpetraGlobalOrdinal GlobalOrdinal
ArrayView< const LocalOrdinal > getPermuteToLIDs() const
List of local IDs in the target Map that are permuted.
size_t getNumExportIDs() const
Number of entries that must be sent by the calling process to other processes.
ArrayView< const LocalOrdinal > getRemoteLIDs() const
List of entries in the target Map to receive from other processes.
#define XPETRA_MONITOR(funcName)
EpetraExportT(const RCP< const Epetra_Export > &exp)
EpetraExportT constructor to wrap a Epetra_Export object.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)