ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
PackInfoPdfSinglePrecision.h
Go to the documentation of this file.
1//======================================================================================================================
2//
3// This file is part of waLBerla. waLBerla is free software: you can
4// redistribute it and/or modify it under the terms of the GNU General Public
5// License as published by the Free Software Foundation, either version 3 of
6// the License, or (at your option) any later version.
7//
8// waLBerla is distributed in the hope that it will be useful, but WITHOUT
9// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11// for more details.
12//
13// You should have received a copy of the GNU General Public License along
14// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
15//
16//! \\file PackInfoPdfSinglePrecision.h
17//! \\author pystencils
18//======================================================================================================================
19
20// kernel generated with pystencils v1.3.3, lbmpy v1.3.3,
21// lbmpy_walberla/pystencils_walberla from waLBerla commit
22// b0842e1a493ce19ef1bbb8d2cf382fc343970a7f
23
24#pragma once
25#include "communication/UniformPackInfo.h"
26#include "core/DataTypes.h"
27#include "core/cell/CellInterval.h"
28#include "domain_decomposition/IBlock.h"
29#include "field/GhostLayerField.h"
30#include "stencil/Directions.h"
31
32#define FUNC_PREFIX
33
34#ifdef __GNUC__
35#define RESTRICT __restrict__
36#elif _MSC_VER
37#define RESTRICT __restrict
38#else
39#define RESTRICT
40#endif
41
42namespace walberla {
43namespace pystencils {
44
46 : public ::walberla::communication::UniformPackInfo {
47public:
48 PackInfoPdfSinglePrecision(BlockDataID pdfsID_) : pdfsID(pdfsID_){};
50
51 bool constantDataExchange() const { return true; }
52 bool threadsafeReceiving() const { return true; }
53
54 void unpackData(IBlock *receiver, stencil::Direction dir,
55 mpi::RecvBuffer &buffer) {
56 const auto dataSize = size(dir, receiver);
57 unpack(dir, buffer.skip(dataSize + sizeof(float)), receiver);
58 }
59
60 void communicateLocal(const IBlock *sender, IBlock *receiver,
61 stencil::Direction dir) {
62 mpi::SendBuffer sBuffer;
63 packData(sender, dir, sBuffer);
64 mpi::RecvBuffer rBuffer(sBuffer);
65 unpackData(receiver, stencil::inverseDir[dir], rBuffer);
66 }
67
68 void packDataImpl(const IBlock *sender, stencil::Direction dir,
69 mpi::SendBuffer &outBuffer) const {
70 const auto dataSize = size(dir, sender);
71 pack(dir, outBuffer.forward(dataSize + sizeof(float)),
72 const_cast<IBlock *>(sender));
73 }
74
75 void pack(stencil::Direction dir, unsigned char *buffer, IBlock *block) const;
76 void unpack(stencil::Direction dir, unsigned char *buffer,
77 IBlock *block) const;
78 uint_t size(stencil::Direction dir, const IBlock *block) const;
79
80private:
81 BlockDataID pdfsID;
82};
83
84} // namespace pystencils
85} // namespace walberla
void pack(stencil::Direction dir, unsigned char *buffer, IBlock *block) const
uint_t size(stencil::Direction dir, const IBlock *block) const
void packDataImpl(const IBlock *sender, stencil::Direction dir, mpi::SendBuffer &outBuffer) const
void unpack(stencil::Direction dir, unsigned char *buffer, IBlock *block) const
void unpackData(IBlock *receiver, stencil::Direction dir, mpi::RecvBuffer &buffer)
void communicateLocal(const IBlock *sender, IBlock *receiver, stencil::Direction dir)
static double * block(double *p, std::size_t index, std::size_t size)
Definition elc.cpp:172
\file PackInfoPdfDoublePrecision.cpp \author pystencils