deal.II version GIT relicensing-2289-g1e5549a87a 2024-12-21 21:30:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
trilinos_tpetra_communication_pattern.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2018 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
16
19
20#ifdef DEAL_II_TRILINOS_WITH_TPETRA
21
23
24# include <Tpetra_Map.hpp>
25
26# include <memory>
27
29
30namespace LinearAlgebra
31{
32 namespace TpetraWrappers
33 {
34 template <typename MemorySpace>
36 const IndexSet &locally_owned_indices,
37 const IndexSet &ghost_indices,
38 const MPI_Comm communicator)
39 {
40 // virtual functions called in constructors and destructors never use the
41 // override in a derived class
42 // for clarity be explicit on which function is called
44 ghost_indices,
45 communicator);
46 }
47
48
49
50 template <typename MemorySpace>
51 void
53 const IndexSet &locally_owned_indices,
54 const IndexSet &ghost_indices,
55 const MPI_Comm communicator)
56 {
57 comm = Teuchos::rcpFromUndefRef(communicator);
58
59 auto vector_space_vector_map =
60 locally_owned_indices
61 .template make_tpetra_map_rcp<TpetraTypes::NodeType<MemorySpace>>(
62 *comm, false);
63 auto read_write_vector_map =
64 ghost_indices
65 .template make_tpetra_map_rcp<TpetraTypes::NodeType<MemorySpace>>(
66 *comm, true);
67
68 // Target map is read_write_vector_map
69 // Source map is vector_space_vector_map. This map must have uniquely
70 // owned GID.
71 tpetra_import =
72 Teuchos::rcp(new Tpetra::Import<int,
75 read_write_vector_map, vector_space_vector_map));
76 tpetra_export =
77 Teuchos::rcp(new Tpetra::Export<int,
80 read_write_vector_map, vector_space_vector_map));
81 }
82
83
84
85 template <typename MemorySpace>
91
92
93
94 template <typename MemorySpace>
95 const Tpetra::Import<int,
99 {
100 return *tpetra_import;
101 }
102
103
104 template <typename MemorySpace>
105 Teuchos::RCP<TpetraTypes::ImportType<MemorySpace>>
107 {
108 return tpetra_import;
109 }
110
111
112
113 template <typename MemorySpace>
114 const Tpetra::Export<int,
118 {
119 return *tpetra_export;
120 }
121
122
123
124 template <typename MemorySpace>
125 Teuchos::RCP<TpetraTypes::ExportType<MemorySpace>>
127 {
128 return tpetra_export;
129 }
130 } // namespace TpetraWrappers
131} // namespace LinearAlgebra
132
133
138
140
141#endif
const TpetraTypes::ImportType< MemorySpace > & get_tpetra_import() const
virtual void reinit(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator) override
CommunicationPattern(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator)
Teuchos::RCP< TpetraTypes::ImportType< MemorySpace > > get_tpetra_import_rcp() const
Teuchos::RCP< TpetraTypes::ExportType< MemorySpace > > get_tpetra_export_rcp() const
const TpetraTypes::ExportType< MemorySpace > & get_tpetra_export() const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
const MPI_Comm comm
Definition mpi.cc:913
Tpetra::KokkosCompat::KokkosDeviceWrapperNode< typename MemorySpace::kokkos_space::execution_space, typename MemorySpace::kokkos_space > NodeType
int signed_global_dof_index
Definition types.h:92