walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T > Class Template Reference

Detailed Description

template<template< typename > class ReduceOperation, typename GhostLayerField_T>
class walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >

Data packing/unpacking for ghost layer based communication of a single walberla::field::Field.

template ReduceOperation is e.g. std::plus

This pack info is used to apply a given reduce operation (e.g. +) to the values in the interior of a ghost layer field together with the values coming from the sender's ghost layer.

#include <UniformPullReductionPackInfo.h>

+ Inheritance diagram for walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >:

Public Types

using T = typename GhostLayerField_T::value_type
 

Public Member Functions

 UniformPullReductionPackInfo (const BlockDataID &bdID)
 
 UniformPullReductionPackInfo (const BlockDataID &bdID, const uint_t numberOfGhostLayers)
 
 ~UniformPullReductionPackInfo () override=default
 
bool constantDataExchange () const override
 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. More...
 
bool threadsafeReceiving () const override
 Must return false if calling unpackData and/or communicateLocal is not thread-safe. More...
 
void unpackData (IBlock *receiver, stencil::Direction dir, mpi::RecvBuffer &buffer) override
 Unpacks received Data. More...
 
void communicateLocal (const IBlock *sender, IBlock *receiver, stencil::Direction dir) override
 Function to copy data from one local block to another local block. More...
 
- Public Member Functions inherited from walberla::communication::UniformPackInfo
 UniformPackInfo ()=default
 
virtual ~UniformPackInfo ()=default
 
void packData (const IBlock *sender, stencil::Direction dir, mpi::SendBuffer &buffer) const
 Packs data from a block into a send buffer. More...
 
virtual void beforeStartCommunication ()
 This function is called once before the communication is started by the UniformBufferedScheme. More...
 
virtual void afterStartCommunication ()
 This function is called once after the communication has been started by the UniformBufferedScheme. More...
 
virtual void beforeWait ()
 This function is called once before the UniformBufferedScheme waits for the communication to finish. More...
 
virtual void afterWait ()
 This function is called once after the communication has been finished by the UniformBufferedScheme. More...
 

Protected Member Functions

void packDataImpl (const IBlock *sender, stencil::Direction dir, mpi::SendBuffer &outBuffer) const override
 Packs data from a block into a send buffer. More...
 
uint_t numberOfGhostLayersToCommunicate (const GhostLayerField_T *const field) const
 
- Protected Member Functions inherited from walberla::communication::UniformPackInfo

Protected Attributes

const BlockDataID bdID_
 
bool communicateAllGhostLayers_
 
uint_t numberOfGhostLayers_
 
ReduceOperation< Top_
 
- Protected Attributes inherited from walberla::communication::UniformPackInfo
std::map< const IBlock *, std::map< stencil::Direction, size_t > > bufferSize_
 

Member Typedef Documentation

◆ T

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
using walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::T = typename GhostLayerField_T::value_type

Constructor & Destructor Documentation

◆ UniformPullReductionPackInfo() [1/2]

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::UniformPullReductionPackInfo ( const BlockDataID bdID)
inline

◆ UniformPullReductionPackInfo() [2/2]

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::UniformPullReductionPackInfo ( const BlockDataID bdID,
const uint_t  numberOfGhostLayers 
)
inline

◆ ~UniformPullReductionPackInfo()

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::~UniformPullReductionPackInfo ( )
overridedefault

Member Function Documentation

◆ communicateLocal()

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
void walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::communicateLocal ( const IBlock sender,
IBlock receiver,
stencil::Direction  dir 
)
overridevirtual

Function to copy data from one local block to another local block.

Both blocks are allocated on the current process. If NOT thread-safe, threadsafeReceiving must return false!

Parameters
senderid of block where the data should be copied from
receiverid of block where the data should be copied to
dirthe direction of the communication ( from sender to receiver )

Implements walberla::communication::UniformPackInfo.

◆ constantDataExchange()

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
bool walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::constantDataExchange ( ) const
inlineoverridevirtual

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.

False otherwise. If you are not sure what to return, return false! Returning false is always save. Falsely return true will lead to errors! However, if the data can be guaranteed to remain constant over time, returning true enables performance optimizations during the communication.

Implements walberla::communication::UniformPackInfo.

◆ numberOfGhostLayersToCommunicate()

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
uint_t walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::numberOfGhostLayersToCommunicate ( const GhostLayerField_T *const  field) const
protected

◆ packDataImpl()

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
void walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::packDataImpl ( const IBlock sender,
stencil::Direction  dir,
mpi::SendBuffer buffer 
) const
overrideprotectedvirtual

Packs data from a block into a send buffer.

Must be thread-safe!

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

Implements walberla::communication::UniformPackInfo.

◆ threadsafeReceiving()

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
bool walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::threadsafeReceiving ( ) const
inlineoverridevirtual

Must return false if calling unpackData and/or communicateLocal is not thread-safe.

True otherwise. If you are not sure what to return, return false! Returning false is always save. Falsely return true will most likely lead to errors! However, if both unpackData AND communicateLocal are thread-safe, returning true can lead to performance improvements.

Implements walberla::communication::UniformPackInfo.

◆ unpackData()

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
void walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::unpackData ( IBlock receiver,
stencil::Direction  dir,
mpi::RecvBuffer buffer 
)
overridevirtual

Unpacks received Data.

If NOT thread-safe, threadsafeReceiving must return false!

Parameters
receiverthe block where the unpacked data should be stored into
dirreceive data from neighbor in this direction
buffer

Implements walberla::communication::UniformPackInfo.

Member Data Documentation

◆ bdID_

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
const BlockDataID walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::bdID_
protected

◆ communicateAllGhostLayers_

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
bool walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::communicateAllGhostLayers_
protected

◆ numberOfGhostLayers_

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
uint_t walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::numberOfGhostLayers_
protected

◆ op_

template<template< typename > class ReduceOperation, typename GhostLayerField_T >
ReduceOperation<T> walberla::field::communication::UniformPullReductionPackInfo< ReduceOperation, GhostLayerField_T >::op_
protected

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