waLBerla 7.2
Loading...
Searching...
No Matches
walberla::communication::UniformPackInfo Class Referenceabstract

Detailed Description

Data packing/unpacking for ghost layer based communication of a field.

Encapsulate information on how to extract data from blocks that should be communicated to neighboring blocks (see packData()) and how to inject this data in a receiving block (see unpackData()). This involves a memory buffer and two memory copy operations.

A special method exists for communication between two blocks which are allocated on the same process (see communicateLocal()). In this case the data does not have be communicated via a buffer, but can be copied directly.

Data that is packed in direction "dir" at one block is unpacked in direction "stencil::inverseDir[dir]" at the neighboring block. This behavior must be implemented in communicateLocal()!

#include <UniformPackInfo.h>

+ Inheritance diagram for walberla::communication::UniformPackInfo:

Construction & Destruction

std::map< const IBlock *, std::map< stencil::Direction, size_t > > bufferSize_
 
 UniformPackInfo ()=default
 
virtual ~UniformPackInfo ()=default
 
virtual bool constantDataExchange () const =0
 Should return true if the amount of data that is packed for a given block in direction "dir" is guaranteed to remain constant over time.
 
virtual bool threadsafeReceiving () const =0
 Must return false if calling unpackData and/or communicateLocal is not thread-safe.
 
void packData (const IBlock *sender, stencil::Direction dir, mpi::SendBuffer &buffer) const
 Pack data from a block into a send buffer.
 
virtual void unpackData (IBlock *receiver, stencil::Direction dir, mpi::RecvBuffer &buffer)=0
 Unpack received Data.
 
virtual void communicateLocal (const IBlock *sender, IBlock *receiver, stencil::Direction dir)=0
 Copy data from one local block to another local block.
 
virtual void beforeStartCommunication ()
 This function is called once before the communication is started by the UniformBufferedScheme.
 
virtual void afterStartCommunication ()
 This function is called once after the communication has been started by the UniformBufferedScheme.
 
virtual void beforeWait ()
 This function is called once before the UniformBufferedScheme waits for the communication to finish.
 
virtual void afterWait ()
 This function is called once after the communication has been finished by the UniformBufferedScheme.
 
virtual void packDataImpl (const IBlock *sender, stencil::Direction dir, mpi::SendBuffer &buffer) const =0
 Pack data from a block into a send buffer.
 

Constructor & Destructor Documentation

◆ UniformPackInfo()

walberla::communication::UniformPackInfo::UniformPackInfo ( )
default

◆ ~UniformPackInfo()

virtual walberla::communication::UniformPackInfo::~UniformPackInfo ( )
virtualdefault

Member Function Documentation

◆ afterStartCommunication()

virtual void walberla::communication::UniformPackInfo::afterStartCommunication ( )
inlinevirtual

This function is called once after the communication has been started by the UniformBufferedScheme.

◆ afterWait()

virtual void walberla::communication::UniformPackInfo::afterWait ( )
inlinevirtual

This function is called once after the communication has been finished by the UniformBufferedScheme.

◆ beforeStartCommunication()

virtual void walberla::communication::UniformPackInfo::beforeStartCommunication ( )
inlinevirtual

This function is called once before the communication is started by the UniformBufferedScheme.

◆ beforeWait()

virtual void walberla::communication::UniformPackInfo::beforeWait ( )
inlinevirtual

This function is called once before the UniformBufferedScheme waits for the communication to finish.

◆ communicateLocal()

◆ constantDataExchange()

virtual bool walberla::communication::UniformPackInfo::constantDataExchange ( ) const
pure virtual

◆ packData()

void walberla::communication::UniformPackInfo::packData ( const IBlock * sender,
stencil::Direction dir,
mpi::SendBuffer & buffer ) const
inline

Pack data from a block into a send buffer.

Must be thread-safe! Calls packDataImpl.

Parameters
senderthe block whose data should be packed into a buffer
dirpack data for neighbor in this direction
bufferbuffer for writing the data into

◆ packDataImpl()

virtual void walberla::communication::UniformPackInfo::packDataImpl ( const IBlock * sender,
stencil::Direction dir,
mpi::SendBuffer & buffer ) const
protectedpure virtual

◆ threadsafeReceiving()

◆ unpackData()

virtual void walberla::communication::UniformPackInfo::unpackData ( IBlock * receiver,
stencil::Direction dir,
mpi::RecvBuffer & buffer )
pure virtual

Member Data Documentation

◆ bufferSize_

std::map< const IBlock *, std::map< stencil::Direction, size_t > > walberla::communication::UniformPackInfo::bufferSize_
mutableprotected

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