deal.II version GIT relicensing-2291-g668cd86249 2024-12-24 11:30:00+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_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
21# include <Epetra_Map.h>
22
23# include <memory>
24
26
27namespace LinearAlgebra
28{
29 namespace EpetraWrappers
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 = std::make_shared<const MPI_Comm>(communicator);
52
53 Epetra_Map vector_space_vector_map =
54 locally_owned_indices.make_trilinos_map(*comm, false);
55 Epetra_Map read_write_vector_map =
56 ghost_indices.make_trilinos_map(*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.
61 importer = std::make_unique<Epetra_Import>(read_write_vector_map,
62 vector_space_vector_map);
63 }
64
65
66
69 {
70 return *comm;
71 }
72
73
74
75 const Epetra_Import &
80 } // namespace EpetraWrappers
81} // namespace LinearAlgebra
82
84
85#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:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499