MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_LWGraph_kokkos_def.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // MueLu: A package for multigrid based preconditioning
4 //
5 // Copyright 2012 NTESS and the MueLu contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef MUELU_LWGRAPH_KOKKOS_DEF_HPP
11 #define MUELU_LWGRAPH_KOKKOS_DEF_HPP
12 
13 #include "MueLu_LWGraph.hpp"
15 
16 namespace MueLu {
17 
18 template <class LocalOrdinal, class GlobalOrdinal, class Node>
20  auto graph = this->getGraph();
21 
22  auto row_map_h = Kokkos::create_mirror_view(graph.row_map);
23  auto entries_h = Kokkos::create_mirror_view(graph.entries);
24  Kokkos::deep_copy(row_map_h, graph.row_map);
25  Kokkos::deep_copy(entries_h, graph.entries);
26 
28  auto graph_h = local_graph_type_host(entries_h, row_map_h);
29 
30  auto lw_h = rcp(new MueLu::LWGraph<LocalOrdinal, GlobalOrdinal, Node>(graph_h, this->GetDomainMap(), this->GetImportMap(), this->getObjectLabel()));
31 
33 
34  auto bndry = this->GetBoundaryNodeMap();
35  auto bndry_h = bndry_nodes_type("boundary_nodes", bndry.extent(0));
36  Kokkos::deep_copy(bndry_h, bndry);
37  lw_h->SetBoundaryNodeMap(bndry_h);
38 
39  return lw_h;
40 }
41 
42 } // namespace MueLu
43 
44 #endif // MUELU_LWGRAPH_KOKKOS_DEF_HPP
RCP< MueLu::LWGraph< LocalOrdinal, GlobalOrdinal, Node > > copyToHost()
typename std::conditional< OnHost, typename local_graph_device_type::HostMirror, local_graph_device_type >::type local_graph_type
Kokkos::View< bool *, memory_space > boundary_nodes_type
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Lightweight MueLu representation of a compressed row storage graph.