Reference documentation for deal.II version GIT e8f57130d0 2023-09-28 07:00:03+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\}}\)
trilinos_epetra_communication_pattern.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2015 - 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_WITH_TRILINOS
19 
20 # include <deal.II/base/index_set.h>
21 
22 # include <Epetra_Map.h>
23 
24 # include <memory>
25 
27 
28 namespace LinearAlgebra
29 {
30  namespace EpetraWrappers
31  {
33  const IndexSet &locally_owned_indices,
34  const IndexSet &ghost_indices,
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(locally_owned_indices,
41  ghost_indices,
42  communicator);
43  }
44 
45 
46 
47  void
48  CommunicationPattern::reinit(const IndexSet &locally_owned_indices,
49  const IndexSet &ghost_indices,
50  const MPI_Comm communicator)
51  {
52  comm = std::make_shared<const MPI_Comm>(communicator);
53 
54  Epetra_Map vector_space_vector_map =
55  locally_owned_indices.make_trilinos_map(*comm, false);
56  Epetra_Map read_write_vector_map =
57  ghost_indices.make_trilinos_map(*comm, true);
58 
59  // Target map is read_write_vector_map
60  // Source map is vector_space_vector_map. This map must have uniquely
61  // owned GID.
62  importer = std::make_unique<Epetra_Import>(read_write_vector_map,
63  vector_space_vector_map);
64  }
65 
66 
67 
68  MPI_Comm
70  {
71  return *comm;
72  }
73 
74 
75 
76  const Epetra_Import &
78  {
79  return *importer;
80  }
81  } // namespace EpetraWrappers
82 } // namespace LinearAlgebra
83 
85 
86 #endif
Epetra_Map make_trilinos_map(const MPI_Comm communicator=MPI_COMM_WORLD, const bool overlapping=false) const
Definition: index_set.cc:840
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:477
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478