deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+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: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2018 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
14
17
18#ifdef DEAL_II_TRILINOS_WITH_TPETRA
19
21
22# include <Tpetra_Map.hpp>
23
24# include <memory>
25
26
27#endif
28
30
31#ifdef DEAL_II_TRILINOS_WITH_TPETRA
32
33namespace LinearAlgebra
34{
35 namespace TpetraWrappers
36 {
37 template <typename MemorySpace>
39 const IndexSet &locally_owned_indices,
40 const IndexSet &ghost_indices,
41 const MPI_Comm communicator)
42 {
43 // virtual functions called in constructors and destructors never use the
44 // override in a derived class
45 // for clarity be explicit on which function is called
47 ghost_indices,
48 communicator);
49 }
50
51
52
53 template <typename MemorySpace>
54 void
56 const IndexSet &locally_owned_indices,
57 const IndexSet &ghost_indices,
58 const MPI_Comm communicator)
59 {
60 comm = Teuchos::rcpFromUndefRef(communicator);
61
62 auto vector_space_vector_map =
63 locally_owned_indices
64 .template make_tpetra_map_rcp<TpetraTypes::NodeType<MemorySpace>>(
65 *comm, false);
66 auto read_write_vector_map =
67 ghost_indices
68 .template make_tpetra_map_rcp<TpetraTypes::NodeType<MemorySpace>>(
69 *comm, true);
70
71 // Target map is read_write_vector_map
72 // Source map is vector_space_vector_map. This map must have uniquely
73 // owned GID.
74 tpetra_import =
75 Teuchos::rcp(new Tpetra::Import<int,
78 read_write_vector_map, vector_space_vector_map));
79 tpetra_export =
80 Teuchos::rcp(new Tpetra::Export<int,
83 read_write_vector_map, vector_space_vector_map));
84 }
85
86
87
88 template <typename MemorySpace>
94
95
96
97 template <typename MemorySpace>
98 const Tpetra::Import<int,
102 {
103 return *tpetra_import;
104 }
105
106
107 template <typename MemorySpace>
108 Teuchos::RCP<TpetraTypes::ImportType<MemorySpace>>
110 {
111 return tpetra_import;
112 }
113
114
115
116 template <typename MemorySpace>
117 const Tpetra::Export<int,
121 {
122 return *tpetra_export;
123 }
124
125
126
127 template <typename MemorySpace>
128 Teuchos::RCP<TpetraTypes::ExportType<MemorySpace>>
130 {
131 return tpetra_export;
132 }
133 } // namespace TpetraWrappers
134} // namespace LinearAlgebra
135
136
141
142
143#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:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
const MPI_Comm comm
Definition mpi.cc:912
Tpetra::KokkosCompat::KokkosDeviceWrapperNode< typename MemorySpace::kokkos_space::execution_space, typename MemorySpace::kokkos_space > NodeType
int signed_global_dof_index
Definition types.h:103