11 #include <dolfinx/common/MPI.h>
12 #include <dolfinx/common/span.hpp>
13 #include <dolfinx/graph/AdjacencyList.h>
34 std::tuple<std::int64_t, std::vector<std::int32_t>,
35 std::vector<std::vector<std::int64_t>>,
36 std::vector<std::vector<int>>>
39 std::pair<std::reference_wrapper<const common::IndexMap>,
int>>& maps);
87 IndexMap(MPI_Comm mpi_comm, std::int32_t local_size,
88 const std::vector<int>& dest_ranks,
89 const std::vector<std::int64_t>&
ghosts,
90 const std::vector<int>& src_ranks);
108 std::array<std::int64_t, 2>
local_range() const noexcept;
121 const std::vector<std::int64_t>&
ghosts() const noexcept;
134 const tcb::span<std::int64_t>& global) const;
141 const tcb::span<std::int32_t>& local) const;
154 const graph::AdjacencyList<std::int32_t>&
shared_indices() const noexcept;
177 template <typename T>
178 void scatter_fwd(tcb::span<const T> local_data, tcb::span<T> remote_data,
190 template <typename T>
191 void scatter_rev(tcb::span<T> local_data, tcb::span<const T> remote_data,
196 std::array<std::int64_t, 2> _local_range;
199 std::int64_t _size_global;
208 dolfinx::
MPI::Comm _comm_owner_to_ghost;
215 dolfinx::
MPI::Comm _comm_ghost_to_owner;
218 dolfinx::
MPI::Comm _comm_symmetric;
221 std::vector<std::int64_t> _ghosts;
225 std::vector<std::int32_t> _ghost_owners;
230 std::unique_ptr<graph::AdjacencyList<std::int32_t>> _shared_indices;
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:49
void scatter_fwd(tcb::span< const T > local_data, tcb::span< 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:659
std::map< std::int32_t, std::set< int > > compute_shared_indices() const
Definition: IndexMap.cpp:546
MPI_Comm comm(Direction dir=Direction::symmetric) const
Return a MPI communicator with attached distributed graph topology information.
Definition: IndexMap.cpp:531
std::vector< int > ghost_owner_rank() const
Owner rank (on global communicator) of each ghost entry.
Definition: IndexMap.cpp:514
~IndexMap()=default
Destructor.
std::array< std::int64_t, 2 > local_range() const noexcept
Range of indices (global) owned by this process.
Definition: IndexMap.cpp:433
Mode
Mode for reverse scatter operation.
Definition: IndexMap.h:53
IndexMap(IndexMap &&map)=default
Move constructor.
void local_to_global(const tcb::span< const std::int32_t > &local, const tcb::span< std::int64_t > &global) const
Compute global indices for array of local indices.
Definition: IndexMap.cpp:452
Direction
Edge directions of neighborhood communicator.
Definition: IndexMap.h:60
std::int64_t size_global() const noexcept
Number indices across communicator.
Definition: IndexMap.cpp:445
std::vector< std::int64_t > global_indices() const
Global indices.
Definition: IndexMap.cpp:495
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:438
void global_to_local(const tcb::span< const std::int64_t > &global, const tcb::span< std::int32_t > &local) const
Compute local indices for array of global indices.
Definition: IndexMap.cpp:469
void scatter_rev(tcb::span< T > local_data, tcb::span< const T > remote_data, int n, IndexMap::Mode op) const
Send n values for each ghost index to owning to the process.
Definition: IndexMap.cpp:742
IndexMap & operator=(IndexMap &&map)=default
Move assignment.
const graph::AdjacencyList< std::int32_t > & shared_indices() const noexcept
Definition: IndexMap.cpp:509
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:447
std::int32_t size_local() const noexcept
Number of indices owned by on this process.
Definition: IndexMap.cpp:440
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