| 
|   | Scatterer (const IndexMap &map, int bs) | 
|   | Create a scatterer for data with a layout described by an IndexMap and a block size.  
  | 
| 
  | Scatterer (const Scatterer &scatterer)=default | 
|   | Copy constructor. 
  | 
| template<class U>  | 
|   | Scatterer (const Scatterer< U > &s) | 
|   | Cast-copy constructor.  
  | 
| template<typename T>  | 
| void  | scatter_fwd_begin (const T *send_buffer, T *recv_buffer, MPI_Request &request) const | 
|   | Start a non-blocking send of owned data to ranks that ghost the data using MPI neighbourhood collective communication (recommended).  
  | 
| template<typename T>  | 
| void  | scatter_fwd_begin (const T *send_buffer, T *recv_buffer, std::span< MPI_Request > requests) const | 
|   | Start a non-blocking send of owned data to ranks that ghost the data using point-to-point MPI communication.  
  | 
| template<typename T>  | 
| void  | scatter_rev_begin (const T *send_buffer, T *recv_buffer, MPI_Request &request) const | 
|   | Start a non-blocking send of ghost data to ranks that own the data using MPI neighbourhood collective communication (recommended).  
  | 
| template<typename T>  | 
| void  | scatter_rev_begin (const T *send_buffer, T *recv_buffer, std::span< MPI_Request > requests) const | 
|   | Start a non-blocking send of ghost data to ranks that own the data using point-to-point MPI communication.  
  | 
| void  | scatter_end (std::span< MPI_Request > requests) const | 
|   | Complete non-blocking MPI point-to-point sends.  
  | 
| void  | scatter_end (MPI_Request &request) const | 
|   | Complete a non-blocking MPI neighbourhood collective send.  
  | 
| const container_type &  | local_indices () const noexcept | 
|   | Array of indices for packing/unpacking owned data to/from a send/receive buffer.  
  | 
| const container_type &  | remote_indices () const noexcept | 
|   | Array of indices for packing/unpacking ghost data to/from a send/receive buffer.  
  | 
| std::size_t  | num_p2p_requests () | 
|   | Number of required MPI_Requests for point-to-point communication.  
  | 
template<class Container = std::vector<std::int32_t>>
class dolfinx::common::Scatterer< Container >
A Scatterer supports the scattering and gathering of distributed data that is associated with a common::IndexMap, using MPI. 
Scatter and gather operations can use:
- MPI neighbourhood collectives (recommended), or
 
- Non-blocking point-to-point communication modes.
 
The implementation is designed for sparse communication patterns, as is typical of patterns based on an IndexMap.
A Scatterer is stateless, i.e. it provides the required information and static data for a given parallel communication pattern but does not provide any communication caches or track the status of MPI requests. Callers of the a Scatterer's members are responsible for managing buffer and MPI request handles.
- Template Parameters
 - 
  
    | Container | Container type for storing the 'local' and 'remote' indices. On CPUs this is normally std::vector<std::int32_t>. For GPUs the container should store the indices on the device, e.g. using thrust::device_vector<std::int32_t>.  | 
  
   
template<class Container = std::vector<std::int32_t>> 
 
Array of indices for packing/unpacking owned data to/from a send/receive buffer. 
For a forward scatter, the indices are used to copy required entries in the owned part of the data array into the appropriate position in a send buffer. For a reverse scatter, indices are used for assigning (accumulating) the receive buffer values into correct position in the owned part of the data array.
For a forward scatter, if x is the owned part of an array and send_buffer is the send buffer, send_buffer is packed such that: 
auto& idx = scatterer.local_indices()
std::vector<T> send_buffer(idx.size())
for (std::size_t i = 0; i < idx.size(); ++i)
    send_buffer[i] = x[idx[i]];
For a reverse scatter, if recv_buffer is the received buffer, then x is updated by 
auto& idx = scatterer.local_indices()
std::vector<T> recv_buffer(idx.size())
for (std::size_t i = 0; i < idx.size(); ++i)
    x[idx[i]] = op(recv_buffer[i], x[idx[i]]);
where op is a binary operation, e.g. x[idx[i]] = buffer[i] or x[idx[i]] += buffer[i].
- Returns
 - Indices container. 
 
 
 
template<class Container = std::vector<std::int32_t>> 
 
Array of indices for packing/unpacking ghost data to/from a send/receive buffer. 
For a forward scatter, the indices are to copy required entries in the owned array into the appropriate position in a send buffer. For a reverse scatter, indices are used for assigning (accumulating) the receive buffer values to correct position in the owned array.
For a forward scatter, if xg is the ghost part of the data array and recv_buffer is the receive buffer, xg is updated that 
auto& idx = scatterer.remote_indices()
std::vector<T> recv_buffer(idx.size())
for (std::size_t i = 0; i < idx.size(); ++i)
    xg[idx[i]] = recv_buffer[i];
For a reverse scatter, if send_buffer is the send buffer, then send_buffer is packaged such that: 
auto& idx = scatterer.local_indices()
std::vector<T> send_buffer(idx.size())
for (std::size_t i = 0; i < idx.size(); ++i)
    send_buffer[i] = xg[idx[i]];
- Returns
 - Indices container.