Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana::CommunicationData< CommPlanType, CommDataType > Class Template Referenceabstract

Store communication plan and communication buffers. More...

#include <Cabana_CommunicationPlan.hpp>

Public Types

using plan_type = CommPlanType
 Communication plan type (Halo, Distributor)
 
using execution_space = typename plan_type::execution_space
 Kokkos execution space.
 
using policy_type = Kokkos::RangePolicy<execution_space>
 Kokkos execution policy.
 
using comm_data_type = CommDataType
 Communication data type.
 
using particle_data_type = typename comm_data_type::particle_data_type
 Particle data type.
 
using memory_space = typename comm_data_type::memory_space
 Kokkos memory space.
 
using data_type = typename comm_data_type::data_type
 Communication data type.
 
using buffer_type = typename comm_data_type::buffer_type
 Communication buffer type.
 

Public Member Functions

 CommunicationData (const CommPlanType &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.
 
virtual void apply ()=0
 Perform the communication (migrate, gather, scatter).
 
template<class ExecutionSpace>
void apply (ExecutionSpace)
 Perform the communication (migrate, gather, scatter).
 

Protected Member Functions

auto getSliceComponents ()
 Get the total number of components in the slice.
 

Protected Attributes

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 CommPlanType, class CommDataType>
class Cabana::CommunicationData< CommPlanType, CommDataType >

Store communication plan and communication buffers.

Constructor & Destructor Documentation

◆ CommunicationData()

template<class CommPlanType, class CommDataType>
Cabana::CommunicationData< CommPlanType, CommDataType >::CommunicationData ( const CommPlanType & comm_plan,
const particle_data_type & particles,
const double overallocation = 1.0 )
inline
Parameters
comm_planThe communication plan.
particlesThe particle data (either AoSoA or slice).
overallocationAn optional factor to keep extra space in the buffers to avoid frequent resizing.

Member Function Documentation

◆ apply()

template<class CommPlanType, class CommDataType>
virtual void Cabana::CommunicationData< CommPlanType, CommDataType >::apply ( )
pure virtual

◆ receiveSize()

template<class CommPlanType, class CommDataType>
auto Cabana::CommunicationData< CommPlanType, CommDataType >::receiveSize ( )
inline

Current receive buffer size.

Note
This is stored as a member because it is not directly related to the buffer sizes (as the capacity is).

◆ sendSize()

template<class CommPlanType, class CommDataType>
auto Cabana::CommunicationData< CommPlanType, CommDataType >::sendSize ( )
inline

Current send buffer size.

Note
This is stored as a member because it is not directly related to the buffer sizes (as the capacity is).

◆ shrinkToFit()

template<class CommPlanType, class CommDataType>
void Cabana::CommunicationData< CommPlanType, CommDataType >::shrinkToFit ( const bool use_overallocation = false)
inline

Reduce communication buffers to current send/receive sizes.

Parameters
use_overallocationShrink the buffers, but retain extra storage according to the overallocation factor.

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