Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana::Scatter< HaloType, SliceType > Class Template Reference

Synchronously scatter data from the ghosts to the local decomposition of a slice using the halo reverse communication plan. This is a multiply-owned to uniquely owned communication. More...

#include <Cabana_Halo.hpp>

Inheritance diagram for Cabana::Scatter< HaloType, SliceType >:
Collaboration diagram for Cabana::Scatter< HaloType, SliceType >:

Public Types

using base_type
 Base type.
 
using plan_type = typename base_type::plan_type
 Communication plan type (Halo).
 
using execution_space = typename base_type::execution_space
 Kokkos execution space.
 
using memory_space = typename base_type::memory_space
 Kokkos memory space.
 
using data_type = typename base_type::data_type
 Communication data type.
 
using buffer_type = typename base_type::buffer_type
 Communication buffer type.
 
- Public Types inherited from Cabana::CommunicationData< HaloType, CommunicationDataSlice< SliceType > >
using plan_type
 Communication plan type (Halo, Distributor)
 
using execution_space
 Kokkos execution space.
 
using policy_type
 Kokkos execution policy.
 
using comm_data_type
 Communication data type.
 
using particle_data_type
 Particle data type.
 
using memory_space
 Kokkos memory space.
 
using data_type
 Communication data type.
 
using buffer_type
 Communication buffer type.
 

Public Member Functions

 Scatter (HaloType halo, SliceType slice, const double overallocation=1.0)
 
auto totalSend ()
 Total scatter send size for this rank.
 
auto totalReceive ()
 Total scatter receive size for this rank.
 
template<class ExecutionSpace>
void apply (ExecutionSpace)
 Perform the scatter operation.
 
void apply () override
 Perform the communication (migrate, gather, scatter).
 
void reserve (const HaloType &halo, const SliceType &slice, const double overallocation)
 Reserve new buffers as needed and update the halo and slice data. Reallocation only occurs if there is not enough space in the buffers.
 
void reserve (const HaloType &halo, const SliceType &slice)
 Reserve new buffers as needed and update the halo and slice data.
 
- Public Member Functions inherited from Cabana::CommunicationData< HaloType, CommunicationDataSlice< SliceType > >
 CommunicationData (const HaloType &comm_plan, const particle_data_type &particles, const double overallocation=1.0)
 
buffer_type getSendBuffer () const
 Get the communication send buffer.
 
buffer_type getReceiveBuffer () const
 Get the communication receive buffer.
 
particle_data_type getData () const
 Get the particles to communicate.
 
void setData (const particle_data_type &particles)
 Update particles to communicate.
 
auto sendSize ()
 Current send buffer size.
 
auto receiveSize ()
 Current receive buffer size.
 
auto sendCapacity ()
 Current allocated send buffer space.
 
auto receiveCapacity ()
 Current allocated receive buffer space.
 
void shrinkToFit (const bool use_overallocation=false)
 Reduce communication buffers to current send/receive sizes.
 
void apply (ExecutionSpace)
 Perform the communication (migrate, gather, scatter).
 
 CommunicationData (const HaloType &comm_plan, const particle_data_type &particles, const double overallocation=1.0)
 
buffer_type getSendBuffer () const
 Get the communication send buffer.
 
buffer_type getReceiveBuffer () const
 Get the communication receive buffer.
 
particle_data_type getData () const
 Get the particles to communicate.
 
void setData (const particle_data_type &particles)
 Update particles to communicate.
 
auto sendSize ()
 Current send buffer size.
 
auto receiveSize ()
 Current receive buffer size.
 
auto sendCapacity ()
 Current allocated send buffer space.
 
auto receiveCapacity ()
 Current allocated receive buffer space.
 
void shrinkToFit (const bool use_overallocation=false)
 Reduce communication buffers to current send/receive sizes.
 
void apply (ExecutionSpace)
 Perform the communication (migrate, gather, scatter).
 

Additional Inherited Members

- Protected Member Functions inherited from Cabana::CommunicationData< HaloType, CommunicationDataSlice< SliceType > >
auto getSliceComponents ()
 Get the total number of components in the slice.
 
auto getSliceComponents ()
 Get the total number of components in the slice.
 
- Protected Attributes inherited from Cabana::CommunicationData< HaloType, CommunicationDataSlice< SliceType > >
plan_type _comm_plan
 Communication plan.
 
comm_data_type _comm_data
 Communication plan.
 
double _overallocation
 Overallocation factor.
 
std::size_t _send_size
 Send sizes.
 
std::size_t _recv_size
 Receive sizes.
 
plan_type _comm_plan
 Communication plan.
 
comm_data_type _comm_data
 Communication plan.
 
double _overallocation
 Overallocation factor.
 
std::size_t _send_size
 Send sizes.
 
std::size_t _recv_size
 Receive sizes.
 

Detailed Description

template<class HaloType, class SliceType>
class Cabana::Scatter< HaloType, SliceType >

Synchronously scatter data from the ghosts to the local decomposition of a slice using the halo reverse communication plan. This is a multiply-owned to uniquely owned communication.

In a scatter operation results from ghosted values on other processors are scattered back to the owning processor of the ghost and the value associated with the ghost is summed into the locally owned value the ghost represents. If a locally owned element is ghosted on multiple ranks, then multiple contributions will be made to the sum, one for each rank.

Member Typedef Documentation

◆ base_type

template<class HaloType, class SliceType>
using Cabana::Scatter< HaloType, SliceType >::base_type
Initial value:
CommunicationData(const HaloType &comm_plan, const particle_data_type &particles, const double overallocation=1.0)
Definition Cabana_CommunicationPlan.hpp:1198

Base type.

Constructor & Destructor Documentation

◆ Scatter()

template<class HaloType, class SliceType>
Cabana::Scatter< HaloType, SliceType >::Scatter ( HaloType halo,
SliceType slice,
const double overallocation = 1.0 )
inline
Parameters
haloThe Halo to be used for the gather.
sliceThe slice on which to perform the gather. The slice should have a size equivalent to halo.numGhost() + halo.numLocal(). The locally owned elements are expected to appear first (i.e. in the first halo.numLocal() elements) and the ghosted elements are expected to appear second (i.e. in the next halo.numGhost() elements()).
overallocationAn optional factor to keep extra space in the buffers to avoid frequent resizing.

Member Function Documentation

◆ apply()

template<class HaloType, class SliceType>
void Cabana::Scatter< HaloType, SliceType >::apply ( )
inlineoverridevirtual

Perform the communication (migrate, gather, scatter).

Implements Cabana::CommunicationData< HaloType, CommunicationDataSlice< SliceType > >.

◆ reserve() [1/2]

template<class HaloType, class SliceType>
void Cabana::Scatter< HaloType, SliceType >::reserve ( const HaloType & halo,
const SliceType & slice )
inline

Reserve new buffers as needed and update the halo and slice data.

Parameters
haloThe Halo to be used for the scatter.
sliceThe slice on which to perform the scatter.

◆ reserve() [2/2]

template<class HaloType, class SliceType>
void Cabana::Scatter< HaloType, SliceType >::reserve ( const HaloType & halo,
const SliceType & slice,
const double overallocation )
inline

Reserve new buffers as needed and update the halo and slice data. Reallocation only occurs if there is not enough space in the buffers.

Parameters
haloThe Halo to be used for the scatter.
sliceThe slice on which to perform the scatter.
overallocationAn optional factor to keep extra space in the buffers to avoid frequent resizing.

The documentation for this class was generated from the following file: