Reference documentation for deal.II version 9.5.0
\(\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// Copyright (C) 2018 - 2023 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
17
18#ifdef DEAL_II_TRILINOS_WITH_TPETRA
19
21
22# include <Tpetra_Map.hpp>
23
24# include <memory>
25
27
28namespace LinearAlgebra
29{
30 namespace TpetraWrappers
31 {
33 const IndexSet &vector_space_vector_index_set,
34 const IndexSet &read_write_vector_index_set,
35 const MPI_Comm communicator)
36 {
37 // virtual functions called in constructors and destructors never use the
38 // override in a derived class
39 // for clarity be explicit on which function is called
40 CommunicationPattern::reinit(vector_space_vector_index_set,
41 read_write_vector_index_set,
42 communicator);
43 }
44
45
46
47 void
48 CommunicationPattern::reinit(const IndexSet &vector_space_vector_index_set,
49 const IndexSet &read_write_vector_index_set,
50 const MPI_Comm communicator)
51 {
52 comm = std::make_shared<const MPI_Comm>(communicator);
53
54 auto vector_space_vector_map =
55 Teuchos::rcp(new Tpetra::Map<int, types::signed_global_dof_index>(
56 vector_space_vector_index_set.make_tpetra_map(*comm, false)));
57 auto read_write_vector_map =
58 Teuchos::rcp(new Tpetra::Map<int, types::signed_global_dof_index>(
59 read_write_vector_index_set.make_tpetra_map(*comm, true)));
60
61 // Target map is read_write_vector_map
62 // Source map is vector_space_vector_map. This map must have uniquely
63 // owned GID.
65 std::make_unique<Tpetra::Import<int, types::signed_global_dof_index>>(
66 read_write_vector_map, vector_space_vector_map);
68 std::make_unique<Tpetra::Export<int, types::signed_global_dof_index>>(
69 read_write_vector_map, vector_space_vector_map);
70 }
71
72
73
76 {
77 return *comm;
78 }
79
80
81
82 const Tpetra::Import<int, types::signed_global_dof_index> &
84 {
85 return *tpetra_import;
86 }
87
88
89
90 const Tpetra::Export<int, types::signed_global_dof_index> &
92 {
93 return *tpetra_export;
94 }
95 } // namespace TpetraWrappers
96} // namespace LinearAlgebra
97
99
100#endif
Tpetra::Map< int, types::signed_global_dof_index > make_tpetra_map(const MPI_Comm communicator=MPI_COMM_WORLD, const bool overlapping=false) const
Definition index_set.cc:720
const Tpetra::Export< int, types::signed_global_dof_index > & get_tpetra_export() const
CommunicationPattern(const IndexSet &vector_space_vector_index_set, const IndexSet &read_write_vector_index_set, const MPI_Comm communicator)
virtual void reinit(const IndexSet &vector_space_vector_index_set, const IndexSet &read_write_vector_index_set, const MPI_Comm communicator) override
std::unique_ptr< Tpetra::Import< int, types::signed_global_dof_index > > tpetra_import
const Tpetra::Import< int, types::signed_global_dof_index > & get_tpetra_import() const
std::unique_ptr< Tpetra::Export< int, types::signed_global_dof_index > > tpetra_export
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473