deal.II version 9.7.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_epetra_communication_pattern.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2016 - 2023 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_WITH_TRILINOS
18
20
22# include <Epetra_Map.h>
24
25# include <memory>
26
28
29namespace LinearAlgebra
30{
31 namespace EpetraWrappers
32 {
34 const IndexSet &locally_owned_indices,
35 const IndexSet &ghost_indices,
36 const MPI_Comm communicator)
37 {
38 // virtual functions called in constructors and destructors never use the
39 // override in a derived class
40 // for clarity be explicit on which function is called
41 CommunicationPattern::reinit(locally_owned_indices,
42 ghost_indices,
43 communicator);
44 }
45
46
47
48 void
49 CommunicationPattern::reinit(const IndexSet &locally_owned_indices,
50 const IndexSet &ghost_indices,
51 const MPI_Comm communicator)
52 {
53 comm = std::make_shared<const MPI_Comm>(communicator);
54
55 Epetra_Map vector_space_vector_map =
56 locally_owned_indices.make_trilinos_map(*comm, false);
57 Epetra_Map read_write_vector_map =
58 ghost_indices.make_trilinos_map(*comm, true);
59
60 // Target map is read_write_vector_map
61 // Source map is vector_space_vector_map. This map must have uniquely
62 // owned GID.
63 importer = std::make_unique<Epetra_Import>(read_write_vector_map,
64 vector_space_vector_map);
65 }
66
67
68
71 {
72 return *comm;
73 }
74
75
76
77 const Epetra_Import &
82 } // namespace EpetraWrappers
83} // namespace LinearAlgebra
84
86
87#endif
Epetra_Map make_trilinos_map(const MPI_Comm communicator=MPI_COMM_WORLD, const bool overlapping=false) 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)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:40
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition config.h:603
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:41
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition config.h:647