18#include <deal.II/base/mpi_noncontiguous_partitioner.templates.h>
23#include <boost/serialization/utility.hpp>
43 const std::vector<types::global_dof_index> &indices_has,
44 const std::vector<types::global_dof_index> &indices_want,
52 std::pair<unsigned int, unsigned int>
109 std::vector<unsigned int> owning_ranks_of_ghosts(
114 process(indexset_has,
117 owning_ranks_of_ghosts,
122 std::pair<types::global_dof_index, types::global_dof_index>>,
123 std::vector<unsigned int>>
125 consensus_algorithm.run();
129 std::map<unsigned int, std::vector<types::global_dof_index>> recv_map;
131 for (
const auto &owner : owning_ranks_of_ghosts)
132 recv_map[owner] = std::vector<types::global_dof_index>();
136 recv_map[owning_ranks_of_ghosts[i]].push_back(i);
139 for (
const auto &target_with_indexset : recv_map)
141 recv_ranks.push_back(target_with_indexset.first);
143 for (
const auto cell_index : target_with_indexset.second)
154 for (
const auto &target_with_indexset : targets_with_indexset)
156 send_ranks.push_back(target_with_indexset.first);
158 for (
const auto cell_index : target_with_indexset.second)
170 const std::vector<types::global_dof_index> &indices_has,
171 const std::vector<types::global_dof_index> &indices_want,
176 std::vector<types::global_dof_index> indices_has_clean;
177 indices_has_clean.reserve(indices_has.size());
179 for (
const auto i : indices_has)
181 indices_has_clean.push_back(i);
183 std::vector<types::global_dof_index> indices_want_clean;
184 indices_want_clean.reserve(indices_want.size());
186 for (
const auto i : indices_want)
188 indices_want_clean.push_back(i);
192 indices_has_clean.empty() ?
194 (*std::max_element(indices_has_clean.begin(),
195 indices_has_clean.end()) +
199 indices_want_clean.empty() ?
201 (*std::max_element(indices_want_clean.begin(),
202 indices_want_clean.end()) +
211 index_set_has.
add_indices(indices_has_clean.begin(),
212 indices_has_clean.end());
215 index_set_want.
add_indices(indices_want_clean.begin(),
216 indices_want_clean.end());
224 std::vector<types::global_dof_index> temp_map_send(
232 i = temp_map_send[i];
236 std::vector<types::global_dof_index> temp_map_recv(
244 i = temp_map_recv[i];
250#include "mpi_noncontiguous_partitioner.inst"
size_type index_within_set(const size_type global_index) const
size_type n_elements() const
void add_indices(const ForwardIterator &begin, const ForwardIterator &end)
std::vector< std::uint8_t > buffers
std::vector< MPI_Request > requests
types::global_dof_index memory_consumption()
const MPI_Comm & get_mpi_communicator() const override
unsigned int temporary_storage_size() const
std::vector< types::global_dof_index > recv_ptr
std::vector< types::global_dof_index > send_ptr
std::vector< unsigned int > send_ranks
std::vector< types::global_dof_index > recv_indices
std::pair< unsigned int, unsigned int > n_targets() const
void reinit(const IndexSet &indexset_locally_owned, const IndexSet &indexset_ghost, const MPI_Comm &communicator) override
std::vector< types::global_dof_index > send_indices
std::vector< unsigned int > recv_ranks
NoncontiguousPartitioner()=default
std::map< unsigned int, IndexSet > get_requesters()
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
T max(const T &t, const MPI_Comm &mpi_communicator)
const types::global_dof_index invalid_dof_index
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)