waLBerla 7.2
Loading...
Searching...
No Matches
walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T > Class Template Reference

Detailed Description

template<typename LatticeModel_T, typename FlagField_T>
class walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >

Optimized PackInfo for sparse PDF fields.

In principle a PDF field can be communicated using a FieldPackInfo which copies all entries (=values for f) of the ghost layer.

For PDF fields, however, it is sufficient to communicate only those discrete velocities which point into the direction of the neighboring block

This PackInfo sends only these required components and therefore the sizes of the messages decrease.

Additionally this PackInfo only communicates PDFs in fluid cells.

see also documentation for FieldPackInfo

Warning
For fields with nrOfGhostLayers > 1: only the components pointing towards the boundary are communicated, which may not be the desired behavior for the 'inner' ghost layers

#include <SparsePdfFieldPackInfo.h>

+ Inheritance diagram for walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >:

Public Types

using PdfField_T = lbm::PdfField<LatticeModel_T>
 
using flag_t = typename FlagField_T::flag_t
 
using Stencil = typename LatticeModel_T::Stencil
 

Public Member Functions

 SparsePdfFieldPackInfo (const BlockDataID &pdfFieldId, const BlockDataID &flagFieldId, FlagUID flag, bool flagFieldConstant)
 
 ~SparsePdfFieldPackInfo () 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.
 
bool threadsafeReceiving () const override
 Must return false if calling unpackData and/or communicateLocal is not thread-safe.
 
void unpackData (IBlock *receiver, stencil::Direction dir, mpi::RecvBuffer &buffer) override
 Unpack received Data.
 
void communicateLocal (const IBlock *sender, IBlock *receiver, stencil::Direction dir) override
 Copy data from one local block to another local block.
 
- 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
 Pack data from a block into a send buffer.
 
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.
 

Protected Member Functions

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

Protected Attributes

BlockDataID pdfFieldId_
 
BlockDataID flagFieldId_
 
FlagUID flag_
 
bool flagFieldConstant_
 
- Protected Attributes inherited from walberla::communication::UniformPackInfo
std::map< const IBlock *, std::map< stencil::Direction, size_t > > bufferSize_
 

Member Typedef Documentation

◆ flag_t

◆ PdfField_T

◆ Stencil

template<typename LatticeModel_T , typename FlagField_T >
using walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::Stencil = typename LatticeModel_T::Stencil

Constructor & Destructor Documentation

◆ SparsePdfFieldPackInfo()

template<typename LatticeModel_T , typename FlagField_T >
walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::SparsePdfFieldPackInfo ( const BlockDataID & pdfFieldId,
const BlockDataID & flagFieldId,
FlagUID flag,
bool flagFieldConstant )
inline

◆ ~SparsePdfFieldPackInfo()

Member Function Documentation

◆ communicateLocal()

template<typename LatticeModel_T , typename FlagField_T >
void walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::communicateLocal ( const IBlock * sender,
IBlock * receiver,
stencil::Direction dir )
overridevirtual

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<typename LatticeModel_T , typename FlagField_T >
bool walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_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 safe. Falsely returning 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.

◆ packDataImpl()

template<typename LatticeModel_T , typename FlagField_T >
void walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::packDataImpl ( const IBlock * sender,
stencil::Direction dir,
mpi::SendBuffer & buffer ) const
overrideprotectedvirtual

Pack data from a block into a send buffer.

Must be thread-safe!

Implementations must reserve extra space and advance the send buffer pointer according to the alignment of the ghost layer data type! The buffer is char-aligned.

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<typename LatticeModel_T , typename FlagField_T >
bool walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_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 safe. Falsely returning 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<typename LatticeModel_T , typename FlagField_T >
void walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::unpackData ( IBlock * receiver,
stencil::Direction dir,
mpi::RecvBuffer & buffer )
overridevirtual

Unpack received Data.

If NOT thread-safe, threadsafeReceiving must return false!

Implementations must reserve extra space and advance the send buffer pointer according to the alignment of the ghost layer data type! The buffer is char-aligned.

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

Implements walberla::communication::UniformPackInfo.

Member Data Documentation

◆ flag_

template<typename LatticeModel_T , typename FlagField_T >
FlagUID walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::flag_
protected

◆ flagFieldConstant_

template<typename LatticeModel_T , typename FlagField_T >
bool walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::flagFieldConstant_
protected

◆ flagFieldId_

template<typename LatticeModel_T , typename FlagField_T >
BlockDataID walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::flagFieldId_
protected

◆ pdfFieldId_


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