From df2ce610f0389edb0583fed15eaabe5d21518fb5 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 19 Mar 2026 12:37:17 +0100 Subject: Add AntiBounce Back as well --- lib/core/c++/boundary.hpp | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'lib/core') diff --git a/lib/core/c++/boundary.hpp b/lib/core/c++/boundary.hpp index 9afdfd7..3503681 100644 --- a/lib/core/c++/boundary.hpp +++ b/lib/core/c++/boundary.hpp @@ -8,6 +8,9 @@ namespace lbm { namespace cmpt { struct BounceBack {}; +template +struct AntiBounceBack {}; + template struct ZouHeHorizontal{}; @@ -69,6 +72,55 @@ public: } }; +/** + * Anti Full-Way BounceBack. + */ +template +class component, Encode> { +private: +public: + component() = default; + + using Component = cmpt::AntiBounceBack; + + /** + * Thoughts regarding automating order setup + */ + using access = cmpt::access_tuple< + cmpt::access<"dfs", 1, true, true, true> + >; + + /** + * Thoughts regarding automating order setup + */ + static constexpr saw::string_literal name = "full_way_anti_bounce_back"; + static constexpr saw::string_literal after = ""; + static constexpr saw::string_literal before = "streaming"; + + /** + * Raw setup + */ + template + void apply(const saw::data& field, const saw::data>& index, saw::data time_step)const{ + bool is_even = ((time_step.get() % 2u) == 0u); + + // This is a ref + + // auto& dfs_f = (is_even) ? field.template get<"dfs">() : field.template get<"dfs_old">(); + auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">(); + + using dfi = df_info; + + // Technically use .copy() + auto& dfs_old = dfs_old_f.at(index); + auto df_cpy = dfs_old; + + for(uint64_t i = 0u; i < Descriptor::Q; ++i){ + dfs_old.at({i}) = df_cpy.at({dfi::opposite_index.at(i)}); + } + } +}; + template class component final { private: -- cgit v1.2.3