Reference documentation for deal.II version GIT relicensing-43-g3fc2fae7c3 2024-03-03 21:10:02+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
17#ifdef DEAL_II_TRILINOS_WITH_TPETRA
18
20
21# include <Tpetra_Map.hpp>
22
23# include <memory>
24
26
27namespace LinearAlgebra
28{
29 namespace TpetraWrappers
30 {
32 const IndexSet &locally_owned_indices,
33 const IndexSet &ghost_indices,
34 const MPI_Comm communicator)
35 {
36 // virtual functions called in constructors and destructors never use the
37 // override in a derived class
38 // for clarity be explicit on which function is called
39 CommunicationPattern::reinit(locally_owned_indices,
40 ghost_indices,
41 communicator);
42 }
43
44
45
46 void
47 CommunicationPattern::reinit(const IndexSet &locally_owned_indices,
48 const IndexSet &ghost_indices,
49 const MPI_Comm communicator)
50 {
51 comm = Teuchos::rcpFromUndefRef(communicator);
52
53 auto vector_space_vector_map =
54 locally_owned_indices.make_tpetra_map_rcp(*comm, false);
55 auto read_write_vector_map =
56 ghost_indices.make_tpetra_map_rcp(*comm, true);
57
58 // Target map is read_write_vector_map
59 // Source map is vector_space_vector_map. This map must have uniquely
60 // owned GID.
62 Teuchos::rcp(new Tpetra::Import<int, types::signed_global_dof_index>(
63 read_write_vector_map, vector_space_vector_map));
65 Teuchos::rcp(new Tpetra::Export<int, types::signed_global_dof_index>(
66 read_write_vector_map, vector_space_vector_map));
67 }
68
69
70
73 {
74 return *comm;
75 }
76
77
78
79 const Tpetra::Import<int, types::signed_global_dof_index> &
84
85
86
87 Teuchos::RCP<const Tpetra::Import<int, types::signed_global_dof_index>>
92
93
94
95 const Tpetra::Export<int, types::signed_global_dof_index> &
100
101
102
103 Teuchos::RCP<const Tpetra::Export<int, types::signed_global_dof_index>>
108 } // namespace TpetraWrappers
109} // namespace LinearAlgebra
110
112
113#endif
Teuchos::RCP< Tpetra::Map< int, types::signed_global_dof_index > > make_tpetra_map_rcp(const MPI_Comm communicator=MPI_COMM_WORLD, const bool overlapping=false) const
Definition index_set.cc:962
Teuchos::RCP< const Tpetra::Import< int, types::signed_global_dof_index > > get_tpetra_import_rcp() const
virtual void reinit(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator) override
const Tpetra::Export< int, types::signed_global_dof_index > & get_tpetra_export() const
Teuchos::RCP< Tpetra::Import< int, types::signed_global_dof_index > > tpetra_import
Teuchos::RCP< const Tpetra::Export< int, types::signed_global_dof_index > > get_tpetra_export_rcp() const
Teuchos::RCP< Tpetra::Export< int, types::signed_global_dof_index > > tpetra_export
const Tpetra::Import< int, types::signed_global_dof_index > & get_tpetra_import() const
CommunicationPattern(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503