Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_EpetraMap.cpp
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 #include "Xpetra_ConfigDefs.hpp"
11 
12 #ifdef HAVE_XPETRA_EPETRA
13 
14 #include "Xpetra_EpetraMap.hpp"
15 
16 namespace Xpetra {
17 
18 template <class GlobalOrdinal, class Node>
19 const Epetra_Map &toEpetra(const Map<int, GlobalOrdinal, Node> &map) {
20  const EpetraMapT<GlobalOrdinal, Node> &epetraMap = dynamic_cast<const EpetraMapT<GlobalOrdinal, Node> &>(*map.getMap());
21  return epetraMap.getEpetra_Map();
22 }
23 
24 template <class GlobalOrdinal, class Node>
25 const Epetra_Map &toEpetra(const RCP<const Map<int, GlobalOrdinal, Node> > &map) {
27  return epetraMap->getEpetra_Map();
28 }
29 
30 template <class GlobalOrdinal, class Node>
31 const RCP<const Xpetra::Map<int, GlobalOrdinal, Node> > toXpetra(const Epetra_BlockMap &map) {
32  RCP<const Epetra_BlockMap> m = rcp(new Epetra_BlockMap(map));
33  return rcp(new EpetraMapT<GlobalOrdinal, Node>(m));
34 }
35 
36 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
37 
38 #ifdef HAVE_XPETRA_TPETRA
39 #include "TpetraCore_config.h"
40 #if ((defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_OPENMP)) || \
41  (!defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_SERIAL)))
42 template const RCP<const Map<int, int, Xpetra::EpetraNode> > toXpetra<int, Xpetra::EpetraNode>(const Epetra_BlockMap &map);
43 template const Epetra_Map &toEpetra<int, Xpetra::EpetraNode>(const RCP<const Map<int, int, Xpetra::EpetraNode> > &map);
44 template const Epetra_Map &toEpetra<int, Xpetra::EpetraNode>(const Map<int, int, Xpetra::EpetraNode> &map);
45 #endif
46 #ifdef HAVE_TPETRA_INST_SERIAL
47 // template class EpetraMapT<int, Tpetra::KokkosCompat::KokkosSerialWrapperNode >;
48 template const RCP<const Map<int, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode> > toXpetra<int, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const Epetra_BlockMap &map);
49 template const Epetra_Map &toEpetra<int, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const RCP<const Map<int, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode> > &map);
50 template const Epetra_Map &toEpetra<int, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const Map<int, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode> &map);
51 #endif
52 #ifdef HAVE_TPETRA_INST_PTHREAD
53 // template class EpetraMapT<int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>;
54 template const RCP<const Map<int, int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> > toXpetra<int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const Epetra_BlockMap &map);
55 template const Epetra_Map &toEpetra<int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const RCP<const Map<int, int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> > &map);
56 template const Epetra_Map &toEpetra<int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const Map<int, int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> &map);
57 #endif
58 #ifdef HAVE_TPETRA_INST_OPENMP
59 // template class EpetraMapT<int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode >;
60 template const RCP<const Map<int, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> > toXpetra<int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const Epetra_BlockMap &map);
61 template const Epetra_Map &toEpetra<int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const RCP<const Map<int, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> > &map);
62 template const Epetra_Map &toEpetra<int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const Map<int, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> &map);
63 #endif
64 #ifdef HAVE_TPETRA_INST_CUDA
65 typedef Tpetra::KokkosCompat::KokkosCudaWrapperNode default_node_type;
66 // template class EpetraMapT<int, default_node_type >;
67 template const RCP<const Map<int, int, default_node_type> > toXpetra<int, default_node_type>(const Epetra_BlockMap &map);
68 template const Epetra_Map &toEpetra<int, default_node_type>(const RCP<const Map<int, int, default_node_type> > &map);
69 template const Epetra_Map &toEpetra<int, default_node_type>(const Map<int, int, default_node_type> &map);
70 #endif
71 #ifdef HAVE_TPETRA_INST_HIP
72 typedef Tpetra::KokkosCompat::KokkosHIPWrapperNode default_node_type;
73 // template class EpetraMapT<int, default_node_type >;
74 template const RCP<const Map<int, int, default_node_type> > toXpetra<int, default_node_type>(const Epetra_BlockMap &map);
75 template const Epetra_Map &toEpetra<int, default_node_type>(const RCP<const Map<int, int, default_node_type> > &map);
76 template const Epetra_Map &toEpetra<int, default_node_type>(const Map<int, int, default_node_type> &map);
77 #endif
78 #else
79 // Tpetra is disabled and Kokkos not available: use dummy node type
80 typedef Xpetra::EpetraNode default_node_type;
81 template const RCP<const Map<int, int, default_node_type> > toXpetra<int, default_node_type>(const Epetra_BlockMap &map);
82 template const Epetra_Map &toEpetra<int, default_node_type>(const RCP<const Map<int, int, default_node_type> > &map);
83 template const Epetra_Map &toEpetra<int, default_node_type>(const Map<int, int, default_node_type> &map);
84 #endif // HAVE_XPETRA_TPETRA
85 
86 #endif // XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
87 
88 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
89 
90 #ifdef HAVE_XPETRA_TPETRA
91 #include "TpetraCore_config.h"
92 #if ((defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_OPENMP)) || \
93  (!defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_SERIAL)))
94 template const RCP<const Map<int, long long, Xpetra::EpetraNode> > toXpetra<long long, Xpetra::EpetraNode>(const Epetra_BlockMap &map);
95 template const Epetra_Map &toEpetra<long long, Xpetra::EpetraNode>(const RCP<const Map<int, long long, Xpetra::EpetraNode> > &map);
96 template const Epetra_Map &toEpetra<long long, Xpetra::EpetraNode>(const Map<int, long long, Xpetra::EpetraNode> &map);
97 #endif
98 
99 #ifdef HAVE_TPETRA_INST_SERIAL
100 // template class EpetraMapT<long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode >;
101 template const RCP<const Map<int, long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode> > toXpetra<long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const Epetra_BlockMap &map);
102 template const Epetra_Map &toEpetra<long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const RCP<const Map<int, long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode> > &map);
103 template const Epetra_Map &toEpetra<long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const Map<int, long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode> &map);
104 #endif
105 
106 #ifdef HAVE_TPETRA_INST_PTHREAD
107 // template class EpetraMapT<long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>;
108 template const RCP<const Map<int, long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> > toXpetra<long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const Epetra_BlockMap &map);
109 template const Epetra_Map &toEpetra<long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const RCP<const Map<int, long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> > &map);
110 template const Epetra_Map &toEpetra<long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const Map<int, long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> &map);
111 #endif
112 
113 #ifdef HAVE_TPETRA_INST_OPENMP
114 // template class EpetraMapT<long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode >;
115 template const RCP<const Map<int, long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> > toXpetra<long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const Epetra_BlockMap &map);
116 template const Epetra_Map &toEpetra<long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const RCP<const Map<int, long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> > &map);
117 template const Epetra_Map &toEpetra<long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const Map<int, long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> &map);
118 #endif
119 
120 #ifdef HAVE_TPETRA_INST_CUDA
121 typedef Tpetra::KokkosCompat::KokkosCudaWrapperNode default_node_type;
122 // template class EpetraMapT<long long, default_node_type >;
123 template const RCP<const Map<int, long long, default_node_type> > toXpetra<long long, default_node_type>(const Epetra_BlockMap &map);
124 template const Epetra_Map &toEpetra<long long, default_node_type>(const RCP<const Map<int, long long, default_node_type> > &map);
125 template const Epetra_Map &toEpetra<long long, default_node_type>(const Map<int, long long, default_node_type> &map);
126 #endif
127 
128 #ifdef HAVE_TPETRA_INST_HIP
129 typedef Tpetra::KokkosCompat::KokkosHIPWrapperNode default_node_type;
130 // template class EpetraMapT<long long, default_node_type >;
131 template const RCP<const Map<int, long long, default_node_type> > toXpetra<long long, default_node_type>(const Epetra_BlockMap &map);
132 template const Epetra_Map &toEpetra<long long, default_node_type>(const RCP<const Map<int, long long, default_node_type> > &map);
133 template const Epetra_Map &toEpetra<long long, default_node_type>(const Map<int, long long, default_node_type> &map);
134 #endif
135 
136 #else
137 // Tpetra is disabled and Kokkos not available: use dummy node type
138 typedef Xpetra::EpetraNode default_node_type;
139 template const RCP<const Map<int, long long, default_node_type> > toXpetra<long long, default_node_type>(const Epetra_BlockMap &map);
140 template const Epetra_Map &toEpetra<long long, default_node_type>(const RCP<const Map<int, long long, default_node_type> > &map);
141 template const Epetra_Map &toEpetra<long long, default_node_type>(const Map<int, long long, default_node_type> &map);
142 #endif // HAVE_XPETRA_TPETRA
143 
144 #endif // HAVE_XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
145 
146 } // namespace Xpetra
147 
148 #endif // HAVE_XPETRA_EPETRA
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
const Epetra_Map & getEpetra_Map() const
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)