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__
42#define RESTRICT __restrict
47#if (defined WALBERLA_CXX_COMPILER_IS_GNU) || \
48 (defined WALBERLA_CXX_COMPILER_IS_CLANG)
49#pragma GCC diagnostic push
50#pragma GCC diagnostic ignored "-Wunused-parameter"
51#pragma GCC diagnostic ignored "-Wreorder"
60 BlockDataID forceID_, BlockDataID pdfsID_,
double kT,
double omega_bulk,
61 double omega_even,
double omega_odd,
double omega_shear, uint32_t seed,
63 : forceID(forceID_), pdfsID(pdfsID_), kT_(kT), omega_bulk_(omega_bulk),
64 omega_even_(omega_even), omega_odd_(omega_odd),
65 omega_shear_(omega_shear), seed_(seed), time_step_(time_step),
66 block_offset_0_(uint32_t(0)), block_offset_1_(uint32_t(0)),
67 block_offset_2_(uint32_t(0)), configured_(false) {}
72 const CellInterval &globalCellInterval,
73 cell_idx_t ghostLayers, IBlock *
block,
74 gpuStream_t
stream =
nullptr);
81 const shared_ptr<CollideSweepDoublePrecisionThermalizedCUDA> &kernel) {
82 return [kernel](IBlock *b) { kernel->run(b); };
86 const shared_ptr<CollideSweepDoublePrecisionThermalizedCUDA> &kernel,
87 const shared_ptr<StructuredBlockStorage> &blocks,
88 const CellInterval &globalCellInterval, cell_idx_t ghostLayers = 1) {
89 return [kernel, blocks, globalCellInterval,
90 ghostLayers](IBlock *b, gpuStream_t
stream =
nullptr) {
91 kernel->runOnCellInterval(blocks, globalCellInterval, ghostLayers, b,
100 std::function<void(IBlock *)>
102 const CellInterval &globalCellInterval,
103 cell_idx_t ghostLayers = 1,
104 gpuStream_t
stream =
nullptr) {
105 return [
this, blocks, globalCellInterval, ghostLayers,
stream](IBlock *b) {
111 void configure(
const shared_ptr<StructuredBlockStorage> &blocks,
113 Cell BlockCellBB = blocks->getBlockCellBB(*block).min();
114 block_offset_0_ = uint32_t(BlockCellBB[0]);
115 block_offset_1_ = uint32_t(BlockCellBB[1]);
116 block_offset_2_ = uint32_t(BlockCellBB[2]);
123 inline double getKt()
const {
return kT_; }
128 inline uint32_t
getSeed()
const {
return seed_; }
131 block_offset_0_ = value;
134 block_offset_1_ = value;
137 block_offset_2_ = value;
139 inline void setKt(
const double value) { kT_ = value; }
144 inline void setSeed(
const uint32_t value) { seed_ = value; }
150 uint32_t block_offset_0_;
151 uint32_t block_offset_1_;
152 uint32_t block_offset_2_;
167#if (defined WALBERLA_CXX_COMPILER_IS_GNU) || \
168 (defined WALBERLA_CXX_COMPILER_IS_CLANG)
169#pragma GCC diagnostic pop
void setTime_step(const uint32_t value)
void setSeed(const uint32_t value)
static std::function< void(IBlock *)> getSweep(const shared_ptr< CollideSweepDoublePrecisionThermalizedCUDA > &kernel)
void run(IBlock *block, gpuStream_t stream=nullptr)
void setOmega_even(const double value)
void setBlock_offset_0(const uint32_t value)
void setBlock_offset_1(const uint32_t value)
double getOmega_bulk() const
void operator()(IBlock *block, gpuStream_t stream=nullptr)
std::function< void(IBlock *)> getSweep(gpuStream_t stream=nullptr)
uint32_t getBlock_offset_2() const
void runOnCellInterval(const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers, IBlock *block, gpuStream_t stream=nullptr)
void setOmega_shear(const double value)
double getOmega_odd() const
std::function< void(IBlock *)> getSweepOnCellInterval(const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers=1, gpuStream_t stream=nullptr)
double getOmega_shear() const
uint32_t getTime_step() const
uint32_t getBlock_offset_0() const
static std::function< void(IBlock *, gpuStream_t)> getSweepOnCellInterval(const shared_ptr< CollideSweepDoublePrecisionThermalizedCUDA > &kernel, const shared_ptr< StructuredBlockStorage > &blocks, const CellInterval &globalCellInterval, cell_idx_t ghostLayers=1)
double getOmega_even() const
void setOmega_bulk(const double value)
void configure(const shared_ptr< StructuredBlockStorage > &blocks, IBlock *block)
void setKt(const double value)
uint32_t getBlock_offset_1() const
void setOmega_odd(const double value)
CollideSweepDoublePrecisionThermalizedCUDA(BlockDataID forceID_, BlockDataID pdfsID_, double kT, double omega_bulk, double omega_even, double omega_odd, double omega_shear, uint32_t seed, uint32_t time_step)
void setBlock_offset_2(const uint32_t value)
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