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
#include <SparsePdfFieldPackInfo.h>
Public Types | |
typedef lbm::PdfField< LatticeModel_T > | PdfField_T |
typedef FlagField_T::flag_t | flag_t |
typedef LatticeModel_T::Stencil | Stencil |
Public Member Functions | |
SparsePdfFieldPackInfo (const BlockDataID &pdfFieldId, const BlockDataID &flagFieldId, FlagUID flag, bool flagFieldConstant) | |
virtual | ~SparsePdfFieldPackInfo () |
bool | constantDataExchange () const |
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 |
Must return false if calling unpackData and/or communicateLocal is not thread-safe. More... | |
void | unpackData (IBlock *receiver, stencil::Direction dir, mpi::RecvBuffer &buffer) |
Unpacks received Data. More... | |
void | communicateLocal (const IBlock *sender, IBlock *receiver, stencil::Direction dir) |
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 |
Packs data from a block into a send buffer. More... | |
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_ |
typedef FlagField_T::flag_t walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::flag_t |
typedef lbm::PdfField<LatticeModel_T> walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::PdfField_T |
typedef LatticeModel_T::Stencil walberla::lbm::SparsePdfFieldPackInfo< LatticeModel_T, FlagField_T >::Stencil |
|
inline |
|
inlinevirtual |
|
virtual |
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!
sender | id of block where the data should be copied from |
receiver | id of block where the data should be copied to |
dir | the direction of the communication ( from sender to receiver ) |
Implements walberla::communication::UniformPackInfo.
|
inlinevirtual |
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.
|
protectedvirtual |
Packs data from a block into a send buffer.
Must be thread-safe!
sender | the block whose data should be packed into a buffer |
dir | pack data for neighbor in this direction |
buffer | buffer for writing the data into |
Implements walberla::communication::UniformPackInfo.
|
inlinevirtual |
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.
|
virtual |
Unpacks received Data.
If NOT thread-safe, threadsafeReceiving must return false!
receiver | the block where the unpacked data should be stored into |
dir | receive data from neighbor in this direction |
buffer |
Implements walberla::communication::UniformPackInfo.
|
protected |
|
protected |
|
protected |
|
protected |