25#include "core/DataTypes.h"
26#include "core/logging/Logging.h"
28#include "gpu/GPUField.h"
29#include "gpu/GPUWrapper.h"
31#include "domain_decomposition/BlockDataID.h"
32#include "domain_decomposition/IBlock.h"
33#include "domain_decomposition/StructuredBlockStorage.h"
34#include "field/SwapableCompare.h"
37#include <unordered_map>
40#define RESTRICT __restrict__
45#if (defined WALBERLA_CXX_COMPILER_IS_GNU) || \
46 (defined WALBERLA_CXX_COMPILER_IS_CLANG)
47#pragma GCC diagnostic push
48#pragma GCC diagnostic ignored "-Wunused-parameter"
49#pragma GCC diagnostic ignored "-Wreorder"
58 BlockDataID forceID_, BlockDataID pdfsID_, int64_t lebc_bot_index,
59 int64_t lebc_top_index,
double omega_bulk,
double omega_even,
60 double omega_odd,
double omega_shear,
double v_s)
61 : forceID(forceID_), pdfsID(pdfsID_), lebc_bot_index_(lebc_bot_index),
62 lebc_top_index_(lebc_top_index), omega_bulk_(omega_bulk),
63 omega_even_(omega_even), omega_odd_(omega_odd),
64 omega_shear_(omega_shear), v_s_(v_s) {}
67 for (
auto p : cache_pdfs_) {
75 const CellInterval &globalCellInterval,
76 cell_idx_t ghostLayers, IBlock *
block,
77 gpuStream_t
stream =
nullptr);
83 static std::function<void(IBlock *)>
84 getSweep(
const shared_ptr<StreamCollideSweepLeesEdwardsDoublePrecisionCUDA>
86 return [kernel](IBlock *b) { kernel->run(b); };
90 const shared_ptr<StreamCollideSweepLeesEdwardsDoublePrecisionCUDA>
92 const shared_ptr<StructuredBlockStorage> &blocks,
93 const CellInterval &globalCellInterval, cell_idx_t ghostLayers = 1) {
94 return [kernel, blocks, globalCellInterval,
95 ghostLayers](IBlock *b, gpuStream_t
stream =
nullptr) {
96 kernel->runOnCellInterval(blocks, globalCellInterval, ghostLayers, b,
105 std::function<void(IBlock *)>
107 const CellInterval &globalCellInterval,
108 cell_idx_t ghostLayers = 1,
109 gpuStream_t
stream =
nullptr) {
110 return [
this, blocks, globalCellInterval, ghostLayers,
stream](IBlock *b) {
116 void configure(
const shared_ptr<StructuredBlockStorage> & ,
125 inline double getV_s()
const {
return v_s_; }
127 lebc_bot_index_ = value;
130 lebc_top_index_ = value;
136 inline void setV_s(
const double value) { v_s_ = value; }
141 int64_t lebc_bot_index_;
142 int64_t lebc_top_index_;
148 std::unordered_map<IBlock *, gpu::GPUField<double> *> cache_pdfs_;
154#if (defined WALBERLA_CXX_COMPILER_IS_GNU) || \
155 (defined WALBERLA_CXX_COMPILER_IS_CLANG)
156#pragma GCC diagnostic pop
void configure(const shared_ptr< StructuredBlockStorage > &, IBlock *)
~StreamCollideSweepLeesEdwardsDoublePrecisionCUDA()
static std::function< void(IBlock *, gpuStream_t)> getSweepOnCellInterval(const shared_ptr< StreamCollideSweepLeesEdwardsDoublePrecisionCUDA > &kernel, const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers=1)
void setLebc_bot_index(const int64_t value)
std::function< void(IBlock *)> getSweepOnCellInterval(const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers=1, gpuStream_t stream=nullptr)
double getOmega_bulk() const
void setV_s(const double value)
void operator()(IBlock *block, gpuStream_t stream=nullptr)
double getOmega_shear() const
static std::function< void(IBlock *)> getSweep(const shared_ptr< StreamCollideSweepLeesEdwardsDoublePrecisionCUDA > &kernel)
int64_t getLebc_top_index() const
void setOmega_odd(const double value)
void setOmega_shear(const double value)
double getOmega_even() const
void setOmega_bulk(const double value)
int64_t getLebc_bot_index() const
std::function< void(IBlock *)> getSweep(gpuStream_t stream=nullptr)
StreamCollideSweepLeesEdwardsDoublePrecisionCUDA(BlockDataID forceID_, BlockDataID pdfsID_, int64_t lebc_bot_index, int64_t lebc_top_index, double omega_bulk, double omega_even, double omega_odd, double omega_shear, double v_s)
void run(IBlock *block, gpuStream_t stream=nullptr)
void setOmega_even(const double value)
double getOmega_odd() const
void setLebc_top_index(const int64_t value)
void runOnCellInterval(const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers, IBlock *block, gpuStream_t stream=nullptr)
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
static double * block(double *p, std::size_t index, std::size_t size)
\file PackInfoPdfDoublePrecision.cpp \author pystencils