Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_EpetraImport.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_EpetraImport.hpp"
11 #include "Xpetra_Exceptions.hpp"
12 
13 namespace Xpetra {
14 
15 template <class GlobalOrdinal, class Node>
16 RCP<const Import<int, GlobalOrdinal, Node> > toXpetra(const Epetra_Import *import) {
17  if (import != NULL) {
18  RCP<const Epetra_Import> imp = rcp(new Epetra_Import(*import)); // NOTE: non consitent: return pointer, take ref
19  return rcp(new Xpetra::EpetraImportT<GlobalOrdinal, Node>(imp));
20  }
21 
22  return Teuchos::null;
23 }
24 //
25 
26 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
27 #ifdef HAVE_XPETRA_TPETRA
28 #include "TpetraCore_config.h"
29 #if ((defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_OPENMP)) || \
30  (!defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_SERIAL)))
31 template class EpetraImportT<int, Xpetra::EpetraNode>;
32 template RCP<const Import<int, int, Xpetra::EpetraNode> > toXpetra<int, Xpetra::EpetraNode>(const Epetra_Import *);
33 #endif
34 
35 #ifdef HAVE_TPETRA_INST_SERIAL
36 template class EpetraImportT<int, Tpetra::KokkosCompat::KokkosSerialWrapperNode>;
37 template RCP<const Import<int, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode> > toXpetra<int, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const Epetra_Import *);
38 #endif
39 #ifdef HAVE_TPETRA_INST_PTHREAD
40 template class EpetraImportT<int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>;
41 template RCP<const Import<int, int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> > toXpetra<int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const Epetra_Import *);
42 #endif
43 #ifdef HAVE_TPETRA_INST_OPENMP
44 template class EpetraImportT<int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>;
45 template RCP<const Import<int, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> > toXpetra<int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const Epetra_Import *);
46 #endif
47 #ifdef HAVE_TPETRA_INST_CUDA
48 typedef Tpetra::KokkosCompat::KokkosCudaWrapperNode default_node_type;
49 template class EpetraImportT<int, default_node_type>;
50 template RCP<const Import<int, int, default_node_type> > toXpetra<int, default_node_type>(const Epetra_Import *);
51 #endif
52 #ifdef HAVE_TPETRA_INST_HIP
53 typedef Tpetra::KokkosCompat::KokkosHIPWrapperNode default_node_type;
54 template class EpetraImportT<int, default_node_type>;
55 template RCP<const Import<int, int, default_node_type> > toXpetra<int, default_node_type>(const Epetra_Import *);
56 #endif
57 #else
58 // Tpetra is disabled and Kokkos not available: use dummy node type
59 typedef Xpetra::EpetraNode default_node_type;
60 template class EpetraImportT<int, default_node_type>;
61 template RCP<const Import<int, int, default_node_type> > toXpetra<int, default_node_type>(const Epetra_Import *);
62 #endif // HAVE_XPETRA_TPETRA
63 #endif // XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
64 
65 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
66 #ifdef HAVE_XPETRA_TPETRA
67 #include "TpetraCore_config.h"
68 #if ((defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_OPENMP)) || \
69  (!defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_SERIAL)))
70 template class EpetraImportT<long long, Xpetra::EpetraNode>;
71 template RCP<const Import<int, long long, Xpetra::EpetraNode> > toXpetra<long long, Xpetra::EpetraNode>(const Epetra_Import *);
72 #endif
73 
74 #ifdef HAVE_TPETRA_INST_SERIAL
75 template class EpetraImportT<long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode>;
76 template RCP<const Import<int, long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode> > toXpetra<long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const Epetra_Import *);
77 #endif
78 #ifdef HAVE_TPETRA_INST_PTHREAD
79 template class EpetraImportT<long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>;
80 template RCP<const Import<int, long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> > toXpetra<long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const Epetra_Import *);
81 #endif
82 #ifdef HAVE_TPETRA_INST_OPENMP
83 template class EpetraImportT<long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>;
84 template RCP<const Import<int, long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> > toXpetra<long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const Epetra_Import *);
85 #endif
86 #ifdef HAVE_TPETRA_INST_CUDA
87 typedef Tpetra::KokkosCompat::KokkosCudaWrapperNode default_node_type;
88 template class EpetraImportT<long long, default_node_type>;
89 template RCP<const Import<int, long long, default_node_type> > toXpetra<long long, default_node_type>(const Epetra_Import *);
90 #endif
91 #ifdef HAVE_TPETRA_INST_HIP
92 typedef Tpetra::KokkosCompat::KokkosHIPWrapperNode default_node_type;
93 template class EpetraImportT<long long, default_node_type>;
94 template RCP<const Import<int, long long, default_node_type> > toXpetra<long long, default_node_type>(const Epetra_Import *);
95 #endif
96 #else
97 // Tpetra is disabled and Kokkos not available: use dummy node type
98 typedef Xpetra::EpetraNode default_node_type;
99 template class EpetraImportT<long long, default_node_type>;
100 template RCP<const Import<int, long long, default_node_type> > toXpetra<long long, default_node_type>(const Epetra_Import *);
101 #endif // HAVE_XPETRA_TPETRA
102 #endif
103 
104 } // namespace Xpetra
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)