11 #include <dolfinx/common/MPI.h>
31 std::tuple<std::int64_t, std::vector<std::int32_t>,
32 std::vector<std::vector<std::int64_t>>,
33 std::vector<std::vector<int>>>
36 std::pair<std::reference_wrapper<const common::IndexMap>,
int>>& maps);
84 IndexMap(MPI_Comm mpi_comm, std::int32_t local_size,
85 const std::vector<int>& dest_ranks,
86 const std::vector<std::int64_t>&
ghosts,
87 const std::vector<int>& src_ranks);
105 std::array<std::int64_t, 2>
local_range() const noexcept;
118 const std::vector<std::int64_t>&
ghosts() const noexcept;
132 std::int64_t* global) const;
138 std::vector<std::int32_t>
173 void scatter_fwd(const std::vector<std::int64_t>& local_data,
174 std::vector<std::int64_t>& remote_data,
int n) const;
186 void scatter_fwd(const std::vector<std::int32_t>& local_data,
187 std::vector<std::int32_t>& remote_data,
int n) const;
199 std::vector<std::int64_t>
200 scatter_fwd(const std::vector<std::int64_t>& local_data,
int n) const;
211 std::vector<std::int32_t>
212 scatter_fwd(const std::vector<std::int32_t>& local_data,
int n) const;
223 void scatter_rev(std::vector<std::int64_t>& local_data,
224 const std::vector<std::int64_t>& remote_data,
int n,
236 void scatter_rev(std::vector<std::int32_t>& local_data,
237 const std::vector<std::int32_t>& remote_data,
int n,
242 std::array<std::int64_t, 2> _local_range;
245 std::int64_t _size_global;
254 dolfinx::
MPI::Comm _comm_owner_to_ghost;
261 dolfinx::
MPI::Comm _comm_ghost_to_owner;
264 dolfinx::
MPI::Comm _comm_symmetric;
267 std::vector<std::int64_t> _ghosts;
271 std::vector<std::int32_t> _ghost_owners;
283 std::vector<std::int32_t> _shared_indices;
289 std::vector<std::int32_t> _shared_disp;
291 template <typename T>
292 void scatter_fwd_impl(const std::vector<T>& local_data,
293 std::vector<T>& remote_data,
int n) const;
294 template <typename T>
295 void scatter_rev_impl(std::vector<T>& local_data,
296 const std::vector<T>& remote_data,
int n,
This class provides utility functions for easy communication with MPI and handles cases when DOLFINX ...
Definition: MPI.h:31
This class represents the distribution index arrays across processes. An index array is a contiguous ...
Definition: IndexMap.h:46
std::map< std::int32_t, std::set< int > > compute_shared_indices() const
Definition: IndexMap.cpp:544
MPI_Comm comm(Direction dir=Direction::symmetric) const
Return a MPI communicator with attached distributed graph topology information.
Definition: IndexMap.cpp:529
std::vector< int > ghost_owner_rank() const
Owner rank (on global communicator) of each ghost entry.
Definition: IndexMap.cpp:512
~IndexMap()=default
Destructor.
std::array< std::int64_t, 2 > local_range() const noexcept
Range of indices (global) owned by this process.
Definition: IndexMap.cpp:430
Mode
Mode for reverse scatter operation.
Definition: IndexMap.h:50
IndexMap(IndexMap &&map)=default
Move constructor.
std::vector< std::int32_t > global_to_local(const std::vector< std::int64_t > &indices) const
Compute local indices for array of global indices.
Definition: IndexMap.cpp:479
void scatter_fwd(const std::vector< std::int64_t > &local_data, std::vector< std::int64_t > &remote_data, int n) const
Send n values for each index that is owned to processes that have the index as a ghost....
Definition: IndexMap.cpp:660
Direction
Edge directions of neighborhood communicator.
Definition: IndexMap.h:57
std::int64_t size_global() const noexcept
Number indices across communicator.
Definition: IndexMap.cpp:442
std::vector< std::int64_t > global_indices() const
Global indices.
Definition: IndexMap.cpp:465
IndexMap(MPI_Comm comm, std::int32_t local_size)
Create an non-overlapping index map with local_size owned on this process.
Definition: IndexMap.cpp:307
std::int32_t num_ghosts() const noexcept
Number of ghost indices on this process.
Definition: IndexMap.cpp:435
void local_to_global(const std::int32_t *local, int n, std::int64_t *global) const
Compute global indices for array of local indices.
Definition: IndexMap.cpp:449
void scatter_rev(std::vector< std::int64_t > &local_data, const std::vector< std::int64_t > &remote_data, int n, IndexMap::Mode op) const
Send n values for each ghost index to owning to the process.
Definition: IndexMap.cpp:688
IndexMap & operator=(IndexMap &&map)=default
Move assignment.
const std::vector< std::int64_t > & ghosts() const noexcept
Local-to-global map for ghosts (local indexing beyond end of local range)
Definition: IndexMap.cpp:444
const std::vector< std::int32_t > & shared_indices() const noexcept
Definition: IndexMap.cpp:507
std::int32_t size_local() const noexcept
Number of indices owned by on this process.
Definition: IndexMap.cpp:437
Miscellaneous classes, functions and types.
std::tuple< std::int64_t, std::vector< std::int32_t >, std::vector< std::vector< std::int64_t > >, std::vector< std::vector< int > > > stack_index_maps(const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int >> &maps)
Compute layout data and ghost indices for a stacked (concatenated) index map, i.e....
Definition: IndexMap.cpp:190