All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Xpetra_EpetraMap.cpp
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 #include "Xpetra_ConfigDefs.hpp"
47 
48 #ifdef HAVE_XPETRA_EPETRA
49 
50 #include "Xpetra_EpetraMap.hpp"
51 
52 namespace Xpetra {
53 
54  template<class GlobalOrdinal, class Node>
56  const EpetraMapT<GlobalOrdinal, Node> & epetraMap = dynamic_cast<const EpetraMapT<GlobalOrdinal, Node> &>(*map.getMap());
57  return epetraMap.getEpetra_Map();
58  }
59 
60  template<class GlobalOrdinal, class Node>
61  const Epetra_Map & toEpetra(const RCP< const Map<int,GlobalOrdinal,Node> > &map) {
63  return epetraMap->getEpetra_Map();
64  }
65 
66  template<class GlobalOrdinal, class Node>
69  return rcp( new EpetraMapT<GlobalOrdinal, Node>(m) );
70  }
71 
72 
73 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
74 #ifdef HAVE_XPETRA_TPETRA
75 #include "TpetraCore_config.h"
76 #if ((defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_OPENMP)) || \
77  (!defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_SERIAL)))
78  template const RCP< const Map<int, int, Xpetra::EpetraNode > > toXpetra<int, Xpetra::EpetraNode>(const Epetra_BlockMap &map);
79  template const Epetra_Map & toEpetra<int, Xpetra::EpetraNode >(const RCP< const Map<int, int, Xpetra::EpetraNode > > &map);
80  template const Epetra_Map & toEpetra<int, Xpetra::EpetraNode >(const Map< int, int, Xpetra::EpetraNode> & map);
81 #endif
82 #ifdef HAVE_TPETRA_INST_SERIAL
83 //template class EpetraMapT<int, Kokkos::Compat::KokkosSerialWrapperNode >;
84 template const RCP< const Map<int, int, Kokkos::Compat::KokkosSerialWrapperNode > > toXpetra<int, Kokkos::Compat::KokkosSerialWrapperNode>(const Epetra_BlockMap &map);
85 template const Epetra_Map & toEpetra<int, Kokkos::Compat::KokkosSerialWrapperNode >(const RCP< const Map<int, int, Kokkos::Compat::KokkosSerialWrapperNode > > & map);
86 template const Epetra_Map & toEpetra<int, Kokkos::Compat::KokkosSerialWrapperNode >(const Map< int, int, Kokkos::Compat::KokkosSerialWrapperNode> & map);
87 #endif
88 #ifdef HAVE_TPETRA_INST_PTHREAD
89 //template class EpetraMapT<int, Kokkos::Compat::KokkosThreadsWrapperNode>;
90 template const RCP< const Map<int, int, Kokkos::Compat::KokkosThreadsWrapperNode > > toXpetra<int, Kokkos::Compat::KokkosThreadsWrapperNode>(const Epetra_BlockMap &map);
91 template const Epetra_Map & toEpetra<int, Kokkos::Compat::KokkosThreadsWrapperNode >(const RCP< const Map<int, int, Kokkos::Compat::KokkosThreadsWrapperNode > > &map);
92 template const Epetra_Map & toEpetra<int, Kokkos::Compat::KokkosThreadsWrapperNode >(const Map< int, int, Kokkos::Compat::KokkosThreadsWrapperNode> & map);
93 #endif
94 #ifdef HAVE_TPETRA_INST_OPENMP
95 //template class EpetraMapT<int, Kokkos::Compat::KokkosOpenMPWrapperNode >;
96 template const RCP< const Map<int, int, Kokkos::Compat::KokkosOpenMPWrapperNode > > toXpetra<int, Kokkos::Compat::KokkosOpenMPWrapperNode>(const Epetra_BlockMap &map);
97 template const Epetra_Map & toEpetra<int, Kokkos::Compat::KokkosOpenMPWrapperNode >(const RCP< const Map<int, int, Kokkos::Compat::KokkosOpenMPWrapperNode > > &map);
98 template const Epetra_Map & toEpetra<int, Kokkos::Compat::KokkosOpenMPWrapperNode >(const Map< int, int, Kokkos::Compat::KokkosOpenMPWrapperNode> & map);
99 #endif
100 #ifdef HAVE_TPETRA_INST_CUDA
101 typedef Kokkos::Compat::KokkosCudaWrapperNode default_node_type;
102 //template class EpetraMapT<int, default_node_type >;
103 template const RCP< const Map<int, int, default_node_type > > toXpetra<int, default_node_type>(const Epetra_BlockMap &map);
104 template const Epetra_Map & toEpetra<int, default_node_type >(const RCP< const Map<int, int, default_node_type > > &map);
105 template const Epetra_Map & toEpetra<int, default_node_type >(const Map< int, int, default_node_type> & map);
106 #endif
107 #else
108 // Tpetra is disabled and Kokkos not available: use dummy node type
109 typedef Xpetra::EpetraNode default_node_type;
110 template const RCP< const Map<int, int, default_node_type > > toXpetra<int, default_node_type>(const Epetra_BlockMap &map);
111 template const Epetra_Map & toEpetra<int, default_node_type >(const RCP< const Map<int, int, default_node_type > > &map);
112 template const Epetra_Map & toEpetra<int, default_node_type >(const Map< int, int, default_node_type> & map);
113 #endif // HAVE_XPETRA_TPETRA
114 #endif
115 
116 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
117 #ifdef HAVE_XPETRA_TPETRA
118 #include "TpetraCore_config.h"
119 #if ((defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_OPENMP)) || \
120  (!defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_SERIAL)))
121 template const RCP< const Map<int, long long, Xpetra::EpetraNode > > toXpetra<long long, Xpetra::EpetraNode>(const Epetra_BlockMap &map);
122 template const Epetra_Map & toEpetra<long long, Xpetra::EpetraNode >(const RCP< const Map<int, long long, Xpetra::EpetraNode > > &map);
123 template const Epetra_Map & toEpetra<long long, Xpetra::EpetraNode >(const Map< int, long long, Xpetra::EpetraNode> & map);
124 #endif
125 
126 #ifdef HAVE_TPETRA_INST_SERIAL
127 //template class EpetraMapT<long long, Kokkos::Compat::KokkosSerialWrapperNode >;
128 template const RCP< const Map<int, long long, Kokkos::Compat::KokkosSerialWrapperNode > > toXpetra<long long, Kokkos::Compat::KokkosSerialWrapperNode>(const Epetra_BlockMap &map);
129 template const Epetra_Map & toEpetra<long long, Kokkos::Compat::KokkosSerialWrapperNode >(const RCP< const Map<int, long long, Kokkos::Compat::KokkosSerialWrapperNode > > & map);
130 template const Epetra_Map & toEpetra<long long, Kokkos::Compat::KokkosSerialWrapperNode >(const Map< int, long long, Kokkos::Compat::KokkosSerialWrapperNode> & map);
131 #endif
132 #ifdef HAVE_TPETRA_INST_PTHREAD
133 //template class EpetraMapT<long long, Kokkos::Compat::KokkosThreadsWrapperNode>;
134 template const RCP< const Map<int, long long, Kokkos::Compat::KokkosThreadsWrapperNode > > toXpetra<long long, Kokkos::Compat::KokkosThreadsWrapperNode>(const Epetra_BlockMap &map);
135 template const Epetra_Map & toEpetra<long long, Kokkos::Compat::KokkosThreadsWrapperNode >(const RCP< const Map<int, long long, Kokkos::Compat::KokkosThreadsWrapperNode > > &map);
136 template const Epetra_Map & toEpetra<long long, Kokkos::Compat::KokkosThreadsWrapperNode >(const Map< int, long long, Kokkos::Compat::KokkosThreadsWrapperNode> & map);
137 #endif
138 #ifdef HAVE_TPETRA_INST_OPENMP
139 //template class EpetraMapT<long long, Kokkos::Compat::KokkosOpenMPWrapperNode >;
140 template const RCP< const Map<int, long long, Kokkos::Compat::KokkosOpenMPWrapperNode > > toXpetra<long long, Kokkos::Compat::KokkosOpenMPWrapperNode>(const Epetra_BlockMap &map);
141 template const Epetra_Map & toEpetra<long long, Kokkos::Compat::KokkosOpenMPWrapperNode >(const RCP< const Map<int, long long, Kokkos::Compat::KokkosOpenMPWrapperNode > > &map);
142 template const Epetra_Map & toEpetra<long long, Kokkos::Compat::KokkosOpenMPWrapperNode >(const Map< int, long long, Kokkos::Compat::KokkosOpenMPWrapperNode> & map);
143 #endif
144 #ifdef HAVE_TPETRA_INST_CUDA
145 typedef Kokkos::Compat::KokkosCudaWrapperNode default_node_type;
146 //template class EpetraMapT<long long, default_node_type >;
147 template const RCP< const Map<int, long long, default_node_type > > toXpetra<long long, default_node_type>(const Epetra_BlockMap &map);
148 template const Epetra_Map & toEpetra<long long, default_node_type >(const RCP< const Map<int, long long, default_node_type > > &map);
149 template const Epetra_Map & toEpetra<long long, default_node_type >(const Map< int, long long, default_node_type> & map);
150 #endif
151 #else
152 // Tpetra is disabled and Kokkos not available: use dummy node type
153 typedef Xpetra::EpetraNode default_node_type;
154 template const RCP< const Map<int, long long, default_node_type > > toXpetra<long long, default_node_type>(const Epetra_BlockMap &map);
155 template const Epetra_Map & toEpetra<long long, default_node_type >(const RCP< const Map<int, long long, default_node_type > > &map);
156 template const Epetra_Map & toEpetra<long long, default_node_type >(const Map< int, long long, default_node_type> & map);
157 #endif // HAVE_XPETRA_TPETRA
158 
159 
160 // Specialization of the case GlobalOrdinal = long
161 #ifdef HAVE_XPETRA_TPETRA
162 #include "TpetraCore_config.h"
163 #if ((defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_OPENMP)) || \
164  (!defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_SERIAL)))
165 template const RCP< const Map<int, long, Xpetra::EpetraNode > > toXpetra<long, Xpetra::EpetraNode>(const Epetra_BlockMap &map);
166 template const Epetra_Map & toEpetra<long, Xpetra::EpetraNode >(const RCP< const Map<int, long, Xpetra::EpetraNode > > &map);
167 template const Epetra_Map & toEpetra<long, Xpetra::EpetraNode >(const Map< int, long, Xpetra::EpetraNode> & map);
168 #endif
169 
170 #ifdef HAVE_TPETRA_INST_SERIAL
171 //template class EpetraMapT<long, Kokkos::Compat::KokkosSerialWrapperNode >;
172 template const RCP< const Map<int, long, Kokkos::Compat::KokkosSerialWrapperNode > > toXpetra<long, Kokkos::Compat::KokkosSerialWrapperNode>(const Epetra_BlockMap &map);
173 template const Epetra_Map & toEpetra<long, Kokkos::Compat::KokkosSerialWrapperNode >(const RCP< const Map<int, long, Kokkos::Compat::KokkosSerialWrapperNode > > & map);
174 template const Epetra_Map & toEpetra<long, Kokkos::Compat::KokkosSerialWrapperNode >(const Map< int, long, Kokkos::Compat::KokkosSerialWrapperNode> & map);
175 #endif
176 #ifdef HAVE_TPETRA_INST_PTHREAD
177 //template class EpetraMapT<long, Kokkos::Compat::KokkosThreadsWrapperNode>;
178 template const RCP< const Map<int, long, Kokkos::Compat::KokkosThreadsWrapperNode > > toXpetra<long, Kokkos::Compat::KokkosThreadsWrapperNode>(const Epetra_BlockMap &map);
179 template const Epetra_Map & toEpetra<long, Kokkos::Compat::KokkosThreadsWrapperNode >(const RCP< const Map<int, long, Kokkos::Compat::KokkosThreadsWrapperNode > > &map);
180 template const Epetra_Map & toEpetra<long, Kokkos::Compat::KokkosThreadsWrapperNode >(const Map< int, long, Kokkos::Compat::KokkosThreadsWrapperNode> & map);
181 #endif
182 #ifdef HAVE_TPETRA_INST_OPENMP
183 //template class EpetraMapT<long, Kokkos::Compat::KokkosOpenMPWrapperNode >;
184 template const RCP< const Map<int, long, Kokkos::Compat::KokkosOpenMPWrapperNode > > toXpetra<long, Kokkos::Compat::KokkosOpenMPWrapperNode>(const Epetra_BlockMap &map);
185 template const Epetra_Map & toEpetra<long, Kokkos::Compat::KokkosOpenMPWrapperNode >(const RCP< const Map<int, long, Kokkos::Compat::KokkosOpenMPWrapperNode > > &map);
186 template const Epetra_Map & toEpetra<long, Kokkos::Compat::KokkosOpenMPWrapperNode >(const Map< int, long, Kokkos::Compat::KokkosOpenMPWrapperNode> & map);
187 #endif
188 #ifdef HAVE_TPETRA_INST_CUDA
189 typedef Kokkos::Compat::KokkosCudaWrapperNode default_node_type;
190 //template class EpetraMapT<long, default_node_type >;
191 template const RCP< const Map<int, long, default_node_type > > toXpetra<long, default_node_type>(const Epetra_BlockMap &map);
192 template const Epetra_Map & toEpetra<long, default_node_type >(const RCP< const Map<int, long, default_node_type > > &map);
193 template const Epetra_Map & toEpetra<long, default_node_type >(const Map< int, long, default_node_type> & map);
194 #endif
195 #else
196 // Tpetra is disabled and Kokkos not available: use dummy node type
197 typedef Xpetra::EpetraNode default_node_type;
198 template const RCP< const Map<int, long, default_node_type > > toXpetra<long, default_node_type>(const Epetra_BlockMap &map);
199 template const Epetra_Map & toEpetra<long, default_node_type >(const RCP< const Map<int, long, default_node_type > > &map);
200 template const Epetra_Map & toEpetra<long, default_node_type >(const Map< int, long, default_node_type> & map);
201 #endif // HAVE_XPETRA_TPETRA
202 
203 #endif
204 
205 }
206 
207 
208 #endif
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Definition: Xpetra_Map.hpp:222
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
const Epetra_Map & getEpetra_Map() const