30#include <blockforest/StructuredBlockForest.h>
31#include <domain_decomposition/BlockDataID.h>
32#include <domain_decomposition/IBlock.h>
33#include <field/AddToStorage.h>
34#include <field/FlagField.h>
35#include <field/FlagUID.h>
36#include <waLBerlaDefinitions.h>
48template <lbmpy::Arch Architecture = lbmpy::Arch::CPU>
53 bool m_pending_changes;
62#if defined(__CUDACC__) and defined(WALBERLA_BUILD_WITH_CUDA)
65 detail::ReactionKernelIndexedSelector::KernelTrait<>::
66 ReactionKernelIndexed::IndexVectors,
67 detail::ReactionKernelIndexedSelector::KernelTraitGPU<>::
68 ReactionKernelIndexedGPU::IndexVectors>::type;
71 detail::ReactionKernelIndexedSelector::KernelTrait<>::
72 ReactionKernelIndexed::IndexInfo,
73 detail::ReactionKernelIndexedSelector::KernelTraitGPU<>::
74 ReactionKernelIndexedGPU::IndexInfo>::type;
76 using IndexVectors = detail::ReactionKernelIndexedSelector::KernelTrait<>::
77 ReactionKernelIndexed::IndexVectors;
78 using IndexInfo = detail::ReactionKernelIndexedSelector::KernelTrait<>::
79 ReactionKernelIndexed::IndexInfo;
94 m_pending_changes(
false) {
95 m_flagfield_id = field::addFlagFieldToStorage<FlagField>(
99 auto createIdxVector = [](IBlock *
const, StructuredBlockStorage *
const) {
129 std::function<
void(IBlock *)> kernel;
131 kernel = detail::ReactionKernelIndexedSelector::get_kernel(
134#if defined(__CUDACC__) and defined(WALBERLA_BUILD_WITH_CUDA)
135 kernel = detail::ReactionKernelIndexedSelector::get_kernel_gpu(
145 bool is_boundary)
override {
148 get_flag_field_and_flag(
bc->block, m_flagfield_id);
154 m_pending_changes =
true;
162 get_flag_field_and_flag(
bc->block, m_flagfield_id);
171 std::vector<int>
out;
174 out.assign(
ci->numCells(), 0);
175 for (
auto const &
block : *lattice.get_blocks()) {
199 std::vector<int>
const &is_boundary)
override {
202 for (
auto &
block : *lattice.get_blocks()) {
222 m_pending_changes =
true;
229 if (m_pending_changes) {
231 fillFromFlagField(
block);
233 m_pending_changes =
false;
238 void fillFromFlagField(IBlock &
block) {
270 if (inner.contains(
it.x(),
it.y(),
it.z())) {
Vector implementation and trait types for boost qvm interoperability.
std::vector< std::shared_ptr< EKReactant > > reactants_type
auto get_lattice() const noexcept
double get_coefficient() const noexcept
auto const & get_reactants() const noexcept
std::optional< bool > get_node_is_boundary(Utils::Vector3i const &node) override
FlagUID const Boundary_flag
Flag for boundary cells.
void ghost_communication() override
void set_slice_is_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, std::vector< int > const &is_boundary) override
FlagUID const Domain_flag
Flag for domain cells, i.e.
field::FlagField< uint8_t > FlagField
detail::ReactionKernelIndexedSelector::KernelTrait<>::ReactionKernelIndexed::IndexInfo IndexInfo
~EKReactionImplIndexed() override=default
std::vector< int > get_slice_is_boundary(Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner) const override
detail::ReactionKernelIndexedSelector::KernelTrait<>::ReactionKernelIndexed::IndexVectors IndexVectors
EKReactionImplIndexed(std::shared_ptr< LatticeWalberla > const &lattice, reactants_type const &reactants, double coefficient)
void set_node_is_boundary(Utils::Vector3i const &node, bool is_boundary) override
void perform_reaction() override
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
void copy_block_buffer(CellInterval const &bci, CellInterval const &ci, Utils::Vector3i const &block_offset, Utils::Vector3i const &lower_corner, auto &&kernel)
Synchronize data between a sliced block and a container.
std::optional< BlockAndCell > get_block_and_cell(::LatticeWalberla const &lattice, signed_integral_vector auto const &node, bool consider_ghost_layers)
Cell to_cell(signed_integral_vector auto const &xyz)
std::optional< walberla::cell::CellInterval > get_block_interval(::LatticeWalberla const &lattice, Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner, Utils::Vector3i const &block_offset, IBlock const &block)
std::optional< walberla::cell::CellInterval > get_interval(::LatticeWalberla const &lattice, Utils::Vector3i const &lower_corner, Utils::Vector3i const &upper_corner)