Reference documentation for deal.II version 9.2.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\}}\)
trilinos_epetra_communication_pattern.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2015 - 2018 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 
19 
20 #ifdef DEAL_II_WITH_TRILINOS
21 
22 # ifdef DEAL_II_WITH_MPI
23 
24 # include <deal.II/base/index_set.h>
25 
26 # include <Epetra_Map.h>
27 
28 # include <memory>
29 
31 
32 namespace LinearAlgebra
33 {
34  namespace EpetraWrappers
35  {
37  const IndexSet &vector_space_vector_index_set,
38  const IndexSet &read_write_vector_index_set,
39  const MPI_Comm &communicator)
40  {
41  // virtual functions called in constructors and destructors never use the
42  // override in a derived class
43  // for clarity be explicit on which function is called
44  CommunicationPattern::reinit(vector_space_vector_index_set,
45  read_write_vector_index_set,
46  communicator);
47  }
48 
49 
50 
51  void
52  CommunicationPattern::reinit(const IndexSet &vector_space_vector_index_set,
53  const IndexSet &read_write_vector_index_set,
54  const MPI_Comm &communicator)
55  {
56  comm = std::make_shared<const MPI_Comm>(communicator);
57 
58  Epetra_Map vector_space_vector_map =
59  vector_space_vector_index_set.make_trilinos_map(*comm, false);
60  Epetra_Map read_write_vector_map =
61  read_write_vector_index_set.make_trilinos_map(*comm, true);
62 
63  // Target map is read_write_vector_map
64  // Source map is vector_space_vector_map. This map must have uniquely
65  // owned GID.
66  import = std_cxx14::make_unique<Epetra_Import>(read_write_vector_map,
67  vector_space_vector_map);
68  }
69 
70 
71 
72  const MPI_Comm &
74  {
75  return *comm;
76  }
77 
78 
79 
80  const Epetra_Import &
82  {
83  return *import;
84  }
85  } // namespace EpetraWrappers
86 } // namespace LinearAlgebra
87 
89 
90 # endif
91 
92 #endif
LinearAlgebra::EpetraWrappers::CommunicationPattern::CommunicationPattern
CommunicationPattern(const IndexSet &vector_space_vector_index_set, const IndexSet &read_write_vector_index_set, const MPI_Comm &communicator)
Definition: trilinos_epetra_communication_pattern.cc:36
IndexSet
Definition: index_set.h:74
LinearAlgebra
Definition: communication_pattern_base.h:30
LinearAlgebra::EpetraWrappers::CommunicationPattern::reinit
virtual void reinit(const IndexSet &vector_space_vector_index_set, const IndexSet &read_write_vector_index_set, const MPI_Comm &communicator) override
Definition: trilinos_epetra_communication_pattern.cc:52
MPI_Comm
IndexSet::make_trilinos_map
Epetra_Map make_trilinos_map(const MPI_Comm &communicator=MPI_COMM_WORLD, const bool overlapping=false) const
Definition: index_set.cc:596
LinearAlgebra::EpetraWrappers::CommunicationPattern::comm
std::shared_ptr< const MPI_Comm > comm
Definition: trilinos_epetra_communication_pattern.h:79
index_set.h
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
trilinos_epetra_communication_pattern.h
memory.h
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
LinearAlgebra::EpetraWrappers::CommunicationPattern::get_epetra_import
const Epetra_Import & get_epetra_import() const
Definition: trilinos_epetra_communication_pattern.cc:81
LinearAlgebra::EpetraWrappers::CommunicationPattern::get_mpi_communicator
virtual const MPI_Comm & get_mpi_communicator() const override
Definition: trilinos_epetra_communication_pattern.cc:73