Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_EpetraVector.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_EpetraVector.hpp"
11 
12 // TODO: replace double -> Scalar etc.
13 
14 namespace Xpetra {
15 
16 // TODO: move that elsewhere
17 template <class GlobalOrdinal, class Node>
20  return *tX.getEpetra_Vector();
21 }
22 
23 template <class GlobalOrdinal, class Node>
24 const Epetra_Vector &toEpetra(const Vector<double, int, GlobalOrdinal, Node> &x) {
26  return *tX.getEpetra_Vector();
27 }
28 //
29 
30 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
31 #ifdef HAVE_XPETRA_TPETRA
32 #include "TpetraCore_config.h"
33 #if ((defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_OPENMP)) || \
34  (!defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_SERIAL)))
35 template class EpetraVectorT<int, Xpetra::EpetraNode>;
36 template Epetra_Vector &toEpetra<int, Xpetra::EpetraNode>(Vector<double, int, int, Xpetra::EpetraNode> &);
37 template const Epetra_Vector &toEpetra<int, Xpetra::EpetraNode>(const Vector<double, int, int, Xpetra::EpetraNode> &);
38 #endif
39 
40 #ifdef HAVE_TPETRA_INST_SERIAL
41 template class EpetraVectorT<int, Tpetra::KokkosCompat::KokkosSerialWrapperNode>;
42 template Epetra_Vector &toEpetra<int, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(Vector<double, int, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode> &);
43 template const Epetra_Vector &toEpetra<int, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const Vector<double, int, int, Tpetra::KokkosCompat::KokkosSerialWrapperNode> &);
44 #endif
45 #ifdef HAVE_TPETRA_INST_PTHREAD
46 template class EpetraVectorT<int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>;
47 template Epetra_Vector &toEpetra<int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(Vector<double, int, int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> &);
48 template const Epetra_Vector &toEpetra<int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const Vector<double, int, int, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> &);
49 #endif
50 #ifdef HAVE_TPETRA_INST_OPENMP
51 template class EpetraVectorT<int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>;
52 template Epetra_Vector &toEpetra<int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(Vector<double, int, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> &);
53 template const Epetra_Vector &toEpetra<int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const Vector<double, int, int, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> &);
54 #endif
55 #ifdef HAVE_TPETRA_INST_CUDA
56 typedef Tpetra::KokkosCompat::KokkosCudaWrapperNode default_node_type;
57 template class EpetraVectorT<int, default_node_type>;
58 template Epetra_Vector &toEpetra<int, default_node_type>(Vector<double, int, int, default_node_type> &);
59 template const Epetra_Vector &toEpetra<int, default_node_type>(const Vector<double, int, int, default_node_type> &);
60 #endif
61 #ifdef HAVE_TPETRA_INST_HIP
62 typedef Tpetra::KokkosCompat::KokkosHIPWrapperNode default_node_type;
63 template class EpetraVectorT<int, default_node_type>;
64 template Epetra_Vector &toEpetra<int, default_node_type>(Vector<double, int, int, default_node_type> &);
65 template const Epetra_Vector &toEpetra<int, default_node_type>(const Vector<double, int, int, default_node_type> &);
66 #endif
67 #else
68 // Tpetra is disabled and Kokkos not available: use dummy node type
69 typedef Xpetra::EpetraNode default_node_type;
70 template class EpetraVectorT<int, default_node_type>;
71 template Epetra_Vector &toEpetra<int, default_node_type>(Vector<double, int, int, default_node_type> &);
72 template const Epetra_Vector &toEpetra<int, default_node_type>(const Vector<double, int, int, default_node_type> &);
73 #endif // HAVE_XPETRA_TPETRA
74 #endif
75 
76 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
77 #ifdef HAVE_XPETRA_TPETRA
78 #include "TpetraCore_config.h"
79 #if ((defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_OPENMP)) || \
80  (!defined(EPETRA_HAVE_OMP) && !defined(HAVE_TPETRA_INST_SERIAL)))
81 template class EpetraVectorT<long long, Xpetra::EpetraNode>;
82 template Epetra_Vector &toEpetra<long long, Xpetra::EpetraNode>(Vector<double, int, long long, Xpetra::EpetraNode> &);
83 template const Epetra_Vector &toEpetra<long long, Xpetra::EpetraNode>(const Vector<double, int, long long, Xpetra::EpetraNode> &);
84 #endif
85 
86 #ifdef HAVE_TPETRA_INST_SERIAL
87 template class EpetraVectorT<long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode>;
88 template Epetra_Vector &toEpetra<long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(Vector<double, int, long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode> &);
89 template const Epetra_Vector &toEpetra<long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode>(const Vector<double, int, long long, Tpetra::KokkosCompat::KokkosSerialWrapperNode> &);
90 #endif
91 #ifdef HAVE_TPETRA_INST_PTHREAD
92 template class EpetraVectorT<long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>;
93 template Epetra_Vector &toEpetra<long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(Vector<double, int, long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> &);
94 template const Epetra_Vector &toEpetra<long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode>(const Vector<double, int, long long, Tpetra::KokkosCompat::KokkosThreadsWrapperNode> &);
95 #endif
96 #ifdef HAVE_TPETRA_INST_OPENMP
97 template class EpetraVectorT<long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>;
98 template Epetra_Vector &toEpetra<long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(Vector<double, int, long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> &);
99 template const Epetra_Vector &toEpetra<long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode>(const Vector<double, int, long long, Tpetra::KokkosCompat::KokkosOpenMPWrapperNode> &);
100 #endif
101 #ifdef HAVE_TPETRA_INST_CUDA
102 typedef Tpetra::KokkosCompat::KokkosCudaWrapperNode default_node_type;
103 template class EpetraVectorT<long long, default_node_type>;
104 template Epetra_Vector &toEpetra<long long, default_node_type>(Vector<double, int, long long, default_node_type> &);
105 template const Epetra_Vector &toEpetra<long long, default_node_type>(const Vector<double, int, long long, default_node_type> &);
106 #endif
107 #ifdef HAVE_TPETRA_INST_HIP
108 typedef Tpetra::KokkosCompat::KokkosHIPWrapperNode default_node_type;
109 template class EpetraVectorT<long long, default_node_type>;
110 template Epetra_Vector &toEpetra<long long, default_node_type>(Vector<double, int, long long, default_node_type> &);
111 template const Epetra_Vector &toEpetra<long long, default_node_type>(const Vector<double, int, long long, default_node_type> &);
112 #endif
113 #else
114 // Tpetra is disabled and Kokkos not available: use dummy node type
115 typedef Xpetra::EpetraNode default_node_type;
116 template class EpetraVectorT<long long, default_node_type>;
117 template Epetra_Vector &toEpetra<long long, default_node_type>(Vector<double, int, long long, default_node_type> &);
118 template const Epetra_Vector &toEpetra<long long, default_node_type>(const Vector<double, int, long long, default_node_type> &);
119 #endif // HAVE_XPETRA_TPETRA
120 #endif
121 
122 } // namespace Xpetra
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)