Reference documentation for deal.II version GIT relicensing-1062-gc06da148b8 2024-07-15 19:20: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
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 {
35 const IndexSet &locally_owned_indices,
36 const IndexSet &ghost_indices,
37 const MPI_Comm communicator)
38 {
39 // virtual functions called in constructors and destructors never use the
40 // override in a derived class
41 // for clarity be explicit on which function is called
42 CommunicationPattern::reinit(locally_owned_indices,
43 ghost_indices,
44 communicator);
45 }
46
47
48
49 void
50 CommunicationPattern::reinit(const IndexSet &locally_owned_indices,
51 const IndexSet &ghost_indices,
52 const MPI_Comm communicator)
53 {
54 comm = Teuchos::rcpFromUndefRef(communicator);
55
56 auto vector_space_vector_map =
57 locally_owned_indices.make_tpetra_map_rcp(*comm, false);
58 auto read_write_vector_map =
59 ghost_indices.make_tpetra_map_rcp(*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 Teuchos::rcp(new Tpetra::Import<int, types::signed_global_dof_index>(
66 read_write_vector_map, vector_space_vector_map));
68 Teuchos::rcp(new 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> &
87
88
89
90 Teuchos::RCP<TpetraTypes::ImportType<::MemorySpace::Host>>
95
96
97
98 const Tpetra::Export<int, types::signed_global_dof_index> &
103
104
105
106 Teuchos::RCP<TpetraTypes::ExportType<::MemorySpace::Host>>
111 } // namespace TpetraWrappers
112} // namespace LinearAlgebra
113
115
116#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:963
Teuchos::RCP< TpetraTypes::ExportType< MemorySpace > > tpetra_export
virtual void reinit(const IndexSet &locally_owned_indices, const IndexSet &ghost_indices, const MPI_Comm communicator) override
const TpetraTypes::ExportType< MemorySpace > & get_tpetra_export() const
Teuchos::RCP< TpetraTypes::ExportType< MemorySpace > > get_tpetra_export_rcp() const
Teuchos::RCP< TpetraTypes::ImportType< MemorySpace > > tpetra_import
Teuchos::RCP< TpetraTypes::ImportType< MemorySpace > > get_tpetra_import_rcp() const
const TpetraTypes::ImportType< MemorySpace > & 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