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