18 #include <deal.II/base/partitioner.templates.h> 30 , n_ghost_indices_data(0)
31 , n_import_indices_data(0)
32 , n_ghost_indices_in_larger_set(0)
35 , communicator(MPI_COMM_SELF)
36 , have_ghost_indices(false)
78 #ifdef DEAL_II_WITH_MPI 82 Utilities::MPI::internal::mpi_type_id(&prefix_sum),
133 const IndexSet &read_write_vector_index_set,
160 ExcMessage(
"The index set specified in locally_owned_indices " 161 "is not contiguous."));
165 std::pair<types::global_dof_index, types::global_dof_index>(
171 static_cast<types::global_dof_index>(
174 "Index overflow: This class supports at most 2^32-1 locally owned vector entries"));
187 const IndexSet &larger_ghost_index_set)
207 "Index overflow: This class supports at most 2^32-1 ghost elements"));
221 #ifdef DEAL_II_WITH_MPI 240 const int ierr = MPI_Exscan(&my_size,
267 std::vector<unsigned int> owning_ranks_of_ghosts(
275 owning_ranks_of_ghosts,
282 std::pair<types::global_dof_index, types::global_dof_index>,
285 consensus_algorithm.run();
290 if (owning_ranks_of_ghosts.size() > 0)
293 for (
auto i : owning_ranks_of_ghosts)
297 "Expect result of ConsensusAlgorithmsProcess to be " 308 std::map<unsigned int, IndexSet> import_data = process.get_requesters();
317 for (
const auto &i : import_data)
318 if (i.second.n_elements() > 0)
324 i.second.n_intervals());
330 for (
const auto &i : import_data)
334 for (
auto interval = i.second.begin_intervals();
335 interval != i.second.end_intervals();
339 interval->last() + 1 -
361 std::vector<types::global_dof_index> ghost_indices_ref;
366 std::vector<types::global_dof_index> my_indices;
368 std::vector<MPI_Request> requests;
372 my_indices.data(), my_indices.size()),
378 const int ierr = MPI_Testall(requests.size(),
381 MPI_STATUSES_IGNORE);
385 "MPI found unfinished requests. Check communication setup"));
387 for (
unsigned int i = 0; i < ghost_indices.size(); ++i)
392 #endif // #ifdef DEAL_II_WITH_MPI 394 if (larger_ghost_index_set.
size() == 0)
407 ExcMessage(
"Ghost index set should not overlap with owned set."));
410 ExcMessage(
"Larger ghost index set must contain the tight " 411 "ghost index set."));
417 std::vector<unsigned int> expanded_numbering;
421 ExcMessage(
"The given larger ghost index set must contain " 422 "all indices in the actual index set."));
428 "Index overflow: This class supports at most 2^32-1 ghost elements"));
429 expanded_numbering.push_back(
434 std::vector<std::pair<unsigned int, unsigned int>>
435 ghost_indices_subset;
440 unsigned int shift = 0;
446 const unsigned int i = shift + ii;
447 if (expanded_numbering[i] == last_index + 1)
449 ghost_indices_subset.back().second++;
452 ghost_indices_subset.emplace_back(expanded_numbering[i],
453 expanded_numbering[i] +
455 last_index = expanded_numbering[i];
459 ghost_indices_subset.size();
474 #ifdef DEAL_II_WITH_MPI 477 int communicators_same = 0;
480 &communicators_same);
482 if (!(communicators_same == MPI_IDENT ||
483 communicators_same == MPI_CONGRUENT))
507 4 *
sizeof(
unsigned int) +
sizeof(
MPI_Comm));
529 #include "partitioner.inst" std::vector< std::pair< unsigned int, unsigned int > > import_indices_data
bool is_globally_compatible(const Partitioner &part) const
static const unsigned int invalid_unsigned_int
unsigned int locally_owned_size() const
#define AssertDimension(dim1, dim2)
bool is_compatible(const Partitioner &part) const
unsigned int local_size() const
IndexSet ghost_indices_data
types::global_dof_index global_size
#define DEAL_II_DOF_INDEX_MPI_TYPE
unsigned int n_ghost_indices_data
#define AssertThrow(cond, exc)
void set_owned_indices(const IndexSet &locally_owned_indices)
std::vector< unsigned int > ghost_indices_subset_chunks_by_rank_data
std::vector< unsigned int > import_indices_chunks_by_rank_data
static ::ExceptionBase & ExcMessage(std::string arg1)
const IndexSet & ghost_indices() const
unsigned int n_ghost_indices() const
T sum(const T &t, const MPI_Comm &mpi_communicator)
void subtract_set(const IndexSet &other)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
size_type index_within_set(const size_type global_index) const
ArrayView< typename std::remove_reference< typename std::iterator_traits< Iterator >::reference >::type, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
#define DEAL_II_NAMESPACE_CLOSE
std::vector< std::pair< unsigned int, unsigned int > > ghost_indices_subset_data
IndexSet locally_owned_range_data
unsigned int n_mpi_processes(const MPI_Comm &mpi_communicator)
void fill_index_vector(std::vector< size_type > &indices) const
void add_range(const size_type begin, const size_type end)
void set_size(const size_type size)
unsigned int global_dof_index
types::global_dof_index size() const
std::size_t memory_consumption() const
#define AssertThrowMPI(error_code)
bool is_contiguous() const
#define DEAL_II_NAMESPACE_OPEN
T min(const T &t, const MPI_Comm &mpi_communicator)
std::vector< std::pair< unsigned int, unsigned int > > import_targets_data
std::pair< types::global_dof_index, types::global_dof_index > local_range_data
std::vector< std::pair< unsigned int, unsigned int > > ghost_targets_data
void export_to_ghosted_array_start(const unsigned int communication_channel, const ArrayView< const Number, MemorySpaceType > &locally_owned_array, const ArrayView< Number, MemorySpaceType > &temporary_storage, const ArrayView< Number, MemorySpaceType > &ghost_array, std::vector< MPI_Request > &requests) const
unsigned int this_mpi_process(const MPI_Comm &mpi_communicator)
void export_to_ghosted_array_finish(const ArrayView< Number, MemorySpaceType > &ghost_array, std::vector< MPI_Request > &requests) const
bool is_element(const size_type index) const
unsigned int n_import_indices() const
unsigned int n_import_indices_data
virtual void reinit(const IndexSet &vector_space_vector_index_set, const IndexSet &read_write_vector_index_set, const MPI_Comm &communicator) override
size_type n_elements() const
size_type nth_index_in_set(const size_type local_index) const
T max(const T &t, const MPI_Comm &mpi_communicator)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
unsigned int n_ghost_indices_in_larger_set
static ::ExceptionBase & ExcInternalError()
void set_ghost_indices(const IndexSet &ghost_indices, const IndexSet &larger_ghost_index_set=IndexSet())